├── .gitignore ├── LICENSE ├── README.md ├── doc ├── GPL.txt ├── LGPL.txt └── license.txt ├── jeez! ├── forms │ ├── ujeezabout.lfm │ ├── ujeezabout.pas │ ├── ujeezbuild.lfm │ ├── ujeezbuild.pas │ ├── ujeezdata.lfm │ ├── ujeezdata.pas │ ├── ujeezeditor.lfm │ ├── ujeezeditor.pas │ ├── ujeezide.lfm │ ├── ujeezide.pas │ ├── ujeezmessages.lfm │ ├── ujeezmessages.pas │ ├── ujeezoptions.lfm │ ├── ujeezoptions.pas │ ├── ujeezproperties.lfm │ ├── ujeezproperties.pas │ ├── ujeezsplash.lfm │ └── ujeezsplash.pas ├── project.ico ├── project.lpi ├── project.lpr ├── project.lps ├── project.res └── utils │ ├── jeezinifile.pas │ ├── jeezlabels.pas │ ├── jeezresources.pas │ ├── jeezsynedit.pas │ ├── jeeztreeview.pas │ └── jeezutils.pas ├── jes2cpp ├── bass │ ├── bass.h │ ├── bass.linux.h │ └── readme.txt ├── exports.def ├── j2c.base │ ├── jes2cppconstants.pas │ ├── jes2cppeel.pas │ ├── jes2cppfilenames.pas │ ├── jes2cppidentstring.pas │ ├── jes2cppiterate.pas │ ├── jes2cppparameter.pas │ ├── jes2cppparsersimple.pas │ ├── jes2cppplatform.pas │ ├── jes2cppstrings.pas │ ├── jes2cpptextfilecache.pas │ ├── jes2cpptoken.pas │ ├── jes2cpptranslate.pas │ └── jes2cpputils.pas ├── j2c.components │ ├── jes2cppcompiler.pas │ ├── jes2cppdescription.pas │ ├── jes2cppfunction.pas │ ├── jes2cppfunctionidentifiers.pas │ ├── jes2cppidentifier.pas │ ├── jes2cpploop.pas │ ├── jes2cppmoduleimporter.pas │ ├── jes2cppprocess.pas │ ├── jes2cppreference.pas │ ├── jes2cppsections.pas │ └── jes2cppvariable.pas ├── j2c.parser │ ├── jes2cppimporter.pas │ ├── jes2cppmessagelog.pas │ ├── jes2cppparser.pas │ ├── jes2cppparserelements.pas │ ├── jes2cppparserexpression.pas │ ├── jes2cppparserfunctions.pas │ ├── jes2cppparserloops.pas │ ├── jes2cppparseroperator.pas │ └── jes2cppprinter.pas ├── jes2cpp.cpp ├── jes2cpp.h ├── jes2cpp.jsfx-inc ├── jes2cpp.pas ├── libsndfile │ ├── sndfile.h │ └── sndfile.hh ├── vest │ ├── VST3 SDK │ │ └── readme.txt │ ├── ladspa │ │ └── ladspa.h │ ├── readme.txt │ ├── vest.cpp │ ├── vest.h │ ├── vest.workspace │ ├── vest32.LADSPA │ │ └── Project.cbp │ ├── vest32 │ │ └── Project.cbp │ └── vest64 │ │ └── Project.cbp └── wdl │ ├── assocarray.h │ ├── eel.h │ ├── eel_fft.cpp │ ├── eel_fft.h │ ├── eel_mdct.cpp │ ├── eel_mdct.h │ ├── fft.c │ ├── fft.h │ ├── heapbuf.h │ ├── readme.license.txt │ ├── wdlcstring.h │ ├── wdlstring.h │ └── wdltypes.h ├── jsfx-inc ├── anomaly.jsfx-inc ├── ax.defines.jsfx-inc ├── ax.math.jsfx-inc ├── axonlib.defines.jsfx-inc ├── axonlib.math.jsfx-inc ├── caps.TDFII.jsfx-inc ├── caps.ToneStack.jsfx-inc ├── caps.util.jsfx-inc ├── effects │ ├── 7 Band Eq (RBJ).swipe.jsfx │ ├── Chorus.swipe.jsfx │ ├── Delay (Spin).swipe.jsfx │ ├── Delay (Surround).swipe.jsfx │ ├── Example.swipe.jsfx │ ├── Filter.swipe.jsfx │ ├── ListBox.swipe.jsfx │ ├── Live Reverb.swipe.jsfx │ ├── Retro Keyboard.swipe.jsfx │ ├── Simple Scope.swipe.jsfx │ ├── Small Room Reverberator.swipe.jsfx │ ├── Stereo Scope.swipe.jsfx │ ├── The Time Traveler.jsfx │ ├── caps.ToneStack.jsfx │ └── tests │ │ ├── test.expressions.jsfx │ │ ├── test.fonts.jsfx │ │ ├── test.graph.jsfx │ │ ├── test.hello.jsfx │ │ ├── test.jsfx-inc │ │ ├── test.malloc.jsfx │ │ ├── test.math.jsfx │ │ ├── test.mouse.jsfx │ │ ├── test.stderr.jsfx │ │ ├── test.string.jsfx │ │ ├── test.strings.jsfx │ │ └── test.vector.jsfx ├── geep.chorus.jsfx-inc ├── geep.gain.jsfx-inc ├── geep.pan.jsfx-inc ├── geep.saturate.jsfx-inc ├── geep.waveshaper.jsfx-inc ├── interpolate.jsfx-inc ├── juce.decibels.jsfx-inc ├── loser.3bandeq.jsfx-inc ├── loser.jsfx-inc ├── pas.classes.jsfx-inc ├── pas.controls.jsfx-inc ├── pas.fileutil.jsfx-inc ├── pas.forms.jsfx-inc ├── pas.graphics.jsfx-inc ├── pas.graphutil.jsfx-inc ├── pas.math.jsfx-inc ├── pas.strutils.jsfx-inc ├── pas.system.jsfx-inc ├── pas.sysutils.jsfx-inc ├── pas.types.jsfx-inc ├── rbj.jsfx-inc ├── std.array.jsfx-inc ├── std.cassert.jsfx-inc ├── std.cconio.jsfx-inc ├── std.cheap.jsfx-inc ├── std.cmath.jsfx-inc ├── std.cmemory.jsfx-inc ├── std.cnew.jsfx-inc ├── std.cstdbool.jsfx-inc ├── std.cstddef.jsfx-inc ├── std.cstdio.jsfx-inc ├── std.cstdlib.jsfx-inc ├── std.cstring.jsfx-inc ├── std.ctype.jsfx-inc ├── std.string.jsfx-inc ├── std.vector.jsfx-inc ├── swipe.array.jsfx-inc ├── swipe.effects.jsfx-inc ├── swipe.file.jsfx-inc ├── swipe.graphics.jsfx-inc ├── swipe.image.jsfx-inc ├── swipe.jsfx-inc ├── swipe.limits.jsfx-inc ├── swipe.math.jsfx-inc ├── swipe.properties.jsfx-inc ├── swipe.system.jsfx-inc └── swipe.widgets.jsfx-inc └── soda ├── readme.txt ├── soda.inc ├── soda.pas └── soda_basic.inc /.gitignore: -------------------------------------------------------------------------------- 1 | jeez!/lib/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Geep-Jeez 2 | The Easy Way to Create VST Effects * Jesusonic Editor + JS 2 C++ Transpiler 3 | -------------------------------------------------------------------------------- /doc/license.txt: -------------------------------------------------------------------------------- 1 | GEEP SOFTWARE LICENCE 2 | 3 | Geep software is designed to be free/easy and fun to use. But, as with all software, please note that this software is provided "AS IS" and without warranty of any kind. (Read Below for more information) 4 | 5 | NOTE: Although this software has been checked for viruses using AVG 2014, please ensure your virus checker is upto date! 6 | 7 | Copyright (c) 2015 Derek John Evans 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezabout.lfm: -------------------------------------------------------------------------------- 1 | object JeezAbout: TJeezAbout 2 | Left = 485 3 | Height = 265 4 | Top = 282 5 | Width = 465 6 | BorderStyle = bsDialog 7 | BorderWidth = 6 8 | ClientHeight = 265 9 | ClientWidth = 465 10 | OnCreate = FormCreate 11 | OnShow = FormShow 12 | Position = poScreenCenter 13 | LCLVersion = '1.4.2.0' 14 | object ButtonPanel: TButtonPanel 15 | Left = 12 16 | Height = 26 17 | Top = 227 18 | Width = 441 19 | OKButton.Name = 'OKButton' 20 | OKButton.DefaultCaption = True 21 | HelpButton.Name = 'HelpButton' 22 | HelpButton.Caption = '&Help (online) ...' 23 | HelpButton.DefaultCaption = False 24 | HelpButton.OnClick = HelpButtonClick 25 | CloseButton.Name = 'CloseButton' 26 | CloseButton.DefaultCaption = True 27 | CancelButton.Name = 'CancelButton' 28 | CancelButton.DefaultCaption = True 29 | TabOrder = 0 30 | DefaultButton = pbClose 31 | ShowButtons = [pbClose, pbHelp] 32 | ShowBevel = False 33 | end 34 | object PageControl: TPageControl 35 | Left = 6 36 | Height = 215 37 | Top = 6 38 | Width = 453 39 | ActivePage = TabSheetInfomation 40 | Align = alClient 41 | Images = JeezData.ImageList16 42 | TabIndex = 0 43 | TabOrder = 1 44 | object TabSheetInfomation: TTabSheet 45 | Caption = 'Information' 46 | ChildSizing.LeftRightSpacing = 4 47 | ChildSizing.TopBottomSpacing = 4 48 | ClientHeight = 188 49 | ClientWidth = 445 50 | ImageIndex = 12 51 | object ListView: TListView 52 | Left = 4 53 | Height = 180 54 | Top = 4 55 | Width = 437 56 | Align = alClient 57 | Color = clWindow 58 | Columns = < 59 | item 60 | Caption = 'Name' 61 | Width = 120 62 | end 63 | item 64 | Caption = 'Value' 65 | Width = 200 66 | end> 67 | ColumnClick = False 68 | GridLines = True 69 | ReadOnly = True 70 | RowSelect = True 71 | ScrollBars = ssVertical 72 | ShowColumnHeaders = False 73 | SmallImages = JeezData.ImageList16 74 | TabOrder = 0 75 | ViewStyle = vsReport 76 | end 77 | end 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezabout.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jeez! - Jesusonic Script Editor 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit UJeezAbout; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | ButtonPanel, ComCtrls, Forms, JeezUtils, Jes2CppConstants, Jes2CppFileNames, 35 | LCLIntf, LCLVersion, SysUtils; 36 | 37 | type 38 | 39 | { TJeezAbout } 40 | 41 | TJeezAbout = class(TForm) 42 | ButtonPanel: TButtonPanel; 43 | ListView: TListView; 44 | PageControl: TPageControl; 45 | TabSheetInfomation: TTabSheet; 46 | procedure FormCreate(ASender: TObject); 47 | procedure FormShow(ASender: TObject); 48 | procedure HelpButtonClick(ASender: TObject); 49 | private 50 | procedure AddKey(const AName, AValue: String); overload; 51 | procedure AddKey(const AName: String; const AValue: Integer); overload; 52 | public 53 | procedure Execute; 54 | end; 55 | 56 | var 57 | JeezAbout: TJeezAbout; 58 | 59 | implementation 60 | 61 | {$R *.lfm} 62 | 63 | procedure TJeezAbout.FormCreate(ASender: TObject); 64 | begin 65 | Caption := 'About ' + GsJeezName; 66 | 67 | AddKey('Name', GsJeezName); 68 | AddKey('Version', GsJes2CppVersion); 69 | AddKey('Description', GsJes2CppSlogan); 70 | AddKey('Copyright', GsJes2CppCopyright); 71 | AddKey('Build Date', GsJes2CppBuildDate); 72 | AddKey('Website', GsJes2CppWebsite); 73 | AddKey('License', GsJes2CppLicense); 74 | AddKey('LGPL', 'http://www.gnu.org/licenses/'); 75 | AddKey('LCL Version', lcl_version); 76 | end; 77 | 78 | procedure TJeezAbout.FormShow(ASender: TObject); 79 | begin 80 | ListView.AutoWidthLastColumn := True; 81 | end; 82 | 83 | procedure TJeezAbout.HelpButtonClick(ASender: TObject); 84 | begin 85 | OpenUrl(GUrls.GeepJeez); 86 | end; 87 | 88 | procedure TJeezAbout.AddKey(const AName, AValue: String); 89 | begin 90 | with ListView.Items.Add do 91 | begin 92 | Caption := AName; 93 | SubItems.Add(AValue); 94 | ImageIndex := 55; 95 | end; 96 | end; 97 | 98 | procedure TJeezAbout.AddKey(const AName: String; const AValue: Integer); 99 | begin 100 | AddKey(AName, IntToStr(AValue)); 101 | end; 102 | 103 | procedure TJeezAbout.Execute; 104 | begin 105 | ShowModal; 106 | end; 107 | 108 | end. 109 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezbuild.lfm: -------------------------------------------------------------------------------- 1 | object JeezBuild: TJeezBuild 2 | Left = 493 3 | Height = 82 4 | Top = 289 5 | Width = 394 6 | AutoSize = True 7 | BorderIcons = [] 8 | BorderStyle = bsDialog 9 | BorderWidth = 6 10 | ClientHeight = 82 11 | ClientWidth = 394 12 | OnPaint = FormPaint 13 | Position = poScreenCenter 14 | LCLVersion = '1.4.0.4' 15 | object ButtonAbortBuild: TBitBtn 16 | Left = 288 17 | Height = 25 18 | Top = 32 19 | Width = 96 20 | Cancel = True 21 | Caption = 'Abort Build' 22 | Glyph.Data = { 23 | 36040000424D3604000000000000360000002800000010000000100000000100 24 | 2000000000000004000064000000640000000000000000000000000000000000 25 | 0000000000000000000000000000000000020000002200000033000000210000 26 | 00000000001D0000003300000033000000330000001E00000000C2915200C291 27 | 5200C2915200000000020000002120180D3BAD8046B9BD8C4CFFAF8142B90000 28 | 0033253EBBA7364CCDFF384DCBFF384DCCFF3145B4AC0000001EC2915200C291 29 | 52000000001A231A0F3CAA7E45B9CD9A5CFFEFB87AFFFFD7A2FFFFCE8EFF776F 30 | A0FF2F4DDEFF365CFAFF375DFAFF385DF9FF3852D7FF3044B4AC0000001B0000 31 | 00339E754099D8A465FFF2BD7FFFFDC78AFFFBC385FFFFD6A7FFFFDF9CFF1D3C 32 | D4FF3C62FEFF3B60FAFF3A5DF8FF3C60FAFF4165FBFF344BCCFFA37A43A0D7A4 33 | 66FFF5C083FFFBC689FFF7C286FFF5C081FFF3BC7CFFFAD8AEFFFFD993FF1C3A 34 | D1FFA6B8FFFFFFFFFFFFFFFFFFFFFFFFFFFFA9BAFFFF3148CAFFBE8D4EFFFBC5 35 | 87FFF5C082FFF1BD7FFFEFBA7DFFEEB87BFFECB575FFF8DCB7FFFFD28EFF1A3A 36 | D2FF5776FFFF5675FEFF5473FDFF5776FEFF5C79FFFF3149CDFFBD8D4EFFF2BD 37 | 80FFECB87AFFEAB678FFE9B576FFE6B273FFE3AD6CFFF5DEC2FFFAC989FF817C 38 | B2FF3754E2FF6A85FFFF7089FFFF6B87FFFF3E5AE4FF2947D891BE8E4EFFEAB7 39 | 79FFE5B274FFE4B071FFE0AD6DFFE1AC6BFFF0C38EFFFFF2DEFFF9D09CFFFDC9 40 | 83FF7E79B0FF1C3AD2FF1F3DD2FF1F3ED7FF6E6796FFFFFFFF00BF8E4EFFE3B0 41 | 70FFDEAB6AFFDAA764FFE3BB85FFF5E8CEFFF7E9CFFFFED6A6FFF3EFDAFFF6F0 42 | D8FFF7D39DFFFAC680FFFFCC86FFFFD18EFFC79145FFFFFFFF00BF8C4CFFDAA7 43 | 65FFDBB37EFFEBDFC1FFF8EAD0FFD6A571FFDBA368FFE2AA6EFFEBB274FFF4C1 44 | 86FFF4F0DBFFEFEBD5FFECCB9EFFF0C28CFFBF8C49FFFFFFFF00C2965BFFECE0 45 | C3FFFAECD3FFFFD7A9FFFFCE95FFEDCBA6FFFFE5C7FFFFDCB4FFFFD3A3FFF7BE 46 | 83FFF9C48AFFFED8AAFFF4F0DDFFEFF0DFFFC2985CFFFFFFFF00BF8D4CFFE1B7 47 | 82FFDCA56BFFDBA46AFFE3AC71FFD1A368FFD3A771FFDDAF7BFFD3A166FFCD98 48 | 5AFFE3AC71FFEBB376FFF9C080FFDEB684FFC29356FFFFFFFF00C18F5087BD8B 49 | 4AFFF3D1AFFFFFEACBFFFFDFBAFFFFD8ACFFF9C38BFFFFCD96FFEECDAAFFFFE9 50 | CCFFFFE1BBFFFFD9ADFFFCC690FFBC8B4AFFC08F4F86FFFFFF00C2905100C08E 51 | 4E00CA9D62D2DEB382FFE1B480FFDAA970FFC89557FFE4AE73FFD2A369FFD4AA 52 | 74FFE1B481FFD8A76FFFCF9E62D2BF8E4F00C1905100FFFFFF00C2915200C18F 53 | 5000CDA16700BE8C4B00BC8A48A3F3D1AFFFFFEACDFFFFE1BBFFFFD9ADFFFDC7 54 | 90FFBC8A4AB8BE8C4C00D3A26600C08F5000C2915200FFFFFF00C2915200C190 55 | 5000CEA26900C08F4F00BF8E4D00C99C60D5DCB17FFFDFB27EFFDBAB74FFC997 56 | 59D5BF8E4F00C08F4F00D4A36800C08F5000C2915200FFFFFF00 57 | } 58 | ModalResult = 3 59 | OnClick = ButtonAbortBuildClick 60 | TabOrder = 0 61 | end 62 | object ProgressBar: TProgressBar 63 | Left = 8 64 | Height = 20 65 | Top = 8 66 | Width = 376 67 | Max = 20 68 | Step = 1 69 | TabOrder = 1 70 | end 71 | object Timer: TTimer 72 | Interval = 300 73 | OnTimer = TimerTimer 74 | left = 16 75 | top = 32 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezbuild.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jeez! - Jesusonic Script Editor 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit UJeezBuild; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Buttons, ComCtrls, Controls, ExtCtrls, Forms, JeezResources, JeezUtils, 35 | Jes2CppCompiler, Jes2CppConstants, 36 | Jes2CppProcess, SysUtils, UJeezEditor; 37 | 38 | type 39 | 40 | { TJeezBuild } 41 | 42 | TJeezBuild = class(TForm) 43 | ButtonAbortBuild: TBitBtn; 44 | ProgressBar: TProgressBar; 45 | Timer: TTimer; 46 | procedure ButtonAbortBuildClick(ASender: TObject); 47 | procedure FormPaint(ASender: TObject); 48 | procedure TimerTimer(ASender: TObject); 49 | private 50 | FCaption, FExceptionMessage: String; 51 | FStartTime: TTime; 52 | FOutputFile: TFileName; 53 | FCompiler: CJes2CppCompiler; 54 | FEditor: TJeezEditor; 55 | public 56 | function Execute(const AEditor: TJeezEditor): Boolean; 57 | property OutputFile: TFileName read FOutputFile; 58 | end; 59 | 60 | var 61 | JeezBuild: TJeezBuild; 62 | 63 | implementation 64 | 65 | {$R *.lfm} 66 | 67 | uses UJeezMessages, UJeezOptions; 68 | 69 | function TJeezBuild.Execute(const AEditor: TJeezEditor): Boolean; 70 | begin 71 | Assert(Assigned(AEditor)); 72 | FEditor := AEditor; 73 | FCaption := SMsgTypeBuilding + CharSpace + 74 | UpperCase(CJes2CppCompiler.TypePluginAsString(JeezOptions.GetPluginType)) + 75 | CharSpace + GsPlugin + CharSpace + CharOpeningParenthesis; 76 | case JeezOptions.GetArchitecture of 77 | ca32bit: begin 78 | FCaption += Gs32Bit + CharSpace + SMsgArchitecture; 79 | end; 80 | ca64bit: begin 81 | FCaption += Gs64Bit + CharSpace + SMsgArchitecture; 82 | end; 83 | end; 84 | FCaption += CharSlashForward; 85 | case JeezOptions.GetPrecision of 86 | cfpSingle: begin 87 | FCaption += Gs32Bit + CharSpace + SMsgPrecision; 88 | end; 89 | cfpDouble: begin 90 | FCaption += Gs64Bit + CharSpace + SMsgPrecision; 91 | end; 92 | end; 93 | FCaption += CharClosingParenthesis; 94 | Caption := FCaption; 95 | FStartTime := Now; 96 | OnPaint := FormPaint; 97 | Timer.Enabled := True; 98 | ProgressBar.Position := 0; 99 | ButtonAbortBuild.Enabled := True; 100 | FExceptionMessage := EmptyStr; 101 | Result := ShowModal = mrOk; 102 | if FExceptionMessage <> EmptyStr then 103 | begin 104 | raise Exception.Create(FExceptionMessage); 105 | end; 106 | if ModalResult = mrAbort then 107 | begin 108 | Abort; 109 | end; 110 | end; 111 | 112 | procedure TJeezBuild.FormPaint(ASender: TObject); 113 | var 114 | LTranspiler: CJeezJes2CppLogMessages; 115 | begin 116 | OnPaint := nil; 117 | ModalResult := mrAbort; 118 | Refresh; 119 | Application.ProcessMessages; 120 | try 121 | LTranspiler := CJeezJes2CppLogMessages.Create(Self); 122 | try 123 | LTranspiler.TranspileScript(FEditor.SynEdit.Lines, FEditor.FileName, 124 | JeezOptions.EditDefVendorString.Text, ExtractFileName(FEditor.FileName), 125 | JeezOptions.EditDefProductString.Text, 126 | JeezOptions.EditDefVendorVersion.Text, JeezOptions.EditDefUniqueId.Text); 127 | FCompiler := CJeezCompiler.Create(Self); 128 | try 129 | FOutputFile := FCompiler.Compile(JeezOptions.GetGccExecutable, LTranspiler.Output); 130 | ModalResult := mrOk; 131 | finally 132 | FreeAndNil(FCompiler); 133 | end; 134 | finally 135 | FreeAndNil(LTranspiler); 136 | end; 137 | JeezConsole.LogMessage(Format(SMsgCompilationComplete1, [TimeToStr(Now - FStartTime)])); 138 | except 139 | on AException: Exception do 140 | begin 141 | FExceptionMessage := AException.Message; 142 | end; 143 | end; 144 | end; 145 | 146 | procedure TJeezBuild.TimerTimer(ASender: TObject); 147 | begin 148 | ProgressBar.StepIt; 149 | if ProgressBar.Position >= ProgressBar.Max then 150 | begin 151 | ProgressBar.Position := ProgressBar.Min; 152 | end; 153 | end; 154 | 155 | procedure TJeezBuild.ButtonAbortBuildClick(ASender: TObject); 156 | begin 157 | if Assigned(FCompiler) then 158 | begin 159 | Caption := SMsgAbortingCompilationPleaseWait; 160 | ButtonAbortBuild.Enabled := False; 161 | FCompiler.Terminate(GiExitStatusAbort); 162 | end; 163 | end; 164 | 165 | end. 166 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezdata.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jeez! - Jesusonic Script Editor 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit UJeezData; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Classes, Controls, Dialogs, Jes2CppFileNames, StrUtils, SynEditHighlighter, 35 | SynHighlighterCpp, SysUtils; 36 | 37 | const 38 | 39 | // These indexs must match images in ImageList16. 40 | GiImageIndexFunctionsSystem = 43; 41 | GiImageIndexFunctionsUser = 44; 42 | GiImageIndexVariablesSystem = 45; 43 | GiImageIndexVariablesUser = 46; 44 | GiImageIndexSliders = 47; 45 | GiImageIndexSamples = 48; 46 | GiImageIndexStringTemp = 53; 47 | GiImageIndexStringNamed = 26; 48 | GiImageIndexStringLiteral = 52; 49 | GiImageIndexRefInternal = 37; 50 | GiImageIndexRefExternal = 39; 51 | 52 | GiImageIndexReference = [GiImageIndexRefInternal, GiImageIndexRefExternal]; 53 | GiImageIndexFunctions = [GiImageIndexFunctionsSystem, GiImageIndexFunctionsUser]; 54 | 55 | type 56 | 57 | { TJeezData } 58 | 59 | TJeezData = class(TDataModule) 60 | FontDialog: TFontDialog; 61 | ImageList32: TImageList; 62 | ImageListTabSheet: TImageList; 63 | ImageList16: TImageList; 64 | OpenDialog: TOpenDialog; 65 | SaveDialog: TSaveDialog; 66 | SaveDialogHtml: TSaveDialog; 67 | SynCppSyn: TSynCppSyn; 68 | procedure DataModuleCreate(ASender: TObject); 69 | private 70 | public 71 | function GetHighlighterFromFileName(const AFileName: TFileName; 72 | const ADefault: TSynCustomHighlighter): TSynCustomHighlighter; 73 | end; 74 | 75 | var 76 | JeezData: TJeezData; 77 | 78 | implementation 79 | 80 | {$R *.lfm} 81 | 82 | procedure TJeezData.DataModuleCreate(ASender: TObject); 83 | begin 84 | SaveDialogHtml.Filter := 'HTML Document (*.htm,*.html)|*.htm;*.html'; 85 | SaveDialogHtml.DefaultExt := GsFileExtHtml; 86 | 87 | OpenDialog.InitialDir := GFilePath.ReaperEffects; 88 | OpenDialog.Filter := 'Jesusonic Effects (*.*)|*'; 89 | OpenDialog.DefaultExt := GsFileExtJsFx; 90 | 91 | SaveDialog.InitialDir := OpenDialog.InitialDir; 92 | SaveDialog.Filter := OpenDialog.Filter; 93 | SaveDialog.DefaultExt := OpenDialog.DefaultExt; 94 | end; 95 | 96 | function TJeezData.GetHighlighterFromFileName(const AFileName: TFileName; 97 | const ADefault: TSynCustomHighlighter): TSynCustomHighlighter; 98 | var 99 | LIndex: Integer; 100 | LFileMask, LFileExt: TFileName; 101 | begin 102 | LFileExt := ExtractFileExt(AFileName); 103 | if not SameText(LFileExt, GsFileExtH) then 104 | begin 105 | LFileMask := AllFilesMask + LFileExt; 106 | if LFileMask <> AllFilesMask then 107 | begin 108 | for LIndex := 0 to ComponentCount - 1 do 109 | begin 110 | if Components[LIndex] is TSynCustomHighlighter then 111 | begin 112 | Result := TSynCustomHighlighter(Components[LIndex]); 113 | if AnsiContainsText(Result.DefaultFilter, LFileMask) then 114 | begin 115 | Exit; 116 | end; 117 | end; 118 | end; 119 | end; 120 | end; 121 | Result := ADefault; 122 | end; 123 | 124 | end. 125 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezeditor.lfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derekjohnevans/Geep-Jeez/6478b51fd4fdd82e10107f8cb3f124054a645f0d/jeez!/forms/ujeezeditor.lfm -------------------------------------------------------------------------------- /jeez!/forms/ujeezmessages.lfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derekjohnevans/Geep-Jeez/6478b51fd4fdd82e10107f8cb3f124054a645f0d/jeez!/forms/ujeezmessages.lfm -------------------------------------------------------------------------------- /jeez!/forms/ujeezproperties.lfm: -------------------------------------------------------------------------------- 1 | object JeezProperties: TJeezProperties 2 | Left = 556 3 | Height = 371 4 | Top = 350 5 | Width = 542 6 | BorderStyle = bsDialog 7 | BorderWidth = 6 8 | Caption = 'Effect Properties' 9 | ClientHeight = 371 10 | ClientWidth = 542 11 | OnCreate = FormCreate 12 | OnShow = FormShow 13 | Position = poScreenCenter 14 | LCLVersion = '1.4.2.0' 15 | object PageControl: TPageControl 16 | Left = 6 17 | Height = 321 18 | Top = 6 19 | Width = 530 20 | ActivePage = TabSheetSettings 21 | Align = alClient 22 | Images = JeezData.ImageList16 23 | TabIndex = 0 24 | TabOrder = 0 25 | object TabSheetSettings: TTabSheet 26 | Caption = 'Settings' 27 | ChildSizing.LeftRightSpacing = 6 28 | ChildSizing.TopBottomSpacing = 6 29 | ChildSizing.VerticalSpacing = 6 30 | ClientHeight = 294 31 | ClientWidth = 522 32 | ImageIndex = 9 33 | object GroupBoxDescription: TGroupBox 34 | Left = 6 35 | Height = 162 36 | Top = 6 37 | Width = 510 38 | Align = alTop 39 | Caption = 'Description' 40 | ClientHeight = 144 41 | ClientWidth = 506 42 | TabOrder = 0 43 | object EditUniqueId: TEdit 44 | Left = 400 45 | Height = 21 46 | Hint = 'Unique Id'#13#10'Unique Id Must be an Integer or a Multbyte Char. eg: ''EFX1''' 47 | Top = 104 48 | Width = 88 49 | TabOrder = 0 50 | end 51 | object EditVendorVersion: TSpinEdit 52 | Left = 152 53 | Height = 21 54 | Hint = 'Vendor Version' 55 | Top = 104 56 | Width = 88 57 | MaxValue = 60000 58 | TabOrder = 1 59 | Value = 1000 60 | end 61 | object EditVendorString: TEdit 62 | Left = 152 63 | Height = 21 64 | Hint = 'Vendor String' 65 | Top = 72 66 | Width = 336 67 | TabOrder = 2 68 | Text = 'EditVendorString' 69 | end 70 | object EditEffectName: TEdit 71 | Left = 152 72 | Height = 21 73 | Hint = 'Effect Name' 74 | Top = 40 75 | Width = 336 76 | TabOrder = 3 77 | Text = 'EditEffectName' 78 | end 79 | object EditProductString: TEdit 80 | Left = 152 81 | Height = 21 82 | Hint = 'Product String' 83 | Top = 8 84 | Width = 336 85 | TabOrder = 4 86 | Text = 'EditProductString' 87 | end 88 | end 89 | object GroupBoxInstall: TGroupBox 90 | Left = 6 91 | Height = 82 92 | Top = 174 93 | Width = 510 94 | Align = alTop 95 | Caption = 'Installation (Path must be Writeable)' 96 | ClientHeight = 64 97 | ClientWidth = 506 98 | TabOrder = 1 99 | object EditPluginInstallPath: TDirectoryEdit 100 | Left = 152 101 | Height = 21 102 | Hint = 'Path' 103 | Top = 16 104 | Width = 336 105 | ShowHidden = False 106 | ButtonWidth = 23 107 | DirectInput = False 108 | NumGlyphs = 1 109 | Flat = True 110 | MaxLength = 0 111 | TabOrder = 0 112 | OnChange = EditPluginInstallPathChange 113 | end 114 | end 115 | end 116 | end 117 | object ButtonPanel: TButtonPanel 118 | Left = 12 119 | Height = 26 120 | Top = 333 121 | Width = 518 122 | OKButton.Name = 'OKButton' 123 | OKButton.DefaultCaption = True 124 | HelpButton.Name = 'HelpButton' 125 | HelpButton.DefaultCaption = True 126 | CloseButton.Name = 'CloseButton' 127 | CloseButton.DefaultCaption = True 128 | CancelButton.Name = 'CancelButton' 129 | CancelButton.DefaultCaption = True 130 | TabOrder = 1 131 | ShowButtons = [pbOK, pbCancel] 132 | ShowBevel = False 133 | end 134 | end 135 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezproperties.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jeez! - Jesusonic Script Editor 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit UJeezProperties; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | ButtonPanel, Classes, ComCtrls, Controls, EditBtn, Forms, JeezLabels, Jes2CppConstants, 35 | Jes2CppPlatform, Jes2CppStrings, Spin, StdCtrls, SysUtils; 36 | 37 | type 38 | 39 | { TJeezProperties } 40 | 41 | TJeezProperties = class(TForm) 42 | ButtonPanel: TButtonPanel; 43 | EditEffectName: TEdit; 44 | EditPluginInstallPath: TDirectoryEdit; 45 | EditProductString: TEdit; 46 | EditUniqueId: TEdit; 47 | EditVendorString: TEdit; 48 | EditVendorVersion: TSpinEdit; 49 | GroupBoxDescription: TGroupBox; 50 | GroupBoxInstall: TGroupBox; 51 | PageControl: TPageControl; 52 | TabSheetSettings: TTabSheet; 53 | procedure EditPluginInstallPathChange(ASender: TObject); 54 | procedure FormCreate(ASender: TObject); 55 | procedure FormShow(ASender: TObject); 56 | public 57 | function Execute(const AStrings: TStrings): Boolean; 58 | end; 59 | 60 | var 61 | JeezProperties: TJeezProperties; 62 | 63 | implementation 64 | 65 | {$R *.lfm} 66 | 67 | uses UJeezOptions; 68 | 69 | procedure TJeezProperties.FormCreate(ASender: TObject); 70 | begin 71 | GPlatform.ScrollingWinControlPrepare(Self); 72 | PageControl.PageIndex := 0; 73 | end; 74 | 75 | procedure TJeezProperties.FormShow(ASender: TObject); 76 | begin 77 | J2C_WinControlCreateLabels(Self); 78 | end; 79 | 80 | procedure TJeezProperties.EditPluginInstallPathChange(ASender: TObject); 81 | begin 82 | with ASender as TDirectoryEdit do 83 | begin 84 | Directory := IncludeTrailingPathDelimiter(Directory); 85 | end; 86 | end; 87 | 88 | function TJeezProperties.Execute(const AStrings: TStrings): Boolean; 89 | begin 90 | EditEffectName.Text := GStrings.GetValue(AStrings, GsEffectName, 'New Effect'); 91 | EditVendorString.Text := GStrings.GetValue(AStrings, GsVendorString, 'Enter Vendor Name'); 92 | EditVendorVersion.Value := StrToIntDef(GStrings.GetValue(AStrings, GsVendorVersion, 93 | EmptyStr), 1000); 94 | EditUniqueId.Text := GStrings.GetValue(AStrings, GsUniqueId, EmptyStr); 95 | EditProductString.Text := GStrings.GetValue(AStrings, GsProductString, 'Enter Description'); 96 | EditPluginInstallPath.Text := GStrings.GetValue(AStrings, GsInstallPath, 97 | JeezOptions.EditDefVstPath.Directory, True); 98 | Result := ShowModal = mrOk; 99 | if Result then 100 | begin 101 | GStrings.SetValue(AStrings, GsProductString, EditProductString.Text); 102 | GStrings.SetValue(AStrings, GsEffectName, EditEffectName.Text); 103 | GStrings.SetValue(AStrings, GsVendorString, EditVendorString.Text); 104 | GStrings.SetValue(AStrings, GsVendorVersion, EditVendorVersion.Text); 105 | GStrings.SetValue(AStrings, GsUniqueId, EditUniqueId.Text); 106 | GStrings.SetValue(AStrings, GsInstallPath, EditPluginInstallPath.Text); 107 | end; 108 | end; 109 | 110 | end. 111 | -------------------------------------------------------------------------------- /jeez!/forms/ujeezsplash.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jeez! - Jesusonic Script Editor 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit UJeezSplash; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | ExtCtrls, Forms, JeezUtils; 35 | 36 | type 37 | 38 | { TJeezSplash } 39 | 40 | TJeezSplash = class(TForm) 41 | Image: TImage; 42 | Timer: TTimer; 43 | procedure FormClose(ASender: TObject; var ACloseAction: TCloseAction); 44 | procedure FormCreate(ASender: TObject); 45 | procedure ImageClick(ASender: TObject); 46 | procedure TimerTimer(ASender: TObject); 47 | private 48 | public 49 | end; 50 | 51 | var 52 | JeezSplash: TJeezSplash; 53 | 54 | implementation 55 | 56 | {$R *.lfm} 57 | 58 | procedure TJeezSplash.FormCreate(ASender: TObject); 59 | begin 60 | Caption := GsJeezTitle; 61 | end; 62 | 63 | procedure TJeezSplash.ImageClick(ASender: TObject); 64 | begin 65 | Close; 66 | end; 67 | 68 | procedure TJeezSplash.FormClose(ASender: TObject; var ACloseAction: TCloseAction); 69 | begin 70 | ACloseAction := caFree; 71 | end; 72 | 73 | procedure TJeezSplash.TimerTimer(ASender: TObject); 74 | begin 75 | Close; 76 | end; 77 | 78 | end. 79 | 80 | -------------------------------------------------------------------------------- /jeez!/project.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derekjohnevans/Geep-Jeez/6478b51fd4fdd82e10107f8cb3f124054a645f0d/jeez!/project.ico -------------------------------------------------------------------------------- /jeez!/project.lpr: -------------------------------------------------------------------------------- 1 | program project; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses {$IFDEF UNIX} {$IFDEF UseCThreads} 6 | cthreads, {$ENDIF} {$ENDIF} 7 | Forms, 8 | Interfaces, // this includes the LCL widgetset 9 | jeezinifile, 10 | JeezLabels, 11 | jeezresources, 12 | jeezsynedit, 13 | jeeztreeview, 14 | JeezUtils, 15 | Jes2Cpp, 16 | jes2cppcompiler, 17 | Jes2CppConstants, 18 | Jes2CppDescription, 19 | jes2cppeel, 20 | Jes2CppFileNames, 21 | Jes2CppFunction, 22 | Jes2CppFunctionIdentifiers, 23 | Jes2CppIdentifier, 24 | Jes2CppIdentString, 25 | Jes2CppImporter, 26 | Jes2CppIterate, 27 | Jes2CppLoop, 28 | Jes2CppMessageLog, 29 | Jes2CppModuleImporter, 30 | jes2cppparameter, 31 | Jes2CppParser, 32 | Jes2CppParserElements, 33 | Jes2CppParserExpression, 34 | jes2cppparserfunctions, 35 | Jes2CppParserLoops, 36 | Jes2CppParserOperator, 37 | Jes2CppParserSimple, 38 | Jes2CppPlatform, 39 | jes2cppprinter, 40 | jes2cppprocess, 41 | Jes2CppReference, 42 | Jes2CppSections, 43 | Jes2CppStrings, 44 | Jes2CppTextFileCache, 45 | Jes2CppToken, 46 | jes2cpptranslate, 47 | Jes2CppUtils, 48 | Jes2CppVariable, 49 | lazcontrols, 50 | soda, 51 | UJeezAbout, 52 | UJeezBuild, 53 | ujeezdata, 54 | UJeezEditor, 55 | ujeezide, 56 | ujeezmessages, 57 | UJeezOptions, 58 | ujeezproperties, 59 | ujeezsplash; 60 | 61 | {$R *.res} 62 | 63 | begin 64 | Application.Title := 'Geep Jeez!'; 65 | RequireDerivedFormResource := True; 66 | Application.Initialize; 67 | Application.CreateForm(TJeezIde, JeezIde); 68 | Application.CreateForm(TJeezOptions, JeezOptions); 69 | Application.CreateForm(TJeezProperties, JeezProperties); 70 | Application.CreateForm(TJeezBuild, JeezBuild); 71 | Application.CreateForm(TJeezData, JeezData); 72 | Application.CreateForm(TJeezConsole, JeezConsole); 73 | Application.CreateForm(TJeezSplash, JeezSplash); 74 | Application.CreateForm(TJeezAbout, JeezAbout); 75 | Application.Run; 76 | end. 77 | -------------------------------------------------------------------------------- /jeez!/project.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derekjohnevans/Geep-Jeez/6478b51fd4fdd82e10107f8cb3f124054a645f0d/jeez!/project.res -------------------------------------------------------------------------------- /jeez!/utils/jeezlabels.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jeez! - Jesusonic Script Editor 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit JeezLabels; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Classes, Controls, EditBtn, ExtCtrls, Graphics, Jes2CppPlatform, StdCtrls, SysUtils, Types; 35 | 36 | const 37 | 38 | clInfoBlock = TColor($E1FFFF); 39 | 40 | procedure J2C_WinControlCreateLabels(const AWinControl: TWinControl); 41 | 42 | implementation 43 | 44 | function J2C_ControlCreateLabel(const AControl: TControl): TPanel; 45 | var 46 | LIndex: Integer; 47 | LCaption, LHint: String; 48 | LRect, LUnion: TRect; 49 | begin 50 | Result := nil; 51 | LHint := Trim(AControl.Hint); 52 | if not AControl.ShowHint and (LHint <> EmptyStr) then 53 | begin 54 | AControl.ShowHint := True; 55 | LRect := Rect(0, AControl.Top, AControl.Left, AControl.BoundsRect.Bottom); 56 | for LIndex := 0 to AControl.Parent.ControlCount - 1 do 57 | begin 58 | LUnion := Bounds(0, 0, 0, 0); 59 | if IntersectRect(LUnion, LRect, AControl.Parent.Controls[LIndex].BoundsRect) then 60 | begin 61 | LRect.Left := LUnion.Right; 62 | end; 63 | end; 64 | if not IsRectEmpty(LRect) then 65 | begin 66 | LIndex := Pos(#10, LHint); 67 | if LIndex > 0 then 68 | begin 69 | LCaption := Trim(Copy(LHint, 1, LIndex - 1)); 70 | LHint := Trim(Copy(LHint, LIndex + 1, MaxInt)); 71 | end else begin 72 | LCaption := LHint; 73 | end; 74 | AControl.Hint := LHint; 75 | if not GPlatform.IsWindows9x then 76 | begin 77 | AControl.Color := clInfoBlock; 78 | end; 79 | Result := TPanel.Create(AControl); 80 | Result.BoundsRect := LRect; 81 | Result.BorderWidth := 6; 82 | Result.Alignment := taRightJustify; 83 | Result.BevelOuter := bvNone; 84 | Result.Caption := LCaption; 85 | Result.Hint := LHint; 86 | Result.ShowHint := True; 87 | Result.Cursor := crHelp; 88 | Result.Parent := AControl.Parent; 89 | Result.Font.Color := clBlack; 90 | end; 91 | end; 92 | end; 93 | 94 | procedure J2C_WinControlCreateLabels(const AWinControl: TWinControl); 95 | var 96 | LIndex: Integer; 97 | begin 98 | if (AWinControl is TCustomEdit) or (AWinControl is TDirectoryEdit) or 99 | (AWinControl is TCustomComboBox) then 100 | begin 101 | J2C_ControlCreateLabel(AWinControl); 102 | end; 103 | for LIndex := 0 to AWinControl.ControlCount - 1 do 104 | begin 105 | if AWinControl.Controls[LIndex] is TWinControl then 106 | begin 107 | J2C_WinControlCreateLabels(TWinControl(AWinControl.Controls[LIndex])); 108 | end; 109 | end; 110 | end; 111 | 112 | end. 113 | -------------------------------------------------------------------------------- /jeez!/utils/jeezresources.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jeez! - Jesusonic Script Editor 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit JeezResources; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | 34 | resourcestring 35 | 36 | SMsgParsingDotDotDot = 'Parsing ...'; 37 | SMsgCompilationComplete1 = 'Compilation Complete - Time Duration = %s'; 38 | SMsgCountFunctions1 = '(%d Functions)'; 39 | SMsgCountVariables1 = '(%d Variables)'; 40 | SMsgDoYouWantToSaveModifiedFile1 = '''%s'' has been modified. Do you want to save?'; 41 | SMsgFileDoesNotExist1 = 'The file ''%s'' does not exist.'; 42 | SMsgFileIsNotText1 = 'The file ''%s'' is not a text file.'; 43 | SMsgFileNameMustBeAbsolute = 'File name must be absolute.'; 44 | SMsgNoCompilerIsSelected = 'No Compiler is Selected. (Choose compiler from Tools->Options)'; 45 | SMsgPluginDoesNotExistWouldYouLikeToBuildInstallIt1 = 46 | 'The plugin ''%s'' does not exist. Would you like to build/install it?'; 47 | SMsgPluginFailedToInstall = 48 | 'Failed to install plugin. (Please check VSTPath is valid and/or if plugin is in use)'; 49 | SMsgPluginHasBeenInstalled = 'Plugin has been installed'; 50 | SMsgScriptsMustBeSaved = 'Script must be saved before VST can be installed.'; 51 | SMsgSearchCompleted1 = 'Search completed. Do you want to restart from the %s?'; 52 | SMsgSyntaxCheckingCompleteNoErrorsFound = 'Syntax checking complete. No errors were found.'; 53 | SMsgSyntaxError = 'Syntax Error'; 54 | SMsgUnableToFind1 = 'Unable to find ''%s''.'; 55 | SMsgUnableToFindFunction1 = 'Unable to find function ''%s''.'; 56 | SMsgUnableToFindVariable1 = 'Unable to find variable ''%s''.'; 57 | 58 | implementation 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /jes2cpp/bass/readme.txt: -------------------------------------------------------------------------------- 1 | BASS 2.4 2 | Copyright (c) 1999-2013 Un4seen Developments Ltd. All rights reserved. 3 | 4 | http://www.un4seen.com/ 5 | 6 | BASS is free for non-commercial use. If you are a non-commercial entity (eg. an individual) and you are not making any money from your product (through sales, advertising, etc), then you can use BASS in it for free. 7 | 8 | -------------------------------------------------------------------------------- /jes2cpp/exports.def: -------------------------------------------------------------------------------- 1 | EXPORTS VSTPluginMain 2 | main=VSTPluginMain -------------------------------------------------------------------------------- /jes2cpp/j2c.base/jes2cppiterate.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppIterate; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Classes, ComCtrls; 35 | 36 | function IndexFirst(const AList: TObject): Integer; overload; 37 | 38 | function IndexCount(const AList: TStrings): Integer; overload; 39 | function IndexCount(const AList: TComponent): Integer; overload; 40 | function IndexCount(const AList: TPageControl): Integer; overload; 41 | function IndexCount(const AList: TToolBar): Integer; overload; 42 | 43 | function IndexLast(const AList: TStrings): Integer; overload; 44 | function IndexLast(const AList: TComponent): Integer; overload; 45 | function IndexLast(const AList: TPageControl): Integer; overload; 46 | function IndexLast(const AList: TToolBar): Integer; overload; 47 | 48 | implementation 49 | 50 | function IndexFirst(const AList: TObject): Integer; 51 | begin 52 | Assert(Assigned(AList)); 53 | Result := 0; 54 | end; 55 | 56 | function IndexCount(const AList: TStrings): Integer; 57 | begin 58 | Assert(Assigned(AList)); 59 | Result := AList.Count; 60 | end; 61 | 62 | function IndexCount(const AList: TComponent): Integer; 63 | begin 64 | Assert(Assigned(AList)); 65 | Result := AList.ComponentCount; 66 | end; 67 | 68 | function IndexCount(const AList: TPageControl): Integer; 69 | begin 70 | Assert(Assigned(AList)); 71 | Result := AList.PageCount; 72 | end; 73 | 74 | function IndexCount(const AList: TToolBar): Integer; 75 | begin 76 | Assert(Assigned(AList)); 77 | Result := AList.ButtonCount; 78 | end; 79 | 80 | function IndexLast(const AList: TStrings): Integer; 81 | begin 82 | Result := IndexCount(AList) - 1; 83 | end; 84 | 85 | function IndexLast(const AList: TComponent): Integer; 86 | begin 87 | Result := IndexCount(AList) - 1; 88 | end; 89 | 90 | function IndexLast(const AList: TPageControl): Integer; 91 | begin 92 | Result := IndexCount(AList) - 1; 93 | end; 94 | 95 | function IndexLast(const AList: TToolBar): Integer; 96 | begin 97 | Result := IndexCount(AList) - 1; 98 | end; 99 | 100 | end. 101 | 102 | -------------------------------------------------------------------------------- /jes2cpp/j2c.base/jes2cppparsersimple.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppParserSimple; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Math, SysUtils; 35 | 36 | type 37 | 38 | TJes2CppParserSimple = object 39 | protected 40 | FPos: Integer; 41 | FSource, FToken: String; 42 | FTerminator: Char; 43 | private 44 | procedure RaiseExpected(const ATrue: Boolean; const AString: String); 45 | public 46 | procedure SetSource(const ASource: String; const APos: Integer = 1); 47 | function TryUntil(const ATerminators: TSysCharSet): Boolean; 48 | procedure GetUntil(const ATerminators: TSysCharSet); 49 | public 50 | function AsString: String; overload; 51 | function AsString(const AExpected: String): String; overload; 52 | function AsName: String; 53 | function AsInteger: Integer; overload; 54 | function AsInteger(const AMin, AMax: Integer): Integer; overload; 55 | function AsFileName: TFileName; 56 | public 57 | property Terminator: Char read FTerminator; 58 | end; 59 | 60 | implementation 61 | 62 | uses Jes2CppConstants, Jes2CppTranslate; 63 | 64 | procedure TJes2CppParserSimple.SetSource(const ASource: String; const APos: Integer); 65 | begin 66 | FPos := APos; 67 | // TODO: Should we really be adding a null here? 68 | // Removing it requires code to be added below to handle NULL terminators. 69 | FSource := ASource + CharNull; 70 | FToken := EmptyStr; 71 | FTerminator := CharNull; 72 | end; 73 | 74 | function TJes2CppParserSimple.TryUntil(const ATerminators: TSysCharSet): Boolean; 75 | var 76 | LEnd: Integer; 77 | begin 78 | Result := False; 79 | for LEnd := FPos to Length(FSource) do 80 | begin 81 | if FSource[LEnd] in ATerminators then 82 | begin 83 | Result := True; 84 | FTerminator := FSource[LEnd]; 85 | FToken := Trim(Copy(FSource, FPos, LEnd - FPos)); 86 | FPos := LEnd + 1; 87 | Break; 88 | end; 89 | end; 90 | end; 91 | 92 | procedure TJes2CppParserSimple.GetUntil(const ATerminators: TSysCharSet); 93 | var 94 | LChar: Char; 95 | LString: String; 96 | begin 97 | if not TryUntil(ATerminators) then 98 | begin 99 | LString := EmptyStr; 100 | for LChar in ATerminators do 101 | begin 102 | if LString <> EmptyStr then 103 | begin 104 | LString += GsCppCommaSpace; 105 | end; 106 | if LChar in [#32..#126] then 107 | begin 108 | LString += CharQuoteSingle + LChar + CharQuoteSingle; 109 | end else begin 110 | LString += CharHash + IntToStr(Ord(LChar)); 111 | end; 112 | end; 113 | RaiseExpected(False, '[' + LString + ']'); 114 | end; 115 | end; 116 | 117 | procedure TJes2CppParserSimple.RaiseExpected(const ATrue: Boolean; const AString: String); 118 | begin 119 | if not ATrue then 120 | begin 121 | raise Exception.Create('Expected ' + AString + '.'); 122 | end; 123 | end; 124 | 125 | function TJes2CppParserSimple.AsString: String; 126 | begin 127 | Result := FToken; 128 | end; 129 | 130 | function TJes2CppParserSimple.AsInteger: Integer; 131 | begin 132 | Result := StrToInt(FToken); 133 | end; 134 | 135 | function TJes2CppParserSimple.AsInteger(const AMin, AMax: Integer): Integer; 136 | begin 137 | Result := AsInteger; 138 | RaiseExpected(InRange(Result, AMin, AMax), Format('Integer %d to %d', [AMin, AMax])); 139 | end; 140 | 141 | function TJes2CppParserSimple.AsString(const AExpected: String): String; 142 | begin 143 | RaiseExpected(FToken <> EmptyStr, AExpected); 144 | Result := FToken; 145 | end; 146 | 147 | function TJes2CppParserSimple.AsName: String; 148 | begin 149 | Result := AsString('Name'); 150 | end; 151 | 152 | function TJes2CppParserSimple.AsFileName: TFileName; 153 | begin 154 | Result := AsString('Filename'); 155 | end; 156 | 157 | end. 158 | -------------------------------------------------------------------------------- /jes2cpp/j2c.base/jes2cpptextfilecache.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppTextFileCache; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Classes, Contnrs, FileUtil, Jes2CppConstants, SysUtils; 35 | 36 | type 37 | TJes2CppTextFile = class(TStringList) 38 | strict private 39 | FFileAge: longint; 40 | strict private 41 | procedure LogAssert(const ATrue: Boolean; const AMessage, AFileName: String); 42 | public 43 | procedure LoadFromFile(const AFileName: TFileName); override; 44 | end; 45 | 46 | GFileCache = object 47 | class function LoadFromFile(const AFileName: TFileName): TJes2CppTextFile; 48 | end; 49 | 50 | implementation 51 | 52 | procedure TJes2CppTextFile.LogAssert(const ATrue: Boolean; const AMessage, AFileName: String); 53 | begin 54 | if not ATrue then 55 | begin 56 | raise Exception.Create(AMessage + ' - ''' + AFileName + ''''); 57 | end; 58 | end; 59 | 60 | procedure TJes2CppTextFile.LoadFromFile(const AFileName: TFileName); 61 | var 62 | LFileAge: longint; 63 | begin 64 | LogAssert(FilenameIsAbsolute(AFileName), SMsgFileNameMustBeAbsolute, AFileName); 65 | LFileAge := FileAge(AFileName); 66 | LogAssert(LFileAge >= 0, SMsgFileDoesNotExist, AFileName); 67 | if LFileAge > FFileAge then 68 | begin 69 | LogAssert(FileIsText(AFileName), SMsgFileIsNotATextFile, AFileName); 70 | inherited LoadFromFile(AFileName); 71 | FFileAge := LFileAge; 72 | end; 73 | end; 74 | 75 | var 76 | GFileObjectList: TFPHashObjectList; 77 | 78 | class function GFileCache.LoadFromFile(const AFileName: TFileName): TJes2CppTextFile; 79 | begin 80 | Result := GFileObjectList.Find(AFileName) as TJes2CppTextFile; 81 | if not Assigned(Result) then 82 | begin 83 | Result := TJes2CppTextFile.Create; 84 | GFileObjectList.Add(AFileName, Result); 85 | end; 86 | Result.LoadFromFile(AFileName); 87 | end; 88 | 89 | initialization 90 | 91 | GFileObjectList := TFPHashObjectList.Create; 92 | 93 | end. 94 | -------------------------------------------------------------------------------- /jes2cpp/j2c.base/jes2cpptoken.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppToken; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses Jes2CppConstants, SysUtils; 34 | 35 | const 36 | 37 | CharSetAll = [#0..#255]; 38 | CharSetWhite = [#9, #10, #11, #12, #13, #32]; 39 | CharSetQuote = [CharQuoteSingle, CharQuoteDouble]; 40 | CharSetNull = [CharNull]; 41 | CharSetLineEnding = CharSetNull + [#10, #13]; 42 | CharSetUpper = ['A'..'Z']; 43 | CharSetLower = ['a'..'z']; 44 | CharSetHex = ['a'..'f', 'A'..'F']; 45 | CharSetDigit = ['0'..'9']; 46 | CharSetAlpha = CharSetLower + CharSetUpper; 47 | 48 | CharSetFunctHead = CharSetAlpha + ['_']; 49 | 50 | CharSetIdentHead = CharSetFunctHead + ['$', '#']; 51 | CharSetIdentBody = CharSetAlpha + CharSetDigit + ['_', '.']; 52 | CharSetIdentFull = CharSetIdentHead + CharSetIdentBody; 53 | 54 | CharSetNumberHead = CharSetDigit + ['.', '$']; 55 | CharSetNumberBody = CharSetDigit + CharSetAlpha + ['~', '.', '''']; 56 | 57 | CharSetOperator1 = ['=', '*', '/', '%', '^', '+', '-', '|', '&', '!', '<', '>', '~']; 58 | CharSetOperator2 = ['<', '>', '&', '|', '=']; 59 | 60 | type 61 | 62 | GToken = object 63 | class function IsSame(const AToken1, AToken2: PChar): Boolean; 64 | class function IsNumberAsc(const AToken: PChar): Boolean; 65 | class function IsNumberHex(const AToken: PChar): Boolean; 66 | class function IsNumberMask(const AToken: PChar): Boolean; 67 | end; 68 | 69 | implementation 70 | 71 | class function GToken.IsSame(const AToken1, AToken2: PChar): Boolean; 72 | begin 73 | Result := StrIComp(AToken1, AToken2) = 0; 74 | end; 75 | 76 | class function GToken.IsNumberAsc(const AToken: PChar): Boolean; 77 | begin 78 | Result := (AToken[0] = '$') and (AToken[1] = '''') and (AToken[2] <> #0) and (AToken[3] = ''''); 79 | end; 80 | 81 | class function GToken.IsNumberHex(const AToken: PChar): Boolean; 82 | begin 83 | Result := (AToken[0] in ['$', '0']) and (AToken[1] in ['x', 'X']); 84 | end; 85 | 86 | class function GToken.IsNumberMask(const AToken: PChar): Boolean; 87 | begin 88 | Result := (AToken[0] = '$') and (AToken[1] = '~'); 89 | end; 90 | 91 | end. 92 | -------------------------------------------------------------------------------- /jes2cpp/j2c.components/jes2cppfunctionidentifiers.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppFunctionIdentifiers; 28 | 29 | {$MODE DELPHI} 30 | {$MACRO ON} 31 | 32 | interface 33 | 34 | uses 35 | Classes, Jes2CppConstants, Jes2CppEel, Jes2CppIdentifier, Jes2CppIdentString, Jes2CppMessageLog, 36 | Jes2CppTranslate, Soda, SysUtils; 37 | 38 | type 39 | 40 | CJes2CppFunctionIdentifier = class(CJes2CppDataType) 41 | end; 42 | 43 | CJes2CppFunctionIdentifiers = class 44 | {$DEFINE DItemClass := CJes2CppFunctionIdentifiers} 45 | {$DEFINE DItemSuper := CComponent} 46 | {$DEFINE DItemOwner := CComponent} 47 | {$DEFINE DItemItems := CJes2CppFunctionIdentifier} 48 | {$INCLUDE soda.inc} 49 | public 50 | function ExistsIdent(const AIdent: TIdentString; 51 | const AMessageLog: CJes2CppMessageLog): Boolean; 52 | function IndexOfIdent(AIdent: TIdentString): Integer; 53 | function IsCountMatch(const ACount: Integer): Boolean; 54 | function IsNameSpaceMatch(const AIdent: TIdentString): Boolean; 55 | function IsVariadic: Boolean; 56 | public 57 | procedure AppendParams(var AResult: String; const AIsDefine, AIsInstance: Boolean); 58 | procedure CopyFrom(const AIdentifiers: CJes2CppFunctionIdentifiers); 59 | end; 60 | 61 | implementation 62 | 63 | {$DEFINE DItemClass := CJes2CppFunctionIdentifiers} 64 | {$INCLUDE soda.inc} 65 | 66 | procedure CJes2CppFunctionIdentifiers.CopyFrom(const AIdentifiers: CJes2CppFunctionIdentifiers); 67 | var 68 | LComponent: TComponent; 69 | begin 70 | Assert(IsEmpty); 71 | for LComponent in AIdentifiers do 72 | begin 73 | CJes2CppFunctionIdentifier.CreateNamed(Self, LComponent.Name); 74 | end; 75 | end; 76 | 77 | function CJes2CppFunctionIdentifiers.IsVariadic: Boolean; 78 | begin 79 | Result := HasComponents and (Self[ComponentCount - 1].Name = GsEelVariadic); 80 | end; 81 | 82 | function CJes2CppFunctionIdentifiers.IndexOfIdent(AIdent: TIdentString): Integer; 83 | begin 84 | AIdent := GIdentString.RemoveRef(AIdent); 85 | for Result := 0 to ComponentCount - 1 do 86 | begin 87 | if SameText(AIdent, GIdentString.RemoveRef(Self[Result].Name)) then 88 | begin 89 | Exit; 90 | end; 91 | end; 92 | Result := -1; 93 | end; 94 | 95 | function CJes2CppFunctionIdentifiers.ExistsIdent(const AIdent: TIdentString; 96 | const AMessageLog: CJes2CppMessageLog): Boolean; 97 | var 98 | LIndex: Integer; 99 | begin 100 | Assert(Assigned(AMessageLog)); 101 | LIndex := IndexOfIdent(AIdent); 102 | Result := LIndex >= 0; 103 | if Result then 104 | begin 105 | AMessageLog.LogWarningCaseCheck(AIdent, Self[LIndex].Name); 106 | end; 107 | end; 108 | 109 | function CJes2CppFunctionIdentifiers.IsCountMatch(const ACount: Integer): Boolean; 110 | begin 111 | Result := (IsVariadic and (ACount >= ComponentCount - 1)) or (ACount = ComponentCount); 112 | end; 113 | 114 | function CJes2CppFunctionIdentifiers.IsNameSpaceMatch(const AIdent: TIdentString): Boolean; 115 | var 116 | LComponent: TComponent; 117 | begin 118 | for LComponent in Self do 119 | begin 120 | if GIdentString.IsNameSpace(AIdent, LComponent.Name) then 121 | begin 122 | Exit(True); 123 | end; 124 | end; 125 | Result := False; 126 | end; 127 | 128 | procedure CJes2CppFunctionIdentifiers.AppendParams(var AResult: String; 129 | const AIsDefine, AIsInstance: Boolean); 130 | var 131 | LComponent: TComponent; 132 | begin 133 | for LComponent in Self do 134 | begin 135 | if AResult <> EmptyStr then 136 | begin 137 | AResult += GsCppCommaSpace; 138 | end; 139 | if AIsDefine then 140 | begin 141 | AResult += GsCppEelF + CharAmpersand + CharSpace; 142 | end; 143 | if AIsInstance then 144 | begin 145 | AResult += GCpp.Encode.NameVariable(GsEelSpaceThis + LComponent.Name); 146 | end else begin 147 | AResult += GCpp.Encode.NameVariable(LComponent.Name); 148 | end; 149 | end; 150 | end; 151 | 152 | end. 153 | -------------------------------------------------------------------------------- /jes2cpp/j2c.components/jes2cppidentifier.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppIdentifier; 28 | 29 | {$MODE DELPHI} 30 | {$MACRO ON} 31 | 32 | interface 33 | 34 | uses 35 | Classes, Jes2CppFileNames, Jes2CppIdentString, Jes2CppReference, Jes2CppTranslate, 36 | Soda, SysUtils; 37 | 38 | type 39 | 40 | TJes2CppIdentifierType = (itInternal, itExternal); 41 | 42 | CJes2CppDataType = class(CComponent) 43 | strict private 44 | FDataType: String; 45 | strict private 46 | function GetDataType: String; 47 | public 48 | property DataType: String read GetDataType write FDataType; 49 | end; 50 | 51 | CJes2CppIdentifier = class(CJes2CppDataType) 52 | strict private 53 | FComment: String; 54 | FIdentType: TJes2CppIdentifierType; 55 | FReferences: CJes2CppReferences; 56 | protected 57 | procedure DoCreate; override; 58 | public 59 | function IsSystem: Boolean; 60 | function IsIdent(const AIdent: TIdentString): Boolean; 61 | function IsDefinedInFileSource(const AFileSource: TFileName): Boolean; 62 | public 63 | property References: CJes2CppReferences read FReferences; 64 | property IdentType: TJes2CppIdentifierType read FIdentType write FIdentType; 65 | property Comment: String read FComment write FComment; 66 | end; 67 | 68 | CJes2CppIdentifiers = class 69 | {$DEFINE DItemClass := CJes2CppIdentifiers} 70 | {$DEFINE DItemSuper := CComponent} 71 | {$DEFINE DItemItems := CJes2CppIdentifier} 72 | {$INCLUDE soda.inc} 73 | end; 74 | 75 | implementation 76 | 77 | {$DEFINE DItemClass := CJes2CppIdentifiers} 78 | {$INCLUDE soda.inc} 79 | 80 | function CJes2CppDataType.GetDataType: String; 81 | begin 82 | Result := FDataType; 83 | if Result = EmptyStr then 84 | begin 85 | Result := GsCppEelF; 86 | end; 87 | end; 88 | 89 | procedure CJes2CppIdentifier.DoCreate; 90 | begin 91 | inherited DoCreate; 92 | FReferences := CJes2CppReferences.Create(Self); 93 | end; 94 | 95 | function CJes2CppIdentifier.IsSystem: Boolean; 96 | begin 97 | Result := (IdentType = itExternal) or (References.HasComponents and 98 | SameText(References[0].FileNameOnly, GsFilePartJes2Cpp + GsFileExtJsFxInc)); 99 | end; 100 | 101 | function CJes2CppIdentifier.IsIdent(const AIdent: TIdentString): Boolean; 102 | begin 103 | Result := SameText(Name, AIdent); 104 | end; 105 | 106 | function CJes2CppIdentifier.IsDefinedInFileSource(const AFileSource: TFileName): Boolean; 107 | begin 108 | Result := (References.HasComponents and SameFileName(References[0].FileSource, AFileSource)); 109 | end; 110 | 111 | end. 112 | -------------------------------------------------------------------------------- /jes2cpp/j2c.components/jes2cpploop.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppLoop; 28 | 29 | {$MODE DELPHI} 30 | {$MACRO ON} 31 | 32 | interface 33 | 34 | uses 35 | Classes, Jes2CppConstants, Jes2CppEel, Jes2CppFunction, Jes2CppIdentifier, 36 | Jes2CppTranslate, Soda, SysUtils; 37 | 38 | type 39 | 40 | TJes2CppLoopType = (ltLoop, ltDoWhile, ltWhile); 41 | 42 | CJes2CppLoops = class; 43 | 44 | CJes2CppLoop = class(CJes2CppIdentifier) 45 | strict private 46 | FParentFunction: CJes2CppFunction; 47 | public 48 | FCondition, FBlock, FPreCondition: String; 49 | FType: TJes2CppLoopType; 50 | strict private 51 | function CppFunctionParameters(const AIsDefine: Boolean): String; 52 | function CppFunctionHead: String; 53 | public 54 | constructor Create(const AOwner: CJes2CppLoops; const AType: TJes2CppLoopType; 55 | const AParentFunction: CJes2CppFunction); 56 | virtual; reintroduce; 57 | public 58 | function CppFunction: String; 59 | function CppFunctionProto: String; 60 | function CppFunctionMacro: String; 61 | end; 62 | 63 | CJes2CppLoops = class 64 | {$DEFINE DItemClass := CJes2CppLoops} 65 | {$DEFINE DItemSuper := CComponent} 66 | {$DEFINE DItemItems := CJes2CppLoop} 67 | {$INCLUDE soda.inc} 68 | end; 69 | 70 | implementation 71 | 72 | {$DEFINE DItemClass := CJes2CppLoops} 73 | {$INCLUDE soda.inc} 74 | 75 | constructor CJes2CppLoop.Create(const AOwner: CJes2CppLoops; const AType: TJes2CppLoopType; 76 | const AParentFunction: CJes2CppFunction); 77 | begin 78 | inherited CreateNamed(AOwner, GsDoLoop + IntToStr(AOwner.ComponentCount)); 79 | FType := AType; 80 | FParentFunction := AParentFunction; 81 | end; 82 | 83 | function CJes2CppLoop.CppFunctionParameters(const AIsDefine: Boolean): String; 84 | begin 85 | Result := EmptyStr; 86 | if Assigned(FParentFunction) then 87 | begin 88 | FParentFunction.Params.AppendParams(Result, AIsDefine, False); 89 | FParentFunction.Locals.AppendParams(Result, AIsDefine, False); 90 | FParentFunction.InstancesAll.AppendParams(Result, AIsDefine, True); 91 | end; 92 | end; 93 | 94 | function CJes2CppLoop.CppFunctionProto: String; 95 | begin 96 | Result := Format(GsCppFunct2, [Name, CppFunctionParameters(False)]); 97 | end; 98 | 99 | function CJes2CppLoop.CppFunctionMacro: String; 100 | begin 101 | Result := CharDollar + UpperCase(Name) + CharDollar; 102 | end; 103 | 104 | function CJes2CppLoop.CppFunctionHead: String; 105 | begin 106 | Result := GsCppJes2CppInlineSpace + GsCppEelF + CharSpace + Name + '(' + 107 | CppFunctionParameters(True) + ')' + LineEnding; 108 | end; 109 | 110 | function CJes2CppLoop.CppFunction: String; 111 | begin 112 | Result := CppFunctionHead + '{' + LineEnding; 113 | Result += 'int LMax = 1000000;' + LineEnding; 114 | case FType of 115 | ltLoop: begin 116 | Result += 'for (int LIdx = (int)(' + FCondition + '); (--LIdx >= 0) && (LMax-- > 0);)' + 117 | LineEnding; 118 | Result += '{' + LineEnding + FBlock + '}' + LineEnding; 119 | end; 120 | ltDoWhile: begin 121 | Result += 'do {' + LineEnding + FBlock + '} while (' + GsFnIf + '(' + 122 | FCondition + ') && (LMax-- > 0));' + LineEnding; 123 | end; 124 | ltWhile: begin 125 | Result += FPreCondition + 'while (' + GsFnIf + '(' + FCondition + 126 | ') && (LMax-- > 0)) {' + LineEnding + FBlock + FPreCondition + '}' + LineEnding; 127 | 128 | end; 129 | end; 130 | Result += 'return ' + GCpp.Encode.Float(1) + ';' + LineEnding + '}' + LineEnding; 131 | end; 132 | 133 | end. 134 | -------------------------------------------------------------------------------- /jes2cpp/j2c.components/jes2cppmoduleimporter.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppModuleImporter; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Classes, Jes2Cpp, Jes2CppConstants, Jes2CppEel, Jes2CppIdentString, 35 | Jes2CppStrings, Jes2CppUtils, Jes2CppVariable, StrUtils, SysUtils; 36 | 37 | procedure J2C_ImportModule(const ADst: TStrings; const AFileName: TFileName); 38 | 39 | implementation 40 | 41 | // TODO: This needs to skip strings, comments and chars. 42 | function EelPosEx(const ASubStr, AString: String; const AIndex: Integer): Integer; 43 | begin 44 | Result := PosEx(ASubStr, AString, AIndex); 45 | end; 46 | 47 | function AdjustArrays(const AString: String): String; 48 | const 49 | LHead = GsEelThis + '+('; 50 | LFoot = ')'; 51 | var 52 | LPos, LEnd: Integer; 53 | begin 54 | Result := AString; 55 | LEnd := 0; 56 | repeat 57 | LPos := EelPosEx('[', Result, LEnd + 1); 58 | if LPos = 0 then 59 | begin 60 | Break; 61 | end; 62 | Inc(LPos); 63 | LEnd := EelPosEx(']', Result, LPos); 64 | if LEnd = 0 then 65 | begin 66 | Break; 67 | end; 68 | Result := StuffString(Result, LPos, LEnd - LPos, LHead + 69 | Copy(Result, LPos, LEnd - LPos) + LFoot); 70 | LPos := LEnd + Length(LHead) + Length(LFoot); 71 | until False; 72 | end; 73 | 74 | procedure J2C_ImportSection(const ADst, ASrc: TStrings; const AFileName: TFileName; 75 | const ASectionName: String); 76 | var 77 | LUnused: Integer; 78 | LSectionHeader, LInstances: String; 79 | LSection: TStringList; 80 | LVariable: CJes2CppVariable; 81 | begin 82 | GStrings.AddCommentTitle(ADst, GEelSectionHeader.Make(ASectionName)); 83 | LSection := TStringList.Create; 84 | try 85 | GUtils.ExtractSection(ASectionName, LSection, ASrc, EmptyStr, False, LSectionHeader); 86 | LSection.Insert(0, GEelSectionHeader.Make(GsEelSectionInit)); 87 | with CJes2Cpp.Create(nil) do 88 | begin 89 | try 90 | TranspileScript(LSection, AFileName); 91 | LSection.Delete(0); 92 | ADst.AddText(WrapText(GsEelFunction + CharSpace + 93 | GIdentString.FixUp(ASectionName + CharUnderscore + ChangeFileExt( 94 | ExtractFileName(AFileName), EmptyStr)) + CharOpeningParenthesis + 95 | CharClosingParenthesis, GiColWidth)); 96 | LInstances := EmptyStr; 97 | for LVariable in Variables do 98 | begin 99 | if not LVariable.IsSystem or ((LVariable.References.ComponentCount > 1) and 100 | (GIdentString.IsSlider(LVariable.Name, LUnused) or 101 | GIdentString.IsSample(LVariable.Name, LUnused))) then 102 | begin 103 | GString.AppendCSV(LInstances, GIdentString.Clean(LVariable.Name)); 104 | end; 105 | end; 106 | if LInstances <> EmptyStr then 107 | begin 108 | ADst.AddText(WrapText(GsEelInstance + CharOpeningParenthesis + 109 | LInstances + CharClosingParenthesis, GiColWidth)); 110 | end; 111 | ADst.Add(CharOpeningParenthesis); 112 | ADst.AddText(AdjustArrays(LSection.Text)); 113 | ADst.Add('0;'); 114 | ADst.Add(CharClosingParenthesis + CharSemiColon); 115 | finally 116 | Free; 117 | end; 118 | end; 119 | finally 120 | FreeAndNil(LSection); 121 | end; 122 | end; 123 | 124 | procedure J2C_ImportModule(const ADst: TStrings; const AFileName: TFileName); 125 | var 126 | LScript: TStrings; 127 | begin 128 | GStrings.AddCommentTitle(ADst, 'This file was auto generated from: ' + 129 | QuotedStr(ExtractFileName(AFileName)) + LineEnding + 130 | 'Note: This feature is experimental and the results may need to be hand edited.' + 131 | LineEnding + 'Module importing only works for simple Jesusonic effects. ie: No functions allowed.'); 132 | ADst.Add(GEelSectionHeader.Make(GsEelSectionInit)); 133 | LScript := TStringList.Create; 134 | try 135 | LScript.LoadFromFile(AFileName); 136 | J2C_ImportSection(ADst, LScript, AFileName, GsEelSectionInit); 137 | J2C_ImportSection(ADst, LScript, AFileName, GsEelSectionSlider); 138 | J2C_ImportSection(ADst, LScript, AFileName, GsEelSectionBlock); 139 | J2C_ImportSection(ADst, LScript, AFileName, GsEelSectionSample); 140 | finally 141 | FreeAndNil(LScript); 142 | end; 143 | end; 144 | 145 | end. 146 | -------------------------------------------------------------------------------- /jes2cpp/j2c.components/jes2cppreference.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppReference; 28 | 29 | {$MODE DELPHI} 30 | {$MACRO ON} 31 | 32 | interface 33 | 34 | uses 35 | Classes, Jes2CppConstants, Soda, SysUtils; 36 | 37 | type 38 | 39 | // TODO: Merge this into the main code. 40 | TJes2CppFileMarker = object 41 | FileName: TFileName; 42 | CaretY: Integer; 43 | end; 44 | 45 | CJes2CppReferences = class; 46 | 47 | CJes2CppReference = class 48 | {$DEFINE DItemClass := CJes2CppReference} 49 | {$DEFINE DItemSuper := CComponent} 50 | {$DEFINE DItemOwner := CJes2CppReferences} 51 | {$INCLUDE soda.inc} 52 | strict private 53 | FFilePath, FFileName: TFileName; 54 | FFileCaretY: Integer; 55 | strict private 56 | procedure SetFullFileName(const AFileName: TFileName); 57 | function GetFullFileName: TFileName; 58 | public 59 | function EncodeLineFilePath: String; 60 | function EncodeLineFile: String; 61 | property FileSource: TFileName read GetFullFileName write SetFullFileName; 62 | property FileNameOnly: TFileName read FFileName; 63 | property FileCaretY: Integer read FFileCaretY write FFileCaretY; 64 | end; 65 | 66 | CJes2CppReferences = class 67 | {$DEFINE DItemClass := CJes2CppReferences} 68 | {$DEFINE DItemSuper := CComponent} 69 | {$DEFINE DItemItems := CJes2CppReference} 70 | {$INCLUDE soda.inc} 71 | public 72 | function CreateReference(const AFileSource: TFileName; 73 | const AFileCaretY: Integer): CJes2CppReference; 74 | end; 75 | 76 | implementation 77 | 78 | {$DEFINE DItemClass := CJes2CppReference} {$INCLUDE soda.inc} 79 | 80 | {$DEFINE DItemClass := CJes2CppReferences} {$INCLUDE soda.inc} 81 | 82 | procedure CJes2CppReference.SetFullFileName(const AFileName: TFileName); 83 | begin 84 | FFilePath := ExtractFilePath(AFileName); 85 | FFileName := ExtractFileName(AFileName); 86 | end; 87 | 88 | function CJes2CppReference.GetFullFileName: TFileName; 89 | begin 90 | Result := FFilePath + FFileName; 91 | end; 92 | 93 | function CJes2CppReference.EncodeLineFilePath: String; 94 | begin 95 | Result := Format('%s=%s %s=%s %s=%s', [GsLine, QuotedStr(IntToStr(FFileCaretY)), 96 | GsFile, QuotedStr(FFileName), GsPath, QuotedStr(FFilePath)]); 97 | end; 98 | 99 | function CJes2CppReference.EncodeLineFile: String; 100 | begin 101 | Result := Format('%s=%s %s=%s', [GsLine, QuotedStr(IntToStr(FFileCaretY)), 102 | GsFile, QuotedStr(FFileName)]); 103 | end; 104 | 105 | function CJes2CppReferences.CreateReference(const AFileSource: TFileName; 106 | const AFileCaretY: Integer): CJes2CppReference; 107 | begin 108 | Result := CreateComponent; 109 | Result.FileSource := AFileSource; 110 | Result.FileCaretY := AFileCaretY; 111 | end; 112 | 113 | end. 114 | -------------------------------------------------------------------------------- /jes2cpp/j2c.components/jes2cppsections.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppSections; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Classes, Jes2CppEel, Jes2CppUtils, Soda, StrUtils, SysUtils; 35 | 36 | type 37 | 38 | CJes2CppSections = class(CComponent) 39 | strict private 40 | FAtInit, FAtSlider, FAtBlock, FAtSample, FAtGfx, FAtSerialize: String; 41 | FGfxWidth, FGfxHeight: Integer; 42 | FGfxEnabled: Boolean; 43 | protected 44 | procedure DoCreate; override; 45 | public 46 | procedure ImportFromScript(const AScript: TStrings; const AFileName: TFileName); overload; 47 | public 48 | property AtBlock: String read FAtBlock; 49 | property AtGfx: String read FAtGfx; 50 | property AtInit: String read FAtInit; 51 | property AtSample: String read FAtSample; 52 | property AtSerialize: String read FAtSerialize; 53 | property AtSlider: String read FAtSlider; 54 | property GfxEnabled: Boolean read FGfxEnabled write FGfxEnabled; 55 | property GfxHeight: Integer read FGfxHeight; 56 | property GfxWidth: Integer read FGfxWidth; 57 | end; 58 | 59 | implementation 60 | 61 | procedure CJes2CppSections.DoCreate; 62 | begin 63 | inherited DoCreate; 64 | FGfxWidth := 400; 65 | FGfxHeight := 300; 66 | FGfxEnabled := True; 67 | end; 68 | 69 | procedure CJes2CppSections.ImportFromScript(const AScript: TStrings; const AFileName: TFileName); 70 | var 71 | LSectionHeader: String; 72 | begin 73 | FAtInit += GUtils.ExtractSection(GsEelSectionInit, AScript, AFileName, True, LSectionHeader); 74 | FAtSlider += GUtils.ExtractSection(GsEelSectionSlider, AScript, AFileName, True, LSectionHeader); 75 | FAtBlock += GUtils.ExtractSection(GsEelSectionBlock, AScript, AFileName, True, LSectionHeader); 76 | FAtSerialize += GUtils.ExtractSection(GsEelSectionSerialize, AScript, AFileName, 77 | True, LSectionHeader); 78 | FAtSample += GUtils.ExtractSection(GsEelSectionSample, AScript, AFileName, True, LSectionHeader); 79 | FAtGfx += GUtils.ExtractSection(GsEelSectionGfx, AScript, AFileName, True, LSectionHeader); 80 | FGfxWidth := StrToIntDef(ExtractDelimited(2, LSectionHeader, StdWordDelims), FGfxWidth); 81 | FGfxHeight := StrToIntDef(ExtractDelimited(3, LSectionHeader, StdWordDelims), FGfxHeight); 82 | if (FGfxWidth <= 0) or (FGfxHeight <= 0) then 83 | begin 84 | FGfxEnabled := False; 85 | end; 86 | end; 87 | 88 | end. 89 | -------------------------------------------------------------------------------- /jes2cpp/j2c.parser/jes2cppimporter.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppImporter; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Classes, Jes2CppConstants, Jes2CppDescription, Jes2CppEel, Jes2CppMessageLog, 35 | Jes2CppTextFileCache, Math, SysUtils; 36 | 37 | type 38 | 39 | CJes2CppImporter = class(CJes2CppMessageLog) 40 | strict private 41 | FDescription: CJes2CppDescription; 42 | FFileNamesImported: TStringList; 43 | protected 44 | procedure PrependSliderSerializationCode; 45 | function LoadStringsFrom(const AFileSource: TFileName): TStrings; virtual; 46 | procedure ImportFrom(const AScript: TStrings; const AFileSource: TFileName; 47 | const ALevel: Integer = 0); overload; 48 | procedure ImportFrom(const AFileSource: TFileName); overload; 49 | protected 50 | procedure DoCreate; override; 51 | procedure DoDestroy; override; 52 | public 53 | property Description: CJes2CppDescription read FDescription; 54 | end; 55 | 56 | implementation 57 | 58 | procedure CJes2CppImporter.DoCreate; 59 | begin 60 | inherited DoCreate; 61 | FDescription := CJes2CppDescription.Create(Self); 62 | FFileNamesImported := TStringList.Create; 63 | FFileNamesImported.Sorted := True; 64 | end; 65 | 66 | procedure CJes2CppImporter.DoDestroy; 67 | begin 68 | FreeAndNil(FFileNamesImported); 69 | inherited DoDestroy; 70 | end; 71 | 72 | function CJes2CppImporter.LoadStringsFrom(const AFileSource: TFileName): TStrings; 73 | begin 74 | Result := GFileCache.LoadFromFile(AFileSource); 75 | end; 76 | 77 | procedure CJes2CppImporter.ImportFrom(const AScript: TStrings; const AFileSource: TFileName; 78 | const ALevel: Integer); 79 | var 80 | LIndex: Integer; 81 | LImportFileName: TFileName; 82 | begin 83 | if ALevel > 10 then 84 | begin 85 | LogException('Max Importing Depth Reached.'); 86 | end else begin 87 | if FFileNamesImported.IndexOf(AFileSource) < ZeroValue then 88 | begin 89 | FFileNamesImported.Add(AFileSource); 90 | LogFileName(SMsgTypeImporting, AFileSource); 91 | for LIndex := ZeroValue to GEel.DescHigh(AScript) do 92 | begin 93 | if GEel.IsImport(AScript[LIndex], LImportFileName) then 94 | begin 95 | try 96 | LogAssert(GEel.ImportResolve(LImportFileName, AFileSource), 97 | SMsgUnableToFindImportFile); 98 | ImportFrom(LoadStringsFrom(LImportFileName), LImportFileName, ALevel + 1); 99 | except 100 | on AException: Exception do 101 | begin 102 | FileCaretY := LIndex + 1; 103 | FileSource := AFileSource; 104 | LogException(AException.Message); 105 | end; 106 | end; 107 | end; 108 | end; 109 | FDescription.ImportFromScript(AScript, AFileSource); 110 | end; 111 | end; 112 | end; 113 | 114 | procedure CJes2CppImporter.ImportFrom(const AFileSource: TFileName); 115 | begin 116 | ImportFrom(LoadStringsFrom(AFileSource), AFileSource); 117 | end; 118 | 119 | procedure CJes2CppImporter.PrependSliderSerializationCode; 120 | begin 121 | // TODO: Read/Write slider in Jesusonic? 122 | end; 123 | 124 | end. 125 | -------------------------------------------------------------------------------- /jes2cpp/j2c.parser/jes2cppparserexpression.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppParserExpression; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Jes2CppConstants, Jes2CppParser, Jes2CppStrings, Jes2CppTranslate, SysUtils; 35 | 36 | type 37 | 38 | CJes2CppParserExpression = class(CJes2CppParser) 39 | strict private 40 | FIsNoOutput: Boolean; 41 | protected 42 | function ParseElement(const AIsExpected: Boolean): String; virtual; abstract; 43 | function ParseExpression(const AIsExpected: Boolean): String; virtual; abstract; 44 | protected 45 | function ParseParenthesis: String; 46 | function ParseBlock(out ALastExpression: String): String; overload; 47 | function ParseBlock: String; overload; 48 | public 49 | property IsNoOutput: Boolean read FIsNoOutput write FIsNoOutput; 50 | end; 51 | 52 | implementation 53 | 54 | function CJes2CppParserExpression.ParseParenthesis: String; 55 | begin 56 | ExpectToken(CharOpeningParenthesis); 57 | Result := EmptyStr; 58 | repeat 59 | if not (IsToken(CharSemiColon) or IsToken(CharClosingParenthesis)) then 60 | begin 61 | GString.AppendCSV(Result, ParseExpression(True)); 62 | end; 63 | until not IsTokenThenPull(CharSemiColon); 64 | ExpectToken(CharClosingParenthesis); 65 | LogExpectNotEmptyStr(Result, SMsgParenthesisBlock); 66 | Result := CharOpeningParenthesis + Result + CharClosingParenthesis; 67 | end; 68 | 69 | function CJes2CppParserExpression.ParseBlock(out ALastExpression: String): String; 70 | var 71 | LExpression: String; 72 | begin 73 | Result := EmptyStr; 74 | ALastExpression := EmptyStr; 75 | ExpectToken(CharOpeningParenthesis); 76 | repeat 77 | LExpression := ParseExpression(False); 78 | if LExpression <> EmptyStr then 79 | begin 80 | if ALastExpression <> EmptyStr then 81 | begin 82 | Result += ALastExpression + GsCppLineEnding; 83 | ALastExpression := EmptyStr; 84 | end; 85 | ALastExpression := LExpression; 86 | end; 87 | until not IsTokenThenPull(CharSemiColon); 88 | ExpectToken(CharClosingParenthesis); 89 | LogExpectNotEmptyStr(ALastExpression, SMsgExpression); 90 | end; 91 | 92 | function CJes2CppParserExpression.ParseBlock: String; 93 | begin 94 | Result := ParseBlock(Result) + Result + GsCppLineEnding; 95 | end; 96 | 97 | end. 98 | -------------------------------------------------------------------------------- /jes2cpp/j2c.parser/jes2cppparserloops.pas: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | Jes2Cpp - Jesusonic Script to C++ Transpiler 4 | 5 | Created by Geep Software 6 | 7 | Author: Derek John Evans (derek.john.evans@hotmail.com) 8 | Website: http://www.wascal.net/music/ 9 | 10 | Copyright (C) 2015 Derek John Evans 11 | 12 | This program is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation, either version 3 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program. If not, see . 24 | 25 | *) 26 | 27 | unit Jes2CppParserLoops; 28 | 29 | {$MODE DELPHI} 30 | 31 | interface 32 | 33 | uses 34 | Jes2CppConstants, Jes2CppEel, Jes2CppLoop, Jes2CppParserElements, Jes2CppTranslate, SysUtils; 35 | 36 | type 37 | 38 | CJes2CppParserLoops = class(CJes2CppParserElements) 39 | strict private 40 | FLoops: CJes2CppLoops; 41 | strict private 42 | function ParseLoopBlock: String; 43 | protected 44 | function ParseWhile: String; 45 | function ParseLoop: String; 46 | protected 47 | procedure DoCreate; override; 48 | public 49 | property Loops: CJes2CppLoops read FLoops; 50 | end; 51 | 52 | implementation 53 | 54 | procedure CJes2CppParserLoops.DoCreate; 55 | begin 56 | inherited DoCreate; 57 | FLoops := CJes2CppLoops.Create(Self); 58 | end; 59 | 60 | function CJes2CppParserLoops.ParseWhile: String; 61 | var 62 | LLoop: CJes2CppLoop; 63 | begin 64 | ExpectToken(GsEelWhile); 65 | LLoop := CJes2CppLoop.Create(FLoops, ltDoWhile, FCurrentFunction); 66 | LLoop.FBlock := ParseBlock(LLoop.FCondition); 67 | if IsToken(CharOpeningParenthesis) then 68 | begin 69 | LLoop.FType := ltWhile; 70 | LLoop.FPreCondition := LLoop.FBlock; 71 | LLoop.FBlock := ParseBlock; 72 | end; 73 | Result := LLoop.CppFunctionMacro; 74 | end; 75 | 76 | function CJes2CppParserLoops.ParseLoopBlock: String; 77 | var 78 | LExpression: String; 79 | begin 80 | Result := EmptyStr; 81 | repeat 82 | LExpression := ParseExpression(False); 83 | if LExpression <> EmptyStr then 84 | begin 85 | Result += LExpression + GsCppLineEnding; 86 | end; 87 | until not IsTokenThenPull(CharSemiColon); 88 | end; 89 | 90 | function CJes2CppParserLoops.ParseLoop: String; 91 | var 92 | LLoop: CJes2CppLoop; 93 | begin 94 | ExpectToken(GsEelLoop); 95 | LLoop := CJes2CppLoop.Create(FLoops, ltLoop, FCurrentFunction); 96 | ExpectToken(CharOpeningParenthesis); 97 | LLoop.FCondition := ParseExpression(True); 98 | ExpectToken(CharComma); 99 | LLoop.FBlock := ParseLoopBlock; 100 | ExpectToken(CharClosingParenthesis); 101 | Result := LLoop.CppFunctionMacro; 102 | end; 103 | 104 | end. 105 | 106 | -------------------------------------------------------------------------------- /jes2cpp/vest/VST3 SDK/readme.txt: -------------------------------------------------------------------------------- 1 | Place a copy of the VST SDK 3.6+ here. -------------------------------------------------------------------------------- /jes2cpp/vest/readme.txt: -------------------------------------------------------------------------------- 1 | Code::Block VeST32/64 Solution 2 | ============================== 3 | 4 | This is the VeST source code + project files for 32bit and 64bit DLL's. 5 | 6 | You will need to copy the VST SDK source code into the "VST3 SDK" folder without 7 | changing its folder structure. 8 | 9 | The project files are for the free "Code::Block" IDE. 10 | 11 | You will also must have TDM-64. TDM-32 will not compile VSTGUI. 12 | 13 | Cheers 14 | Derek 15 | -------------------------------------------------------------------------------- /jes2cpp/vest/vest.workspace: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /jes2cpp/vest/vest32.LADSPA/Project.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 51 | 52 | -------------------------------------------------------------------------------- /jes2cpp/vest/vest32/Project.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 85 | 86 | -------------------------------------------------------------------------------- /jes2cpp/vest/vest64/Project.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 85 | 86 | -------------------------------------------------------------------------------- /jes2cpp/wdl/eel.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - eel.h 3 | Copyright (C) 2006 and later Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | */ 22 | 23 | #ifndef _EEL_H_ 24 | #define _EEL_H_ 25 | 26 | //#include 27 | #include 28 | #include 29 | #include 30 | 31 | #define PI 3.1415926535897932384626433832795 32 | 33 | #ifndef EEL_F 34 | #define EEL_F float 35 | #define WDL_FFT_REALSIZE 4 36 | #endif 37 | 38 | #define EEL_DCT_MINBITLEN 5 39 | #define EEL_DCT_MAXBITLEN 12 40 | #define EEL_FFT_MINBITLEN 4 41 | #define EEL_FFT_MAXBITLEN 15 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /jes2cpp/wdl/eel_fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - eel_fft.h 3 | Copyright (C) 2006 and later Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | */ 22 | 23 | #ifndef _EEL_FFT_H_ 24 | #define _EEL_FFT_H_ 25 | 26 | #include "eel.h" 27 | #include "fft.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #define DIR_FFT 0 34 | #define DIR_IFFT 1 35 | #define DIR_PERMUTE 4 36 | #define DIR_IPERMUTE 5 37 | 38 | extern void FFT(int sizebits, EEL_F *data, int dir); 39 | extern void EEL_fft_register(); 40 | 41 | #ifdef __cplusplus 42 | }; 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /jes2cpp/wdl/eel_mdct.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - mdct.h 3 | Copyright (C) 2006 and later Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | */ 22 | 23 | #ifndef _MDCT_H_ 24 | #define _MDCT_H_ 25 | 26 | #include "eel.h" 27 | 28 | typedef struct { 29 | int n; 30 | int log2n; 31 | EEL_F *trig; 32 | int *bitrev; 33 | EEL_F *oldw; 34 | EEL_F scale; 35 | EEL_F *window; 36 | } mdct_lookup; 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | extern void *megabuf_mdct_init(int n); 43 | 44 | extern void megabuf_mdct_apply_window(void *init, EEL_F *inbuf, EEL_F *outbuf); 45 | extern void megabuf_mdct_forward(void *init, EEL_F *in, EEL_F *out); 46 | extern void megabuf_mdct_backward(void *init, EEL_F *in, EEL_F *out); 47 | 48 | #ifdef __cplusplus 49 | }; 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /jes2cpp/wdl/fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - fft.h 3 | Copyright (C) 2006 and later Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | 22 | 23 | This file defines the interface to the WDL FFT library. These routines are based on the 24 | DJBFFT library, which are Copyright 1999 D. J. Bernstein, djb@pobox.com 25 | 26 | The DJB FFT web page is: http://cr.yp.to/djbfft.html 27 | 28 | */ 29 | 30 | #ifndef _WDL_FFT_H_ 31 | #define _WDL_FFT_H_ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | #ifndef WDL_FFT_REALSIZE 38 | #define WDL_FFT_REALSIZE 4 39 | #endif 40 | 41 | #if WDL_FFT_REALSIZE == 4 42 | typedef float WDL_FFT_REAL; 43 | #elif WDL_FFT_REALSIZE == 8 44 | typedef double WDL_FFT_REAL; 45 | #else 46 | #error invalid FFT item size 47 | #endif 48 | 49 | typedef struct { 50 | WDL_FFT_REAL re; 51 | WDL_FFT_REAL im; 52 | } WDL_FFT_COMPLEX; 53 | 54 | extern void WDL_fft_init(); 55 | 56 | extern void WDL_fft_complexmul(WDL_FFT_COMPLEX *dest, WDL_FFT_COMPLEX *src, int len); 57 | extern void WDL_fft_complexmul2(WDL_FFT_COMPLEX *dest, WDL_FFT_COMPLEX *src, WDL_FFT_COMPLEX *src2, int len); 58 | extern void WDL_fft_complexmul3(WDL_FFT_COMPLEX *destAdd, WDL_FFT_COMPLEX *src, WDL_FFT_COMPLEX *src2, int len); 59 | 60 | extern void WDL_fft(WDL_FFT_COMPLEX *, int len, int isInverse); 61 | 62 | #if 0 // these dont work right! 63 | extern void WDL_fft_realmul(WDL_FFT_REAL *dest, WDL_FFT_REAL *src, int len); 64 | extern void WDL_real_fft(WDL_FFT_REAL *, int len, int isInverse); 65 | #endif 66 | 67 | int WDL_fft_permute(int fftsize, int idx); 68 | int *WDL_fft_permute_tab(int fftsize); 69 | 70 | #ifdef __cplusplus 71 | }; 72 | #endif 73 | 74 | #endif -------------------------------------------------------------------------------- /jes2cpp/wdl/readme.license.txt: -------------------------------------------------------------------------------- 1 | This code is from Cockos WDL. 2 | Some of the code needed to be edited for use with Jes2Cpp and GCC. 3 | 4 | 5 | 6 | Cockos WDL License 7 | 8 | Copyright (C) 2005 and later Cockos Incorporated 9 | 10 | Portions copyright other contributors, see each source file for more information 11 | 12 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 17 | 1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 18 | 1. This notice may not be removed or altered from any source distribution. 19 | 20 | 21 | -------------------------------------------------------------------------------- /jes2cpp/wdl/wdltypes.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDLTYPES_ 2 | #define _WDLTYPES_ 3 | 4 | #ifdef _MSC_VER 5 | 6 | typedef __int64 WDL_INT64; 7 | typedef unsigned __int64 WDL_UINT64; 8 | 9 | #else 10 | 11 | typedef long long WDL_INT64; 12 | typedef unsigned long long WDL_UINT64; 13 | 14 | #endif 15 | 16 | #ifdef _MSC_VER 17 | #define WDL_UINT64_CONST(x) (x##ui64) 18 | #define WDL_INT64_CONST(x) (x##i64) 19 | #else 20 | #define WDL_UINT64_CONST(x) (x##ULL) 21 | #define WDL_INT64_CONST(x) (x##LL) 22 | #endif 23 | 24 | 25 | #if !defined(_MSC_VER) || _MSC_VER > 1200 26 | #define WDL_DLGRET INT_PTR CALLBACK 27 | #else 28 | #define WDL_DLGRET BOOL CALLBACK 29 | #endif 30 | 31 | 32 | #ifdef _WIN32 33 | #include 34 | #else 35 | #include 36 | typedef intptr_t INT_PTR; 37 | typedef uintptr_t UINT_PTR; 38 | #endif 39 | 40 | #if defined(__ppc__) || !defined(__cplusplus) 41 | typedef char WDL_bool; 42 | #else 43 | typedef bool WDL_bool; 44 | #endif 45 | 46 | #ifndef GWLP_USERDATA 47 | #define GWLP_USERDATA GWL_USERDATA 48 | #define GWLP_WNDPROC GWL_WNDPROC 49 | #define GWLP_HINSTANCE GWL_HINSTANCE 50 | #define GWLP_HWNDPARENT GWL_HWNDPARENT 51 | #define DWLP_USER DWL_USER 52 | #define DWLP_DLGPROC DWL_DLGPROC 53 | #define DWLP_MSGRESULT DWL_MSGRESULT 54 | #define SetWindowLongPtr(a,b,c) SetWindowLong(a,b,c) 55 | #define GetWindowLongPtr(a,b) GetWindowLong(a,b) 56 | #define SetWindowLongPtrW(a,b,c) SetWindowLongW(a,b,c) 57 | #define GetWindowLongPtrW(a,b) GetWindowLongW(a,b) 58 | #define SetWindowLongPtrA(a,b,c) SetWindowLongA(a,b,c) 59 | #define GetWindowLongPtrA(a,b) GetWindowLongA(a,b) 60 | 61 | #define GCLP_WNDPROC GCL_WNDPROC 62 | #define GCLP_HICON GCL_HICON 63 | #define GCLP_HICONSM GCL_HICONSM 64 | #define SetClassLongPtr(a,b,c) SetClassLong(a,b,c) 65 | #define GetClassLongPtr(a,b) GetClassLong(a,b) 66 | #endif 67 | 68 | 69 | #ifdef __GNUC__ 70 | // for structures that contain doubles, or doubles in structures that are after stuff of questionable alignment (for OSX/linux) 71 | #define WDL_FIXALIGN __attribute__ ((aligned (8))) 72 | // usage: void func(int a, const char *fmt, ...) WDL_VARARG_WARN(printf,2,3); // note: if member function, this pointer is counted as well, so as member function that would be 3,4 73 | #define WDL_VARARG_WARN(x,n,s) __attribute__ ((format (x,n,s))) 74 | #define WDL_STATICFUNC_UNUSED __attribute__((unused)) 75 | 76 | #else 77 | #define WDL_FIXALIGN 78 | #define WDL_VARARG_WARN(x,n,s) 79 | #define WDL_STATICFUNC_UNUSED 80 | #endif 81 | 82 | #ifndef WDL_WANT_NEW_EXCEPTIONS 83 | #if defined(__cplusplus) 84 | #include 85 | #define WDL_NEW (std::nothrow) 86 | #endif 87 | #else 88 | #define WDL_NEW 89 | #endif 90 | 91 | 92 | #ifndef max 93 | #define max(x,y) ((x)<(y)?(y):(x)) 94 | #define min(x,y) ((x)<(y)?(x):(y)) 95 | #endif 96 | 97 | #ifndef _WIN32 98 | #ifndef strnicmp 99 | #define strnicmp(x,y,z) strncasecmp(x,y,z) 100 | #endif 101 | #ifndef stricmp 102 | #define stricmp(x,y) strcasecmp(x,y) 103 | #endif 104 | #endif 105 | 106 | #ifdef WDL_BACKSLASHES_ARE_ORDINARY 107 | #define WDL_IS_DIRCHAR(x) ((x) == '/') 108 | #else 109 | // for multi-platform applications it seems better to treat backslashes as directory separators even if it 110 | // isn't supported by the underying system (for resolving filenames, etc) 111 | #define WDL_IS_DIRCHAR(x) ((x) == '\\' || (x) == '/') 112 | #endif 113 | 114 | #if defined(_WIN32) && !defined(WDL_BACKSLASHES_ARE_ORDINARY) 115 | #define WDL_DIRCHAR '\\' 116 | #define WDL_DIRCHAR_STR "\\" 117 | #else 118 | #define WDL_DIRCHAR '/' 119 | #define WDL_DIRCHAR_STR "/" 120 | #endif 121 | 122 | 123 | #if defined(__GNUC__) || defined(__INTEL_COMPILER) 124 | #define WDL_likely(x) __builtin_expect(!!(x),1) 125 | #define WDL_unlikely(x) __builtin_expect(!!(x),0) 126 | #else 127 | #define WDL_likely(x) (!!(x)) 128 | #define WDL_unlikely(x) (!!(x)) 129 | #endif 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /jsfx-inc/anomaly.jsfx-inc: -------------------------------------------------------------------------------- 1 | @init 2 | 3 | 4 | -------------------------------------------------------------------------------- /jsfx-inc/ax.defines.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Axonlib. 3 | * 4 | * Axonlib is free software: you can redistribute it and/or modify 5 | * it under the terms of the Axonlib License, either version 1.0 6 | * of the License, or (at your option) any later version. 7 | * 8 | * Axonlib is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | * See LICENSE_AX for more details. 12 | * 13 | * You should have received a copy of the Axonlib License 14 | * If not, see . 15 | */ 16 | 17 | @init 18 | 19 | // constants 20 | // ----------------------------------------------------------------------------- 21 | //DENORM = 1.4012984e-45; 22 | LOG2DB = 8.65617024533; 23 | DB2LOG = 0.11552453009; 24 | E = 2.71828182845; 25 | LOG2E = 1.44269504088; 26 | LOG10E = 0.43429448190; 27 | LN2 = 0.69314718055; 28 | LN10 = 2.30258509299; 29 | PI = 3.14159265358; 30 | PI2 = 6.28318530717; 31 | PI4 = 12.5663706143; 32 | PI_2 = 1.57079632679; 33 | PI_4 = 0.78539816339; 34 | D1_PI = 0.31830988618; 35 | D2_PI = 0.63661977236; 36 | SQRT2 = 1.41421356237; 37 | SQRT1_2 = 0.70710678118; 38 | //EPSILON = 1.19209290e-7; 39 | inv360 = 0.00277777778; 40 | inv16 = 0.06250000000; 41 | inv127 = 0.00787401575; 42 | inv256 = 0.00390625000; 43 | 44 | // limits 45 | // ----------------------------------------------------------------------------- 46 | AX_CHAR_BIT = 8; 47 | AX_CHAR_MAX = 127; 48 | AX_SHRT_MAX = 32767; 49 | AX_WCHAR_MAX = 65535; 50 | AX_INT_MAX = 2147483647; 51 | AX_UINT_MAX = 8589934591; 52 | AX_LONG_LONG_MAX = 9223372036854775807; 53 | AX_ULONG_LONG_MAX = 18446744073709551615; 54 | 55 | /* 56 | AX_FLT_MAX = 3.40282347e+38; 57 | AX_FLT_MIN = 1.17549435e-38; 58 | AX_FLT_EPSILON = 1.19209290e-7; 59 | AX_FLT_DENORM = 1.40129846e-45; 60 | AX_DBL_MAX = 1.7976931348623157e+308; 61 | AX_DBL_MIN = 2.2250738585072014e-308; 62 | AX_DBL_EPSILON = 2.2204460492503131e-16; 63 | AX_DBL_DENORM = 4.9406564584124654e-324; 64 | AX_LDBL_MAX = 1.18973149535723176502e+4932; 65 | AX_LDBL_MIN = 3.36210314311209350626e-4932; 66 | AX_LDBL_EPSILON = 1.08420217248550443401e-19; 67 | AX_LDBL_DENORM = 3.64519953188247460253e-4951; 68 | */ 69 | 70 | -------------------------------------------------------------------------------- /jsfx-inc/axonlib.defines.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Axonlib. 3 | * 4 | * Axonlib is free software: you can redistribute it and/or modify 5 | * it under the terms of the Axonlib License, either version 1.0 6 | * of the License, or (at your option) any later version. 7 | * 8 | * Axonlib is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | * See LICENSE_AX for more details. 12 | * 13 | * You should have received a copy of the Axonlib License 14 | * If not, see . 15 | */ 16 | 17 | @init 18 | 19 | // constants 20 | // ----------------------------------------------------------------------------- 21 | //DENORM = 1.4012984e-45; 22 | LOG2DB = 8.65617024533; 23 | DB2LOG = 0.11552453009; 24 | E = 2.71828182845; 25 | LOG2E = 1.44269504088; 26 | LOG10E = 0.43429448190; 27 | LN2 = 0.69314718055; 28 | LN10 = 2.30258509299; 29 | PI = 3.14159265358; 30 | PI2 = 6.28318530717; 31 | PI4 = 12.5663706143; 32 | PI_2 = 1.57079632679; 33 | PI_4 = 0.78539816339; 34 | D1_PI = 0.31830988618; 35 | D2_PI = 0.63661977236; 36 | SQRT2 = 1.41421356237; 37 | SQRT1_2 = 0.70710678118; 38 | //EPSILON = 1.19209290e-7; 39 | inv360 = 0.00277777778; 40 | inv16 = 0.06250000000; 41 | inv127 = 0.00787401575; 42 | inv256 = 0.00390625000; 43 | 44 | // limits 45 | // ----------------------------------------------------------------------------- 46 | AX_CHAR_BIT = 8; 47 | AX_CHAR_MAX = 127; 48 | AX_SHRT_MAX = 32767; 49 | AX_WCHAR_MAX = 65535; 50 | AX_INT_MAX = 2147483647; 51 | AX_UINT_MAX = 8589934591; 52 | AX_LONG_LONG_MAX = 9223372036854775807; 53 | AX_ULONG_LONG_MAX = 18446744073709551615; 54 | 55 | /* 56 | AX_FLT_MAX = 3.40282347e+38; 57 | AX_FLT_MIN = 1.17549435e-38; 58 | AX_FLT_EPSILON = 1.19209290e-7; 59 | AX_FLT_DENORM = 1.40129846e-45; 60 | AX_DBL_MAX = 1.7976931348623157e+308; 61 | AX_DBL_MIN = 2.2250738585072014e-308; 62 | AX_DBL_EPSILON = 2.2204460492503131e-16; 63 | AX_DBL_DENORM = 4.9406564584124654e-324; 64 | AX_LDBL_MAX = 1.18973149535723176502e+4932; 65 | AX_LDBL_MIN = 3.36210314311209350626e-4932; 66 | AX_LDBL_EPSILON = 1.08420217248550443401e-19; 67 | AX_LDBL_DENORM = 3.64519953188247460253e-4951; 68 | */ 69 | 70 | -------------------------------------------------------------------------------- /jsfx-inc/caps.TDFII.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | TDFII.jsfx-inc 3 | 4 | Copyright 2006-7 5 | David Yeh (implementation) 6 | 2006-14 7 | Tim Goetze (cosmetics) 8 | 9 | transposed Direct Form II digital filter. 10 | Assumes order of b = order of a. 11 | Assumes a0 = 1. 12 | 13 | */ 14 | /* 15 | This program is free software; you can redistribute it and/or 16 | modify it under the terms of the GNU General Public License 17 | as published by the Free Software Foundation; either version 3 18 | of the License, or (at your option) any later version. 19 | 20 | This program is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | GNU General Public License for more details. 24 | 25 | You should have received a copy of the GNU General Public License 26 | along with this program; if not, write to the Free Software 27 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 28 | 02111-1307, USA or point your web browser to http://www.gnu.org. 29 | */ 30 | 31 | import std.cstdlib.jsfx-inc 32 | 33 | @init 34 | 35 | /* N is the highest power of s in the transfer function */ 36 | function TDFII(_N) global() instance(N, a, b, h) 37 | ( 38 | N = _N; 39 | a = malloc(_N + 1); 40 | b = malloc(_N + 1); 41 | h = malloc(_N + 1); 42 | ); 43 | 44 | function TDFII_clear() global() instance(N, a, b) local(i) 45 | ( 46 | i = 0; 47 | while (i <= N) ( 48 | a[i] = b[i] = 0; 49 | i += 1; 50 | ); 51 | b[0] = 1; 52 | ); 53 | 54 | function TDFII_reset() global() instance(N, h) local(i) 55 | ( 56 | i = 0; 57 | while (i <= N) ( 58 | h[i] = 0; // zero state 59 | i += 1; 60 | ); 61 | ); 62 | 63 | function TDFII_init(fs) global() 64 | ( 65 | this.TDFII_reset(); 66 | this.TDFII_clear(); 67 | ); 68 | 69 | /* per-band recursion: 70 | * y = 2 * (a * (x - x[-2]) + c * y[-1] - b * y[-2]) 71 | */ 72 | function TDFII_process(s) global() instance(N, h, b, a) local(i, y) 73 | ( 74 | y = h[0] + b[0]*s; 75 | i = 1; 76 | while (i < N) ( 77 | h[i-1] = h[i] + b[i]*s - a[i]*y; 78 | i += 1; 79 | ); 80 | h[N-1] = b[N]*s - a[N]*y; 81 | y; 82 | ); 83 | 84 | -------------------------------------------------------------------------------- /jsfx-inc/caps.util.jsfx-inc: -------------------------------------------------------------------------------- 1 | @init 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Chorus.swipe.jsfx: -------------------------------------------------------------------------------- 1 | // Author: Derek John Evans 2 | // License: LGPL - http://www.gnu.org/licenses/gpl.html 3 | 4 | desc: Geep Chorus (SWIPE Version) 5 | 6 | EffectName: Geep Chorus 7 | VendorString: Geep 8 | VendorVersion: 1000 9 | UniqueId: 0 10 | InstallPath: C:\Program Files\VST\Geep Effects Pack\ 11 | 12 | import swipe.jsfx-inc 13 | import geep.chorus.jsfx-inc 14 | 15 | // To enable graphics, ALL sliders must be hidden by prefixing the labels with a '-'. 16 | 17 | slider1:15<5,100>-Range (ms) 18 | slider2:0.1<0.01,10>-Rate (Hz) 19 | slider3:0<-100,100>-Feedback (%) 20 | 21 | slider60:1<-1,1>-Dry/Wet 22 | slider61:0<-24,3>-Output (dB) 23 | 24 | @init 25 | 26 | StereoChorus.Init(200); 27 | 28 | @sample 29 | 30 | SliderChanged() ? StereoChorus.Slider(slider1, slider2, slider3, slider60, slider61); 31 | StereoChorus.Sample(spl0, spl1); 32 | 33 | @init 34 | 35 | // Define SWIPE Interface 36 | 37 | _1.TWidget(1, 5, 100, "Range", "ms", 15); 38 | _2.TWidget(2, 0.01, 10, "Rate", "Hz", 0.1); 39 | _3.TWidget(3, -100, 100, "Feedback", "%", 0); 40 | _4.TWidget(60, -1, 1, "Dry/Wet", "", 1); 41 | _5.TWidget(61, -24, 3, "Output", "dB", 0); 42 | 43 | @gfx 450 300 44 | 45 | SWIPE(450, 260) ? 46 | ( 47 | _effect.TEffectBasic( 48 | "Geep Chorus (Dual ModDelay)", 49 | "License LGPL / Copyright (C) 2015 Derek J. Evans", 50 | "Chorus"); 51 | 52 | knobs.TObject() ? ( 53 | knobs.0.TImage_LoadFromFile("data/knobs/knob_64_white1.png"); 54 | knobs.1.TImage_LoadFromFile("data/knobs/knob_32_white.png"); 55 | ); 56 | 57 | xx = 80; 58 | yy = 110; 59 | x = (gfx_w - xx * 5) * 0.5; 60 | y = 90; 61 | 62 | _1.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 63 | _2.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 64 | _3.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 65 | _4.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 66 | _5.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 67 | 68 | _effect.TEffect_Done(); 69 | ); 70 | 71 | 72 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Delay (Spin).swipe.jsfx: -------------------------------------------------------------------------------- 1 | // Author: Derek John Evans 2 | // License: LGPL - http://www.gnu.org/licenses/gpl.html 3 | 4 | desc: Geep Spin Delay (SWIPE Version) 5 | 6 | EffectName: Geep Spin Delay 7 | VendorString: Geep 8 | VendorVersion: 1000 9 | UniqueId: 0 10 | InstallPath: C:\Program Files\VST\Geep Effects Pack\ 11 | 12 | import swipe.jsfx-inc 13 | 14 | // To enable graphics, ALL sliders must be hidden by prefixing the labels with a '-'. 15 | 16 | slider1:500<30,2000>-Length (ms) 17 | slider2:0.5<0.01,10>-Rotate Speed (hz) 18 | slider3:30<-100,100>-Feedback (%) 19 | 20 | slider60:-0.3<-1,1>-Dry/Wet (%) 21 | slider61:0<-24,3>-Output (dB) 22 | 23 | @sample 24 | 25 | SliderChanged() ? ( 26 | 27 | mem = floor(max(slider1, 1) * srate / 1000) * 2; 28 | spd = slider2 * M_2PI / srate; 29 | fbk = slider3 / 100; 30 | 31 | lev = 2 ^ (slider61 / 6); 32 | wet = (slider60 + 1) * 0.5 * lev; 33 | dry = (1 - slider60) * 0.5 * lev; 34 | ); 35 | 36 | (ang += spd) >= M_2PI ? ang -= M_2PI; 37 | 38 | (pos -= 2) < 0 ? pos += mem; 39 | 40 | pos[0] = spl0 + (wet0 = pos[0] * cos(ang)) * fbk; 41 | pos[1] = spl1 + (wet1 = pos[1] * sin(ang)) * fbk; 42 | 43 | spl0 = spl0 * dry + wet0 * wet; 44 | spl1 = spl1 * dry + wet1 * wet; 45 | 46 | @init 47 | 48 | // Register memory usage with system. 49 | heap.max(srate * 2); 50 | 51 | // Define SWIPE Interface. 52 | 53 | _1.TWidget(1, 30, 2000, "Length", "ms", 500); 54 | _2.TWidget(2, 0.01, 10, "Rotate Speed", "Hz", 0.5); 55 | _3.TWidget(3, -100, 100, "Feedback", "%", 30); 56 | _4.TWidget(60, -1, 1, "Dry <> Wet", "", -0.3); 57 | _5.TWidget(61, -24, 3, "Output", "dB", 0); 58 | 59 | @gfx 480 300 60 | 61 | SWIPE(480, 300) ? 62 | ( 63 | Effect.TEffectBasic("Geep Delay (Surround Spin)", "License LGPL / Copyright (C) 2015 Derek J. Evans", "Delay"); 64 | 65 | knobs.TObject() ? ( 66 | knobs.0.TImage_LoadFromFile("data/knobs/knob_64_white1.png"); 67 | knobs.1.TImage_LoadFromFile("data/knobs/knob_32_white.png"); 68 | ); 69 | 70 | xx = 90; yy = 100; 71 | x = (gfx_w - (xx * 5)) / 2; 72 | y = (gfx_h - (yy * 1)) / 2; 73 | 74 | _1.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 75 | _2.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 76 | _3.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 77 | _4.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 78 | _5.TKnob_Draw(x, y, x + xx, y + yy, knobs.0); x += xx; 79 | 80 | Effect.TEffect_Done(); 81 | ); 82 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Delay (Surround).swipe.jsfx: -------------------------------------------------------------------------------- 1 | // Author: Derek John Evans 2 | // License: LGPL - http://www.gnu.org/licenses/gpl.html 3 | 4 | desc: Geep Delay (Surround) 5 | 6 | EffectName: Geep Delay (Surround) 7 | VendorString: Geep 8 | VendorVersion: 1000 9 | UniqueId: 4562 10 | InstallPath: C:\Program Files\VST\SWIPE\ 11 | 12 | import swipe.jsfx-inc 13 | 14 | // To enable graphics, ALL sliders must be hidden by prefixing the labels with a '-'. 15 | 16 | slider1:500<1,1000,1>-Length (ms) 17 | slider2:40<-100,100,1>-Delay (%) 18 | slider3:74<-180,180,1>-Delay Angle (deg) 19 | slider4:30<-100,100,1>-Feedback (%) 20 | slider5:-74<-180,180,1>-Feedback Angle (deg) 21 | 22 | slider60:-0.3<-1,1,0.01>-Dry <> Wet 23 | slider61:0<-24,3,0.5>-Output (dB) 24 | 25 | @sample 26 | 27 | SliderChanged() ? ( 28 | 29 | msize = floor(max(slider1, 1) * srate / 1000) * 2; 30 | 31 | delay = slider2 / 100; 32 | angle = (45 - slider3) * $pi / 180; 33 | delay0 = delay * sin(angle); 34 | delay1 = delay * cos(angle); 35 | 36 | fback = min(max(slider4/ 100, -1), 1); 37 | angle = (45 - slider5) * $pi / 180; 38 | fback0 = fback * sin(angle); 39 | fback1 = fback * cos(angle); 40 | 41 | lev = 2 ^ (slider61 / 6); 42 | wet = (slider60 + 1) * 0.5 * lev; 43 | dry = (1 - slider60) * 0.5 * lev; 44 | ); 45 | 46 | (p1 -= 2) < 0 ? p1 += msize; 47 | 48 | p1[0] = spl0 * delay0 + (wet0 = p1[0]) * fback0; 49 | p1[1] = spl1 * delay1 + (wet1 = p1[1]) * fback1; 50 | 51 | spl0 = spl0 * dry + wet0 * wet; 52 | spl1 = spl1 * dry + wet1 * wet; 53 | 54 | @init 55 | 56 | // Register memory usage with system. 57 | 58 | heap.max(srate * 2); 59 | 60 | // Define SWIPE Interface. 61 | 62 | _1.TWidget(1, 1, 1000, "Length", "ms"); 63 | _2.TWidget(2, -100, 100, "Delay", "%"); 64 | _3.TWidget(3, -180,180, "Delay Angle", "deg"); 65 | _4.TWidget(4, -100, 100, "Feedback", "%"); 66 | _5.TWidget(5, -180, 180, "Feedback Angle", "deg"); 67 | _6.TWidget(60, -1, 1, "Dry <> Wet", ""); 68 | _7.TWidget(61, -24, 3, "Output", "dB"); 69 | 70 | @gfx 450 300 71 | 72 | SWIPE(320, 300) ? 73 | ( 74 | _effect.TEffectBasic("Geep Delay (Surround)", "License LGPL / Copyright (C) 2015 Derek J. Evans", "Delay"); 75 | 76 | y = 80; yy = 22; 77 | x1 = 20; x2 = gfx_w - x1; 78 | 79 | _1.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 80 | _2.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 81 | _3.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 82 | _4.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 83 | _5.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 84 | _6.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 85 | _7.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 86 | 87 | _effect.TEffect_Done(); 88 | ); 89 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Filter.swipe.jsfx: -------------------------------------------------------------------------------- 1 | 2 | slider1:4000<10,20000,10>band (Hz) 3 | slider2:0<-12,12,0.5>gain (dB) 4 | slider3:0.7<0.01,50,0.05>width 5 | 6 | import swipe.effects.jsfx-inc 7 | 8 | @slider 9 | 10 | spl0.EffectFilterParametric(slider1, slider3, slider2); 11 | spl1.EffectFilterParametric(slider1, slider3, slider2); 12 | 13 | @sample 14 | 15 | spl0.EffectFilterParametric(); 16 | spl1.EffectFilterParametric(); 17 | 18 | -------------------------------------------------------------------------------- /jsfx-inc/effects/ListBox.swipe.jsfx: -------------------------------------------------------------------------------- 1 | // Author: Derek John Evans 2 | // License: LGPL - http://www.gnu.org/licenses/gpl.html 3 | 4 | desc: SWIPE ListBox Example 5 | 6 | EffectName: SWIPE ListBox Example 7 | VendorString: Geep 8 | VendorVersion: 1000 9 | UniqueId: 0 10 | InstallPath: C:\Program Files\VST\SWIPE\ 11 | 12 | import swipe.jsfx-inc 13 | 14 | @init 15 | 16 | ListBox.Strings.LoadFromFile("data/txt/Audio-EQ-Cookbook.jsfx-inc"); 17 | 18 | @gfx 700 500 19 | 20 | SWIPE(700, 200) ? 21 | ( 22 | Effect.TEffectBasic("SWIPE ListBox Example", 23 | "License LGPL / Copyright (C) 2015 Derek J. Evans", 24 | "ListBox"); 25 | gfx_setfont(0); 26 | ListBox.TListBox_Draw(30, 75, gfx_w - 30, gfx_h - 60); 27 | Effect.TEffect_Done(); 28 | ); 29 | 30 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Retro Keyboard.swipe.jsfx: -------------------------------------------------------------------------------- 1 | desc: Simple Retro Keyboard 2 | 3 | EffectName: Geep Retro Keyboard 4 | VendorString: Geep 5 | VendorVersion: 1000 6 | UniqueId: 0 7 | InstallPath: C:\Program Files\VST\SWIPE\ 8 | 9 | // SWIPE interface has not been added yet. 10 | // import swipe.jsfx-inc 11 | 12 | slider1:8<1,16,1>Voices 13 | slider4:42<0,48,0.5>Attack 14 | slider5:16<0,48,0.5>Release 15 | 16 | slider8:1<0,1,0.01>Base Sine Level: 17 | slider9:0<0,4,0.01>Phase Offset: 18 | 19 | slider10:1<0,1,0.01>Sine Wave Level 20 | slider11:0<0,4,0.01>Phase Offset: 21 | 22 | slider12:0.35<0,1,0.01>Square Wave Level 23 | slider13:0<0,4,0.01>Phase Offset: 24 | 25 | slider14:0.5<0,1,0.01>Saw Wave Level 26 | 27 | slider60:0<-12,12,0.5>Output (dB) 28 | 29 | @init 30 | pi2 = $pi * 2; 31 | fn = 4; 32 | 33 | @slider 34 | 35 | (i = floor(slider1)) != voices ? 36 | ( 37 | voices = i; 38 | vid = 0; 39 | ); 40 | 41 | attack = (2 ^ (slider4 / 6)) / srate; 42 | release = 1 - ((2 ^ (slider5 / 6)) / srate); 43 | output = 2 ^ (slider60 / 6); 44 | 45 | @sample 46 | 47 | function wave(x) 48 | ( 49 | (sin(x + slider9) * slider8) * 50 | (sin(x + slider11) * slider10 + (1 - slider10)) * 51 | (sign(sin(x + slider13)) * slider12 + (1 - slider12)) * 52 | ((x / pi2) * slider14 + (1 - slider14)); 53 | ); 54 | 55 | while(midirecv(offs, msg1, msg23)) 56 | ( 57 | (msg1 & $xf0) == $x90 ? ( 58 | vid[0] = vid[3] = 0; 59 | vid[1] = (msg23 >> 8) / 256; 60 | vid[2] = (2 ^ ((msg23 & $x7F) / 12)) * $pi / 1790; // Tuned by a bad ear. :-) 61 | (vid -= fn) < 0 ? vid += voices * fn; 62 | ); 63 | midisend(offs, msg1, msg23); 64 | ); 65 | 66 | out = 0; 67 | i = voices * fn; 68 | while((i -= fn) >= 0) 69 | ( 70 | i[0] += (((i[1] *= release) - i[0]) * attack); 71 | out += i[0] * wave(i[3]); 72 | (i[3] += i[2]) > pi2 ? i[3] -= pi2; 73 | ); 74 | 75 | spl0 = spl1 = out * output; 76 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Simple Scope.swipe.jsfx: -------------------------------------------------------------------------------- 1 | // Author: Derek John Evans 2 | // License: LGPL - http://www.gnu.org/licenses/gpl.html 3 | 4 | desc: Geep Simple Scope 5 | 6 | EffectName: Geep Simple Scope 7 | VendorString: Geep 8 | VendorVersion: 1000 9 | UniqueId: 0 10 | InstallPath: C:\Program Files\VST\SWIPE\ 11 | 12 | import swipe.jsfx-inc 13 | 14 | @init 15 | 16 | Buffer.TScope(srate * 2); 17 | 18 | @sample 19 | 20 | Buffer.TScope_Stream((spl0 + spl1) * 0.5); 21 | 22 | @gfx 500 300 23 | 24 | SWIPE(150, 150) ? 25 | ( 26 | jes2cpp.gfx_rate = 30; 27 | Effect.TEffectBasic("Geep Simple Scope", "License LGPL / Copyright (C) 2015 Derek J. Evans", "Scope"); 28 | Buffer.TScope_Draw(30, 75, gfx_w - 30, gfx_h - 60); 29 | Effect.TEffect_Done(); 30 | ); 31 | 32 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Small Room Reverberator.swipe.jsfx: -------------------------------------------------------------------------------- 1 | /* Small Room Reverberator 2 | * 3 | * Implemented as proposed in "The Virtual Acoustic Room" by William Grant Gardner 4 | * (http://www.media.mit.edu/~billg/docs/ms-thesis.ps.gz) 5 | */ 6 | 7 | desc: Small Room Reverberator (Gardner) 8 | 9 | EffectName: Small Room Reverberator 10 | VendorString: Geep 11 | VendorVersion: 1000 12 | UniqueId: 4562 13 | InstallPath: C:\Program Files\VST\SWIPE\ 14 | 15 | import swipe.jsfx-inc 16 | 17 | // To enable graphics, ALL sliders must be hidden by prefixing the labels with a '-'. 18 | 19 | slider1:0<-120,0>-Dry (dB) 20 | slider2:-6<-120,0>-Wet (dB) 21 | slider3:50<0,100>-Damping (%) 22 | 23 | @init 24 | 25 | a0_pos = 0; 26 | a1_pos = 0; 27 | a2_pos = 0; 28 | a3_pos = 0; 29 | a4_pos = 0; 30 | a0r_pos = 0; 31 | a1r_pos = 0; 32 | a2r_pos = 0; 33 | a3r_pos = 0; 34 | a4r_pos = 0; 35 | tmp = 0; 36 | tmpr = 0; 37 | t = 0; 38 | tr = 0; 39 | 40 | @sample 41 | 42 | SliderChanged() ? ( 43 | 44 | wet = exp(slider2/8.65617); 45 | dry = exp(slider1/8.65617); 46 | g = 1-slider3/100; 47 | 48 | a0 = 0; 49 | a0_len = (srate*35/1000)|0; 50 | a0_g = 0.3; 51 | 52 | a1 = a0+a0_len+1; 53 | a1_len = (srate*22/1000)|0; 54 | a1_g = 0.4; 55 | 56 | a2 = a1+a1_len+1; 57 | a2_len = (srate*8.3/1000)|0; 58 | a2_g = 0.6; 59 | 60 | a3 = a2+a2_len+1; 61 | a3_len = (srate*66/1000)|0; 62 | a3_g = 0.1; 63 | 64 | a4 = a3+a3_len+1; 65 | a4_len = (srate*30/1000)|0; 66 | a4_g = 0.4; 67 | 68 | /* scatter second channels delay length's to give stereo spread */ 69 | rndcoef = 50; 70 | 71 | a0r = a4+a4_len+1; 72 | a0r_len = ((srate*35/1000)|0)+rndcoef; 73 | 74 | a1r = a0r+a0r_len+1; 75 | a1r_len = ((srate*22/1000)|0)-rndcoef; 76 | 77 | a2r = a1r+a1r_len+1; 78 | a2r_len = ((srate*8.3/1000)|0)+rndcoef; 79 | 80 | a3r = a2r+a2r_len+1; 81 | a3r_len = ((srate*66/1000)|0)-rndcoef; 82 | 83 | a4r = a3r+a3r_len+1; 84 | a4r_len = ((srate*30/1000)|0)+rndcoef; 85 | 86 | /* the lowpass isn't sepcified any further so we use a simple RC filter */ 87 | c = exp(-2*3.14*4200/srate); 88 | 89 | ); 90 | 91 | // left channel 92 | 93 | in = spl0 + tmp*g; 94 | 95 | // ---- AP 1 96 | a0_in = in; 97 | a0_out = -a0_in*a0_g + a2_out; 98 | a1_in = a0_in + a0_out*a0_g; 99 | 100 | // -> nested 101 | a1_out = -a1_in*a1_g + a1[a1_pos]; 102 | a1[a1_pos] = a1_in + a1_out*a1_g; 103 | (a1_pos+=1) >= a1_len ? a1_pos = 0; 104 | 105 | a2_in = a1_out; 106 | a2_out = -a2_in*a2_g + a2[a2_pos]; 107 | a2[a2_pos] = a2_in + a2_out*a2_g; 108 | (a2_pos+=1) >= a2_len ? a2_pos = 0; 109 | 110 | // delay 111 | a0[a0_pos] = a2_out; 112 | (a0_pos+=1) >= a0_len ? a0_pos = 0; 113 | a2_out = a0[a0_pos]; 114 | // <- 115 | 116 | // ---- end AP 1 117 | 118 | // ---- AP 2 119 | a3_in = a0_out; 120 | a3_out = -a3_in*a3_g + a4_out; 121 | a4_in = a3_in + a3_out*a3_g; 122 | 123 | // -> nested 124 | a4_out = -a4_in*a4_g + a4[a4_pos]; 125 | a4[a4_pos] = a4_in + a4_out*a4_g; 126 | (a4_pos+=1) >= a4_len ? a4_pos = 0; 127 | 128 | // delay 129 | a3[a3_pos] = a4_out; 130 | (a3_pos+=1) >= a3_len ? a3_pos = 0; 131 | a4_out = a3[a3_pos]; 132 | // <- 133 | 134 | // ---- end AP 2 135 | 136 | tmp = a3_out; 137 | tmp = (t = tmp + c*(t-tmp)); 138 | 139 | out = a0_out*0.5 + a3_out*0.5; 140 | 141 | spl0 = spl0*dry + out*wet; 142 | 143 | 144 | 145 | // right channel 146 | 147 | in = spl1 + tmpr*g; 148 | 149 | // ---- AP 1 150 | a0r_in = in; 151 | a0r_out = -a0r_in*a0_g + a2r_out; 152 | a1r_in = a0r_in + a0r_out*a0_g; 153 | 154 | // -> nested 155 | a1r_out = -a1r_in*a1_g + a1r[a1r_pos]; 156 | a1r[a1r_pos] = a1r_in + a1r_out*a1_g; 157 | (a1r_pos+=1) >= a1r_len ? a1r_pos = 0; 158 | 159 | a2r_in = a1r_out; 160 | a2r_out = -a2r_in*a2_g + a2r[a2r_pos]; 161 | a2r[a2r_pos] = a2r_in + a2r_out*a2_g; 162 | (a2r_pos+=1) >= a2r_len ? a2r_pos = 0; 163 | 164 | // delay 165 | a0r[a0r_pos] = a2r_out; 166 | (a0r_pos+=1) >= a0r_len ? a0r_pos = 0; 167 | a2r_out = a0r[a0r_pos]; 168 | // <- 169 | 170 | // AP 2 171 | a3r_in = a0r_out; 172 | a3r_out = -a3r_in*a3_g + a4r_out; 173 | a4r_in = a3r_in + a3r_out*a3_g; 174 | 175 | // -> nested 176 | a4r_out = -a4r_in*a4_g + a4r[a4r_pos]; 177 | a4r[a4r_pos] = a4r_in + a4r_out*a4_g; 178 | (a4r_pos+=1) >= a4r_len ? a4r_pos = 0; 179 | 180 | // delay 181 | a3r[a3r_pos] = a4r_out; 182 | (a3r_pos+=1) >= a3r_len ? a3r_pos = 0; 183 | a4r_out = a3r[a3r_pos]; 184 | // <- 185 | 186 | tmpr = a3r_out; 187 | tmpr = (tr = tmpr + c*(tr-tmpr)); 188 | 189 | out = a0r_out*0.5 + a3r_out*0.5; 190 | 191 | spl1 = spl1*dry + out*wet; 192 | 193 | @init 194 | 195 | // Register memory usages with SWIPE. 196 | 197 | // TODO 198 | 199 | // Define SWIPE Interface 200 | 201 | _1.TWidget(1, -120, 0, "Dry", "dB"); 202 | _2.TWidget(2, -120, 0, "Wet", "dB"); 203 | _3.TWidget(3, 0, 100, "Damping", "%"); 204 | 205 | @gfx 400 300 206 | 207 | SWIPE(320, 300) ? 208 | ( 209 | _effect.TEffectBasic( 210 | "Small Room Reverberator (Gardner)", 211 | "LOSER - \"The Virtual Acoustic Room\" by William Grant Gardner", 212 | "Reverb"); 213 | 214 | y = 80; 215 | yy = 24; 216 | x1 = 20; 217 | x2 = gfx_w - x1; 218 | 219 | _1.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 220 | _2.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 221 | _3.TSliderHorz_Draw(x1, y, x2, y + 16); y += yy; 222 | 223 | _effect.TEffect_Done(); 224 | ); 225 | -------------------------------------------------------------------------------- /jsfx-inc/effects/Stereo Scope.swipe.jsfx: -------------------------------------------------------------------------------- 1 | // Author: Derek John Evans 2 | // License: LGPL - http://www.gnu.org/licenses/gpl.html 3 | 4 | desc: Geep Stereo Scope 5 | 6 | EffectName: Stereo Scope 7 | VendorString: Geep 8 | VendorVersion: 1000 9 | UniqueId: 4562 10 | InstallPath: C:\Program Files\VST\SWIPE\ 11 | 12 | import swipe.jsfx-inc 13 | 14 | @init 15 | 16 | Scope.TScopeStereo(); 17 | 18 | @sample 19 | 20 | Scope.TScopeStereo_Stream((spl0 - spl1) * 0.5, (spl0 + spl1) * 0.5); 21 | 22 | @gfx 500 300 23 | 24 | SWIPE(150, 150) ? 25 | ( 26 | jes2cpp.gfx_rate = 30; 27 | Effect.TEffectBasic("Geep Simple Stereo Scope", "License LGPL / Copyright (C) 2015 Derek J. Evans", "Scope"); 28 | Scope.TScopeStereo_Draw(30, 75, gfx_w - 30, gfx_h - 60, m, s); 29 | Effect.TEffect_Done(); 30 | ); 31 | 32 | -------------------------------------------------------------------------------- /jsfx-inc/effects/The Time Traveler.jsfx: -------------------------------------------------------------------------------- 1 | desc: The Time Traveler 2 | 3 | EffectName: The Time Traveler 4 | VendorString: GEEP 5 | VendorVersion: 1000 6 | UniqueId: 'TTT1' 7 | InstallPath: C:\Program Files\VST\ 8 | 9 | slider1:750<50,5000>Time (ms) 10 | slider2:3<-10,10>Travel (sr) 11 | slider3:0.2<0,1>Feedback 12 | 13 | @init 14 | 15 | function LinearSample(m, n, x) global() local(fr, fl) 16 | ( 17 | fr = x - (fl = (x|0)); 18 | m[fl % n] * (1 - fr) + m[(fl + 1) % n] * fr; 19 | ); 20 | 21 | @slider 22 | 23 | n = slider1 * srate / 1000; 24 | jj = slider2; 25 | 26 | @sample 27 | 28 | (i -= 1) < 0 ? i += n; 29 | m[i] = m[i] * slider3 + spl0 * (1 - slider3); 30 | (j += jj) < 0 ? j += n : j >= n ? j -= n; 31 | spl0 = spl1 = LinearSample(m, n, j); 32 | 33 | -------------------------------------------------------------------------------- /jsfx-inc/effects/caps.ToneStack.jsfx: -------------------------------------------------------------------------------- 1 | /* 2 | ToneStack.jsfx-inc 3 | 4 | Copyright 2006-7 5 | David Yeh 6 | 7 | 2007-2013 8 | Tim Goetze (cosmetics) 9 | 10 | Tone Stack emulation. 11 | * 12 | */ 13 | /* 14 | This program is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU General Public License 16 | as published by the Free Software Foundation; either version 3 17 | of the License, or (at your option) any later version. 18 | 19 | This program is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this program; if not, write to the Free Software 26 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | 02111-1307, USA or point your web browser to http://www.gnu.org. 28 | */ 29 | 30 | desc: ToneStack - Classic amplifier tone stack emulation 31 | 32 | import caps.ToneStack.jsfx-inc 33 | 34 | slider1:0<0,8,1{basswoman,stanford,wookie,DC 30,juice 800,twin,AK 20,nihon ace,porky}>Model 35 | slider2:0.5<0,1>Bass 36 | slider3:0.5<0,1>Mid 37 | slider4:0.5<0,1>Treble 38 | 39 | @init 40 | 41 | ts.ToneStack(); 42 | ts.ToneStack_init(srate); 43 | 44 | @slider 45 | 46 | ts.ToneStack_setmodel(slider1); 47 | ts.ToneStack_updatecoefs(slider2, slider3, slider4); 48 | 49 | @sample 50 | 51 | spl0 = spl1 = ts.ToneStack_process(spl0); 52 | 53 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.expressions.jsfx: -------------------------------------------------------------------------------- 1 | 2 | import test.jsfx-inc 3 | 4 | @init 5 | 6 | clrscr(); 7 | 8 | H1("Expression Tests"); 9 | 10 | function Test(f, value, expected) global() 11 | ( 12 | printf("%20s = %8.2f -> %s\n", f, value, value == expected ? "GOOD" : "ERROR!"); 13 | ); 14 | 15 | Test("2 | 2 == 2" , 2 | 2 == 2 , 1); 16 | Test("1 & 3 + 2" , 1 & 3 + 2 , 1); 17 | Test("2 ^ 3 / 2" , 2 ^ 3 / 2 , 4); 18 | Test("2 ^ 3 ^ 3" , 2 ^ 3 ^ 3 , 512); 19 | Test("5 - 2 * 5" , 5 - 2 * 5 , -5); 20 | Test("10 == 2 * 5" , 10 == 2 * 5 , 1); 21 | Test("6 << 2 * 4" , 6 << 2 * 4 , 96); 22 | Test("100 / 1 << 2" , 100 / 1 << 2 , 25); 23 | Test("2 & 2 << 2" , 2 & 2 << 2 , 0); 24 | Test("2 + 2 & 1" , 2 + 2 & 1 , 0); 25 | Test("1 & 1 + 4" , 1 & 1 + 4 , 1); 26 | 27 | x = (x = 1; 4 + x *= 1); Test("x = 1; 4 + x *= 1" , x, 5); 28 | x = (x = 10; 4 + x /= 2); Test("x = 10; 4 + x /= 2", x, 9); 29 | x = (x = 10; 4 * x += 2); Test("x = 10; 4 * x += 2", x, 48); 30 | x = (x = 10; x += 2 * 4); Test("x = 10; x += 2 * 4", x, 18); 31 | 32 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.fonts.jsfx: -------------------------------------------------------------------------------- 1 | @init 2 | 3 | name_count = 4; 4 | names = 0; 5 | names[0] = "impact"; 6 | names[1] = "times"; 7 | names[2] = "verdana"; 8 | names[3] = "arial"; 9 | 10 | @gfx 800 600 11 | 12 | gfx_a = 1; 13 | 14 | gfx_b = gfx_g = 0; gfx_r = 0.3; 15 | gfx_x = gfx_y = 0; 16 | gfx_rectto(gfx_w, gfx_h); 17 | 18 | gfx_r = gfx_g = gfx_b = gfx_a = 1; 19 | gfx_x = gfx_y = 0; 20 | 21 | gfx_setfont(1, "verdana", 19); 22 | gfx_drawstr("Verdana 19"); gfx_x += 20; 23 | gfx_setfont(1, "verdana", 0); 24 | gfx_drawstr("Verdana 0"); gfx_x += 20; 25 | gfx_setfont(1, "verdana", -19); 26 | gfx_drawstr("Verdana -19"); gfx_x += 20; 27 | 28 | name = names[count % name_count]; 29 | size = sin(count += 0.04) * 100; 30 | gfx_setfont(1, name, size); 31 | 32 | s = sprintf(#, "Jesusonic Rocks!\n%s: %d", name, size); 33 | gfx_measurestr(s, w, h); 34 | gfx_x = (gfx_w - w) * 0.5; 35 | gfx_y = (gfx_h - h) * 0.5; 36 | gfx_drawstr(s); 37 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.graph.jsfx: -------------------------------------------------------------------------------- 1 | desc: Graph Drawer 2 | 3 | import pas.graphics.jsfx-inc 4 | 5 | slider1:<,,{none,sin,cos,tan,asin,acos,atan,sqr,sqrt,invsqrt,exp,log,log10,abs,user1,user2}>Function: 6 | slider2:<,,{none,-x,1-x,x*x}>Modifier 7 | slider10:20<1, 100>X Zoom: 8 | slider11:20<1, 100>Y Zoom: 9 | 10 | @gfx 11 | 12 | Canvas.Brush.Color = 0x332211; 13 | Canvas.FillRect(0, 0, gfx_w, gfx_h); 14 | 15 | Canvas.Pen.Color = clRed; 16 | 17 | w = gfx_w * 0.5; 18 | h = gfx_h * 0.5; 19 | 20 | Canvas.Line(w, 0, w, gfx_h); 21 | Canvas.Line(0, h, gfx_w, h); 22 | 23 | Canvas.Pen.Color = clWhite; 24 | x = 0; 25 | Canvas.MoveTo(x, h); 26 | while (x < gfx_w) ( 27 | v = (x - w) / slider10; 28 | y = ( 29 | slider1 == 0 ? v : 30 | slider1 == 1 ? sin (v) : 31 | slider1 == 2 ? cos (v) : 32 | slider1 == 3 ? tan (v) : 33 | slider1 == 4 ? asin (v) : 34 | slider1 == 5 ? acos (v) : 35 | slider1 == 6 ? atan (v) : 36 | slider1 == 7 ? sqr (v) : 37 | slider1 == 8 ? sqrt (v) : 38 | slider1 == 9 ? invsqrt(v) : 39 | slider1 == 10 ? exp (v) : 40 | slider1 == 11 ? log (v) : 41 | slider1 == 12 ? log10 (v) : 42 | slider1 == 13 ? abs (v) : 43 | slider1 == 14 ? 2 / (1 + exp(v * -2)) - 1 : 44 | slider1 == 15 ? sqrt(abs(v)^0.5) * sign(v) : 45 | 0 46 | ); 47 | y = ( 48 | slider2 == 0 ? y : 49 | slider2 == 1 ? -y : 50 | slider2 == 2 ? 1 - y : 51 | slider2 == 3 ? y * y : 52 | y; 53 | ); 54 | Canvas.LineTo(x, y * -slider11 + h); 55 | x += 1; 56 | ); 57 | 58 | 59 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.hello.jsfx: -------------------------------------------------------------------------------- 1 | import test.jsfx-inc 2 | 3 | @init 4 | 5 | clrscr(); 6 | 7 | printf("Hello World!"); 8 | 9 | @sample 10 | 11 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.jsfx-inc: -------------------------------------------------------------------------------- 1 | desc: Shared Test Import 2 | 3 | // ANSI C Headers 4 | 5 | import std.cmath.jsfx-inc 6 | import std.ctype.jsfx-inc 7 | import std.cstdio.jsfx-inc 8 | import std.cstdlib.jsfx-inc 9 | import std.cmemory.jsfx-inc 10 | import std.cstring.jsfx-inc 11 | import std.cassert.jsfx-inc 12 | 13 | // C++ Headers 14 | 15 | import std.string.jsfx-inc 16 | import std.vector.jsfx-inc 17 | 18 | import std.cconio.jsfx-inc 19 | 20 | @init 21 | 22 | function H1(s) 23 | ( 24 | puts(sprintf(#, "%s", s)); 25 | puts("-----------------------------------"); 26 | ); 27 | 28 | function H2(s) 29 | ( 30 | puts(sprintf(#, "\n// %s\n", s)); 31 | ); 32 | 33 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.malloc.jsfx: -------------------------------------------------------------------------------- 1 | 2 | import test.jsfx-inc 3 | 4 | @init 5 | 6 | function PrintMem(name, m) global() 7 | ( 8 | printf("name=%5s ptr=0x%X size=%4d state=%s\n", 9 | name, m, _msize(m), mcheck(m) ? "ok" : "ERROR!"); 10 | ); 11 | 12 | function PrintMem(i) 13 | ( 14 | H2(sprintf(#, "Test #%d", i)); 15 | PrintMem("m1", m1); 16 | PrintMem("m2", m2); 17 | PrintMem("m3", m3); 18 | ); 19 | 20 | clrscr(); 21 | 22 | H1("Memory Allocation Testing"); 23 | 24 | m1 = calloc(10); 25 | m2 = calloc(20); 26 | m3 = calloc(500); 27 | 28 | PrintMem(1); 29 | 30 | free(m1); 31 | free(m2); 32 | m1 = calloc(20); 33 | m2 = calloc(0); 34 | 35 | PrintMem(2); 36 | 37 | free(m1); 38 | free(m2); 39 | m1 = calloc(30); 40 | m2 = calloc(5); 41 | 42 | PrintMem(3); 43 | 44 | free(m1); 45 | free(m2); 46 | m1 = calloc(3); 47 | m2 = calloc(400); 48 | 49 | PrintMem(4); 50 | 51 | free(m1); m1 = calloc(300); 52 | free(m2); m2 = calloc(1); 53 | 54 | PrintMem(5); 55 | 56 | free(m1); m1 = calloc(10); 57 | free(m2); m2 = calloc(20); 58 | 59 | PrintMem(6); 60 | 61 | free(m1); 62 | free(m2); 63 | 64 | m1 = calloc(10); 65 | m2 = calloc(20); 66 | 67 | PrintMem(7); 68 | 69 | H2("The aim of this test is to restore the original m1, m2, m3 state"); 70 | H2("DONE"); 71 | 72 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.math.jsfx: -------------------------------------------------------------------------------- 1 | 2 | import test.jsfx-inc 3 | 4 | @init 5 | 6 | function Test(name, value, result) 7 | ( 8 | printf("%-6s(%8.2f) = %8.2f\n", name, value, result); 9 | ); 10 | 11 | clrscr(); 12 | H1("Test Math Functions"); 13 | 14 | H2("General Function Tests"); 15 | Test("floor", +1.3, floor(+1.3)); 16 | Test("floor", -1.3, floor(-1.3)); 17 | Test("round", +1.5, round(+1.5)); 18 | Test("round", +1.4, round(+1.4)); 19 | Test("round", -1.4, round(-1.4)); 20 | Test("round", -1.5, round(-1.5)); 21 | Test("trunc", -1.5, trunc(-1.5)); 22 | Test("trunc", +1.5, trunc(+1.5)); 23 | Test("log2" , 1024, log2(1024)); 24 | Test("cbrt" , 27, cbrt(27)); 25 | 26 | H2("http://www.cplusplus.com/reference/cmath/round/"); 27 | 28 | string5 = "%8s%8s%8s%8s%8s\n"; 29 | float5 = "%8.1f%8.1f%8.1f%8.1f%8.1f\n"; 30 | 31 | printf(string5, "value", "round", "floor", "ceil", "trunc"); 32 | printf(string5, "-----", "-----", "-----", "----", "-----"); 33 | printf(float5, 2.3,round( 2.3),floor( 2.3),ceil( 2.3),trunc( 2.3)); 34 | printf(float5, 3.8,round( 3.8),floor( 3.8),ceil( 3.8),trunc( 3.8)); 35 | printf(float5, 5.5,round( 5.5),floor( 5.5),ceil( 5.5),trunc( 5.5)); 36 | printf(float5,-2.3,round(-2.3),floor(-2.3),ceil(-2.3),trunc(-2.3)); 37 | printf(float5,-3.8,round(-3.8),floor(-3.8),ceil(-3.8),trunc(-3.8)); 38 | printf(float5,-5.5,round(-5.5),floor(-5.5),ceil(-5.5),trunc(-5.5)); 39 | 40 | 41 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.mouse.jsfx: -------------------------------------------------------------------------------- 1 | 2 | import test.jsfx-inc 3 | 4 | @init 5 | 6 | clrscr(); 7 | 8 | @gfx 9 | 10 | printf("mouse_x=%4d, mouse_y=%4d, mouse_cap=%4d\n", mouse_x, mouse_y, mouse_cap); 11 | 12 | strlen(stdout) > 4096 ? clrscr(); 13 | 14 | Console.Draw(); 15 | 16 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.stderr.jsfx: -------------------------------------------------------------------------------- 1 | 2 | import test.jsfx-inc 3 | 4 | @init 5 | 6 | clrscr(); 7 | 8 | H1("Standard Error/Assert Testing"); 9 | 10 | loop (5, 11 | puts("1) Write to stderr"); 12 | fputs("This is a test error message.\n", stderr); 13 | fputs("Unable to load image.\n", stderr); 14 | 15 | puts("2) Using the assert functions"); 16 | assert(a != 0, "Divide by zero"); 17 | assert(1 == 2, "1 does not equal 2", "test.stderr.jsfx"); 18 | ); 19 | @gfx 20 | 21 | a.Console.Draw(0, 0, gfx_w, gfx_h - 100, stdout); 22 | b.Console.Draw(0, gfx_h - 100, gfx_w, gfx_h, stderr); 23 | 24 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.string.jsfx: -------------------------------------------------------------------------------- 1 | import test.jsfx-inc 2 | 3 | @init 4 | 5 | clrscr(); 6 | 7 | H1("C++ Strings in Jesusonic"); 8 | 9 | puts("Note: This code is still experimental.\n"); 10 | 11 | function PrintString(_str) global() instance(str) 12 | ( 13 | str = _str; // Need to copy param to a instance. 14 | printf("\"%s\" Length: %d\n", str, str.length()); 15 | ); 16 | 17 | a.string("This is a C++ style string."); 18 | b.string("String B"); 19 | b = sfree(b); 20 | c.string("String C"); 21 | b.string("String B"); 22 | 23 | PrintString(a); 24 | PrintString(a.upper()); 25 | PrintString(a.lower()); 26 | 27 | 28 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.strings.jsfx: -------------------------------------------------------------------------------- 1 | import test.jsfx-inc 2 | 3 | @init 4 | 5 | function TestStr(name, result) global() 6 | ( 7 | printf("%-18s -> \"%s\"\n", name, result); 8 | ); 9 | 10 | function TestInt(name, result) global() 11 | ( 12 | printf("%-18s -> %2d\n", name, result); 13 | ); 14 | 15 | clrscr(); 16 | 17 | H1("String Functions"); 18 | 19 | str = "Jesusonic ANSI String Functions"; 20 | 21 | H2(sprintf(#, "INPUT: \"%s\"", str)); 22 | 23 | #s = str; 24 | TestStr("strrev (str)", strrev(#s)); 25 | 26 | #s = str; 27 | TestStr("strupr (str)", strupr(#s)); 28 | 29 | #s = str; 30 | TestStr("strlwr (str)", strlwr(#s)); 31 | 32 | #s = str; 33 | TestStr("strset (str, '^')", strset(#s, '^')); 34 | 35 | H2("Other Functions"); 36 | 37 | TestInt("strchr (str, 'F')", strchr (str, 'F')); 38 | TestInt("strchr (str, 'e')", strchr (str, 'e')); 39 | TestInt("strchr (str, 'Z')", strchr (str, 'z')); 40 | 41 | TestInt("strrchr(str, 'i')", strrchr(str, 'i')); 42 | TestInt("strchr (str, 'i')", strchr (str, 'i')); 43 | 44 | TestInt("strccnt(str, 'i')", strccnt(str, 'i')); 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /jsfx-inc/effects/tests/test.vector.jsfx: -------------------------------------------------------------------------------- 1 | import test.jsfx-inc 2 | 3 | @init 4 | 5 | function VectorVerbose() global() local(i) 6 | ( 7 | printf("["); 8 | i = 0; 9 | while (i < this.size()) ( 10 | i > 0 ? printf(", "); 11 | printf("%d", this[i]); 12 | i += 1; 13 | ); 14 | printf("]\n"); 15 | ); 16 | 17 | function VectorResize(name, size) global() local(i) 18 | ( 19 | i = 0; 20 | while (i < this.size()) ( 21 | this[i] != i ? puts("ERROR"); 22 | i += 1; 23 | ); 24 | this.resize(size); 25 | i = 0; 26 | while (i < size) ( 27 | this[i] = i; 28 | i += 1; 29 | ); 30 | printf("Vector='%s' Resize='%d' -> ", name, this.size()); 31 | this.VectorVerbose(); 32 | ); 33 | 34 | clrscr(); 35 | 36 | H1("C++ Style Vector Tests"); 37 | 38 | a.VectorResize("a", 20); 39 | 40 | H2("Create the vector 'b' test vector via pushing."); 41 | b.clear(); 42 | b.push_back(5); 43 | b.push_back(4); 44 | b.push_back(3); 45 | b.push_back(2); 46 | b.push_back(1); 47 | b.VectorVerbose(); 48 | 49 | a.VectorResize("a", 5); 50 | a.VectorResize("a", 0); 51 | a.VectorResize("a", 2); 52 | a.VectorResize("a", 4); 53 | 54 | H2("Original test vector. Should be the same as what was written above."); 55 | b.VectorVerbose(); 56 | 57 | H2("Push some more values."); 58 | b.push_back(11); 59 | b.push_back(12); 60 | b.push_back(13); 61 | b.push_back(14); 62 | b.push_back(15); 63 | b.VectorVerbose(); 64 | 65 | H2("Resize vector 'a' some more times."); 66 | 67 | a.VectorResize("a", 0); 68 | a.VectorResize("a", 2); 69 | a.VectorResize("a", 4); 70 | a.VectorResize("a", 1000); 71 | a.VectorResize("a", 30); 72 | a.VectorResize("a", 89); 73 | 74 | H2("Verbose vector 'b'. Should be the same as what was written above."); 75 | b.VectorVerbose(); 76 | 77 | H2("Now clear both 'a' and 'b' vectors."); 78 | 79 | a = free(a); 80 | b = free(b); 81 | 82 | printf("Both should be zero -> a='%d' b='%d'\n", a, b); 83 | 84 | H2("Allocate some new memory using malloc."); 85 | 86 | a = malloc(100); 87 | b = malloc(100); 88 | 89 | printf("New memory pointers -> a=0x%x b=0x%x\n", a, b); 90 | 91 | puts("\ndone."); 92 | 93 | -------------------------------------------------------------------------------- /jsfx-inc/geep.chorus.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | import std.cstdlib.jsfx-inc 3 | import axonlib.math.jsfx-inc 4 | 5 | @init 6 | 7 | function StereoChorus.Init(_maxms) global(srate) 8 | instance(msize, mem, p1) 9 | ( 10 | msize = floor(_maxms * srate / 1000) * 2; 11 | mem = malloc(msize + 2); 12 | p1 = 0; 13 | ); 14 | 15 | function StereoChorus.Slider(_radius, _speed, _fback, _wetdry, _level) global(srate) 16 | instance(radius, speed, fback, lev, wet, dry) 17 | ( 18 | radius = _radius * srate / 1000 / 2; 19 | speed = (2*$pi) * _speed / srate; 20 | fback = _fback / 100; 21 | 22 | lev = 2 ^ (_level / 6); 23 | wet = (_wetdry + 1) * 0.5 * lev; 24 | dry = (1 - _wetdry) * 0.5 * lev; 25 | ); 26 | 27 | function StereoChorus.Sample(spl0*, spl1*) global() 28 | instance(angle, speed, radius, fback, wet, dry, p1, msize, mem) 29 | local(co, sa, fl, fr, p2, p3, wet0, wet1) 30 | ( 31 | (angle += speed) >= (2*$pi) ? angle -= (2*$pi); 32 | 33 | co = axCosf(angle); 34 | 35 | sa = (1 + co) * radius; 36 | fl = 0 | sa; 37 | fr = sa - fl; 38 | (p2 = (p1 + fl * 2)) >= msize ? p2 -= msize; 39 | (p3 = p2 + 2) >= msize ? p3 -= msize; 40 | wet0 = mem[p2+0] * (1 - fr) + mem[p3+0] * fr; 41 | 42 | sa = (1 - co) * radius; 43 | fl = 0 | sa; 44 | fr = sa - fl; 45 | (p2 = (p1 + fl * 2)) >= msize ? p2 -= msize; 46 | (p3 = p2 + 2) >= msize ? p3 -= msize; 47 | wet1 = mem[p2+1] * (1 - fr) + mem[p3+1] * fr; 48 | 49 | (p1 -= 2) < 0 ? p1 += msize; 50 | 51 | mem[p1+0] = spl0 + wet0 * fback; 52 | mem[p1+1] = spl1 + wet1 * fback; 53 | 54 | spl0 = spl0 * dry + wet0 * wet; 55 | spl1 = spl1 * dry + wet1 * wet; 56 | ); 57 | 58 | -------------------------------------------------------------------------------- /jsfx-inc/geep.gain.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | function Gain.Set(db) global() 5 | ( 6 | this.db = db; 7 | this = 2 ^ (db / 6); 8 | ); 9 | 10 | -------------------------------------------------------------------------------- /jsfx-inc/geep.pan.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | function Pan.Set(pan) 5 | ( 6 | this.x = (1 - pan) * 0.5; 7 | this.y = (pan + 1) * 0.5; 8 | ); 9 | 10 | -------------------------------------------------------------------------------- /jsfx-inc/geep.saturate.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | // Value should be 0.0001 - 2.0 5 | function Saturation.Set(value) global() 6 | ( 7 | this = value; 8 | this.makeup = 1 / atan(value); 9 | ); 10 | 11 | function Saturation.Sample(spl) global() 12 | ( 13 | atan(spl * this) * this.makeup; 14 | ); 15 | 16 | -------------------------------------------------------------------------------- /jsfx-inc/geep.waveshaper.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | import std.vector.jsfx-inc 3 | 4 | @init 5 | 6 | function WaveType1(spl, brown) global() local(gain) 7 | ( 8 | gain = spl * 10000; // 80db gain 9 | spl = cos(spl) * (atan(sign(gain) * abs(gain) ^ brown)); 10 | ); 11 | 12 | function WaveShaper.Init(size, gain, brown) global() local(spl) 13 | ( 14 | this.resize(size); 15 | spl = 0; 16 | while (spl < this.size()) ( 17 | this[spl] = WaveType1(spl * gain / this.size(), brown); 18 | spl += 1; 19 | ); 20 | ); 21 | 22 | function WaveShaper.Sample(spl) global() local(abs, idx, int, fra) 23 | ( 24 | int = (abs = min(abs(spl), 1))|0; 25 | fra = abs - int; 26 | idx = abs * (this.size() - 1); 27 | (this[idx] * (1 - fra) + this[idx + 1] * fra) * sign(spl); 28 | ); 29 | 30 | -------------------------------------------------------------------------------- /jsfx-inc/juce.decibels.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | /** 5 | This class contains some helpful static methods for dealing with decibel values. 6 | */ 7 | 8 | defaultMinusInfinitydB = -100; 9 | 10 | /** Converts a dBFS value to its equivalent gain level. 11 | 12 | A gain of 1.0 = 0 dB, and lower gains map onto negative decibel values. Any 13 | decibel value lower than minusInfinityDb will return a gain of 0. 14 | */ 15 | function Decibels.decibelsToGain(decibels, minusInfinityDb) global() 16 | ( 17 | decibels > minusInfinityDb ? 10 ^ (decibels * 0.05) : 0; // 0.05 = 1/20 18 | ); 19 | 20 | function Decibels.decibelsToGain(decibels) global(defaultMinusInfinitydB) 21 | ( 22 | this.Decibels.decibelsToGain(decibels, defaultMinusInfinitydB); 23 | ); 24 | 25 | /** Converts a gain level into a dBFS value. 26 | 27 | A gain of 1.0 = 0 dB, and lower gains map onto negative decibel values. 28 | If the gain is 0 (or negative), then the method will return the value 29 | provided as minusInfinityDb. 30 | */ 31 | function Decibels.gainToDecibels(gain, minusInfinityDb) global() 32 | ( 33 | gain > 0 ? max(minusInfinityDb, log10(gain) * 20) : minusInfinityDb; 34 | ); 35 | 36 | function Decibels.gainToDecibels(gain) global(defaultMinusInfinitydB) 37 | ( 38 | this.Decibels.gainToDecibels(gain, defaultMinusInfinitydB); 39 | ); 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /jsfx-inc/loser.3bandeq.jsfx-inc: -------------------------------------------------------------------------------- 1 | import loser.jsfx-inc 2 | 3 | @init 4 | 5 | function LOSER.3BandEq.Init(l, f1, m, f2, h) global(cAmpDB, srate) 6 | instance(lVol, mVol, hVol, xLP, xHP, a0LP, a0HP, b1LP, b1HP) 7 | ( 8 | lVol = exp(l/cAmpDB); 9 | mVol = exp(m/cAmpDB); 10 | hVol = exp(h/cAmpDB); 11 | 12 | xLP = exp(-2.0 * $pi * min(min(f1, srate), f2) / srate); 13 | a0LP = 1.0 - xLP; 14 | b1LP = -xLP; 15 | 16 | xHP = exp(-2.0 * $pi * max(min(f2, srate), f1) / srate); 17 | a0HP = 1.0 - xHP; 18 | b1HP = -xHP; 19 | ); 20 | 21 | function LOSER.3BandEq.Sample(spl) global(cDenorm) 22 | instance(sl0, a0LP, a0HP, b1LP, b1HP, sh0, lVol, mVol, hVol) 23 | instance(tmplLP, tmplHP) 24 | ( 25 | sl0 = tmplLP = a0LP * spl - b1LP * tmplLP + cDenorm; 26 | sh0 = spl - (tmplHP = a0HP * spl - b1HP * tmplHP + cDenorm); 27 | spl = (sl0 * lVol + (spl - sl0 - sh0) * mVol + sh0 * hVol); 28 | ); 29 | 30 | -------------------------------------------------------------------------------- /jsfx-inc/loser.jsfx-inc: -------------------------------------------------------------------------------- 1 | @init 2 | 3 | cDenorm = 10^-30; 4 | cAmpDB = 8.65617025; 5 | 6 | 7 | -------------------------------------------------------------------------------- /jsfx-inc/pas.classes.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: Classes 3 | ** Desc: This is part of a Pascal style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.string.jsfx-inc 12 | import std.vector.jsfx-inc 13 | 14 | @init 15 | 16 | function Strings.Count() global() 17 | ( 18 | this.size(); 19 | ); 20 | 21 | function Strings.Clear() global() local(LIndex) 22 | ( 23 | LIndex = this.size(); 24 | while (LIndex > 0) ( 25 | LIndex -= 1; 26 | sfree(this[LIndex]); 27 | ); 28 | this.clear(); 29 | ); 30 | 31 | function Strings.LoadFromFile(AFileName) global() local(LString, LFile) 32 | ( 33 | this.Strings.Clear(); 34 | (LFile = file_open(AFileName)) >= 0 ? ( 35 | LString = #; 36 | while (file_string(LFile, LString)) ( 37 | this.push_back(strcpy(salloc(), LString)); 38 | ); 39 | file_close(LFile); 40 | ); 41 | ); 42 | 43 | function Strings.SetDelimitedText(AString, AChar) global() local(LPos, LEnd) 44 | ( 45 | this.Strings.Clear(); 46 | LPos = 0; 47 | while ((LEnd = strchr(AString, AChar, LPos)) >= 0) ( 48 | this.push_back(strcpy_substr(salloc(), AString, LPos, LEnd - LPos)); 49 | LPos = LEnd + 1; 50 | ); 51 | this.push_back(strcpy_substr(salloc(), AString, LPos)); 52 | ); 53 | 54 | function Strings.SetCommaText(AString) global() 55 | ( 56 | this.Strings.SetDelimitedText(AString, $','); 57 | ); 58 | 59 | -------------------------------------------------------------------------------- /jsfx-inc/pas.controls.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: Controls 3 | ** Desc: This is part of a Pascal style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import pas.types.jsfx-inc 12 | 13 | @init 14 | 15 | function Buttons.L.Down.Set(x) ( this = x; ); 16 | function Buttons.L.Down.Get() ( this; ); 17 | function Buttons.L.Clicked.Set(x) ( this = x; ); 18 | function Buttons.L.Clicked.Get() ( this; ); 19 | function Buttons.L.UnClicked.Set(x) ( this = x; ); 20 | function Buttons.L.UnClicked.Get() ( this; ); 21 | 22 | function Buttons.R.Down.Set(x) ( this = x; ); 23 | function Buttons.R.Down.Get() ( this; ); 24 | function Buttons.R.Clicked.Set(x) ( this = x; ); 25 | function Buttons.R.Clicked.Get() ( this; ); 26 | function Buttons.R.UnClicked.Set(x) ( this = x; ); 27 | function Buttons.R.UnClicked.Get() ( this; ); 28 | 29 | function Buttons.Set(x, y, cap) global() local(isdown) 30 | ( 31 | this = cap; 32 | isdown = sign(this & 1); 33 | this.Buttons.L.Clicked.Set( isdown && !this.Buttons.L.Down.Get() ); 34 | this.Buttons.L.UnClicked.Set( !isdown && this.Buttons.L.Down.Get() ); 35 | this.Buttons.L.Down.Set(isdown); 36 | this.Buttons.L.Clicked.Get() ? ( this.Buttons.L.Clicked.Point.TPoint_Set(x, y) ); 37 | 38 | isdown = sign(this & 2); 39 | this.Buttons.R.Clicked.Set( isdown && !this.Buttons.R.Down.Get() ); 40 | this.Buttons.R.UnClicked.Set( !isdown && this.Buttons.R.Down.Get() ); 41 | this.Buttons.R.Down.Set(isdown); 42 | this.Buttons.R.Clicked.Get() ? ( this.Buttons.R.Clicked.Point.TPoint_Set(x, y) ); 43 | ); 44 | 45 | // TMouse Object 46 | 47 | function Mouse.Set(x, y, cap) global() 48 | ( 49 | this.Point.TPoint_Set(x, y); 50 | this.Buttons.Set(x, y, cap); 51 | ); 52 | 53 | function Mouse.Set() global(mouse_x, mouse_y, mouse_cap) 54 | ( 55 | this.Mouse.Set(mouse_x, mouse_y, mouse_cap); 56 | ); 57 | 58 | function Mouse.SetCapture(x) global() 59 | ( 60 | this.Capture = x; 61 | ); 62 | 63 | function Mouse.GetCapture() global() 64 | ( 65 | this.Capture; 66 | ); 67 | 68 | -------------------------------------------------------------------------------- /jsfx-inc/pas.fileutil.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: FileUtil 3 | ** Desc: This is part of a Pascal style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import pas.sysutils.jsfx-inc 12 | 13 | @init 14 | 15 | function ExtractFileExt(filename) global() 16 | local(pos) 17 | ( 18 | (pos = RPos('.', filename)) < 0 ? "" : strcpy_substr(#, filename, pos); 19 | ); 20 | 21 | function ExtractFileName(filename) global() 22 | local(pos) 23 | ( 24 | (pos = LastDelimiter("\\/", filename)) < 0 ? "" : strcpy_substr(#, filename, pos + 1); 25 | ); 26 | 27 | function ExtractFileDir(filename) global() 28 | local(pos) 29 | ( 30 | (pos = LastDelimiter("\\/", filename)) < 0 ? "" : strcpy_substr(#, filename, 0, pos); 31 | ); 32 | 33 | function ExtractFilePath(filename) global() 34 | local(pos) 35 | ( 36 | (pos = LastDelimiter("\\/", filename)) < 0 ? "" : strcpy_substr(#, filename, 0, pos + 1); 37 | ); 38 | 39 | -------------------------------------------------------------------------------- /jsfx-inc/pas.forms.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | function Screen.Set() global(gfx_w, gfx_h) 5 | ( 6 | this.Width = gfx_w; 7 | this.Height = gfx_h; 8 | ); 9 | 10 | -------------------------------------------------------------------------------- /jsfx-inc/pas.graphutil.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | function ExtractRGB(RGB, R*, G*, B*) global() 5 | ( 6 | R = RGB & 0xFF; 7 | G = (RGB >> 8) & 0xFF; 8 | B = (RGB >> 16) & 0xFF; 9 | ); 10 | -------------------------------------------------------------------------------- /jsfx-inc/pas.math.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: Math 3 | ** Desc: This is part of a Pascal style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | @init 12 | 13 | // Converts degrees to radians. 14 | function DegToRad(x) global() 15 | ( 16 | x * 180 / $pi; 17 | ); 18 | 19 | // Converts radians to degrees. 20 | function RadToDeg(x) global() 21 | ( 22 | x * $pi / 180; 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /jsfx-inc/pas.strutils.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: StrUtils 3 | ** Desc: This is part of a Pascal style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import pas.system.jsfx-inc 12 | 13 | @init 14 | 15 | function SameStr(s1, s2) global() 16 | ( 17 | !strcmp(s1, s2); 18 | ); 19 | 20 | function SameText(s1, s2) global() 21 | ( 22 | !stricmp(s1, s2); 23 | ); 24 | 25 | 26 | -------------------------------------------------------------------------------- /jsfx-inc/pas.system.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: System 3 | ** Desc: This is part of a Pascal style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | @init 12 | 13 | // Converts a single char to a string of length 1. 14 | function ChrToStr(chr) global() 15 | ( 16 | str_setchar(str_setlen(#, 1), 0, chr); 17 | ); 18 | 19 | function Copy(str, pos, len) global() 20 | ( 21 | strcpy_substr(#, str, pos, len); 22 | ); 23 | 24 | function Pos(chr, str) global() 25 | local(pos, len) 26 | ( 27 | pos = 0; len = strlen(str); 28 | while (pos < len && str_getchar(str, pos) != chr) (pos += 1); 29 | pos < len ? pos : -1; 30 | ); 31 | 32 | function RPos(chr, str) global() 33 | local(pos) 34 | ( 35 | pos = strlen(str) - 1; 36 | while (pos >= 0 && str_getchar(str, pos) != chr) (pos -= 1); 37 | pos; 38 | ); 39 | 40 | function PosSet(set, str) global() 41 | local(pos, len) 42 | ( 43 | pos = 0; len = strlen(str); 44 | while (pos < len && Pos(str_getchar(str, pos), set) < 0) (pos += 1); 45 | pos < len ? pos : -1; 46 | ); 47 | 48 | -------------------------------------------------------------------------------- /jsfx-inc/pas.sysutils.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: SysUtils 3 | ** Desc: This is part of a Pascal style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import pas.system.jsfx-inc 12 | 13 | @init 14 | 15 | function LastDelimiter(delimiters, str) global() 16 | local(pos) 17 | ( 18 | pos = strlen(str) - 1; 19 | while (pos >= 0 && PosSet(delimiters, ChrToStr(str_getchar(str, pos))) < 0) (pos -= 1); 20 | pos; 21 | ); 22 | 23 | // Returns true if file exists. 24 | function FileExists(filename) global() 25 | ( 26 | // NOTE: We must prepend the program directory to filenames. 27 | ! 28 | "struct stat buffer;" 29 | "return stat((ProgramDirectory() + *GetString(filename$)).c_str(), &buffer) == 0"; 30 | 1; // Always returns true in REAPER. 31 | ); 32 | 33 | -------------------------------------------------------------------------------- /jsfx-inc/pas.types.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | // Point Object 5 | 6 | // Initializes this 2D point. 7 | function TPoint_Set(x, y) global() 8 | ( 9 | this.x = x; 10 | this.y = y; 11 | ); 12 | 13 | // Initializes this 3D point. 14 | function TPoint_Set(x, y, z) global() 15 | ( 16 | this.x = x; 17 | this.y = y; 18 | this.z = z; 19 | ); 20 | 21 | // Returns TRUE if this 2D point is inside given rectange. 22 | function TPoint_Inside(x1, y1, x2, y2) global() 23 | ( 24 | this.x >= x1 && this.x < x2 && 25 | this.y >= y1 && this.y < y2; 26 | ); 27 | 28 | // Returns TRUE if this 3D point is inside given rectange. 29 | function TPoint_Inside(x1, y1, z1, x2, y2, z2) global() 30 | ( 31 | this.x >= x1 && this.x < x2 && 32 | this.y >= y1 && this.y < y2 && 33 | this.z >= z1 && this.z < z2; 34 | ); 35 | 36 | // Rect Object 37 | 38 | // Initializes this 2D rectangle. 39 | function TRect_SetRect(x1, y1, x2, y2) global() 40 | ( 41 | this.x1 = x1; this.y1 = y1; 42 | this.x2 = x2; this.y2 = y2; 43 | ); 44 | 45 | // Initializes this 3D rectangle. 46 | function TRect_SetRect(x1, y1, z1, x2, y2, z2) global() 47 | ( 48 | this.x1 = x1; this.y1 = y1; this.z1 = z1; 49 | this.x2 = x2; this.y2 = y2; this.z2 = z2; 50 | ); 51 | 52 | // Returns the width of this rectange. 53 | function TRect_GetWidth() global() 54 | ( 55 | this.x2 - this.x1; 56 | ); 57 | 58 | // Returns the height of this rectangle. 59 | function TRect_GetHeight() global() 60 | ( 61 | this.y2 - this.y1; 62 | ); 63 | 64 | // Returns the depth of this rectangle. 65 | function TRect_GetDepth() global() 66 | ( 67 | this.z2 - this.z1; 68 | ); 69 | 70 | // Offsets (moves) this rectangle by given x & y. 71 | function TRect_Offset(x, y) global() 72 | ( 73 | this.x1 += x; this.y1 += y; 74 | this.x2 += x; this.y2 += y; 75 | ); 76 | 77 | // Inflates this rectangle by given x & y. 78 | function TRect_Inflate(x, y) global() 79 | ( 80 | this.x1 -= x; this.y1 -= y; 81 | this.x2 += x; this.y2 += y; 82 | ); 83 | 84 | // Returns TRUE if x & y are inside this rectangle. 85 | function TRect_Contains(x, y) global() 86 | ( 87 | x >= this.x1 && x < this.x2 && 88 | y >= this.y1 && y < this.y2; 89 | ); 90 | 91 | -------------------------------------------------------------------------------- /jsfx-inc/rbj.jsfx-inc: -------------------------------------------------------------------------------- 1 | @init 2 | 3 | // Init filter given frequency, attenuation and Q factor. 4 | function RBJ.InitFAQ(F, A, Q) global(srate) 5 | ( 6 | this.A = A; 7 | this.w0 = 2 * $pi * F / srate; 8 | this.cos = cos(this.w0); 9 | this.sin = sin(this.w0); 10 | this.alpha = this.sin / (2 * Q); 11 | ); 12 | 13 | // Init filter given frequency and Q factor. 14 | function RBJ.InitFQ(F, Q) global() 15 | ( 16 | this.RBJ.InitFAQ(F, 0, Q); 17 | ); 18 | 19 | // Init filter given frequency, attenuation and shelf slope. 20 | function RBJ.InitFAS(F, A, S) global() 21 | ( 22 | this.RBJ.InitFAQ(F, A, 1 / (sqrt((A + 1 / A) * (1 / S - 1) + 2))); 23 | ); 24 | 25 | // Init filter given frequency and attenuation. 26 | function RBJ.InitFA(F, A) global() 27 | ( 28 | this.RBJ.InitFAS(F, A, 1); 29 | ); 30 | 31 | function RBJ.InitFGS1(F, G, S) global() 32 | ( 33 | this.RBJ.InitFAS(F, sqrt(10 ^ (G / 20)), S); 34 | ); 35 | 36 | function RBJ.InitFGS1(F, G) global() 37 | ( 38 | this.RBJ.InitFGS1(F, G, 1); 39 | ); 40 | 41 | function RBJ.InitFGS2(F, G, S) global() 42 | ( 43 | this.RBJ.InitFAS(F, 10 ^ (G / 40), S); 44 | ); 45 | 46 | function RBJ.InitFGS2(F, dBgain) global() 47 | ( 48 | this.RBJ.InitFGS2(F, dBgain, 1); 49 | ); 50 | 51 | function RBJ.Invert() global() 52 | instance(a0, a1, a2, b0, b1, b2) 53 | ( 54 | b0 /= a0; b1 /= a0; b2 /= a0; 55 | a1 /= a0; a2 /= a0; 56 | 0; 57 | ); 58 | 59 | function RBJ.Sample(spl) global() 60 | instance(b0, b1, b2, a1, a2, x1, x2, y1, y2) 61 | local(op) 62 | ( 63 | op = b0 * spl + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2; 64 | x2 = x1; x1 = spl; y2 = y1; y1 = op; 65 | ); 66 | 67 | function RBJ.LPF() global() 68 | instance(alpha, cos, a0, a1, a2, b0, b1, b2) 69 | ( 70 | b0 = (1 - cos) / 2; 71 | b1 = (1 - cos); 72 | b2 = (1 - cos) / 2; 73 | a0 = 1 + alpha; 74 | a1 = -2 * cos; 75 | a2 = 1 - alpha; 76 | this.RBJ.Invert(); 77 | ); 78 | 79 | function RBJ.HPF() global() 80 | instance(alpha, cos, a0, a1, a2, b0, b1, b2) 81 | ( 82 | b0 = (1 + cos) / 2; 83 | b1 = -(1 + cos); 84 | b2 = (1 + cos) / 2; 85 | a0 = 1 + alpha; 86 | a1 = -2 * cos; 87 | a2 = 1 - alpha; 88 | this.RBJ.Invert(); 89 | ); 90 | 91 | function RBJ.Notch() global() 92 | instance(alpha, cos, a0, a1, a2, b0, b1, b2) 93 | ( 94 | b0 = 1; 95 | b1 = -2 * cos; 96 | b2 = 1; 97 | a0 = 1 + alpha; 98 | a1 = -2 * cos; 99 | a2 = 1 - alpha; 100 | this.RBJ.Invert(); 101 | ); 102 | 103 | function RBJ.APF() global() 104 | instance(alpha, cos, a0, a1, a2, b0, b1, b2) 105 | ( 106 | b0 = 1 - alpha; 107 | b1 = -2 * cos; 108 | b2 = 1 + alpha; 109 | a0 = 1 + alpha; 110 | a1 = -2 * cos; 111 | a2 = 1 - alpha; 112 | this.RBJ.Invert(); 113 | ); 114 | 115 | function RBJ.PeakEq() global() 116 | instance(alpha, cos, a0, a1, a2, b0, b1, b2, A) 117 | ( 118 | b0 = 1 + alpha * A; 119 | b1 = -2 * cos; 120 | b2 = 1 - alpha * A; 121 | a0 = 1 + alpha / A; 122 | a1 = -2 * cos; 123 | a2 = 1 - alpha / A; 124 | this.RBJ.Invert(); 125 | ); 126 | 127 | 128 | -------------------------------------------------------------------------------- /jsfx-inc/std.array.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: memory 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.cstdlib.jsfx-inc 12 | 13 | @init 14 | 15 | // Returns a direct pointer to the memory array used internally by the vector to store its owned elements. 16 | function data() global() 17 | ( 18 | this; 19 | ); 20 | 21 | // Returns the number of elements of a memory block or string. 22 | function size() global() 23 | ( 24 | this ? mcheck(this) ? _msize(this) : strlen(this) : 0; 25 | ); 26 | 27 | function begin() global() 28 | ( 29 | 0; 30 | ); 31 | 32 | function end() global() 33 | ( 34 | this.size() - 1; 35 | ); 36 | 37 | function get(idx) global() 38 | ( 39 | this ? mcheck(this) ? this[idx] : str_getchar(this, idx) : 0; 40 | ); 41 | 42 | function set(idx, value) global() 43 | ( 44 | this ? mcheck(this) ? this[idx] = value : str_setchar(this, idx, value) : 0; 45 | ); 46 | 47 | 48 | // Resizes memory or string so that it contains n elements. 49 | function resize(n) global() 50 | ( 51 | !this || mcheck(this) ? this = realloc(this, n, 1) : str_setlen(this, n); 52 | ); 53 | 54 | // Removes all elements from memory/string, leaving the container with a size of 0. 55 | function clear() global() 56 | ( 57 | this.resize(0); 58 | ); 59 | 60 | function empty() global() 61 | ( 62 | this.resize(0); 63 | ); 64 | 65 | // Returns the first element in the vector. 66 | function front() global() 67 | ( 68 | this.get(this.begin()); 69 | ); 70 | 71 | // Returns the last element in the vector. 72 | function back() global() 73 | ( 74 | this.get(this.end()); 75 | ); 76 | 77 | function fill(value, begin, end) global() 78 | ( 79 | while (begin <= end) ( 80 | this.set(begin, value); 81 | begin += 1; 82 | ); 83 | this; 84 | ); 85 | 86 | function fill(value, begin) global() 87 | ( 88 | this.fill(value, begin, this.end()); 89 | ); 90 | 91 | function fill(value) global() 92 | ( 93 | this.fill(value, this.begin()); 94 | ); 95 | 96 | function find(value, begin, end) global() 97 | ( 98 | while (begin <= end && this.get(begin) != value) ( begin += 1; ); 99 | begin <= end ? begin : -1; 100 | ); 101 | 102 | function find(value, begin) global() 103 | ( 104 | this.find(value, begin, this.end()); 105 | ); 106 | 107 | function find(value) global() 108 | ( 109 | this.find(value, this.begin()); 110 | ); 111 | 112 | function rfind(value, begin, end) global() 113 | ( 114 | while (begin <= end && this.get(end) != value) ( end -= 1; ); 115 | begin <= end ? end : -1; 116 | ); 117 | 118 | function rfind(value, begin) global() 119 | ( 120 | this.rfind(value, begin, this.end()); 121 | ); 122 | 123 | function rfind(value) global() 124 | ( 125 | this.rfind(value, this.begin()); 126 | ); 127 | 128 | function count(value, begin end) global() local(count) 129 | ( 130 | count = 0; 131 | while (begin <= end) ( 132 | this.get(begin) == value ? count += 1; 133 | begin += 1; 134 | ); 135 | count; 136 | ); 137 | 138 | function count(value, begin) global() 139 | ( 140 | this.count(value, begin, this.end()); 141 | ); 142 | 143 | function count(value) global() 144 | ( 145 | this.count(value, this.begin()); 146 | ); 147 | 148 | function reverse(begin, end) global() local(value) 149 | ( 150 | while (begin <= end) ( 151 | value = this.get(begin); 152 | this.set(begin, this.get(end)); 153 | this.set(end, value); 154 | begin += 1; 155 | end -= 1; 156 | ); 157 | this; 158 | ); 159 | 160 | -------------------------------------------------------------------------------- /jsfx-inc/std.cassert.jsfx-inc: -------------------------------------------------------------------------------- 1 | 2 | @init 3 | 4 | function _assert(message, file, line) 5 | ( 6 | fprintf(stderr, "Assertion failed: %s, file %s, line %d\n", message, file, line); 7 | ); 8 | 9 | function assert(true, message, file, line) global() 10 | ( 11 | !true ? _assert(message, file, line); 12 | ); 13 | 14 | function assert(true, message, file) global() 15 | ( 16 | assert(true, message, file, -1); 17 | ); 18 | 19 | function assert(true, message) global() 20 | ( 21 | assert(true, message, "unknown"); 22 | ); 23 | 24 | function assert(true) global() 25 | ( 26 | assert(true, "error"); 27 | ); 28 | 29 | -------------------------------------------------------------------------------- /jsfx-inc/std.cconio.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: conio.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.cstdio.jsfx-inc 12 | import std.cmath.jsfx-inc 13 | 14 | import pas.graphics.jsfx-inc 15 | 16 | @init 17 | 18 | // clrscr function clears the screen amd move the cursor to upper left hand corner of screen. 19 | function clrscr() global(stdout) 20 | ( 21 | strcpy(stdout, ""); 22 | ); 23 | 24 | // Draws a very basic console window with scrollbar. Nothing fancy. 25 | function Console.Draw(x1, y1, x2, y2, str) 26 | global(gfx_texth, mouse_cap, mouse_y) 27 | global(clBtnFace, clBtnShadow, clBtnHighlight, Canvas*) 28 | local(min, max, count, pos, end) 29 | ( 30 | Canvas.Frame3D(x1, y1, x2, y2, clBtnShadow, clBtnHighlight, 0x332222); 31 | x1 += 4; y1 += 4; 32 | x2 -= 4; y2 -= 4; 33 | Canvas.Font.Name = "Courier New"; 34 | Canvas.Font.Size = 14; 35 | Canvas.Font.Color = 0xFFFF00; 36 | Canvas.PenPos.y = y1 - (this.pos * gfx_texth); 37 | count = pos = 0; 38 | while(pos < strlen(str)) ( 39 | (end = strchr(str, '\n', pos)) < 0 ? end = strlen(str); 40 | Canvas.PenPos.y >= y1 && Canvas.PenPos.y < y2 - gfx_texth ? ( 41 | Canvas.TextOut(x1,Canvas.PenPos.y, strcpy_substr(#, str, pos, end - pos)); 42 | ); 43 | Canvas.PenPos.y += gfx_texth; 44 | count += 1; 45 | pos = end + 1; 46 | ); 47 | min = 0; 48 | max = max(min, floor(count - (y2 - y1) / gfx_texth)); 49 | 50 | mouse_cap & 1 ? this.pos = floor((mouse_y / (y2 - y1)) * (max - min + 1)); 51 | 52 | this.pos = minmax(this.pos, min, max); 53 | Canvas.Frame3D(x2 - 16, y1, x2, y2, clBtnFace, clBtnHighlight, clBtnShadow); 54 | Canvas.Frame3D( 55 | x2 - 16, y1 + (y2 - y1) * this.pos / (max - min + 1), 56 | x2, y1 + (y2 - y1) * (this.pos + 1) / (max - min + 1), clBtnHighlight, clBtnShadow, clBtnFace); 57 | ); 58 | 59 | function Console.Draw(x1, y1, x2, y2) global(stdout) 60 | ( 61 | this.Console.Draw(x1, y1, x2, y2, stdout); 62 | ); 63 | 64 | function Console.Draw() global(gfx_w, gfx_h) 65 | ( 66 | this.Console.Draw(0, 0, gfx_w, gfx_h); 67 | ); 68 | 69 | @gfx 600 400 70 | 71 | Console.Draw(); 72 | 73 | -------------------------------------------------------------------------------- /jsfx-inc/std.cheap.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: heap.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.cstddef.jsfx-inc 12 | 13 | @init 14 | 15 | // Sets the starting offset for heap memory. Also resets heap link list. 16 | function heap.min(min) global() 17 | ( 18 | this.min = this.max = max(size_t(min), 4 << 16); 19 | this.min[] = 0; 20 | ); 21 | 22 | function heap.max(max) global() 23 | ( 24 | this.max = max(this.min, size_t(max)); 25 | ); 26 | 27 | heap.min(0); 28 | 29 | // Returns the max heap used. Includes memory that was freed. 30 | function heap.size() global() 31 | ( 32 | this.max - this.min; 33 | ); 34 | 35 | // Checks the heap block is valid. Not 100% perfect, but the best we can achieve. 36 | function heap.check(block) global() 37 | ( 38 | block >= this.min && (block[] <= -1 || block[] >= 1); 39 | ); 40 | 41 | // Returns true if heap block is free. 42 | function heap.isfree(block) global() 43 | ( 44 | this.heap.check(block) && block[] < 0; 45 | ); 46 | 47 | // Merges free blocks into one free block. 48 | function heap.merge(block) global() local(ptr, size) 49 | ( 50 | this.heap.isfree(block) ? ( 51 | size = 0; ptr = block; 52 | while (this.heap.isfree(ptr)) ( size += ptr[]; ptr += abs(ptr[]); ); 53 | block[] = size; 54 | ); 55 | ); 56 | 57 | /* 58 | Checks if block is avaliable to store a given size. Also handles merging 59 | of freed blocks after given block. 60 | */ 61 | function heap.avail(block, size) global() 62 | ( 63 | !this.heap.check(block) ? block[] = -0x80000000; // 1 gig should be more than enough. 64 | this.heap.merge(block); 65 | size <= -block[]; 66 | ); 67 | 68 | -------------------------------------------------------------------------------- /jsfx-inc/std.cmath.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: math.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | @init 12 | 13 | // Constants 14 | 15 | M_E = 2.7182818284590452354; 16 | M_LOG2E = 1.4426950408889634074; 17 | M_LOG10E = 0.43429448190325182765; 18 | M_LN2 = 0.69314718055994530942; 19 | M_LN10 = 2.30258509299404568402; 20 | M_PI = 3.14159265358979323846; 21 | M_PI_2 = 1.57079632679489661923; 22 | M_PI_4 = 0.78539816339744830962; 23 | M_1_PI = 0.31830988618379067154; 24 | M_2_PI = 0.63661977236758134308; 25 | M_2_SQRTPI = 1.12837916709551257390; 26 | M_SQRT2 = 1.41421356237309504880; 27 | M_SQRT1_2 = 0.70710678118654752440; 28 | 29 | // Rounds x toward zero, returning the nearest integral value that is not larger in magnitude than x. 30 | function trunc(x) global() 31 | ( 32 | x < 0 ? ceil(x) : floor(x); 33 | ); 34 | 35 | // Returns the integral value that is nearest to x, with halfway cases rounded away from zero. 36 | function round(x) global() 37 | ( 38 | x < 0 ? ceil(x - 0.5) : floor(x + 0.5); 39 | ); 40 | 41 | // Calculates sine and cosine value of _X 42 | function sincos(x, sin*, cos*) global() 43 | ( 44 | sin = sin(x); 45 | cos = cos(x); 46 | ); 47 | 48 | // Hyperbolic sine of x = sinh x = (ex - e-x)/2 49 | function sinh(x) global() local(e1, e2) 50 | ( 51 | !"return sinh(x$)"; // C++ 52 | e1 = exp(+x); 53 | e2 = exp(-x); 54 | (e1 - e2) * 0.5; 55 | ); 56 | 57 | // Hyperbolic cosine of x = cosh x = (ex + e-x)/2 58 | function cosh(x) global() local(e1, e2) 59 | ( 60 | !"return cosh(x$)"; // C++ 61 | e1 = exp(+x); 62 | e2 = exp(-x); 63 | (e1 + e2) * 0.5; 64 | ); 65 | 66 | // Hyperbolic tangent of x = tanh x = (ex - e-x)/(ex + e-x) 67 | function tanh(x) global() local(e1, e2) 68 | ( 69 | !"return tanh(x$)"; // C++ 70 | e1 = exp(+x); 71 | e2 = exp(-x); 72 | (e1 - e2) / (e1 + e2); 73 | ); 74 | 75 | // Hyperbolic cotangent of x = coth x = (ex + e-x)/(ex - e-x) 76 | function coth(x) global() local(e1, e2) 77 | ( 78 | e1 = exp(+x); 79 | e2 = exp(-x); 80 | (e1 + e2) / (e1 - e2); 81 | ); 82 | 83 | // Hyperbolic secant of x = sech x = 2/(ex + e-x) 84 | function sech(x) global() local(e1, e2) 85 | ( 86 | e1 = exp(+x); 87 | e2 = exp(-x); 88 | 2 / (e1 + e2); 89 | ); 90 | 91 | // Hyperbolic cosecant of x = csch x = 2/(ex - e-x) 92 | function csch(x) global() local(e1, e2) 93 | ( 94 | e1 = exp(+x); 95 | e2 = exp(-x); 96 | 2 / (e1 - e2); 97 | ); 98 | 99 | function logx(x, a) global() 100 | ( 101 | log(x) / log(a); 102 | ); 103 | 104 | // Returns the binary (base-2) logarithm of x. 105 | function log2(x) global() 106 | ( 107 | logx(x, 2); 108 | ); 109 | 110 | // Note a standard C++ function. 111 | function ln(x) global() 112 | ( 113 | logx(x, 2.718281828459045235); 114 | ); 115 | 116 | // Basic operations 117 | 118 | // Absolute value of a floating point value (|x|) 119 | function fabs(x) global() 120 | ( 121 | !"return fabs(x$)"; // C++ 122 | abs(x); 123 | ); 124 | 125 | // Remainder of the floating point division operation 126 | function fmod(x, y) global() 127 | ( 128 | !"return fmod(x$, y$)"; // C++ 129 | x % y; 130 | ); 131 | 132 | /* 133 | Breaks x into an integral and a fractional part. 134 | The integer part is stored in the object pointed by intpart, and the fractional part is returned by the function. 135 | */ 136 | function modf(x, intpart*) global() 137 | ( 138 | x - (intpart = floor(x)); 139 | ); 140 | 141 | // Larger of two floating point values 142 | function fmax(x, y) global() 143 | ( 144 | !"return fmax(x$, y$)"; // C++ 145 | max(x, y); 146 | ); 147 | 148 | // Smaller of two floating point values 149 | function fmin(x, y) global() 150 | ( 151 | !"return fmin(x$, y$)"; // C++ 152 | min(x, y); 153 | ); 154 | 155 | // Positive difference of two floating point values (max(0, x-y)) 156 | function fdim(x, y) global() 157 | ( 158 | !"return fdim(x$, y$)"; // C++ 159 | max(0, x - y); 160 | ); 161 | 162 | // Power functions 163 | 164 | // computes square root of the sum of the squares of two given numbers (√x2+y2) 165 | function hypot(x, y) global() 166 | ( 167 | !"return hypot(x$, y$)"; // C++ 168 | sqrt(sqr(x) + sqr(y)); 169 | ); 170 | 171 | // Returns the cubic root of x. 172 | function cbrt(x) global() 173 | ( 174 | !"return cbrt(x$)"; // C++ 175 | x ^ (1 / 3); 176 | ); 177 | 178 | // Returns x*y+z. 179 | function fma(x, y, z) global() 180 | ( 181 | !"return fma(x$, y$, z$)"; // C++ 182 | x * y + z; 183 | ); 184 | 185 | function minmax(x, min, max) 186 | ( 187 | min(max(x, min), max); 188 | ); 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /jsfx-inc/std.cmemory.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: memory.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | @init 12 | 13 | -------------------------------------------------------------------------------- /jsfx-inc/std.cnew.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: new.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.cstring.jsfx-inc 12 | 13 | @init 14 | 15 | function _def(type, size) global() 16 | ( 17 | str_setlen(type, 0); 18 | str_setlen(type, size); 19 | ); 20 | 21 | function _new(type) global() local(handle) 22 | ( 23 | handle = strlen(type) - 1; 24 | while (handle > 0 && str_getchar(type, handle) != $' ') ( handle -= 1; ); 25 | str_setchar(type, handle, $'.'); 26 | handle; 27 | ); 28 | 29 | function _delete(type, handle) global() 30 | ( 31 | str_setchar(type, handle, $' '); 32 | 0; 33 | ); 34 | 35 | function _count(type) global() 36 | ( 37 | strccnt(type, $'.'); 38 | ); 39 | 40 | _def(#string_t, 1024); 41 | _def(#image_t, 128); 42 | _def(#font_t, 17); 43 | 44 | function salloc() global(#string_t) local() 45 | ( 46 | strcpy(_new(#string_t), ""); 47 | ); 48 | 49 | function sfree(handle) global(#string_t) 50 | ( 51 | _delete(#string_t, handle); 52 | ); 53 | 54 | function scount() global(#string_t) 55 | ( 56 | _count(#string_t); 57 | ); 58 | 59 | function ialloc() global(#image_t) 60 | ( 61 | _new(#image_t) 62 | ); 63 | 64 | function ifree(handle) global(#image_t) 65 | ( 66 | _delete(#image_t, handle); 67 | ); 68 | 69 | function icount() global(#image_t) 70 | ( 71 | _count(#image_t); 72 | ); 73 | 74 | -------------------------------------------------------------------------------- /jsfx-inc/std.cstdbool.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: stdbool.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | @init 12 | 13 | true = 1; 14 | false = 0; 15 | 16 | __bool_true_false_are_defined = true; 17 | 18 | -------------------------------------------------------------------------------- /jsfx-inc/std.cstddef.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: stddef.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | @init 12 | 13 | NULL = 0; 14 | 15 | function size_t(x) global() 16 | ( 17 | max(floor(x), 0); 18 | ); 19 | 20 | function bool_t(x) global() 21 | ( 22 | x ? 1 : 0; 23 | ); 24 | 25 | -------------------------------------------------------------------------------- /jsfx-inc/std.cstdio.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: stdio.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.cstring.jsfx-inc 12 | 13 | @init 14 | 15 | stdout = strcpy(#stdout, ""); 16 | stderr = strcpy(#stderr, ""); 17 | stdin = strcpy(#stdin , ""); // Unused 18 | 19 | function fputs(str, file) global() 20 | ( 21 | strcat(file, str); 22 | ); 23 | 24 | function puts(s) global(stdout) 25 | ( 26 | fputs(strcat(strcpy(#, s), "\n"), stdout); 27 | ); 28 | 29 | function fprintf(file, fmt ) global() ( fputs(sprintf(#, fmt), file); ); 30 | function fprintf(file, fmt, a ) global() ( fputs(sprintf(#, fmt, a), file); ); 31 | function fprintf(file, fmt, a, b ) global() ( fputs(sprintf(#, fmt, a, b), file); ); 32 | function fprintf(file, fmt, a, b, c ) global() ( fputs(sprintf(#, fmt, a, b, c), file); ); 33 | function fprintf(file, fmt, a, b, c, d ) global() ( fputs(sprintf(#, fmt, a, b, c, d), file); ); 34 | function fprintf(file, fmt, a, b, c, d, e) global() ( fputs(sprintf(#, fmt, a, b, c, d, e), file); ); 35 | 36 | function printf(fmt ) global(stdout) ( fprintf(stdout, fmt); ); 37 | function printf(fmt, a ) global(stdout) ( fprintf(stdout, fmt, a); ); 38 | function printf(fmt, a, b ) global(stdout) ( fprintf(stdout, fmt, a, b); ); 39 | function printf(fmt, a, b, c ) global(stdout) ( fprintf(stdout, fmt, a, b, c); ); 40 | function printf(fmt, a, b, c, d ) global(stdout) ( fprintf(stdout, fmt, a, b, c, d); ); 41 | function printf(fmt, a, b, c, d, e) global(stdout) ( fprintf(stdout, fmt, a, b, c, d, e); ); 42 | 43 | // Call this in your @gfx section to display stderr. 44 | function gfx_stderr(x1, y1, x2, y2) 45 | global(gfx_x, gfx_y, gfx_r, gfx_g, gfx_b, gfx_a) 46 | global(stderr) 47 | ( 48 | strlen(stderr) ? ( 49 | gfx_a = 0.5; 50 | gfx_r = gfx_g = gfx_b = 0; 51 | gfx_x = x1; gfx_y = y1; 52 | gfx_rectto(x2, y2); 53 | gfx_setfont(0); 54 | gfx_r = gfx_a = 1; 55 | gfx_g = gfx_b = 0; 56 | gfx_x = x1 + 4; 57 | gfx_y = y1 + 4; 58 | gfx_drawstr(stderr); 59 | ); 60 | ); 61 | 62 | -------------------------------------------------------------------------------- /jsfx-inc/std.cstdlib.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: stdlib.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.cheap.jsfx-inc 12 | 13 | @init 14 | 15 | function malloc(size) global(heap*) local(block) 16 | ( 17 | size = size_t(size) + 1; 18 | size >= 1 && size < 0x80000000 ? ( 19 | block = heap.min; 20 | while (!heap.avail(block, size)) ( block += abs(block[]); ); 21 | size != -block[] ? block[size] = block[] + size; 22 | block[] = size; 23 | heap.max(max(heap.max, block + size)); 24 | block + 1; 25 | ) : 0; 26 | ); 27 | 28 | function calloc(size) global() 29 | ( 30 | size = size_t(size); 31 | memset(malloc(size), 0, size); 32 | ); 33 | 34 | function calloc(count, size) global() 35 | ( 36 | calloc(size_t(count) * size_t(size)); 37 | ); 38 | 39 | function mcheck(memory) global(heap*) 40 | ( 41 | heap.check(memory - 1); 42 | ); 43 | 44 | function _msize(memory) global() 45 | ( 46 | mcheck(memory) && memory[-1] > 0 ? memory[-1] - 1 : 0; 47 | ); 48 | 49 | function malloc_size(memory) global() 50 | ( 51 | _msize(memory); 52 | ); 53 | 54 | function free(memory) global() 55 | ( 56 | mcheck(memory) ? memory[-1] = -abs(memory[-1]); 57 | 0; 58 | ); 59 | 60 | function realloc(memory, size, clear) global() local(newmem) 61 | ( 62 | size = size_t(size); 63 | size == _msize(memory) ? ( 64 | memory; 65 | ) : ( 66 | newmem = clear ? calloc(size) : malloc(size); 67 | memcpy(newmem, memory, min(size, _msize(memory))); 68 | free(memory); 69 | newmem; 70 | ); 71 | ); 72 | 73 | function realloc(m, n) global() 74 | ( 75 | realloc(m, n, 0); 76 | ); 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /jsfx-inc/std.cstring.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: string.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.ctype.jsfx-inc 12 | import std.array.jsfx-inc 13 | 14 | @init 15 | 16 | // Compares the two strings s1 and s2, ignoring the case of the characters. 17 | function strcasecmp(s1, s2) global() 18 | ( 19 | stricmp(s1, s2); 20 | ); 21 | 22 | /* 23 | Compares the two strings s1 and s2, ignoring the case of the characters. 24 | Same as strcasecmp, except it only compares the first n bytes of s1. 25 | */ 26 | function strncasecmp(s1, s2, n) global() 27 | ( 28 | strnicmp(s1, s2, n); 29 | ); 30 | 31 | // Returns the position of a char in a string starting at pos. (-1 if not found) 32 | function strchr(str, chr, pos) global() 33 | ( 34 | this = str; 35 | this.find(chr, pos); 36 | ); 37 | 38 | // Returns the position of a char in a string starting at 0. (-1 of not found) 39 | function strchr(str, chr) global() 40 | ( 41 | strchr(str, chr, 0); 42 | ); 43 | 44 | // Returns the position to the last occurrence of character in the string str. (-1 of not found) 45 | function strrchr(str, chr, pos) global() 46 | ( 47 | this = str; 48 | this.rfind(chr, 0, pos); 49 | ); 50 | 51 | // Returns the position to the last occurrence of character in the C string str. (-1 of not found) 52 | function strrchr(str, chr) global() 53 | ( 54 | strrchr(str, chr, strlen(str) - 1); 55 | ); 56 | 57 | // Converts a string to lowercase. 58 | function strlwr(str) global() local(pos) 59 | ( 60 | pos = strlen(str); 61 | while (pos > 0) ( 62 | pos -= 1; 63 | str_setchar(str, pos, tolower(str_getchar(str, pos))); 64 | ); 65 | str; 66 | ); 67 | 68 | // Converts a string to uppercase. 69 | function strupr(str) global() local(pos) 70 | ( 71 | pos = strlen(str); 72 | while (pos > 0) ( 73 | pos -= 1; 74 | str_setchar(str, pos, toupper(str_getchar(str, pos))); 75 | ); 76 | str; 77 | ); 78 | 79 | // Sets characters of a string to a character. 80 | function strset(str, chr) global() 81 | ( 82 | this = str; 83 | this.fill(chr); 84 | ); 85 | 86 | // Reverses the characters of a string. 87 | function strrev(str) global() local(pos, end, chr) 88 | ( 89 | this = str; 90 | this.reverse(this.begin(), this.end()); 91 | ); 92 | 93 | /* 94 | Duplicates strings. This copies a string to a temp (#) string, which is 95 | useful for converting a literal (constant) string to a variable string. 96 | */ 97 | function strdup(str) global() 98 | ( 99 | strcpy(#, str); 100 | ); 101 | 102 | // Count the number of (chr) in the string (str). Not standard, but very useful. 103 | function strccnt(str, chr) global() 104 | ( 105 | this = str; 106 | this.count(chr); 107 | ); 108 | 109 | // NON-STANDARD STRING FUNCTIONS 110 | 111 | /* 112 | Splits a string 'src' at char 'chr' to a string array 'dst'. (Returns string count) 113 | Note: Always returns at least one string. 114 | */ 115 | function strsplit(src, dst, chr) global() local(return, pos, end) 116 | ( 117 | return = pos = 0; 118 | while ((end = strchr(src, chr, pos)) >= 0) ( 119 | strcpy_substr(dst + return, src, pos, end - pos); 120 | return += 1; pos = end + 1; 121 | ); 122 | strcpy_substr(dst + return, src, pos); 123 | return += 1; 124 | ); 125 | 126 | // strextract 127 | function strextract(d, s, index) global() local(i, e, l) 128 | ( 129 | e = -1; 130 | l = strlen(s); 131 | while ( 132 | i = e + 1; 133 | (e = strchr(s, ',', i)) < 0 ? e = l; 134 | (index -= 1) >= 0; 135 | ); 136 | strcpy_substr(d, s, i, e - i); 137 | ); 138 | 139 | // strskip 140 | function strskip(s, i, c) global() local(return, len) 141 | ( 142 | return = 0; 143 | len = strlen(s); 144 | while (i && return < len) ( 145 | (return = strchr(s, c, return) + 1) <= 0 ? return = len; 146 | i -= 1; 147 | ); 148 | return; 149 | ); 150 | 151 | -------------------------------------------------------------------------------- /jsfx-inc/std.ctype.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: ctype.h 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | @init 12 | 13 | // Checks whether c is a white-space character. 14 | function isspace (c) global() ( c == 32 || (c >= 9 && c <= 13) ); 15 | 16 | // Checks whether c is a blank character. A blank character is a space character used to separate words within a line of text. 17 | function isblank (c) global() ( c == 32 || c == 9); 18 | 19 | // Checks whether c is a control character. 20 | function iscntrl (c) global() ( (c > 0 && c < 32) || c == 127); 21 | 22 | // Checks whether c is a decimal digit character. 23 | function isdigit (c) global() ( c >= $'0' && c <= $'9' ); 24 | 25 | // Checks whether c is a lowercase letter. 26 | function islower (c) global() ( c >= $'a' && c <= $'z' ); 27 | 28 | // Checks if parameter c is an uppercase alphabetic letter. 29 | function isupper (c) global() ( c >= $'A' && c <= $'Z' ); 30 | 31 | // Checks whether c is an alphabetic letter. 32 | function isalpha (c) global() ( isupper(c) || islower(c) ); 33 | 34 | // Checks whether c is either a decimal digit or an uppercase or lowercase letter. 35 | function isalnum (c) global() ( isalpha(c) || isdigit(c) ); 36 | 37 | // Checks whether c is a printable character. 38 | function isprint (c) global() ( c >= 32 && c != 127 ); 39 | 40 | // Checks whether c is a character with graphical representation. (same as isprint except no space) 41 | function isgraph (c) global() ( c > 32 && c != 127 ); 42 | 43 | // Checks whether c is a punctuation character. 44 | function ispunct (c) global() ( isgraph(c) && !isalpha(c) ); 45 | 46 | // Checks whether c is a hexdecimal digit character. 47 | function isxdigit(c) global() ( isdigit(c) || (c >= $'a' && c <= $'f') || (c >= $'A' && c <= $'F')); 48 | 49 | /* 50 | Converts c to its lowercase equivalent if c is an uppercase letter and has a lowercase equivalent. 51 | If no such conversion is possible, the value returned is c unchanged. 52 | */ 53 | function tolower (c) global() ( isupper(c) ? c - $'A' + $'a' : c ); 54 | 55 | /* 56 | Converts c to its uppercase equivalent if c is a lowercase letter and has an uppercase equivalent. 57 | If no such conversion is possible, the value returned is c unchanged. 58 | */ 59 | function toupper (c) global() ( islower(c) ? c - $'a' + $'A' : c ); 60 | 61 | -------------------------------------------------------------------------------- /jsfx-inc/std.string.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: string 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.cnew.jsfx-inc 12 | import std.array.jsfx-inc 13 | 14 | @init 15 | 16 | function c_str() global(new*) 17 | ( 18 | this == 0 ? this = salloc() : this; 19 | ); 20 | 21 | function string(str) global() 22 | ( 23 | strcpy(this.c_str(), str); 24 | ); 25 | 26 | function string(str, pos) global() 27 | ( 28 | strcpy_substr(this.c_str(), str, pos); 29 | ); 30 | 31 | function string(str, pos, len) global() 32 | ( 33 | strcpy_substr(this.c_str(), str, pos, len); 34 | ); 35 | 36 | function length() global() 37 | ( 38 | strlen(this.c_str()); 39 | ); 40 | 41 | function substr(pos) global() 42 | ( 43 | strcpy_substr(#, this.c_str(), pos); 44 | ); 45 | 46 | function substr(pos, len) global() 47 | ( 48 | strcpy_substr(#, this.c_str(), pos, len); 49 | ); 50 | 51 | function upper() 52 | ( 53 | strupr(this.c_str()); 54 | ); 55 | 56 | function lower() 57 | ( 58 | strlwr(this.c_str()); 59 | ); 60 | 61 | 62 | -------------------------------------------------------------------------------- /jsfx-inc/std.vector.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: vector 3 | ** Desc: This is part of a ANSI C style library for Jesusonic. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | ** 8 | ** License: LGPL - http://www.gnu.org/licenses/gpl.html 9 | */ 10 | 11 | import std.array.jsfx-inc 12 | 13 | @init 14 | 15 | function vector(size) global() 16 | ( 17 | this.resize(size); 18 | ); 19 | 20 | // Allocate this 2D vector given a width (w) and height (h). (untested) 21 | // NOTE: Dont use this. It is going to be rewritten. 22 | function vector2(w, h) global() local(y) 23 | ( 24 | this.vector(w * h + h); 25 | y = 0; 26 | while (y < h) ( 27 | this[y] = w * y + h; 28 | y += 1; 29 | ); 30 | ); 31 | 32 | // Adds a new element at the end of the vector, after its current last element. 33 | function push_back(val) global() 34 | ( 35 | this.resize(this.size() + 1); 36 | this[this.size() - 1] = val; 37 | ); 38 | 39 | // Removes the last element in the vector, effectively reducing the container size by one. 40 | function pop_back() global() local(val) 41 | ( 42 | val = this[this.size() - 1]; 43 | this.resize(this.size() - 1); 44 | val; 45 | ); 46 | 47 | // Removes a value from this array given its index position. 48 | function erase(i) global() 49 | ( 50 | i >= 0 && i < this.size() ? ( 51 | while (i < this.size() - 1) ( 52 | this[i] = this[i + 1]; 53 | i += 1; 54 | ); 55 | this.resize(this.size() - 1); 56 | ); 57 | ); 58 | 59 | -------------------------------------------------------------------------------- /jsfx-inc/swipe.array.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: array.jsfx-inc 3 | ** Desc: Array objects for SWIPE. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | */ 8 | 9 | import std.vector.jsfx-inc 10 | import swipe.system.jsfx-inc 11 | 12 | @init 13 | 14 | 15 | // Linear samples a value given its position in this array. 16 | function TArray_GetLinear(x) global() local(fl, fr) 17 | ( 18 | fr = x - (fl = (x|0)); 19 | this[fl % _msize(this)] * (1 - fr) + this[(fl + 1) % _msize(this)] * fr; 20 | ); 21 | 22 | // TBuffer Object 23 | 24 | // A buffer is an array where all the array is used. ie: Count = Size. 25 | function TBuffer(ASize) global() 26 | ( 27 | this.vector(ASize); 28 | ); 29 | 30 | // Gets a value from this buffer relative to the buffers current position marker. 31 | function TBuffer_Get(AIndex) global() 32 | ( 33 | this[(this.Position.Get() + AIndex) % _msize(this)]; 34 | ); 35 | 36 | // Streams a value into a buffer. When the buffer position reaches count, the position is rewounded to zero. 37 | function TBuffer_Stream(AValue) global() 38 | ( 39 | this[this.Position.Get()] = AValue; 40 | this.Position.Inc(1) >= this.size() ? this.Position.Set(0); 41 | ); 42 | 43 | // Initializes this object to a 2D buffer. Used for stereo buffer storage. 44 | function TBuffer2(ASize) global() 45 | ( 46 | this.0.TBuffer(ASize); 47 | this.1.TBuffer(ASize); 48 | ); 49 | 50 | // Stream two values to this buffer. 51 | function TBuffer2_Stream(x, y) global() 52 | ( 53 | this.0.TBuffer_Stream(x); 54 | this.1.TBuffer_Stream(y); 55 | ); 56 | 57 | // TVector Objects 58 | 59 | function TVector2() global() 60 | ( 61 | this.vector(2); 62 | ); 63 | 64 | function TVector3() global() 65 | ( 66 | this.vector(3); 67 | ); 68 | 69 | // Matrix Objects 70 | 71 | function TMatrix33() global() 72 | ( 73 | this.vector2(3, 3); 74 | ); 75 | 76 | function TMatrix44() global() 77 | ( 78 | this.vector2(4, 4); 79 | ); 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /jsfx-inc/swipe.effects.jsfx-inc: -------------------------------------------------------------------------------- 1 | @init 2 | 3 | function EffectFilterParametric(AFreq, AWidth, AGain) local(tmp, a, arc) 4 | ( 5 | AGain = 2 ^ (AGain / 6); 6 | arc = AFreq * $pi / (srate * 0.5); 7 | a = (sin(arc) * AWidth) * (AGain < 1 ? 1 : 0.25); 8 | tmp = 1 / (1 + a); 9 | this.c0 = tmp * a * (AGain - 1); 10 | this.c1 = tmp * 2 * cos(arc); 11 | this.c2 = tmp * (a - 1); 12 | ); 13 | 14 | function EffectFilterParametric() local(tmp) 15 | ( 16 | tmp = this.c0 * (this - this.d2) + this.c1 * this.i1 + this.c2 * this.i2; 17 | this.d2 = this.d1; 18 | this.d1 = this; 19 | this.i2 = this.i1; 20 | this += (this.i1 = tmp); 21 | ); 22 | 23 | -------------------------------------------------------------------------------- /jsfx-inc/swipe.file.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: file.jsfx-inc 3 | ** Desc: A basic file object for the SWIPE library. 4 | ** Note: Im not sure this is a good way todo files, since files are 5 | ** normally opened/closed quickly, therefore they dont require objects. 6 | ** Auth: Derek John Evans 7 | ** 8 | ** Copyright (C) 2015 Derek John Evans 9 | */ 10 | 11 | import swipe.system.jsfx-inc 12 | 13 | @init 14 | 15 | function TFile_Close() global() 16 | ( 17 | this.IsOpen.Get() ? 18 | ( 19 | file_close(this); 20 | this.IsOpen.Set(0); 21 | ); 22 | ); 23 | 24 | function TFile_Open(AFileName) global() 25 | ( 26 | this.TFile_Close(); 27 | this = file_open(AFileName); 28 | this.IsOpen.Set(this >= 0); 29 | ); 30 | 31 | -------------------------------------------------------------------------------- /jsfx-inc/swipe.image.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: image.jsfx-inc 3 | ** Desc: Image functions for the SWIPE library. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | */ 8 | 9 | import std.cnew.jsfx-inc 10 | import swipe.system.jsfx-inc 11 | 12 | import pas.sysutils.jsfx-inc 13 | 14 | @init 15 | 16 | // Initialize this object to an image. Allocates a image slot for this object. 17 | function TImage() global() local(return) 18 | ( 19 | (return = this.TObject()) ? this = ialloc(); 20 | return; 21 | ); 22 | 23 | function TImage_Clear() global() 24 | ( 25 | this.TImage(); 26 | gfx_setimgdim(this, 0, 0); 27 | this.Width.Set(0); 28 | this.Height.Set(0); 29 | ); 30 | 31 | // Loads an image into this objects image slot given a filename. Returns image handle or -1 on error. 32 | function TImage_LoadFromFile(AFileName) global() 33 | local(return, LWidth, LHeight) 34 | ( 35 | this.TImage_Clear(); 36 | FileExists(AFileName) ? ( 37 | (return = gfx_loadimg(this, AFileName) >= 0) ? ( 38 | gfx_getimgdim(this, LWidth, LHeight); 39 | this.Width.Set(LWidth); 40 | this.Height.Set(LHeight); 41 | ); 42 | ) : ( 43 | return = -1; 44 | ); 45 | return; 46 | ); 47 | 48 | // Draws this image object to the given x, y location. 49 | function TImage_Draw(x, y) global() local(w, h) 50 | ( 51 | this.TImage(); 52 | // TODO: Should we be using the objects width/height values here? 53 | gfx_getimgdim(this, w, h); 54 | gfx_blit(this, 1, 0, 0, 0, w, h, x, y, w, h); 55 | ); 56 | 57 | -------------------------------------------------------------------------------- /jsfx-inc/swipe.limits.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: limits.jsfx-inc 3 | ** Desc: Limits object for SWIPE. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | */ 8 | 9 | import swipe.system.jsfx-inc 10 | 11 | @init 12 | 13 | // Limits Object 14 | 15 | // Sets the limits of this object given min, max and def values. 16 | function TLimits(AMin, AMax, ADef) global() 17 | ( 18 | this.IsLimited.Set(1); 19 | this.Min.Set(AMin); 20 | this.Max.Set(AMax); 21 | this.Def.Set(ADef); 22 | ); 23 | 24 | // Sets the limits of this object. Default value = 0. 25 | function TLimits(AMin, AMax) global() 26 | ( 27 | this.TLimits(AMin, AMax, 0); 28 | ); 29 | 30 | // Converts a value to a normalized (0..1) value given this objects limits. 31 | function TLimits_FromNormal(AValue) global() 32 | ( 33 | this.Min.Get() + (this.Max.Get() - this.Min.Get()) * AValue; 34 | ); 35 | 36 | // Converts a normalized value (0..1) to a limited value given this objects limits. 37 | function TLimits_ToNormal(AValue) global() 38 | ( 39 | (AValue - this.Min.Get()) / (this.Max.Get() - this.Min.Get()); 40 | ); 41 | 42 | 43 | -------------------------------------------------------------------------------- /jsfx-inc/swipe.math.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: math.jsfx-inc 3 | ** Desc: Math functions for the SWIPE library. 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | */ 8 | 9 | @init 10 | 11 | // Math Constants 12 | 13 | M_PI = $pi; 14 | M_2PI = 2 * M_PI; 15 | M_DENORM = 10^-30; 16 | M_AMPDB = 8.65617025; 17 | M_MS2SPL = srate / 1000; 18 | M_DEG2RAD = 180 / M_PI; 19 | M_RAD2DEG = M_PI / 180; 20 | 21 | // Conversion Functions 22 | 23 | // Converts milliseconds to sample count, based on the current sample rate. 24 | function ms2spl(x) global(M_MS2SPL) 25 | ( 26 | (x * M_MS2SPL)|0; 27 | ); 28 | 29 | // Converts a freq hz to radian delta per sample rate. 30 | function hz2rad(x) global(srate, M_2PI) 31 | ( 32 | M_2PI * x / srate; 33 | ); 34 | 35 | // Converts a dB value to a PCM value. 36 | function db2pcm(x) global() 37 | ( 38 | 2 ^ (x / 6); 39 | ); 40 | 41 | // Converts a PCM value to a dB value. 42 | function pcm2db(x) global(M_AMPDB) 43 | ( 44 | log(x) * M_AMPDB; 45 | ); 46 | 47 | -------------------------------------------------------------------------------- /jsfx-inc/swipe.system.jsfx-inc: -------------------------------------------------------------------------------- 1 | /* 2 | ** Name: system.jsfx-inc 3 | ** Desc: System functions and TObject for the SWIPE library. (Based on FreePascal) 4 | ** Auth: Derek John Evans 5 | ** 6 | ** Copyright (C) 2015 Derek John Evans 7 | */ 8 | 9 | import swipe.properties.jsfx-inc 10 | 11 | @init 12 | 13 | // Object Initialization 14 | 15 | /* 16 | Initialization helper. Use this to prevent an object from being 17 | initialized more than once. 18 | */ 19 | function TObject() global() 20 | ( 21 | this.IsCreated.Get() ? 0 : this.IsCreated.Set(1); 22 | ); 23 | 24 | -------------------------------------------------------------------------------- /soda/readme.txt: -------------------------------------------------------------------------------- 1 | Soda is a new component model im working on. It extends the standard TComponent, 2 | and provides features like type safe owners, items, searches, etc. 3 | 4 | Soda takes care of all the nitty gritty component type protection code which 5 | is often not implemented or, buggy. 6 | -------------------------------------------------------------------------------- /soda/soda.inc: -------------------------------------------------------------------------------- 1 | {$IF 0} 2 | unit Soda; 3 | 4 | {$ENDIF} 5 | 6 | {$IFNDEF DItemClass} 7 | {$ERROR Class name is undefined.} 8 | {$ENDIF} 9 | 10 | {$IFNDEF DItemOwner} 11 | {$DEFINE DItemOwner := TComponent} 12 | {$ENDIF} 13 | 14 | {$IFNDEF DItemItems} 15 | {$DEFINE DItemItemsPrivate} 16 | {$DEFINE DItemItems := CComponent} 17 | {$ENDIF} 18 | 19 | {$IFDEF DItemSuper} 20 | {$IF 0} 21 | interface 22 | 23 | type 24 | CComponent = class 25 | {$ENDIF} 26 | (DItemSuper) 27 | strict private 28 | type TClassOf = object 29 | type Super = DItemSuper; 30 | type Owner = DItemOwner; 31 | type Components = DItemItems; 32 | end; 33 | type TComponentEnumerator = object 34 | private 35 | FIndex: Integer; 36 | FComponent: DItemClass; 37 | function GetCurrent: DItemItems; 38 | public 39 | function MoveNext: Boolean; 40 | property Current: DItemItems read GetCurrent; 41 | end; 42 | function GetComponent(const AIndex: Integer): DItemItems; 43 | function GetOwner: DItemOwner; reintroduce; 44 | function GetSuper: DItemSuper; 45 | public 46 | function CreateComponent(const AName: String = ''): DItemItems; 47 | function FindComponent(const AName: String): DItemItems; 48 | function GetEnumerator: TComponentEnumerator; 49 | property Components[const AIndex: Integer]: DItemItems read GetComponent; default; 50 | public 51 | constructor Create(const AOwner: DItemOwner); reintroduce; 52 | public 53 | property Owner: DItemOwner read GetOwner; 54 | strict private 55 | {$IF 0} 56 | end; 57 | 58 | implementation 59 | 60 | {$ENDIF} 61 | 62 | {$ENDIF} 63 | 64 | {$IFNDEF DItemSuper} 65 | 66 | constructor DItemClass.Create(const AOwner: TClassOf.Owner); 67 | begin 68 | Assert(AOwner is TClassOf.Owner); 69 | inherited Create(AOwner); 70 | end; 71 | 72 | function DItemClass.CreateComponent(const AName: String): TClassOf.Components; 73 | begin 74 | Result := TClassOf.Components.CreateNamed(Self, AName); 75 | end; 76 | 77 | function DItemClass.FindComponent(const AName: String): TClassOf.Components; 78 | begin 79 | Result := inherited FindComponent(AName) as TClassOf.Components; 80 | end; 81 | 82 | function DItemClass.GetOwner: TClassOf.Owner; 83 | begin 84 | Result := TClassOf.Owner(inherited Owner); 85 | end; 86 | 87 | function DItemClass.GetSuper: TClassOf.Super; 88 | begin 89 | Result := Self; 90 | end; 91 | 92 | function DItemClass.GetComponent(const AIndex: Integer): TClassOf.Components; 93 | begin 94 | Result := inherited Components[AIndex] as TClassOf.Components; 95 | end; 96 | 97 | function DItemClass.TComponentEnumerator.GetCurrent: TClassOf.Components; 98 | begin 99 | Result := FComponent.Components[FIndex]; 100 | end; 101 | 102 | function DItemClass.TComponentEnumerator.MoveNext: Boolean; 103 | begin 104 | Result := FIndex < FComponent.ComponentCount - 1; 105 | if Result then 106 | begin 107 | Inc(FIndex); 108 | end; 109 | end; 110 | 111 | function DItemClass.GetEnumerator: TComponentEnumerator; 112 | begin 113 | Result.FIndex := -1; 114 | Result.FComponent := Self; 115 | end; 116 | 117 | {$ENDIF} 118 | 119 | {$UNDEF DItemItemsPrivate} 120 | {$UNDEF DItemSuper} 121 | {$UNDEF DItemClass} 122 | {$UNDEF DItemOwner} 123 | {$UNDEF DItemItems} 124 | 125 | {$IF 0} 126 | end. 127 | {$ENDIF} 128 | -------------------------------------------------------------------------------- /soda/soda.pas: -------------------------------------------------------------------------------- 1 | (* 2 | SSSSSS OOOOOO DDDDDDDD AAAAA 3 | SSSS SSSS OOOO OOOO DDDD DDD AAAAAAA 4 | SSSS OOOO OOOO DDD DDD AAA AAA 5 | SSSSSS OOOO OOOO DDD DDD AAAAAAAAAAA 6 | SSSS OOOO OOOO DDD DDD AAAA AAAA 7 | SSSS SSSS OOOO OOOO DDDD DDD AAAA AAAA 8 | SSSSSS OOOOOO DDDDDDDD AAAA AAAA 9 | 10 | The SODA Component 11 | 12 | *) 13 | unit Soda; 14 | 15 | {$MODE DELPHI} 16 | 17 | interface 18 | 19 | uses 20 | Classes, Masks, SysUtils; 21 | 22 | type 23 | 24 | TItemFlag = (ifCreated, ifDestroyed); 25 | TItemFlags = set of TItemFlag; 26 | 27 | CComponent = class(TComponent) 28 | strict private 29 | FFlags: TItemFlags; 30 | strict private 31 | function GetComponent(const AIndex: Integer): CComponent; 32 | protected 33 | procedure DoCreate; virtual; 34 | procedure DoDestroy; virtual; 35 | public 36 | function FindComponent(const AName: TComponentName; 37 | const ACaseSensitive: Boolean = False): CComponent; 38 | function FindComponentMaskDest(const AName: TComponentName; 39 | const ACaseSensitive: Boolean = False): CComponent; 40 | function ComponentExists(const AName: TComponentName): Boolean; 41 | function ComponentExistsMaskDest(const AName: TComponentName; 42 | const ACaseSensitive: Boolean = False): Boolean; 43 | function HasComponents: Boolean; 44 | function IsEmpty: Boolean; 45 | public 46 | constructor Create(AOwner: TComponent); override; 47 | constructor CreateNamed(AOwner: TComponent; const AName: TComponentName); virtual; 48 | destructor Destroy; override; 49 | public 50 | property Components[const AIndex: Integer]: CComponent read GetComponent; default; 51 | end; 52 | 53 | CComponentEx = class(CComponent) 54 | public 55 | procedure ExceptionRaise(const AMessage: String); 56 | procedure ExceptionAssert(const ATrue: Boolean; const AMessage: String); 57 | end; 58 | 59 | implementation 60 | 61 | constructor CComponent.Create(AOwner: TComponent); 62 | begin 63 | inherited Create(AOwner); 64 | DoCreate; 65 | if not (ifCreated in FFlags) then 66 | begin 67 | Beep; 68 | end; 69 | end; 70 | 71 | destructor CComponent.Destroy; 72 | begin 73 | DoDestroy; 74 | if not (ifDestroyed in FFLags) then 75 | begin 76 | Beep; 77 | end; 78 | inherited Destroy; 79 | end; 80 | 81 | constructor CComponent.CreateNamed(AOwner: TComponent; const AName: TComponentName); 82 | begin 83 | ChangeName(AName); 84 | Create(AOwner); 85 | end; 86 | 87 | procedure CComponent.DoCreate; 88 | begin 89 | Include(FFlags, ifCreated); 90 | end; 91 | 92 | procedure CComponent.DoDestroy; 93 | begin 94 | Include(FFlags, ifDestroyed); 95 | end; 96 | 97 | function CComponent.IsEmpty: Boolean; 98 | begin 99 | Result := inherited ComponentCount = 0; 100 | end; 101 | 102 | function CComponent.HasComponents: Boolean; 103 | begin 104 | Result := inherited ComponentCount > 0; 105 | end; 106 | 107 | function CComponent.GetComponent(const AIndex: Integer): CComponent; 108 | begin 109 | Result := inherited Components[AIndex] as CComponent; 110 | end; 111 | 112 | function CComponent.FindComponent(const AName: TComponentName; 113 | const ACaseSensitive: Boolean): CComponent; 114 | var 115 | LIndex: Integer; 116 | begin 117 | if ACaseSensitive then 118 | begin 119 | for LIndex := 0 to ComponentCount - 1 do 120 | begin 121 | Result := Self[LIndex]; 122 | if CompareStr(AName, Result.Name) = 0 then 123 | begin 124 | Exit; 125 | end; 126 | end; 127 | end else begin 128 | for LIndex := 0 to ComponentCount - 1 do 129 | begin 130 | Result := Self[LIndex]; 131 | if CompareText(AName, Result.Name) = 0 then 132 | begin 133 | Exit; 134 | end; 135 | end; 136 | end; 137 | Result := nil; 138 | end; 139 | 140 | function CComponent.FindComponentMaskDest(const AName: TComponentName; 141 | const ACaseSensitive: Boolean): CComponent; 142 | var 143 | LIndex: Integer; 144 | begin 145 | for LIndex := 0 to ComponentCount - 1 do 146 | begin 147 | Result := Self[LIndex]; 148 | if MatchesMask(AName, Result.Name, ACaseSensitive) then 149 | begin 150 | Exit; 151 | end; 152 | end; 153 | Result := nil; 154 | end; 155 | 156 | function CComponent.ComponentExists(const AName: TComponentName): Boolean; 157 | begin 158 | Result := Assigned(FindComponent(AName)); 159 | end; 160 | 161 | function CComponent.ComponentExistsMaskDest(const AName: TComponentName; 162 | const ACaseSensitive: Boolean): Boolean; 163 | begin 164 | Result := Assigned(FindComponentMaskDest(AName, ACaseSensitive)); 165 | end; 166 | 167 | procedure CComponentEx.ExceptionRaise(const AMessage: String); 168 | begin 169 | raise Exception.Create(AMessage); 170 | end; 171 | 172 | procedure CComponentEx.ExceptionAssert(const ATrue: Boolean; const AMessage: String); 173 | begin 174 | if not ATrue then 175 | begin 176 | ExceptionRaise(AMessage); 177 | end; 178 | end; 179 | 180 | end. 181 | -------------------------------------------------------------------------------- /soda/soda_basic.inc: -------------------------------------------------------------------------------- 1 | {$IF 0} 2 | unit SodaBasic; 3 | 4 | {$ENDIF} 5 | 6 | {$IFNDEF DItemItems} 7 | {$DEFINE DItemItems := TComponent} 8 | {$ENDIF} 9 | 10 | {$IFDEF DItemSuper} 11 | {$IF 0} 12 | interface 13 | 14 | type 15 | CComponent = class 16 | {$ENDIF} 17 | 18 | // TODO: What about parent & controls type checking? 19 | 20 | (DItemSuper) 21 | strict private 22 | type TClassOfSuper = DItemSuper; 23 | type TClassOfOwner = DItemOwner; 24 | type TClassOfComponents = DItemItems; 25 | {$IFDEF DItemClass} 26 | type TClassOfSelf = DItemClass; 27 | type TClassOfEnum = DItemItems; 28 | {$ELSE} 29 | type TClassOfSelf = TComponent; 30 | type TClassOfEnum = TComponent; 31 | {$ENDIF} 32 | type TComponentEnumerator = object 33 | private 34 | FIndex: Integer; 35 | FComponent: TClassOfSelf; 36 | function GetCurrent: TClassOfEnum; 37 | public 38 | function MoveNext: Boolean; 39 | property Current: TClassOfEnum read GetCurrent; 40 | end; 41 | function GetComponent(const AIndex: Integer): TClassOfComponents; reintroduce; 42 | function GetOwner: TClassOfOwner; reintroduce; 43 | function GetSuper: TClassOfSuper; 44 | protected 45 | procedure DoCreate; 46 | public 47 | constructor Create(const AOwner: TClassOfOwner); reintroduce; 48 | public 49 | function GetEnumerator: TComponentEnumerator; 50 | public 51 | property Components[const AIndex: Integer]: TClassOfComponents read GetComponent; default; 52 | property Owner: TClassOfOwner read GetOwner; 53 | strict private 54 | {$IF 0} 55 | end; 56 | 57 | implementation 58 | 59 | {$ENDIF} 60 | {$ENDIF} 61 | 62 | {$IFNDEF DItemSuper} 63 | 64 | constructor DItemClass.Create(const AOwner: TClassOfOwner); 65 | begin 66 | Assert(AOwner is TClassOfOwner); 67 | inherited Create(AOwner); 68 | DoCreate; 69 | end; 70 | 71 | function DItemClass.GetOwner: TClassOfOwner; 72 | begin 73 | Result := TClassOfOwner(inherited Owner); 74 | end; 75 | 76 | function DItemClass.GetSuper: TClassOfSuper; 77 | begin 78 | Result := Self; 79 | end; 80 | 81 | function DItemClass.GetComponent(const AIndex: Integer): TClassOfComponents; 82 | begin 83 | Result := inherited Components[AIndex] as TClassOfComponents; 84 | end; 85 | 86 | function DItemClass.TComponentEnumerator.GetCurrent: TClassOfEnum; 87 | begin 88 | Result := FComponent.Components[FIndex]; 89 | end; 90 | 91 | function DItemClass.TComponentEnumerator.MoveNext: Boolean; 92 | begin 93 | Result := FIndex < FComponent.ComponentCount - 1; 94 | if Result then 95 | begin 96 | Inc(FIndex); 97 | end; 98 | end; 99 | 100 | function DItemClass.GetEnumerator: TComponentEnumerator; 101 | begin 102 | Result.FIndex := -1; 103 | Result.FComponent := Self; 104 | end; 105 | 106 | {$ENDIF} 107 | 108 | {$UNDEF DItemClass} 109 | {$UNDEF DItemSuper} 110 | {$UNDEF DItemOwner} 111 | {$UNDEF DItemItems} 112 | 113 | {$IF 0} 114 | end. 115 | {$ENDIF} 116 | --------------------------------------------------------------------------------