BlankPage: Difference between revisions
Jump to navigation
Jump to search
This template allows for a short author credit.
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Replaced content with "{{DISPLAYTITLE:_BlankPage}} The '''_BlankPage''' serves as a skeleton for new Wiki pages. {{PageSyntax}} : _BlankSub {{Parameter|arg1}}[, {{Parameter|arg2}}] : {{Parameter|result%}} = _BlankFunc({{Parameter|arg1}}[, {{Parameter|arg2}}]) {{PageParameters}} * {{Parameter|arg1}} is a mandatory argument * the {{Parameter|arg2}} is optional {{PageDescription}} To use this skeleton click on the '''Edit''' tab above the page, then copy the raw text of this pag...") Tags: Replaced Manual revert |
No edit summary Tag: Reverted |
||
Line 96: | Line 96: | ||
{{PageNavigation}} | {{PageNavigation}} | ||
{{CodeStart}} | |||
{{Text|<nowiki>'All variables will be of type LONG unless explicitly defined</nowiki>|#919191}} | |||
{{Cl|DEFLNG}} A-Z | |||
{{Text|<nowiki>'All arrays will be dynamically allocated so they can be REDIM-ed</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$DYNAMIC}} | |||
{{Text|<nowiki>'We need console access to support command-line compilation via the -x command line compile option</nowiki>|#919191}} | |||
{{Cm|$CONSOLE}} | |||
{{Text|<nowiki>'Initially the "SCREEN" will be hidden, if the -x option is used it will never be created</nowiki>|#919191}} | |||
{{Cm|$SCREENHIDE}} | |||
{{Cm|$EXEICON}}:{{Text|<nowiki>'./qb64pe.ico'</nowiki>|#919191}} | |||
{{Cm|$VERSIONINFO}}:CompanyName=QB64 Phoenix Edition | |||
{{Cm|$VERSIONINFO}}:FileDescription=QB64 IDE and Compiler | |||
{{Cm|$VERSIONINFO}}:InternalName=qb64pe.bas | |||
{{Cm|$VERSIONINFO}}:LegalCopyright=MIT | |||
{{Cm|$VERSIONINFO}}:LegalTrademarks= | |||
{{Cm|$VERSIONINFO}}:OriginalFilename=qb64pe.exe | |||
{{Cm|$VERSIONINFO}}:ProductName=QB64-PE | |||
{{Cm|$VERSIONINFO}}:Comments=QB64 is a modern extended BASIC programming language that retains QB4.5/QBasic compatibility and compiles native binaries for Windows, Linux and macOS. | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'global\version.bas'</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'global\settings.bas'</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'global\constants.bas'</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'subs_functions\extensions\opengl\opengl_global.bas'</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'utilities\ini-manager\ini.bi'</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'utilities\s-buffer\simplebuffer.bi'</nowiki>|#919191}} | |||
{{Cl|DEFLNG}} A-Z | |||
{{Text|<nowiki>'-------- Optional IDE Component (1/2) --------</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'ide\ide_global.bas'</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} OName({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'Operation Name</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} PL({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'Priority Level</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} PP_TypeMod({{Text|0|#F580B1}}) {{Cl|AS}} {{Cl|STRING}}, PP_ConvertedMod({{Text|0|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'Prepass Name Conversion variables.</nowiki>|#919191}} | |||
{{Text|Set_OrderOfOperations|#55FF55}} | |||
{{Cl|DIM}} {{Cl|SHARED}} NoExeSaved {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} vWatchOn, vWatchRecompileAttempts, vWatchDesiredState, vWatchErrorCall$ | |||
{{Cl|DIM}} {{Cl|SHARED}} vWatchNewVariable$, vWatchVariableExclusions$ | |||
vWatchErrorCall$ = {{Text|<nowiki>"if (stop_program) {*__LONG_VWATCH_LINENUMBER=0; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);};if(new_error){bkp_new_error=new_error;new_error=0;*__LONG_VWATCH_LINENUMBER=-1; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);new_error=bkp_new_error;};"</nowiki>|#FFB100}} | |||
vWatchVariableExclusions$ = {{Text|<nowiki>"@__LONG_VWATCH_LINENUMBER@__LONG_VWATCH_SUBLEVEL@__LONG_VWATCH_GOTO@"</nowiki>|#FFB100}} + _ | |||
{{Text|<nowiki>"@__STRING_VWATCH_SUBNAME@__STRING_VWATCH_CALLSTACK@__ARRAY_BYTE_VWATCH_BREAKPOINTS"</nowiki>|#FFB100}} + _ | |||
{{Text|<nowiki>"@__ARRAY_BYTE_VWATCH_SKIPLINES@__STRING_VWATCH_INTERNALSUBNAME@__ARRAY_STRING_VWATCH_STACK@"</nowiki>|#FFB100}} | |||
{{Cl|DIM}} {{Cl|SHARED}} nativeDataTypes$ | |||
nativeDataTypes$ = {{Text|<nowiki>"@_OFFSET@OFFSET@_UNSIGNED _OFFSET@UNSIGNED OFFSET@_BIT@BIT@_UNSIGNED _BIT@UNSIGNED BIT@_BYTE@_UNSIGNED _BYTE@BYTE@UNSIGNED BYTE@INTEGER@_UNSIGNED INTEGER@UNSIGNED INTEGER@LONG@_UNSIGNED LONG@UNSIGNED LONG@_INTEGER64@INTEGER64@_UNSIGNED _INTEGER64@UNSIGNED INTEGER64@SINGLE@DOUBLE@_FLOAT@FLOAT@STRING@"</nowiki>|#FFB100}} | |||
{{Cl|DIM}} {{Cl|SHARED}} qb64prefix_set_recompileAttempts, qb64prefix_set_desiredState | |||
{{Cl|DIM}} {{Cl|SHARED}} opex_recompileAttempts, opex_desiredState | |||
{{Cl|DIM}} {{Cl|SHARED}} opexarray_recompileAttempts, opexarray_desiredState | |||
{{Cl|REDIM}} EveryCaseSet({{Text|100|#F580B1}}), SelectCaseCounter {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|LONG}} | |||
{{Cl|REDIM}} SelectCaseHasCaseBlock({{Text|100|#F580B1}}) | |||
{{Cl|DIM}} ExecLevel({{Text|255|#F580B1}}), ExecCounter {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} UserDefine({{Text|1|#F580B1}}, {{Text|100|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'0 element is the name, 1 element is the string value</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} InValidLine({{Text|10000|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} DefineElse({{Text|255|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} UserDefineCount {{Cl|AS}} {{Cl|INTEGER}}, UserDefineList$ | |||
UserDefineList$ = {{Text|<nowiki>"@DEFINED@UNDEFINED@WINDOWS@WIN@LINUX@MAC@MACOSX@32BIT@64BIT@VERSION@"</nowiki>|#FFB100}} | |||
UserDefine({{Text|0|#F580B1}}, {{Text|0|#F580B1}}) = {{Text|<nowiki>"WINDOWS"</nowiki>|#FFB100}}: UserDefine({{Text|0|#F580B1}}, {{Text|1|#F580B1}}) = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} | |||
UserDefine({{Text|0|#F580B1}}, {{Text|2|#F580B1}}) = {{Text|<nowiki>"LINUX"</nowiki>|#FFB100}} | |||
UserDefine({{Text|0|#F580B1}}, {{Text|3|#F580B1}}) = {{Text|<nowiki>"MAC"</nowiki>|#FFB100}}: UserDefine({{Text|0|#F580B1}}, {{Text|4|#F580B1}}) = {{Text|<nowiki>"MACOSX"</nowiki>|#FFB100}} | |||
UserDefine({{Text|0|#F580B1}}, {{Text|5|#F580B1}}) = {{Text|<nowiki>"32BIT"</nowiki>|#FFB100}}: UserDefine({{Text|0|#F580B1}}, {{Text|6|#F580B1}}) = {{Text|<nowiki>"64BIT"</nowiki>|#FFB100}} | |||
UserDefine({{Text|0|#F580B1}}, {{Text|7|#F580B1}}) = {{Text|<nowiki>"VERSION"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"WIN"</nowiki>|#FFB100}}) {{Cl|THEN}} UserDefine({{Text|1|#F580B1}}, {{Text|0|#F580B1}}) = {{Text|<nowiki>"-1"</nowiki>|#FFB100}}: UserDefine({{Text|1|#F580B1}}, {{Text|1|#F580B1}}) = {{Text|<nowiki>"-1"</nowiki>|#FFB100}} {{Cl|ELSE}} UserDefine({{Text|1|#F580B1}}, {{Text|0|#F580B1}}) = {{Text|<nowiki>"0"</nowiki>|#FFB100}}: UserDefine({{Text|1|#F580B1}}, {{Text|1|#F580B1}}) = {{Text|<nowiki>"0"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"LINUX"</nowiki>|#FFB100}}) {{Cl|THEN}} UserDefine({{Text|1|#F580B1}}, {{Text|2|#F580B1}}) = {{Text|<nowiki>"-1"</nowiki>|#FFB100}} {{Cl|ELSE}} UserDefine({{Text|1|#F580B1}}, {{Text|2|#F580B1}}) = {{Text|<nowiki>"0"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"MAC"</nowiki>|#FFB100}}) {{Cl|THEN}} UserDefine({{Text|1|#F580B1}}, {{Text|3|#F580B1}}) = {{Text|<nowiki>"-1"</nowiki>|#FFB100}}: UserDefine({{Text|1|#F580B1}}, {{Text|4|#F580B1}}) = {{Text|<nowiki>"-1"</nowiki>|#FFB100}} {{Cl|ELSE}} UserDefine({{Text|1|#F580B1}}, {{Text|3|#F580B1}}) = {{Text|<nowiki>"0"</nowiki>|#FFB100}}: UserDefine({{Text|1|#F580B1}}, {{Text|4|#F580B1}}) = {{Text|<nowiki>"0"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"32BIT"</nowiki>|#FFB100}}) {{Cl|THEN}} UserDefine({{Text|1|#F580B1}}, {{Text|5|#F580B1}}) = {{Text|<nowiki>"-1"</nowiki>|#FFB100}}: UserDefine({{Text|1|#F580B1}}, {{Text|6|#F580B1}}) = {{Text|<nowiki>"0"</nowiki>|#FFB100}} {{Cl|ELSE}} UserDefine({{Text|1|#F580B1}}, {{Text|5|#F580B1}}) = {{Text|<nowiki>"0"</nowiki>|#FFB100}}: UserDefine({{Text|1|#F580B1}}, {{Text|6|#F580B1}}) = {{Text|<nowiki>"-1"</nowiki>|#FFB100}} | |||
UserDefine({{Text|1|#F580B1}}, {{Text|7|#F580B1}}) = Version$ | |||
{{Cl|DIM}} {{Cl|SHARED}} QB64_uptime! | |||
QB64_uptime! = {{Cl|TIMER (function)|TIMER}} | |||
NoInternalFolder: | |||
{{Cl|IF}} {{Cl|_DIREXISTS}}({{Text|<nowiki>"internal"</nowiki>|#FFB100}}) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|_SCREENSHOW}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"QB64-PE cannot locate the 'internal' folder"</nowiki>|#FFB100}} | |||
{{Cl|PRINT}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"Check that QB64-PE has been extracted properly."</nowiki>|#FFB100}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"For MacOSX, launch 'qb64pe_start.command' or enter './qb64pe' in Terminal."</nowiki>|#FFB100}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"For Linux, in the console enter './qb64pe'."</nowiki>|#FFB100}} | |||
{{Cl|DO}} | |||
{{Cl|_LIMIT}} {{Text|1|#F580B1}} | |||
{{Cl|DO...LOOP|LOOP UNTIL}} {{Cl|INKEY$}} <> {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|SYSTEM}} {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|DIM}} {{Cl|SHARED}} Include_GDB_Debugging_Info {{Text|<nowiki>'set using "options.bin"</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} DEPENDENCY_LAST | |||
{{Cl|CONST}} DEPENDENCY_LOADFONT = {{Text|1|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_AUDIO_CONVERSION = {{Text|2|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_AUDIO_DECODE = {{Text|3|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_AUDIO_OUT = {{Text|4|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_GL = {{Text|5|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_IMAGE_CODEC = {{Text|6|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_CONSOLE_ONLY = {{Text|7|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} {{Text|<nowiki>'=2 if via -g switch, =1 if via metacommand $CONSOLE:ONLY</nowiki>|#919191}} | |||
{{Cl|CONST}} DEPENDENCY_SOCKETS = {{Text|8|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_PRINTER = {{Text|9|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_ICON = {{Text|10|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_SCREENIMAGE = {{Text|11|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} | |||
{{Cl|CONST}} DEPENDENCY_DEVICEINPUT = {{Text|12|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} {{Text|<nowiki>'removes support for gamepad input if not present</nowiki>|#919191}} | |||
{{Cl|CONST}} DEPENDENCY_ZLIB = {{Text|13|#F580B1}}: DEPENDENCY_LAST = DEPENDENCY_LAST + {{Text|1|#F580B1}} {{Text|<nowiki>'ZLIB library linkage, if desired, for compression/decompression.</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} DEPENDENCY({{Text|1|#F580B1}} {{Cl|TO}} DEPENDENCY_LAST) | |||
{{Cl|DIM}} {{Cl|SHARED}} UseGL {{Text|<nowiki>'declared SUB _GL (no params)</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} OS_BITS {{Cl|AS}} {{Cl|LONG}}, WindowTitle {{Cl|AS}} {{Cl|STRING}} | |||
OS_BITS = {{Text|64|#F580B1}}: {{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"[32BIT]"</nowiki>|#FFB100}}) {{Cl|THEN}} OS_BITS = {{Text|32|#F580B1}} | |||
{{Cl|IF}} OS_BITS = {{Text|32|#F580B1}} {{Cl|THEN}} WindowTitle = {{Text|<nowiki>"QB64 Phoenix Edition (x32)"</nowiki>|#FFB100}} {{Cl|ELSE}} WindowTitle = {{Text|<nowiki>"QB64 Phoenix Edition (x64)"</nowiki>|#FFB100}} | |||
{{Cl|_TITLE}} WindowTitle | |||
{{Cl|DIM}} {{Cl|SHARED}} ConsoleMode, No_C_Compile_Mode, NoIDEMode | |||
{{Cl|DIM}} {{Cl|SHARED}} ShowWarnings {{Cl|AS}} {{Cl|_BYTE}}, QuietMode {{Cl|AS}} {{Cl|_BYTE}}, CMDLineFile {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} MonochromeLoggingMode {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|TYPE}} usedVarList | |||
{{Cl|AS}} {{Cl|LONG}} id, linenumber, includeLevel, includedLine, {{Text|scope|#55FF55}}, localIndex | |||
{{Cl|AS}} {{Cl|LONG}} arrayElementSize | |||
{{Cl|AS}} {{Cl|_BYTE}} used, watch, isarray, displayFormat {{Text|<nowiki>'displayFormat: 0=DEC;1=HEX;2=BIN;3=OCT</nowiki>|#919191}} | |||
{{Cl|AS}} {{Cl|STRING}} name, cname, varType, includedFile, subfunc | |||
{{Cl|AS}} {{Cl|STRING}} watchRange, indexes, elements, elementTypes {{Text|<nowiki>'for Arrays and UDTs</nowiki>|#919191}} | |||
{{Cl|AS}} {{Cl|STRING}} elementOffset, storage | |||
{{Cl|END TYPE}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} backupUsedVariableList({{Text|1000|#F580B1}}) {{Cl|AS}} usedVarList | |||
{{Cl|DIM}} {{Cl|SHARED}} typeDefinitions$, backupTypeDefinitions$ | |||
{{Cl|DIM}} {{Cl|SHARED}} totalVariablesCreated {{Cl|AS}} {{Cl|LONG}}, totalMainVariablesCreated {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} bypassNextVariable {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} totalWarnings {{Cl|AS}} {{Cl|LONG}}, warningListItems {{Cl|AS}} {{Cl|LONG}}, lastWarningHeader {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} duplicateConstWarning {{Cl|AS}} {{Cl|_BYTE}}, warningsissued {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} emptySCWarning {{Cl|AS}} {{Cl|_BYTE}}, maxLineNumber {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ExeIconSet {{Cl|AS}} {{Cl|LONG}}, qb64prefix$, qb64prefix_set | |||
{{Cl|DIM}} {{Cl|SHARED}} VersionInfoSet {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Text|<nowiki>'Variables to handle $VERSIONINFO metacommand:</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} viFileVersionNum$, viProductVersionNum$, viCompanyName$ | |||
{{Cl|DIM}} {{Cl|SHARED}} viFileDescription$, viFileVersion$, viInternalName$ | |||
{{Cl|DIM}} {{Cl|SHARED}} viLegalCopyright$, viLegalTrademarks$, viOriginalFilename$ | |||
{{Cl|DIM}} {{Cl|SHARED}} viProductName$, viProductVersion$, viComments$, viWeb$ | |||
{{Cl|DIM}} {{Cl|SHARED}} NoChecks | |||
{{Cl|DIM}} {{Cl|SHARED}} Console | |||
{{Cl|DIM}} {{Cl|SHARED}} ScreenHide | |||
{{Cl|DIM}} {{Cl|SHARED}} Asserts | |||
{{Cl|DIM}} {{Cl|SHARED}} OptMax {{Cl|AS}} {{Cl|LONG}} | |||
OptMax = {{Text|256|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} Opt({{Text|1|#F580B1}} {{Cl|TO}} OptMax, {{Text|1|#F580B1}} {{Cl|TO}} {{Text|10|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
{{Text|<nowiki>' (1,1)="READ"</nowiki>|#919191}} | |||
{{Text|<nowiki>' (1,2)="WRITE"</nowiki>|#919191}} | |||
{{Text|<nowiki>' (1,3)="READ WRITE"</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} OptWords({{Text|1|#F580B1}} {{Cl|TO}} OptMax, {{Text|1|#F580B1}} {{Cl|TO}} {{Text|10|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'The number of words of each opt () element</nowiki>|#919191}} | |||
{{Text|<nowiki>' (1,1)=1 '"READ"</nowiki>|#919191}} | |||
{{Text|<nowiki>' (1,2)=1 '"WRITE"</nowiki>|#919191}} | |||
{{Text|<nowiki>' (1,3)=2 '"READ WRITE"</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} T({{Text|1|#F580B1}} {{Cl|TO}} OptMax) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'The type of the entry</nowiki>|#919191}} | |||
{{Text|<nowiki>' t is 0 for ? opts</nowiki>|#919191}} | |||
{{Text|<nowiki>' ---------- 0 means ? , 1+ means a symbol or {}block ----------</nowiki>|#919191}} | |||
{{Text|<nowiki>' t is 1 for symbol opts</nowiki>|#919191}} | |||
{{Text|<nowiki>' t is the number of rhs opt () index enteries for {READ|WRITE|READ WRITE} like opts</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} Lev({{Text|1|#F580B1}} {{Cl|TO}} OptMax) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'The indwelling level of each opt () element (the lowest is 0)</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} EntryLev({{Text|1|#F580B1}} {{Cl|TO}} OptMax) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'The level required from which this opt () can be validly be entered/checked-for</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} DitchLev({{Text|1|#F580B1}} {{Cl|TO}} OptMax) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'The lowest level recorded between the previous Opt and this Opt</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} DontPass({{Text|1|#F580B1}} {{Cl|TO}} OptMax) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'Set to 1 or 0, with 1 meaning don't pass</nowiki>|#919191}} | |||
{{Text|<nowiki>'Determines whether the opt () entry needs to actually be passed to the C++ sub/function</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} TempList({{Text|1|#F580B1}} {{Cl|TO}} OptMax) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} PassRule({{Text|1|#F580B1}} {{Cl|TO}} OptMax) {{Cl|AS}} {{Cl|LONG}} | |||
{{Text|<nowiki>'0 means no pass rule</nowiki>|#919191}} | |||
{{Text|<nowiki>'negative values refer to an opt () element</nowiki>|#919191}} | |||
{{Text|<nowiki>'positive values refer to a flag value</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} LevelEntered(OptMax) {{Text|<nowiki>'up to 64 levels supported</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} separgs(OptMax + {{Text|1|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} separgslayout(OptMax + {{Text|1|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} separgs2(OptMax + {{Text|1|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} separgslayout2(OptMax + {{Text|1|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} E | |||
{{Cl|DIM}} {{Cl|SHARED}} ResolveStaticFunctions | |||
{{Cl|REDIM}} {{Cl|SHARED}} ResolveStaticFunction_File({{Text|1|#F580B1}} {{Cl|TO}} {{Text|100|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} ResolveStaticFunction_Name({{Text|1|#F580B1}} {{Cl|TO}} {{Text|100|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} ResolveStaticFunction_Method({{Text|1|#F580B1}} {{Cl|TO}} {{Text|100|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} Error_Happened {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} Error_Message {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} os {{Cl|AS}} {{Cl|STRING}} | |||
os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"[LINUX]"</nowiki>|#FFB100}}) {{Cl|THEN}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} | |||
{{Cl|DIM}} {{Cl|SHARED}} MacOSX {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"[MACOSX]"</nowiki>|#FFB100}}) {{Cl|THEN}} MacOSX = {{Text|1|#F580B1}} | |||
{{Cl|DIM}} {{Cl|SHARED}} inline_DATA | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} inline_DATA = {{Text|1|#F580B1}} | |||
{{Cl|DIM}} {{Cl|SHARED}} BATCHFILE_EXTENSION {{Cl|AS}} {{Cl|STRING}} | |||
BATCHFILE_EXTENSION = {{Text|<nowiki>".bat"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} BATCHFILE_EXTENSION = {{Text|<nowiki>".sh"</nowiki>|#FFB100}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} BATCHFILE_EXTENSION = {{Text|<nowiki>".command"</nowiki>|#FFB100}} | |||
{{Cl|DIM}} inlinedatastr({{Text|255|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|FOR}} i = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}} | |||
inlinedatastr(i) = {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>","</nowiki>|#FFB100}} | |||
{{Cl|NEXT}} | |||
{{Cl|DIM}} {{Cl|SHARED}} extension {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} path.exe$, path.source$, lastBinaryGenerated$ | |||
extension$ = {{Text|<nowiki>".exe"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} extension$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Text|<nowiki>'no extension under Linux</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} pathsep {{Cl|AS}} {{Cl|STRING}} * {{Text|1|#F580B1}} | |||
pathsep$ = {{Text|<nowiki>"\"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} pathsep$ = {{Text|<nowiki>"/"</nowiki>|#FFB100}} | |||
{{Text|<nowiki>'note: QB64 handles OS specific path separators automatically except under SHELL calls</nowiki>|#919191}} | |||
{{Cl|ON ERROR}} {{Cl|GOTO}} qberror_test | |||
{{Cl|DIM}} {{Cl|SHARED}} tmpdir {{Cl|AS}} {{Cl|STRING}}, tmpdir2 {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} tmpdir$ = {{Text|<nowiki>".\internal\temp\"</nowiki>|#FFB100}}: tmpdir2$ = {{Text|<nowiki>"..\\temp\\"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} tmpdir$ = {{Text|<nowiki>"./internal/temp/"</nowiki>|#FFB100}}: tmpdir2$ = {{Text|<nowiki>"../temp/"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|NOT}} {{Cl|_DIREXISTS}}(tmpdir$) {{Cl|THEN}} {{Cl|MKDIR}} tmpdir$ | |||
{{Cl|DECLARE LIBRARY}} | |||
{{Cl|FUNCTION}} {{Text|getpid&|#55FF55}} () | |||
{{Cl|END DECLARE}} | |||
thisinstancepid = {{Text|getpid&|#55FF55}} | |||
{{Cl|DIM}} {{Cl|SHARED}} tempfolderindex | |||
{{Cl|IF}} {{Cl|INSTR}}({{Cl|_OS$}}, {{Text|<nowiki>"LINUX"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
fh = {{Cl|FREEFILE}} | |||
{{Cl|OPEN}} {{Text|<nowiki>".\internal\temp\tempfoldersearch.bin"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|RANDOM}} {{Cl|OPEN|AS}} #fh {{Cl|OPEN|LEN}} = {{Cl|OPEN|LEN}}(tempfolderindex) | |||
tempfolderrecords = {{Cl|LOF}}(fh) / {{Cl|LEN}}(tempfolderindex) | |||
i = {{Text|1|#F580B1}} | |||
{{Cl|IF}} tempfolderrecords = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'first run ever?</nowiki>|#919191}} | |||
{{Cl|PUT}} #fh, {{Text|1|#F580B1}}, thisinstancepid | |||
{{Cl|ELSE}} | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} tempfolderrecords | |||
{{Text|<nowiki>'check if any of the temp folders is being used = pid still active</nowiki>|#919191}} | |||
{{Cl|GET}} #fh, i, tempfoldersearch | |||
{{Cl|SHELL}} {{Cl|_HIDE}} {{Text|<nowiki>"ps -p "</nowiki>|#FFB100}} + {{Cl|STR$}}(tempfoldersearch) + {{Text|<nowiki>" > /dev/null 2>&1; echo $? > internal/temp/checkpid.bin"</nowiki>|#FFB100}} | |||
fh2 = {{Cl|FREEFILE}} | |||
{{Cl|OPEN}} {{Text|<nowiki>"internal/temp/checkpid.bin"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|BINARY}} {{Cl|OPEN|AS}} #fh2 | |||
{{Cl|LINE INPUT (file statement)|LINE INPUT}} #fh2, checkpid$ | |||
{{Cl|CLOSE}} #fh2 | |||
{{Cl|IF}} {{Cl|VAL}}(checkpid$) = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'This temp folder was locked by an instance that's no longer active, so</nowiki>|#919191}} | |||
{{Text|<nowiki>'this will be our temp folder</nowiki>|#919191}} | |||
{{Cl|PUT}} #fh, i, thisinstancepid | |||
{{Cl|EXIT FOR}} | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
{{Cl|IF}} i > tempfolderrecords {{Cl|THEN}} | |||
{{Text|<nowiki>'All indexes were busy. Let's initiate a new one:</nowiki>|#919191}} | |||
{{Cl|PUT}} #fh, i, thisinstancepid | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|CLOSE}} #fh | |||
{{Cl|IF}} i > {{Text|1|#F580B1}} {{Cl|THEN}} | |||
tmpdir$ = {{Text|<nowiki>"./internal/temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"/"</nowiki>|#FFB100}}: tmpdir2$ = {{Text|<nowiki>"../temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"/"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|_DIREXISTS}}(tmpdir$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|MKDIR}} tmpdir$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"temp.bin"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|LOCK}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|WRITE}} {{Cl|OPEN|AS}} #26 | |||
{{Cl|ELSE}} | |||
{{Cl|ON ERROR}} {{Cl|GOTO}} qberror_test | |||
E = {{Text|0|#F580B1}} | |||
i = {{Text|1|#F580B1}} | |||
{{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"temp.bin"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|LOCK}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|WRITE}} {{Cl|OPEN|AS}} #26 | |||
{{Cl|DO...LOOP|DO WHILE}} E | |||
i = i + {{Text|1|#F580B1}} | |||
{{Cl|IF}} i = {{Text|1000|#F580B1}} {{Cl|THEN}} {{Cl|PRINT}} {{Text|<nowiki>"Unable to locate the 'internal' folder"</nowiki>|#FFB100}}: {{Cl|END}} {{Text|1|#F580B1}} | |||
{{Cl|MKDIR}} {{Text|<nowiki>".\internal\temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} tmpdir$ = {{Text|<nowiki>".\internal\temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"\"</nowiki>|#FFB100}}: tmpdir2$ = {{Text|<nowiki>"..\\temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"\\"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} tmpdir$ = {{Text|<nowiki>"./internal/temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"/"</nowiki>|#FFB100}}: tmpdir2$ = {{Text|<nowiki>"../temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"/"</nowiki>|#FFB100}} | |||
E = {{Text|0|#F580B1}} | |||
{{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"temp.bin"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|LOCK}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|WRITE}} {{Cl|OPEN|AS}} #26 | |||
{{Cl|LOOP}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'temp folder established</nowiki>|#919191}} | |||
tempfolderindex = i | |||
{{Cl|IF}} i > {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'create modified version of qbx.cpp</nowiki>|#919191}} | |||
{{Cl|OPEN}} {{Text|<nowiki>".\internal\c\qbx"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>".cpp"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN|AS}} #2 | |||
{{Cl|OPEN}} {{Text|<nowiki>".\internal\c\qbx.cpp"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|BINARY}} {{Cl|OPEN|AS}} #1 | |||
{{Cl|DO...LOOP|DO UNTIL}} {{Cl|EOF}}({{Text|1|#F580B1}}) | |||
{{Cl|LINE INPUT (file statement)|LINE INPUT}} #1, a$ | |||
x = {{Cl|INSTR}}(a$, {{Text|<nowiki>"..\\temp\\"</nowiki>|#FFB100}}): {{Cl|IF}} x {{Cl|THEN}} a$ = {{Cl|LEFT$}}(a$, x - {{Text|1|#F580B1}}) + {{Text|<nowiki>"..\\temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"\\"</nowiki>|#FFB100}} + {{Cl|RIGHT$}}(a$, {{Cl|LEN}}(a$) - (x + {{Text|9|#F580B1}})) | |||
x = {{Cl|INSTR}}(a$, {{Text|<nowiki>"../temp/"</nowiki>|#FFB100}}): {{Cl|IF}} x {{Cl|THEN}} a$ = {{Cl|LEFT$}}(a$, x - {{Text|1|#F580B1}}) + {{Text|<nowiki>"../temp"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>"/"</nowiki>|#FFB100}} + {{Cl|RIGHT$}}(a$, {{Cl|LEN}}(a$) - (x + {{Text|7|#F580B1}})) | |||
{{Cl|PRINT (file statement)|PRINT}} #2, a$ | |||
{{Cl|LOOP}} | |||
{{Cl|CLOSE}} #1, #2 | |||
{{Cl|END IF}} | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"debug.txt"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN|AS}} #9 | |||
{{Cl|ON ERROR}} {{Cl|GOTO}} qberror | |||
{{Cl|DIM}} {{Cl|SHARED}} tempfolderindexstr {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'appended to "Untitled"</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} tempfolderindexstr2 {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|IF}} tempfolderindex <> {{Text|1|#F580B1}} {{Cl|THEN}} tempfolderindexstr$ = {{Text|<nowiki>"("</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(tempfolderindex) + {{Text|<nowiki>")"</nowiki>|#FFB100}}: tempfolderindexstr2$ = {{Text|str2$|#55FF55}}(tempfolderindex) | |||
{{Cl|DIM}} {{Cl|SHARED}} idedebuginfo | |||
{{Cl|DIM}} {{Cl|SHARED}} seperateargs_error | |||
{{Cl|DIM}} {{Cl|SHARED}} seperateargs_error_message {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} compfailed | |||
{{Cl|DIM}} {{Cl|SHARED}} reginternalsubfunc | |||
{{Cl|DIM}} {{Cl|SHARED}} reginternalvariable | |||
{{Cl|DIM}} {{Cl|SHARED}} symboltype_size | |||
symboltype_size = {{Text|0|#F580B1}} | |||
{{Cl|DIM}} {{Cl|SHARED}} use_global_byte_elements | |||
use_global_byte_elements = {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'compiler-side IDE data & definitions</nowiki>|#919191}} | |||
{{Text|<nowiki>'SHARED variables "passed" to/from the compiler & IDE</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} idecommand {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'a 1 byte message-type code, followed by optional string data</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} idereturn {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'used to pass formatted-lines and return information back to the IDE</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ideerror {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} idecompiled {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} idemode {{Text|<nowiki>'1 if using the IDE to compile</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ideerrorline {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'set by qb64-error(...) to the line number it would have reported, this number</nowiki>|#919191}} | |||
{{Text|<nowiki>'is later passed to the ide in message #8</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} idemessage {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'set by qb64-error(...) to the error message to be reported, this</nowiki>|#919191}} | |||
{{Text|<nowiki>'is later passed to the ide in message #8</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} optionexplicit {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} optionexplicitarray {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} optionexplicit_cmd {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ideStartAtLine {{Cl|AS}} {{Cl|LONG}}, errorLineInInclude {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} warningInInclude {{Cl|AS}} {{Cl|LONG}}, warningInIncludeLine {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} outputfile_cmd$ | |||
{{Cl|DIM}} {{Cl|SHARED}} compilelog$ | |||
{{Text|<nowiki>'</nowiki>|#919191}}{{Cm|$INCLUDE}}:{{Text|<nowiki>'global\IDEsettings.bas'</nowiki>|#919191}} | |||
{{Cl|DIM}} OutputIsRelativeToStartDir {{Cl|AS}} {{Cl|LONG}} | |||
CMDLineFile = {{Text|ParseCMDLineArgs$|#55FF55}} | |||
{{Cl|IF}} CMDLineFile <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} {{Cl|_FILEEXISTS}}({{Cl|_STARTDIR$}} + {{Text|<nowiki>"/"</nowiki>|#FFB100}} + CMDLineFile) {{Cl|THEN}} | |||
CMDLineFile = {{Cl|_STARTDIR$}} + {{Text|<nowiki>"/"</nowiki>|#FFB100}} + CMDLineFile | |||
OutputIsRelativeToStartDir = {{Text|-1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} ConsoleMode {{Cl|THEN}} | |||
{{Cl|_DEST}} {{Cl|_CONSOLE}} | |||
{{Cl|ELSE}} | |||
{{Cl|_CONSOLE}} {{Cl|OFF}} | |||
{{Cl|_SCREENSHOW}} | |||
{{Cl|_ICON}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'the function ?=ide(?) should always be passed 0, it returns a message code number, any further information</nowiki>|#919191}} | |||
{{Text|<nowiki>'is passed back in idereturn</nowiki>|#919191}} | |||
{{Text|<nowiki>'message code numbers:</nowiki>|#919191}} | |||
{{Text|<nowiki>'0 no ide present (auto defined array ide() return 0)</nowiki>|#919191}} | |||
{{Text|<nowiki>'1 launch ide & with passed filename (compiler->ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>'2 begin new compilation with returned line of code (compiler<-ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [2][line of code]</nowiki>|#919191}} | |||
{{Text|<nowiki>'3 request next line (compiler->ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [3]</nowiki>|#919191}} | |||
{{Text|<nowiki>'4 next line of code returned (compiler<-ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [4][line of code]</nowiki>|#919191}} | |||
{{Text|<nowiki>'5 no more lines of code exist (compiler<-ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [5]</nowiki>|#919191}} | |||
{{Text|<nowiki>'6 code is OK/ready (compiler->ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [6]</nowiki>|#919191}} | |||
{{Text|<nowiki>'7 repass the code from the beginning (compiler->ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [7]</nowiki>|#919191}} | |||
{{Text|<nowiki>'8 an error has occurred with 'this' message on 'this' line(compiler->ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [8][error message][line as LONG]</nowiki>|#919191}} | |||
{{Text|<nowiki>'9 C++ compile (if necessary) and run with 'this' name (compiler<-ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [9][name(no path, no .bas)]</nowiki>|#919191}} | |||
{{Text|<nowiki>'10 The line requires more time to process</nowiki>|#919191}} | |||
{{Text|<nowiki>' Pass-back 'line of code' using method [4] when ready</nowiki>|#919191}} | |||
{{Text|<nowiki>' [10][line of code]</nowiki>|#919191}} | |||
{{Text|<nowiki>'11 ".EXE file created" message</nowiki>|#919191}} | |||
{{Text|<nowiki>'12 The name of the exe I'll create is '...' (compiler->ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' [12][exe name without .exe]</nowiki>|#919191}} | |||
{{Text|<nowiki>'255 A qb error happened in the IDE (compiler->ide)</nowiki>|#919191}} | |||
{{Text|<nowiki>' note: detected by the fact that ideerror was not set to 0</nowiki>|#919191}} | |||
{{Text|<nowiki>' [255]</nowiki>|#919191}} | |||
{{Text|<nowiki>'hash table data</nowiki>|#919191}} | |||
{{Cl|TYPE}} HashListItem | |||
Flags {{Cl|AS}} {{Cl|LONG}} | |||
Reference {{Cl|AS}} {{Cl|LONG}} | |||
NextItem {{Cl|AS}} {{Cl|LONG}} | |||
PrevItem {{Cl|AS}} {{Cl|LONG}} | |||
LastItem {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'note: this value is only valid on the first item in the list</nowiki>|#919191}} | |||
{{Text|<nowiki>'note: name is stored in a seperate array of strings</nowiki>|#919191}} | |||
{{Cl|END TYPE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashFind_NextListItem {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashFind_Reverse {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashFind_SearchFlags {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashFind_Name {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashRemove_LastFound {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashListSize {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashListNext {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashListFreeSize {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} HashListFreeLast {{Cl|AS}} {{Cl|LONG}} | |||
{{Text|<nowiki>'hash lookup tables</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} hash1char({{Text|255|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} hash2char({{Text|65535|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|FOR}} x = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|26|#F580B1}} | |||
hash1char({{Text|64|#F580B1}} + x) = x | |||
hash1char({{Text|96|#F580B1}} + x) = x | |||
{{Cl|NEXT}} | |||
hash1char({{Text|95|#F580B1}}) = {{Text|27|#F580B1}} {{Text|<nowiki>'_</nowiki>|#919191}} | |||
hash1char({{Text|48|#F580B1}}) = {{Text|28|#F580B1}} {{Text|<nowiki>'0</nowiki>|#919191}} | |||
hash1char({{Text|49|#F580B1}}) = {{Text|29|#F580B1}} {{Text|<nowiki>'1</nowiki>|#919191}} | |||
hash1char({{Text|50|#F580B1}}) = {{Text|30|#F580B1}} {{Text|<nowiki>'2</nowiki>|#919191}} | |||
hash1char({{Text|51|#F580B1}}) = {{Text|31|#F580B1}} {{Text|<nowiki>'3</nowiki>|#919191}} | |||
hash1char({{Text|52|#F580B1}}) = {{Text|23|#F580B1}} {{Text|<nowiki>'4 'note: x, y, z and beginning alphabet letters avoided because of common usage (eg. a2, y3)</nowiki>|#919191}} | |||
hash1char({{Text|53|#F580B1}}) = {{Text|22|#F580B1}} {{Text|<nowiki>'5</nowiki>|#919191}} | |||
hash1char({{Text|54|#F580B1}}) = {{Text|20|#F580B1}} {{Text|<nowiki>'6</nowiki>|#919191}} | |||
hash1char({{Text|55|#F580B1}}) = {{Text|19|#F580B1}} {{Text|<nowiki>'7</nowiki>|#919191}} | |||
hash1char({{Text|56|#F580B1}}) = {{Text|18|#F580B1}} {{Text|<nowiki>'8</nowiki>|#919191}} | |||
hash1char({{Text|57|#F580B1}}) = {{Text|17|#F580B1}} {{Text|<nowiki>'9</nowiki>|#919191}} | |||
{{Cl|FOR}} c1 = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}} | |||
{{Cl|FOR}} c2 = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}} | |||
hash2char(c1 + c2 * {{Text|256|#F580B1}}) = hash1char(c1) + hash1char(c2) * {{Text|32|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'init</nowiki>|#919191}} | |||
HashListSize = {{Text|65536|#F580B1}} | |||
HashListNext = {{Text|1|#F580B1}} | |||
HashListFreeSize = {{Text|1024|#F580B1}} | |||
HashListFreeLast = {{Text|0|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} HashList({{Text|1|#F580B1}} {{Cl|TO}} HashListSize) {{Cl|AS}} HashListItem | |||
{{Cl|REDIM}} {{Cl|SHARED}} HashListName({{Text|1|#F580B1}} {{Cl|TO}} HashListSize) {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} HashListFree({{Text|1|#F580B1}} {{Cl|TO}} HashListFreeSize) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} HashTable({{Text|16777215|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'64MB lookup table with indexes to the hashlist</nowiki>|#919191}} | |||
{{Cl|CONST}} HASHFLAG_LABEL = {{Text|2|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_TYPE = {{Text|4|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_RESERVED = {{Text|8|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_OPERATOR = {{Text|16|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_CUSTOMSYNTAX = {{Text|32|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_SUB = {{Text|64|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_FUNCTION = {{Text|128|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_UDT = {{Text|256|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_UDTELEMENT = {{Text|512|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_CONSTANT = {{Text|1024|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_VARIABLE = {{Text|2048|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_ARRAY = {{Text|4096|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_XELEMENTNAME = {{Text|8192|#F580B1}} | |||
{{Cl|CONST}} HASHFLAG_XTYPENAME = {{Text|16384|#F580B1}} | |||
{{Cl|TYPE}} Label_Type | |||
State {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_BYTE}} {{Text|<nowiki>'0=label referenced, 1=label created</nowiki>|#919191}} | |||
cn {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
{{Text|Scope|#55FF55}} {{Cl|AS}} {{Cl|LONG}} | |||
Data_Offset {{Cl|AS}} {{Cl|_INTEGER64}} {{Text|<nowiki>'offset within data</nowiki>|#919191}} | |||
Data_Referenced {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_BYTE}} {{Text|<nowiki>'set to 1 if data is referenced (data_offset will be used to create the data offset variable)</nowiki>|#919191}} | |||
Error_Line {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'the line number to reference on errors</nowiki>|#919191}} | |||
Scope_Restriction {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'cannot exist inside this scope (post checked)</nowiki>|#919191}} | |||
SourceLineNumber {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|END TYPE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} nLabels, Labels_Ubound | |||
Labels_Ubound = {{Text|100|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} Labels({{Text|1|#F580B1}} {{Cl|TO}} Labels_Ubound) {{Cl|AS}} Label_Type | |||
{{Cl|DIM}} {{Cl|SHARED}} Empty_Label {{Cl|AS}} Label_Type | |||
{{Cl|DIM}} {{Cl|SHARED}} PossibleSubNameLabels {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'format: name+sp+name+sp+name <-ucase$'d</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} SubNameLabels {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'format: name+sp+name+sp+name <-ucase$'d</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} CreatingLabel {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} AllowLocalName {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} DataOffset | |||
{{Cl|DIM}} {{Cl|SHARED}} prepass | |||
{{Cl|DIM}} {{Cl|SHARED}} autoarray | |||
{{Cl|DIM}} {{Cl|SHARED}} ontimerid, onkeyid, onstrigid | |||
{{Cl|DIM}} {{Cl|SHARED}} revertmaymusthave({{Text|1|#F580B1}} {{Cl|TO}} {{Text|10000|#F580B1}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} revertmaymusthaven | |||
{{Cl|DIM}} {{Cl|SHARED}} linecontinuation | |||
{{Cl|DIM}} {{Cl|SHARED}} dim2typepassback {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'passes back correct case sensitive version of type</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} inclevel | |||
{{Cl|DIM}} {{Cl|SHARED}} incname({{Text|100|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'must be full path as given</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} inclinenumber({{Text|100|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} incerror {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} fix046 {{Cl|AS}} {{Cl|STRING}} | |||
fix046$ = {{Text|<nowiki>"__"</nowiki>|#FFB100}} + {{Text|<nowiki>"ASCII"</nowiki>|#FFB100}} + {{Text|<nowiki>"_"</nowiki>|#FFB100}} + {{Text|<nowiki>"CHR"</nowiki>|#FFB100}} + {{Text|<nowiki>"_"</nowiki>|#FFB100}} + {{Text|<nowiki>"046"</nowiki>|#FFB100}} + {{Text|<nowiki>"__"</nowiki>|#FFB100}} {{Text|<nowiki>'broken up to avoid detection for layout reversion</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} layout {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'passed to IDE</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} layoutok {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'tracks status of entire line</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} layoutcomment {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} tlayout {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'temporary layout string set by supporting functions</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} layoutdone {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'tracks status of single command</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} fooindwel | |||
{{Cl|DIM}} {{Cl|SHARED}} alphanumeric({{Text|255|#F580B1}}) | |||
{{Cl|FOR}} i = {{Text|48|#F580B1}} {{Cl|TO}} {{Text|57|#F580B1}} | |||
alphanumeric(i) = {{Text|-1|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Cl|FOR}} i = {{Text|65|#F580B1}} {{Cl|TO}} {{Text|90|#F580B1}} | |||
alphanumeric(i) = {{Text|-1|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Cl|FOR}} i = {{Text|97|#F580B1}} {{Cl|TO}} {{Text|122|#F580B1}} | |||
alphanumeric(i) = {{Text|-1|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'_ is treated as an alphabet letter</nowiki>|#919191}} | |||
alphanumeric({{Text|95|#F580B1}}) = {{Text|-1|#F580B1}} | |||
{{Cl|DIM}} {{Cl|SHARED}} isalpha({{Text|255|#F580B1}}) | |||
{{Cl|FOR}} i = {{Text|65|#F580B1}} {{Cl|TO}} {{Text|90|#F580B1}} | |||
isalpha(i) = {{Text|-1|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Cl|FOR}} i = {{Text|97|#F580B1}} {{Cl|TO}} {{Text|122|#F580B1}} | |||
isalpha(i) = {{Text|-1|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'_ is treated as an alphabet letter</nowiki>|#919191}} | |||
isalpha({{Text|95|#F580B1}}) = {{Text|-1|#F580B1}} | |||
{{Cl|DIM}} {{Cl|SHARED}} isnumeric({{Text|255|#F580B1}}) | |||
{{Cl|FOR}} i = {{Text|48|#F580B1}} {{Cl|TO}} {{Text|57|#F580B1}} | |||
isnumeric(i) = {{Text|-1|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Cl|DIM}} {{Cl|SHARED}} lfsinglechar({{Text|255|#F580B1}}) | |||
lfsinglechar({{Text|40|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'(</nowiki>|#919191}} | |||
lfsinglechar({{Text|41|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>')</nowiki>|#919191}} | |||
lfsinglechar({{Text|42|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'*</nowiki>|#919191}} | |||
lfsinglechar({{Text|43|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'+</nowiki>|#919191}} | |||
lfsinglechar({{Text|45|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'-</nowiki>|#919191}} | |||
lfsinglechar({{Text|47|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'/</nowiki>|#919191}} | |||
lfsinglechar({{Text|60|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'<</nowiki>|#919191}} | |||
lfsinglechar({{Text|61|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'=</nowiki>|#919191}} | |||
lfsinglechar({{Text|62|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'></nowiki>|#919191}} | |||
lfsinglechar({{Text|92|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'\</nowiki>|#919191}} | |||
lfsinglechar({{Text|94|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'^</nowiki>|#919191}} | |||
lfsinglechar({{Text|44|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>',</nowiki>|#919191}} | |||
lfsinglechar({{Text|46|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'.</nowiki>|#919191}} | |||
lfsinglechar({{Text|58|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>':</nowiki>|#919191}} | |||
lfsinglechar({{Text|59|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>';</nowiki>|#919191}} | |||
lfsinglechar({{Text|35|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'# (file no only)</nowiki>|#919191}} | |||
lfsinglechar({{Text|36|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'$ (metacommand only)</nowiki>|#919191}} | |||
lfsinglechar({{Text|63|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'? (print macro)</nowiki>|#919191}} | |||
lfsinglechar({{Text|95|#F580B1}}) = {{Text|1|#F580B1}} {{Text|<nowiki>'_</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} nextrunlineindex {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} lineinput3buffer {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} lineinput3index {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} dimstatic {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} staticarraylist {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} staticarraylistn {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} commonarraylist {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} commonarraylistn {{Cl|AS}} {{Cl|LONG}} | |||
{{Text|<nowiki>'CONST support</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} constmax {{Cl|AS}} {{Cl|LONG}} | |||
constmax = {{Text|100|#F580B1}} | |||
{{Cl|DIM}} {{Cl|SHARED}} constlast {{Cl|AS}} {{Cl|LONG}} | |||
constlast = {{Text|-1|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constname(constmax) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constcname(constmax) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constnamesymbol(constmax) {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'optional name symbol</nowiki>|#919191}} | |||
{{Text|<nowiki>' `1 and `no-number must be handled correctly</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED constlastshared AS LONG 'so any defined inside a sub/function after this index can be "forgotten" when sub/function exits</nowiki>|#919191}} | |||
{{Text|<nowiki>'constlastshared = -1</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} consttype(constmax) {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'variable type number</nowiki>|#919191}} | |||
{{Text|<nowiki>'consttype determines storage</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constinteger(constmax) {{Cl|AS}} {{Cl|_INTEGER64}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constuinteger(constmax) {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_INTEGER64}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constfloat(constmax) {{Cl|AS}} {{Cl|_FLOAT}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} conststring(constmax) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constsubfunc(constmax) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} constdefined(constmax) {{Cl|AS}} {{Cl|LONG}} | |||
{{Text|<nowiki>'UDT</nowiki>|#919191}} | |||
{{Text|<nowiki>'names</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} lasttype {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} lasttypeelement {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|TYPE}} idstruct | |||
n {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} {{Text|<nowiki>'name</nowiki>|#919191}} | |||
cn {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} {{Text|<nowiki>'case sensitive version of n</nowiki>|#919191}} | |||
arraytype {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'similar to t</nowiki>|#919191}} | |||
arrayelements {{Cl|AS}} {{Cl|INTEGER}} | |||
staticarray {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'set for arrays declared in the main module with static elements</nowiki>|#919191}} | |||
mayhave {{Cl|AS}} {{Cl|STRING}} * {{Text|8|#F580B1}} {{Text|<nowiki>'mayhave and musthave are exclusive of each other</nowiki>|#919191}} | |||
musthave {{Cl|AS}} {{Cl|STRING}} * {{Text|8|#F580B1}} | |||
t {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'type</nowiki>|#919191}} | |||
tsize {{Cl|AS}} {{Cl|LONG}} | |||
subfunc {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'if function=1, sub=2 (max 100 arguments)</nowiki>|#919191}} | |||
Dependency {{Cl|AS}} {{Cl|INTEGER}} | |||
internal_subfunc {{Cl|AS}} {{Cl|INTEGER}} | |||
callname {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
ccall {{Cl|AS}} {{Cl|INTEGER}} | |||
overloaded {{Cl|AS}} {{Cl|_BYTE}} | |||
args {{Cl|AS}} {{Cl|INTEGER}} | |||
minargs {{Cl|AS}} {{Cl|INTEGER}} | |||
arg {{Cl|AS}} {{Cl|STRING}} * {{Text|400|#F580B1}} {{Text|<nowiki>'similar to t</nowiki>|#919191}} | |||
argsize {{Cl|AS}} {{Cl|STRING}} * {{Text|400|#F580B1}} {{Text|<nowiki>'similar to tsize (used for fixed length strings)</nowiki>|#919191}} | |||
specialformat {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
secondargmustbe {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
secondargcantbe {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
ret {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'the value it returns if it is a function (again like t)</nowiki>|#919191}} | |||
insubfunc {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
insubfuncn {{Cl|AS}} {{Cl|LONG}} | |||
share {{Cl|AS}} {{Cl|INTEGER}} | |||
nele {{Cl|AS}} {{Cl|STRING}} * {{Text|100|#F580B1}} | |||
nelereq {{Cl|AS}} {{Cl|STRING}} * {{Text|100|#F580B1}} | |||
linkid {{Cl|AS}} {{Cl|LONG}} | |||
linkarg {{Cl|AS}} {{Cl|INTEGER}} | |||
staticscope {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Text|<nowiki>'For variables which are arguments passed to a sub/function</nowiki>|#919191}} | |||
sfid {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'id number of variable's parent sub/function</nowiki>|#919191}} | |||
sfarg {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'argument/parameter # within call (1=first)</nowiki>|#919191}} | |||
hr_syntax {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|END TYPE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} id {{Cl|AS}} idstruct | |||
{{Cl|DIM}} {{Cl|SHARED}} idn {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ids_max {{Cl|AS}} {{Cl|LONG}} | |||
ids_max = {{Text|1024|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} ids({{Text|1|#F580B1}} {{Cl|TO}} ids_max) {{Cl|AS}} idstruct | |||
{{Cl|REDIM}} {{Cl|SHARED}} cmemlist({{Text|1|#F580B1}} {{Cl|TO}} ids_max + {{Text|1|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'variables that must be in cmem</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} sfcmemargs({{Text|1|#F580B1}} {{Cl|TO}} ids_max + {{Text|1|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} * {{Text|100|#F580B1}} {{Text|<nowiki>'s/f arg that must be in cmem</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} arrayelementslist({{Text|1|#F580B1}} {{Cl|TO}} ids_max + {{Text|1|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'arrayelementslist (like cmemlist) helps to resolve the number of elements in arrays with an unknown number of elements. Note: arrays with an unknown number of elements have .arrayelements=-1</nowiki>|#919191}} | |||
{{Text|<nowiki>'create blank id template for idclear to copy (stops strings being set to chr$(0))</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} cleariddata {{Cl|AS}} idstruct | |||
cleariddata.cn = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.n = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.mayhave = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.musthave = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.callname = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.arg = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.argsize = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.specialformat = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.secondargmustbe = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.secondargcantbe = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.insubfunc = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.nele = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
cleariddata.nelereq = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISSTRING {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISFLOAT {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISUNSIGNED {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISPOINTER {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISFIXEDLENGTH {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISINCONVENTIONALMEMORY {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISOFFSETINBITS {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISARRAY {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISREFERENCE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISUDT {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ISOFFSET {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} STRINGTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} BITTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} UBITTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} BYTETYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} UBYTETYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} INTEGERTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} UINTEGERTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} LONGTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ULONGTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} INTEGER64TYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} UINTEGER64TYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} SINGLETYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} DOUBLETYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} FLOATTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} OFFSETTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} UOFFSETTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} UDTTYPE {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} gosubid {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} redimoption {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} dimoption {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} arraydesc {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} qberrorhappened {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} qberrorcode {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} qberrorline {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Text|<nowiki>'COMMON SHARED defineaz() AS STRING</nowiki>|#919191}} | |||
{{Text|<nowiki>'COMMON SHARED defineextaz() AS STRING</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} sourcefile {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'the full path and filename</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} file {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'name of the file (without .bas or path)</nowiki>|#919191}} | |||
{{Text|<nowiki>'COMMON SHARED separgs() AS STRING</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} constequation {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} DynamicMode {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} findidsecondarg {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} findanotherid {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} findidinternal {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} currentid {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'is the index of the last ID accessed</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} linenumber {{Cl|AS}} {{Cl|LONG}}, reallinenumber {{Cl|AS}} {{Cl|LONG}}, totallinenumber {{Cl|AS}} {{Cl|LONG}}, definingtypeerror {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} wholeline {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} firstLineNumberLabelvWatch {{Cl|AS}} {{Cl|LONG}}, lastLineNumberLabelvWatch {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} vWatchUsedLabels {{Cl|AS}} {{Cl|STRING}}, vWatchUsedSkipLabels {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} linefragment {{Cl|AS}} {{Cl|STRING}} | |||
{{Text|<nowiki>'COMMON SHARED bitmask() AS _INTEGER64</nowiki>|#919191}} | |||
{{Text|<nowiki>'COMMON SHARED bitmaskinv() AS _INTEGER64</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} arrayprocessinghappened {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} stringprocessinghappened {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} cleanupstringprocessingcall {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} inputfunctioncalled {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} recompile {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'forces recompilation</nowiki>|#919191}} | |||
{{Text|<nowiki>'COMMON SHARED cmemlist() AS INTEGER</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} optionbase {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} addmetastatic {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} addmetadynamic {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} addmetainclude {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} closedmain {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} module {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} subfunc {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} subfuncn {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} closedsubfunc {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} {{Cl|SHARED}} subfuncid {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} defdatahandle {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} dimsfarray {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} dimshared {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Text|<nowiki>'Allows passing of known elements to recompilation</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} sflistn {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Text|<nowiki>'COMMON SHARED sfidlist() AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'COMMON SHARED sfarglist() AS INTEGER</nowiki>|#919191}} | |||
{{Text|<nowiki>'COMMON SHARED sfelelist() AS INTEGER</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} glinkid {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} glinkarg {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} typname2typsize {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} uniquenumbern {{Cl|AS}} {{Cl|LONG}} | |||
{{Text|<nowiki>'CLEAR , , 16384</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} bitmask({{Text|1|#F580B1}} {{Cl|TO}} {{Text|64|#F580B1}}) {{Cl|AS}} {{Cl|_INTEGER64}} | |||
{{Cl|DIM}} {{Cl|SHARED}} bitmaskinv({{Text|1|#F580B1}} {{Cl|TO}} {{Text|64|#F580B1}}) {{Cl|AS}} {{Cl|_INTEGER64}} | |||
{{Cl|DIM}} {{Cl|SHARED}} defineextaz({{Text|1|#F580B1}} {{Cl|TO}} {{Text|27|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|DIM}} {{Cl|SHARED}} defineaz({{Text|1|#F580B1}} {{Cl|TO}} {{Text|27|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'27 is an underscore</nowiki>|#919191}} | |||
ISSTRING = {{Text|1073741824|#F580B1}} | |||
ISFLOAT = {{Text|536870912|#F580B1}} | |||
ISUNSIGNED = {{Text|268435456|#F580B1}} | |||
ISPOINTER = {{Text|134217728|#F580B1}} | |||
ISFIXEDLENGTH = {{Text|67108864|#F580B1}} {{Text|<nowiki>'only set for strings with pointer flag</nowiki>|#919191}} | |||
ISINCONVENTIONALMEMORY = {{Text|33554432|#F580B1}} | |||
ISOFFSETINBITS = {{Text|16777216|#F580B1}} | |||
ISARRAY = {{Text|8388608|#F580B1}} | |||
ISREFERENCE = {{Text|4194304|#F580B1}} | |||
ISUDT = {{Text|2097152|#F580B1}} | |||
ISOFFSET = {{Text|1048576|#F580B1}} | |||
STRINGTYPE = ISSTRING + ISPOINTER | |||
BITTYPE = {{Text|1&|#F580B1}} + ISPOINTER + ISOFFSETINBITS | |||
UBITTYPE = {{Text|1&|#F580B1}} + ISPOINTER + ISUNSIGNED + ISOFFSETINBITS {{Text|<nowiki>'QB64 will also support BIT*n, eg. DIM bitarray[10] AS _UNSIGNED _BIT*10</nowiki>|#919191}} | |||
BYTETYPE = {{Text|8&|#F580B1}} + ISPOINTER | |||
UBYTETYPE = {{Text|8&|#F580B1}} + ISPOINTER + ISUNSIGNED | |||
INTEGERTYPE = {{Text|16&|#F580B1}} + ISPOINTER | |||
UINTEGERTYPE = {{Text|16&|#F580B1}} + ISPOINTER + ISUNSIGNED | |||
LONGTYPE = {{Text|32&|#F580B1}} + ISPOINTER | |||
ULONGTYPE = {{Text|32&|#F580B1}} + ISPOINTER + ISUNSIGNED | |||
INTEGER64TYPE = {{Text|64&|#F580B1}} + ISPOINTER | |||
UINTEGER64TYPE = {{Text|64&|#F580B1}} + ISPOINTER + ISUNSIGNED | |||
SINGLETYPE = {{Text|32&|#F580B1}} + ISFLOAT + ISPOINTER | |||
DOUBLETYPE = {{Text|64&|#F580B1}} + ISFLOAT + ISPOINTER | |||
FLOATTYPE = {{Text|256&|#F580B1}} + ISFLOAT + ISPOINTER {{Text|<nowiki>'8-32 bytes</nowiki>|#919191}} | |||
OFFSETTYPE = {{Text|64&|#F580B1}} + ISOFFSET + ISPOINTER: {{Cl|IF}} OS_BITS = {{Text|32|#F580B1}} {{Cl|THEN}} OFFSETTYPE = {{Text|32&|#F580B1}} + ISOFFSET + ISPOINTER | |||
UOFFSETTYPE = {{Text|64&|#F580B1}} + ISOFFSET + ISUNSIGNED + ISPOINTER: {{Cl|IF}} OS_BITS = {{Text|32|#F580B1}} {{Cl|THEN}} UOFFSETTYPE = {{Text|32&|#F580B1}} + ISOFFSET + ISUNSIGNED + ISPOINTER | |||
UDTTYPE = ISUDT + ISPOINTER | |||
{{Cl|DIM}} {{Cl|SHARED}} statementn {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} everycasenewcase {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} controllevel {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'0=not in a control block</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} controltype({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Text|<nowiki>'1=IF (awaiting END IF)</nowiki>|#919191}} | |||
{{Text|<nowiki>'2=FOR (awaiting NEXT)</nowiki>|#919191}} | |||
{{Text|<nowiki>'3=DO (awaiting LOOP [UNTIL|WHILE param])</nowiki>|#919191}} | |||
{{Text|<nowiki>'4=DO WHILE/UNTIL (awaiting LOOP)</nowiki>|#919191}} | |||
{{Text|<nowiki>'5=WHILE (awaiting WEND)</nowiki>|#919191}} | |||
{{Text|<nowiki>'6=$IF (precompiler)</nowiki>|#919191}} | |||
{{Text|<nowiki>'10=SELECT CASE qbs (awaiting END SELECT/CASE)</nowiki>|#919191}} | |||
{{Text|<nowiki>'11=SELECT CASE int64 (awaiting END SELECT/CASE)</nowiki>|#919191}} | |||
{{Text|<nowiki>'12=SELECT CASE uint64 (awaiting END SELECT/CASE)</nowiki>|#919191}} | |||
{{Text|<nowiki>'13=SELECT CASE LONG double (awaiting END SELECT/CASE/CASE ELSE)</nowiki>|#919191}} | |||
{{Text|<nowiki>'14=SELECT CASE float ...</nowiki>|#919191}} | |||
{{Text|<nowiki>'15=SELECT CASE double</nowiki>|#919191}} | |||
{{Text|<nowiki>'16=SELECT CASE int32</nowiki>|#919191}} | |||
{{Text|<nowiki>'17=SELECT CASE uint32</nowiki>|#919191}} | |||
{{Text|<nowiki>'18=CASE (awaiting END SELECT/CASE/CASE ELSE)</nowiki>|#919191}} | |||
{{Text|<nowiki>'19=CASE ELSE (awaiting END SELECT)</nowiki>|#919191}} | |||
{{Text|<nowiki>'32=SUB/FUNCTION (awaiting END SUB/FUNCTION)</nowiki>|#919191}} | |||
{{Cl|DIM}} controlid({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} controlvalue({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} controlstate({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} controlref({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'the line number the control was created on</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}} | |||
{{Text|<nowiki>' Collection of flags indicating which unstable features should be used during compilation</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} unstableFlags({{Text|1|#F580B1}} {{Cl|TO}} {{Text|2|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|DIM}} UNSTABLE_MIDI {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} UNSTABLE_HTTP {{Cl|AS}} {{Cl|LONG}} | |||
UNSTABLE_MIDI = {{Text|1|#F580B1}} | |||
UNSTABLE_HTTP = {{Text|2|#F580B1}} | |||
{{Cl|ON ERROR}} {{Cl|GOTO}} qberror | |||
i2&& = {{Text|1|#F580B1}} | |||
{{Cl|FOR}} i&& = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|64|#F580B1}} | |||
bitmask(i&&) = i2&& | |||
bitmaskinv(i&&) = {{Cl|NOT}} i2&& | |||
i2&& = i2&& + {{Text|2|#F580B1}} ^ i&& | |||
{{Cl|NEXT}} | |||
{{Cl|DIM}} id2 {{Cl|AS}} idstruct | |||
cleanupstringprocessingcall$ = {{Text|<nowiki>"qbs_cleanup(qbs_tmp_base,"</nowiki>|#FFB100}} | |||
{{Cl|DIM}} {{Cl|SHARED}} sfidlist({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|DIM}} {{Cl|SHARED}} sfarglist({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|DIM}} {{Cl|SHARED}} sfelelist({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Text|<nowiki>'----------------ripgl.bas--------------------------------------------------------------------------------</nowiki>|#919191}} | |||
{{Text|gl_scan_header|#55FF55}} | |||
{{Text|<nowiki>'----------------ripgl.bas--------------------------------------------------------------------------------</nowiki>|#919191}} | |||
{{Text|<nowiki>'-----------------------QB64 COMPILER ONCE ONLY SETUP CODE ENDS HERE---------------------------------------</nowiki>|#919191}} | |||
{{Cl|IF}} NoIDEMode {{Cl|THEN}} IDE_AutoPosition = {{Text|0|#F580B1}}: {{Cl|GOTO}} noide | |||
{{Cl|DIM}} FileDropEnabled {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|IF}} FileDropEnabled = {{Text|0|#F580B1}} {{Cl|THEN}} FileDropEnabled = {{Text|-1|#F580B1}}: {{Cl|_ACCEPTFILEDROP}} | |||
{{Cl|IF}} IDE_AutoPosition {{Cl|AND (boolean)|AND}} {{Cl|NOT}} IDE_BypassAutoPosition {{Cl|THEN}} {{Cl|_SCREENMOVE}} IDE_LeftPosition, IDE_TopPosition | |||
idemode = {{Text|1|#F580B1}} | |||
sendc$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Text|<nowiki>'no initial message</nowiki>|#919191}} | |||
{{Cl|IF}} CMDLineFile <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} sendc$ = {{Cl|CHR$}}({{Text|1|#F580B1}}) + CMDLineFile | |||
sendcommand: | |||
idecommand$ = sendc$ | |||
C = {{Text|ide|#55FF55}}({{Text|0|#F580B1}}) | |||
ideerror = {{Text|0|#F580B1}} | |||
{{Cl|IF}} C = {{Text|0|#F580B1}} {{Cl|THEN}} idemode = {{Text|0|#F580B1}}: {{Cl|GOTO}} noide | |||
c$ = idereturn$ | |||
{{Cl|IF}} C = {{Text|2|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'begin</nowiki>|#919191}} | |||
ideerrorline = {{Text|0|#F580B1}} {{Text|<nowiki>'addresses invalid prepass error line numbers being reported</nowiki>|#919191}} | |||
idepass = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} fullrecompile | |||
ideret1: | |||
wholeline$ = c$ | |||
{{Cl|GOTO}} ideprepass | |||
ideret2: | |||
{{Cl|IF}} lastLineReturn {{Cl|THEN}} {{Cl|GOTO}} lastLineReturn | |||
sendc$ = {{Cl|CHR$}}({{Text|3|#F580B1}}) {{Text|<nowiki>'request next line</nowiki>|#919191}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Cl|IF}} C = {{Text|4|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'next line</nowiki>|#919191}} | |||
{{Cl|IF}} idepass = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
wholeline$ = c$ | |||
{{Cl|GOTO}} ideprepass | |||
{{Text|<nowiki>'(returns to ideret2: above)</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'assume idepass>1</nowiki>|#919191}} | |||
a3$ = c$ | |||
continuelinefrom = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} ide4 | |||
ideret4: | |||
{{Cl|IF}} lastLineReturn {{Cl|THEN}} {{Cl|GOTO}} lastLineReturn | |||
sendc$ = {{Cl|CHR$}}({{Text|3|#F580B1}}) {{Text|<nowiki>'request next line</nowiki>|#919191}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Cl|IF}} C = {{Text|5|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'end of program reached</nowiki>|#919191}} | |||
lastLine = {{Text|1|#F580B1}} | |||
lastLineReturn = {{Text|1|#F580B1}} | |||
{{Cl|IF}} idepass = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
wholeline$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} ideprepass | |||
{{Text|<nowiki>'(returns to ideret2: above, then to lastLinePrepassReturn below)</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'idepass>1</nowiki>|#919191}} | |||
a3$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
continuelinefrom = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} ide4 {{Text|<nowiki>'returns to ideret4, then to lastLinePrepassReturn below</nowiki>|#919191}} | |||
lastLineReturn: | |||
lastLineReturn = {{Text|0|#F580B1}} | |||
lastLine = {{Text|0|#F580B1}} | |||
{{Cl|IF}} idepass = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'prepass complete</nowiki>|#919191}} | |||
idepass = {{Text|2|#F580B1}} | |||
{{Cl|GOTO}} ide3 | |||
ideret3: | |||
sendc$ = {{Cl|CHR$}}({{Text|7|#F580B1}}) {{Text|<nowiki>'repass request</nowiki>|#919191}} | |||
firstLine = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'assume idepass=2</nowiki>|#919191}} | |||
{{Text|<nowiki>'finalize program</nowiki>|#919191}} | |||
{{Cl|GOTO}} ide5 | |||
ideret5: {{Text|<nowiki>'note: won't return here if a recompile was required!</nowiki>|#919191}} | |||
sendc$ = {{Cl|CHR$}}({{Text|6|#F580B1}}) {{Text|<nowiki>'ready</nowiki>|#919191}} | |||
idecompiled = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Cl|IF}} C = {{Text|9|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'run</nowiki>|#919191}} | |||
{{Cl|IF}} idecompiled = {{Text|0|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'exe needs to be compiled</nowiki>|#919191}} | |||
file$ = c$ | |||
{{Text|<nowiki>'locate accessible file and truncate</nowiki>|#919191}} | |||
f$ = file$ | |||
path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} SaveExeWithSource {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEN}}(ideprogname) {{Cl|THEN}} path.exe$ = idepath$ + pathsep$ | |||
{{Cl|END IF}} | |||
i = {{Text|1|#F580B1}} | |||
nextexeindex: | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(path.exe$ + file$ + extension$) {{Cl|THEN}} | |||
E = {{Text|0|#F580B1}} | |||
{{Cl|ON ERROR}} {{Cl|GOTO}} qberror_test | |||
{{Cl|KILL}} path.exe$ + file$ + extension$ | |||
{{Cl|ON ERROR}} {{Cl|GOTO}} qberror | |||
{{Cl|IF}} E = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
i = i + {{Text|1|#F580B1}} | |||
file$ = f$ + {{Text|<nowiki>"("</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(i) + {{Text|<nowiki>")"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} nextexeindex | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'inform IDE of name change if necessary (IDE will respond with message 9 and corrected name)</nowiki>|#919191}} | |||
{{Cl|IF}} i <> {{Text|1|#F580B1}} {{Cl|THEN}} | |||
sendc$ = {{Cl|CHR$}}({{Text|12|#F580B1}}) + file$ | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
ideerrorline = {{Text|0|#F580B1}} {{Text|<nowiki>'addresses C++ comp. error's line number</nowiki>|#919191}} | |||
{{Cl|GOTO}} ide6 | |||
ideret6: | |||
idecompiled = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} iderunmode = {{Text|2|#F580B1}} {{Cl|THEN}} | |||
sendc$ = {{Cl|CHR$}}({{Text|11|#F580B1}}) {{Text|<nowiki>'.EXE file created</nowiki>|#919191}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'execute program</nowiki>|#919191}} | |||
{{Cl|IF}} iderunmode = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} NoExeSaved {{Cl|THEN}} | |||
{{Text|<nowiki>'This is the section which deals with if the user selected to run the program without</nowiki>|#919191}} | |||
{{Text|<nowiki>'saving an EXE file to the disk.</nowiki>|#919191}} | |||
{{Text|<nowiki>'We start off by first running the EXE, and then we delete it from the drive.</nowiki>|#919191}} | |||
{{Text|<nowiki>'making it a temporary file when all is said and done.</nowiki>|#919191}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|SHELL}} {{Text|QuotedFilename$|#55FF55}}({{Cl|CHR$}}({{Text|34|#F580B1}}) + lastBinaryGenerated$ + {{Cl|CHR$}}({{Text|34|#F580B1}})) + ModifyCOMMAND$ {{Text|<nowiki>'run the newly created program</nowiki>|#919191}} | |||
{{Cl|SHELL}} {{Cl|_HIDE}} {{Cl|_DONTWAIT}} {{Text|<nowiki>"del "</nowiki>|#FFB100}} + {{Text|QuotedFilename$|#55FF55}}({{Cl|CHR$}}({{Text|34|#F580B1}}) + lastBinaryGenerated$ + {{Cl|CHR$}}({{Text|34|#F580B1}})) {{Text|<nowiki>'kill it</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} path.exe$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(lastBinaryGenerated$, {{Cl|LEN}}(path.exe$)) = path.exe$ {{Cl|THEN}} | |||
{{Cl|SHELL}} {{Text|QuotedFilename$|#55FF55}}(lastBinaryGenerated$) + ModifyCOMMAND$ | |||
{{Cl|KILL}} lastBinaryGenerated$ | |||
{{Cl|ELSE}} | |||
{{Cl|SHELL}} {{Text|QuotedFilename$|#55FF55}}(path.exe$ + lastBinaryGenerated$) + ModifyCOMMAND$ | |||
{{Cl|KILL}} path.exe$ + lastBinaryGenerated$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} path.exe$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} {{Cl|THEN}} path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
NoExeSaved = {{Text|0|#F580B1}} {{Text|<nowiki>'reset the flag for a temp EXE</nowiki>|#919191}} | |||
sendc$ = {{Cl|CHR$}}({{Text|6|#F580B1}}) {{Text|<nowiki>'ready</nowiki>|#919191}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|SHELL}} {{Cl|_DONTWAIT}} {{Text|QuotedFilename$|#55FF55}}({{Cl|CHR$}}({{Text|34|#F580B1}}) + lastBinaryGenerated$ + {{Cl|CHR$}}({{Text|34|#F580B1}})) + ModifyCOMMAND$ | |||
{{Cl|IF}} path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} path.exe$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(lastBinaryGenerated$, {{Cl|LEN}}(path.exe$)) = path.exe$ {{Cl|THEN}} | |||
{{Cl|SHELL}} {{Cl|_DONTWAIT}} {{Text|QuotedFilename$|#55FF55}}(lastBinaryGenerated$) + ModifyCOMMAND$ | |||
{{Cl|ELSE}} | |||
{{Cl|SHELL}} {{Cl|_DONTWAIT}} {{Text|QuotedFilename$|#55FF55}}(path.exe$ + lastBinaryGenerated$) + ModifyCOMMAND$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} path.exe$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} {{Cl|THEN}} path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|SHELL}} {{Text|QuotedFilename$|#55FF55}}({{Cl|CHR$}}({{Text|34|#F580B1}}) + lastBinaryGenerated$ + {{Cl|CHR$}}({{Text|34|#F580B1}})) + ModifyCOMMAND$ | |||
{{Cl|IF}} path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} path.exe$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(lastBinaryGenerated$, {{Cl|LEN}}(path.exe$)) = path.exe$ {{Cl|THEN}} | |||
{{Cl|SHELL}} {{Text|QuotedFilename$|#55FF55}}(lastBinaryGenerated$) + ModifyCOMMAND$ | |||
{{Cl|ELSE}} | |||
{{Cl|SHELL}} {{Text|QuotedFilename$|#55FF55}}(path.exe$ + lastBinaryGenerated$) + ModifyCOMMAND$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} path.exe$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} {{Cl|THEN}} path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|DO}}: {{Cl|DO...LOOP|LOOP UNTIL}} {{Cl|INKEY$}} = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|DO}}: {{Cl|DO...LOOP|LOOP UNTIL}} {{Cl|_KEYHIT}} = {{Text|0|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} idemode {{Cl|THEN}} | |||
{{Text|<nowiki>'Darken fg/bg colors</nowiki>|#919191}} | |||
dummy = {{Text|DarkenFGBG|#55FF55}}({{Text|0|#F580B1}}) | |||
{{Cl|END IF}} | |||
{{Cl|IF}} vWatchOn {{Cl|THEN}} | |||
sendc$ = {{Cl|CHR$}}({{Text|254|#F580B1}}) {{Text|<nowiki>'launch debug interface</nowiki>|#919191}} | |||
{{Cl|ELSE}} | |||
sendc$ = {{Cl|CHR$}}({{Text|6|#F580B1}}) {{Text|<nowiki>'ready</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"Invalid IDE message"</nowiki>|#FFB100}}: {{Cl|END}} | |||
ideerror: | |||
{{Cl|IF}} {{Cl|INSTR}}(idemessage$, sp$) {{Cl|THEN}} | |||
{{Text|<nowiki>'Something went wrong here, so let's give a generic error message to the user.</nowiki>|#919191}} | |||
{{Text|<nowiki>'(No error message should contain sp$ - that is, CHR$(13), when not in Debug mode)</nowiki>|#919191}} | |||
terrmsg$ = {{Cl|_ERRORMESSAGE$}} | |||
{{Cl|IF}} terrmsg$ = {{Text|<nowiki>"No error"</nowiki>|#FFB100}} {{Cl|THEN}} terrmsg$ = {{Text|<nowiki>"Internal error"</nowiki>|#FFB100}} | |||
idemessage$ = {{Text|<nowiki>"Compiler error (check for syntax errors) ("</nowiki>|#FFB100}} + terrmsg$ + {{Text|<nowiki>":"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|ERR}} {{Cl|THEN}} idemessage$ = idemessage$ + {{Text|str2$|#55FF55}}({{Cl|ERR}}) + {{Text|<nowiki>"-"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|_ERRORLINE}} {{Cl|THEN}} idemessage$ = idemessage$ + {{Text|str2$|#55FF55}}({{Cl|_ERRORLINE}}) | |||
{{Cl|IF}} {{Cl|_INCLERRORLINE}} {{Cl|THEN}} idemessage$ = idemessage$ + {{Text|<nowiki>"-"</nowiki>|#FFB100}} + {{Cl|_INCLERRORFILE$}} + {{Text|<nowiki>"-"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}({{Cl|_INCLERRORLINE}}) | |||
idemessage$ = idemessage$ + {{Text|<nowiki>")"</nowiki>|#FFB100}} | |||
{{Cl|IF}} inclevel > {{Text|0|#F580B1}} {{Cl|THEN}} idemessage$ = idemessage$ + incerror$ | |||
{{Cl|END IF}} | |||
sendc$ = {{Cl|CHR$}}({{Text|8|#F580B1}}) + idemessage$ + {{Cl|MKL$}}(ideerrorline) | |||
{{Cl|GOTO}} sendcommand | |||
noide: | |||
{{Cl|IF}} (qb64versionprinted = {{Text|0|#F580B1}} {{Cl|OR (boolean)|OR}} ConsoleMode = {{Text|0|#F580B1}}) {{Cl|AND (boolean)|AND}} {{Cl|NOT}} QuietMode {{Cl|THEN}} | |||
qb64versionprinted = {{Text|-1|#F580B1}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"QB64-PE Compiler V"</nowiki>|#FFB100}} + Version$ | |||
{{Cl|END IF}} | |||
{{Cl|IF}} CMDLineFile = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|LINE INPUT}} ; {{Text|<nowiki>"COMPILE (.bas)>"</nowiki>|#FFB100}}, f$ | |||
{{Cl|ELSE}} | |||
f$ = CMDLineFile | |||
{{Cl|END IF}} | |||
f$ = {{Cl|LTRIM$}}({{Cl|RTRIM$}}(f$)) | |||
{{Cl|IF}} {{Text|FileHasExtension|#55FF55}}(f$) = {{Text|0|#F580B1}} {{Cl|THEN}} f$ = f$ + {{Text|<nowiki>".bas"</nowiki>|#FFB100}} | |||
sourcefile$ = f$ | |||
CMDLineFile = sourcefile$ | |||
{{Text|<nowiki>'derive name from sourcefile</nowiki>|#919191}} | |||
f$ = {{Text|RemoveFileExtension$|#55FF55}}(f$) | |||
path.exe$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
currentdir$ = {{Cl|_CWD$}} | |||
path.source$ = {{Text|getfilepath$|#55FF55}}(sourcefile$) | |||
{{Cl|IF}} {{Cl|LEN}}(path.source$) {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_DIREXISTS}}(path.source$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|PRINT}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"Cannot locate source file: "</nowiki>|#FFB100}} + sourcefile$ | |||
{{Cl|IF}} ConsoleMode {{Cl|THEN}} {{Cl|SYSTEM}} {{Text|1|#F580B1}} | |||
{{Cl|END}} {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|CHDIR}} path.source$ | |||
path.source$ = {{Cl|_CWD$}} | |||
{{Cl|IF}} {{Cl|RIGHT$}}(path.source$, {{Text|1|#F580B1}}) <> pathsep$ {{Cl|THEN}} path.source$ = path.source$ + pathsep$ | |||
{{Cl|CHDIR}} currentdir$ | |||
{{Cl|END IF}} | |||
{{Cl|IF}} SaveExeWithSource {{Cl|THEN}} path.exe$ = path.source$ | |||
{{Cl|FOR}} x = {{Cl|LEN}}(f$) {{Cl|TO}} {{Text|1|#F580B1}} {{Cl|STEP}} {{Text|-1|#F580B1}} | |||
a$ = {{Cl|MID$ (function)|MID$}}(f$, x, {{Text|1|#F580B1}}) | |||
{{Cl|IF}} a$ = {{Text|<nowiki>"/"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} a$ = {{Text|<nowiki>"\"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
f$ = {{Cl|RIGHT$}}(f$, {{Cl|LEN}}(f$) - x) | |||
{{Cl|EXIT FOR}} | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
file$ = f$ | |||
{{Text|<nowiki>'if cmemlist(currentid+1)<>0 before calling regid the variable</nowiki>|#919191}} | |||
{{Text|<nowiki>'MUST be defined in cmem!</nowiki>|#919191}} | |||
fullrecompile: | |||
{{Cl|IF}} idemode = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|NOT}} QuietMode {{Cl|THEN}} | |||
{{Cl|PRINT}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"Beginning C++ output from QB64 code... "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
BU_DEPENDENCY_CONSOLE_ONLY = DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|UBOUND}}(DEPENDENCY): DEPENDENCY(i) = {{Text|0|#F580B1}}: {{Cl|NEXT}} | |||
DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) = BU_DEPENDENCY_CONSOLE_ONLY {{Cl|AND}} {{Text|2|#F580B1}} {{Text|<nowiki>'Restore -g switch if used</nowiki>|#919191}} | |||
Error_Happened = {{Text|0|#F580B1}} | |||
{{Cl|FOR}} closeall = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}}: {{Cl|CLOSE}} closeall: {{Cl|NEXT}} | |||
{{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"temp.bin"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|LOCK}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|WRITE}} {{Cl|OPEN|AS}} #26 {{Text|<nowiki>'relock</nowiki>|#919191}} | |||
bh = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"dyninfo.txt"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|CLOSE}} #9: {{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"debug.txt"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN|AS}} #9 | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} ids_max + {{Text|1|#F580B1}} | |||
arrayelementslist(i) = {{Text|0|#F580B1}} | |||
cmemlist(i) = {{Text|0|#F580B1}} | |||
sfcmemargs(i) = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'erase cmemlist</nowiki>|#919191}} | |||
{{Text|<nowiki>'erase sfcmemargs</nowiki>|#919191}} | |||
lastunresolved = {{Text|-1|#F580B1}} {{Text|<nowiki>'first pass</nowiki>|#919191}} | |||
sflistn = {{Text|-1|#F580B1}} {{Text|<nowiki>'no entries</nowiki>|#919191}} | |||
SubNameLabels = sp {{Text|<nowiki>'QB64 will perform a repass to resolve sub names used as labels</nowiki>|#919191}} | |||
vWatchDesiredState = {{Text|0|#F580B1}} | |||
vWatchRecompileAttempts = {{Text|0|#F580B1}} | |||
qb64prefix_set_desiredState = {{Text|0|#F580B1}} | |||
qb64prefix_set_recompileAttempts = {{Text|0|#F580B1}} | |||
opex_desiredState = {{Text|0|#F580B1}} | |||
opex_recompileAttempts = {{Text|0|#F580B1}} | |||
opexarray_desiredState = {{Text|0|#F580B1}} | |||
opexarray_recompileAttempts = {{Text|0|#F580B1}} | |||
recompile: | |||
vWatchOn = vWatchDesiredState | |||
{{Text|vWatchVariable|#55FF55}} {{Text|<nowiki>""</nowiki>|#FFB100}}, {{Text|-1|#F580B1}} {{Text|<nowiki>'reset internal variables list</nowiki>|#919191}} | |||
qb64prefix_set = qb64prefix_set_desiredState | |||
qb64prefix$ = {{Text|<nowiki>"_"</nowiki>|#FFB100}} | |||
optionexplicit = opex_desiredState | |||
{{Cl|IF}} optionexplicit_cmd = {{Text|-1|#F580B1}} {{Cl|AND (boolean)|AND}} NoIDEMode = {{Text|1|#F580B1}} {{Cl|THEN}} optionexplicit = {{Text|-1|#F580B1}} | |||
optionexplicitarray = opexarray_desiredState | |||
lastLineReturn = {{Text|0|#F580B1}} | |||
lastLine = {{Text|0|#F580B1}} | |||
firstLine = {{Text|1|#F580B1}} | |||
Resize = {{Text|0|#F580B1}} | |||
Resize_Scale = {{Text|0|#F580B1}} | |||
UseGL = {{Text|0|#F580B1}} | |||
Error_Happened = {{Text|0|#F580B1}} | |||
{{Text|HashClear|#55FF55}} {{Text|<nowiki>'clear the hash table</nowiki>|#919191}} | |||
{{Text|<nowiki>'add reserved words to hashtable</nowiki>|#919191}} | |||
f = HASHFLAG_TYPE + HASHFLAG_RESERVED | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"_UNSIGNED"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"_BIT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"_BYTE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"INTEGER"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"LONG"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"_INTEGER64"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"_OFFSET"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"SINGLE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DOUBLE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"_FLOAT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"STRING"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"ANY"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
f = HASHFLAG_OPERATOR + HASHFLAG_RESERVED | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"NOT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"IMP"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"EQV"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"AND"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"OR"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"XOR"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"MOD"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
f = HASHFLAG_RESERVED + HASHFLAG_CUSTOMSYNTAX | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"LIST"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"BASE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"_EXPLICIT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"AS"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"IS"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"OFF"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"ON"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"STOP"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"TO"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"USING"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'PUT(graphics) statement:</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"PRESET"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"PSET"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'OPEN statement:</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"FOR"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"OUTPUT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"RANDOM"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"BINARY"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"APPEND"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"SHARED"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"ACCESS"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"LOCK"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"READ"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"WRITE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'LINE statement:</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"STEP"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'WIDTH statement:</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"LPRINT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'VIEW statement:</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"PRINT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
f = HASHFLAG_RESERVED + HASHFLAG_XELEMENTNAME + HASHFLAG_XTYPENAME | |||
{{Text|<nowiki>'A</nowiki>|#919191}} | |||
{{Text|<nowiki>'B</nowiki>|#919191}} | |||
{{Text|<nowiki>'C</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"COMMON"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"CALL"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"CASE"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"COM"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} {{Text|<nowiki>'(ON...)</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"CONST"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'D</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DATA"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DECLARE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DEF"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DEFDBL"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DEFINT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DEFLNG"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DEFSNG"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DEFSTR"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DIM"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"DO"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'E</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"ERROR"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} {{Text|<nowiki>'(ON ...)</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"ELSEIF"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"ENDIF"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"EXIT"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'F</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"FIELD"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"FUNCTION"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'G</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"GOSUB"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"GOTO"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'H</nowiki>|#919191}} | |||
{{Text|<nowiki>'I</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"INPUT"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, {{Text|0|#F580B1}} {{Text|<nowiki>'(INPUT$ function exists, so conflicts if allowed as custom syntax)</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"IF"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'K</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"KEY"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, {{Text|0|#F580B1}} {{Text|<nowiki>'(ON...)</nowiki>|#919191}} | |||
{{Text|<nowiki>'L</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"LET"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"LOOP"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"LEN"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} {{Text|<nowiki>'(LEN function exists, so conflicts if allowed as custom syntax)</nowiki>|#919191}} | |||
{{Text|<nowiki>'M</nowiki>|#919191}} | |||
{{Text|<nowiki>'N</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"NEXT"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'O</nowiki>|#919191}} | |||
{{Text|<nowiki>'P</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"PLAY"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, {{Text|0|#F580B1}} {{Text|<nowiki>'(ON...)</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"PEN"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, {{Text|0|#F580B1}} {{Text|<nowiki>'(ON...)</nowiki>|#919191}} | |||
{{Text|<nowiki>'Q</nowiki>|#919191}} | |||
{{Text|<nowiki>'R</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"REDIM"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"REM"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"RESTORE"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"RESUME"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"RETURN"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"RUN"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'S</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"STATIC"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"STRIG"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} {{Text|<nowiki>'(ON...)</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"SEG"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"SELECT"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"SUB"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"SCREEN"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'T</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"THEN"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"TIMER"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, {{Text|0|#F580B1}} {{Text|<nowiki>'(ON...)</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"TYPE"</nowiki>|#FFB100}}, f - HASHFLAG_XELEMENTNAME, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'U</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"UNTIL"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"UEVENT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'V</nowiki>|#919191}} | |||
{{Text|<nowiki>'W</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"WEND"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"WHILE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'X</nowiki>|#919191}} | |||
{{Text|<nowiki>'Y</nowiki>|#919191}} | |||
{{Text|<nowiki>'Z</nowiki>|#919191}} | |||
{{Text|<nowiki>'clear/init variables</nowiki>|#919191}} | |||
Console = {{Text|0|#F580B1}} | |||
ScreenHide = {{Text|0|#F580B1}} | |||
Asserts = {{Text|0|#F580B1}} | |||
ResolveStaticFunctions = {{Text|0|#F580B1}} | |||
dynamiclibrary = {{Text|0|#F580B1}} | |||
dimsfarray = {{Text|0|#F580B1}} | |||
dimstatic = {{Text|0|#F580B1}} | |||
AllowLocalName = {{Text|0|#F580B1}} | |||
PossibleSubNameLabels = sp {{Text|<nowiki>'QB64 will perform a repass to resolve sub names used as labels</nowiki>|#919191}} | |||
use_global_byte_elements = {{Text|0|#F580B1}} | |||
dimshared = {{Text|0|#F580B1}}: dimmethod = {{Text|0|#F580B1}}: dimoption = {{Text|0|#F580B1}}: redimoption = {{Text|0|#F580B1}}: commonoption = {{Text|0|#F580B1}} | |||
mylib$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: mylibopt$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
declaringlibrary = {{Text|0|#F580B1}} | |||
nLabels = {{Text|0|#F580B1}} | |||
dynscope = {{Text|0|#F580B1}} | |||
elsefollowup = {{Text|0|#F580B1}} | |||
ontimerid = {{Text|0|#F580B1}}: onkeyid = {{Text|0|#F580B1}}: onstrigid = {{Text|0|#F580B1}} | |||
commonarraylist = {{Text|<nowiki>""</nowiki>|#FFB100}}: commonarraylistn = {{Text|0|#F580B1}} | |||
staticarraylist = {{Text|<nowiki>""</nowiki>|#FFB100}}: staticarraylistn = {{Text|0|#F580B1}} | |||
fooindwel = {{Text|0|#F580B1}} | |||
layout = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
layoutok = {{Text|0|#F580B1}} | |||
NoChecks = {{Text|0|#F580B1}} | |||
inclevel = {{Text|0|#F580B1}} | |||
errorLineInInclude = {{Text|0|#F580B1}} | |||
addmetainclude$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
nextrunlineindex = {{Text|1|#F580B1}} | |||
lasttype = {{Text|0|#F580B1}} | |||
lasttypeelement = {{Text|0|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtxname({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtxcname({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtxsize({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtxbytealign({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'first element MUST be on a byte alignment & size is a multiple of 8</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtxnext({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtxvariable({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} {{Text|<nowiki>'true if the udt contains variable length elements</nowiki>|#919191}} | |||
{{Text|<nowiki>'elements</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtename({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtecname({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} * {{Text|256|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtebytealign({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|INTEGER}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtesize({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtetype({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtetypesize({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtearrayelements({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} udtenext({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
definingtype = {{Text|0|#F580B1}} | |||
definingtypeerror = {{Text|0|#F580B1}} | |||
constlast = {{Text|-1|#F580B1}} | |||
{{Text|<nowiki>'constlastshared = -1</nowiki>|#919191}} | |||
closedmain = {{Text|0|#F580B1}} | |||
addmetastatic = {{Text|0|#F580B1}} | |||
addmetadynamic = {{Text|0|#F580B1}} | |||
DynamicMode = {{Text|0|#F580B1}} | |||
optionbase = {{Text|0|#F580B1}} | |||
ExeIconSet = {{Text|0|#F580B1}} | |||
VersionInfoSet = {{Text|0|#F580B1}} | |||
viFileVersionNum$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viProductVersionNum$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viCompanyName$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
viFileDescription$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viFileVersion$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viInternalName$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
viLegalCopyright$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viLegalTrademarks$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viOriginalFilename$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
viProductName$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viProductVersion$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viComments$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: viWeb$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
DataOffset = {{Text|0|#F580B1}} | |||
statementn = {{Text|0|#F580B1}} | |||
everycasenewcase = {{Text|0|#F580B1}} | |||
qberrorhappened = {{Text|0|#F580B1}}: qberrorcode = {{Text|0|#F580B1}}: qberrorline = {{Text|0|#F580B1}} | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|27|#F580B1}}: defineaz(i) = {{Text|<nowiki>"SINGLE"</nowiki>|#FFB100}}: defineextaz(i) = {{Text|<nowiki>"!"</nowiki>|#FFB100}}: {{Cl|NEXT}} | |||
controllevel = {{Text|0|#F580B1}} | |||
findidsecondarg$ = {{Text|<nowiki>""</nowiki>|#FFB100}}: findanotherid = {{Text|0|#F580B1}}: findidinternal = {{Text|0|#F580B1}}: currentid = {{Text|0|#F580B1}} | |||
linenumber = {{Text|0|#F580B1}} | |||
wholeline$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
linefragment$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
idn = {{Text|0|#F580B1}} | |||
arrayprocessinghappened = {{Text|0|#F580B1}} | |||
stringprocessinghappened = {{Text|0|#F580B1}} | |||
inputfunctioncalled = {{Text|0|#F580B1}} | |||
subfuncn = {{Text|0|#F580B1}} | |||
closedsubfunc = {{Text|0|#F580B1}} | |||
subfunc = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
SelectCaseCounter = {{Text|0|#F580B1}} | |||
ExecCounter = {{Text|0|#F580B1}} | |||
UserDefineCount = {{Text|7|#F580B1}} | |||
totalVariablesCreated = {{Text|0|#F580B1}} | |||
typeDefinitions$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
totalMainVariablesCreated = {{Text|0|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} usedVariableList({{Text|1000|#F580B1}}) {{Cl|AS}} usedVarList | |||
totalWarnings = {{Text|0|#F580B1}} | |||
duplicateConstWarning = {{Text|0|#F580B1}} | |||
emptySCWarning = {{Text|0|#F580B1}} | |||
warningListItems = {{Text|0|#F580B1}} | |||
lastWarningHeader = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
vWatchUsedLabels = {{Cl|SPACE$}}({{Text|1000|#F580B1}}) | |||
vWatchUsedSkipLabels = {{Cl|SPACE$}}({{Text|1000|#F580B1}}) | |||
firstLineNumberLabelvWatch = {{Text|0|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} warning$({{Text|1000|#F580B1}}) | |||
{{Cl|REDIM}} {{Cl|SHARED}} warningLines({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} warningIncLines({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|SHARED}} warningIncFiles({{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|STRING}} | |||
maxLineNumber = {{Text|0|#F580B1}} | |||
uniquenumbern = {{Text|0|#F580B1}} | |||
{{Text|<nowiki>''create a type for storing memory blocks</nowiki>|#919191}} | |||
{{Text|<nowiki>''UDT</nowiki>|#919191}} | |||
{{Text|<nowiki>''names</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED lasttype AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtxname(1000) AS STRING * 256</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtxcname(1000) AS STRING * 256</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtxsize(1000) AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtxbytealign(1000) AS INTEGER 'first element MUST be on a byte alignment & size is a multiple of 8</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtxnext(1000) AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>''elements</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED lasttypeelement AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtename(1000) AS STRING * 256</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtecname(1000) AS STRING * 256</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtebytealign(1000) AS INTEGER</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtesize(1000) AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtetype(1000) AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtetypesize(1000) AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtearrayelements(1000) AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'DIM SHARED udtenext(1000) AS LONG</nowiki>|#919191}} | |||
{{Text|<nowiki>'import _MEM type</nowiki>|#919191}} | |||
ptrsz = OS_BITS \ {{Text|8|#F580B1}} | |||
lasttype = lasttype + {{Text|1|#F580B1}}: i = lasttype | |||
udtxname(i) = {{Text|<nowiki>"_MEM"</nowiki>|#FFB100}} | |||
udtxcname(i) = {{Text|<nowiki>"_MEM"</nowiki>|#FFB100}} | |||
udtxsize(i) = ((ptrsz) * {{Text|5|#F580B1}} + ({{Text|4|#F580B1}}) * {{Text|2|#F580B1}} + ({{Text|8|#F580B1}}) * {{Text|1|#F580B1}}) * {{Text|8|#F580B1}} | |||
udtxbytealign(i) = {{Text|1|#F580B1}} | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"OFFSET"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"OFFSET"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * {{Text|8|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtxnext(i) = i2 | |||
i3 = i2 | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"SIZE"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"SIZE"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * {{Text|8|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtenext(i3) = i2 | |||
i3 = i2 | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"$_LOCK_ID"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"$_LOCK_ID"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = INTEGER64TYPE: udtesize(i2) = {{Text|64|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtenext(i3) = i2 | |||
i3 = i2 | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"$_LOCK_OFFSET"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"$_LOCK_OFFSET"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * {{Text|8|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtenext(i3) = i2 | |||
i3 = i2 | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"TYPE"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"TYPE"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * {{Text|8|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtenext(i3) = i2 | |||
i3 = i2 | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"ELEMENTSIZE"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"ELEMENTSIZE"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * {{Text|8|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtenext(i3) = i2 | |||
udtenext(i2) = {{Text|0|#F580B1}} | |||
i3 = i2 | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"IMAGE"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"IMAGE"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = LONGTYPE: udtesize(i2) = {{Text|32|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtenext(i3) = i2 | |||
udtenext(i2) = {{Text|0|#F580B1}} | |||
i3 = i2 | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}}: i2 = lasttypeelement | |||
udtename(i2) = {{Text|<nowiki>"SOUND"</nowiki>|#FFB100}} | |||
udtecname(i2) = {{Text|<nowiki>"SOUND"</nowiki>|#FFB100}} | |||
udtebytealign(i2) = {{Text|1|#F580B1}} | |||
udtetype(i2) = LONGTYPE: udtesize(i2) = {{Text|32|#F580B1}} | |||
udtetypesize(i2) = {{Text|0|#F580B1}} {{Text|<nowiki>'tsize</nowiki>|#919191}} | |||
udtenext(i3) = i2 | |||
udtenext(i2) = {{Text|0|#F580B1}} | |||
{{Text|<nowiki>' Reset all unstable flags</nowiki>|#919191}} | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|UBOUND}}(unstableFlags): unstableFlags(i) = {{Text|0|#F580B1}}: {{Cl|NEXT}} | |||
{{Text|<nowiki>' Indicates if a MIDI sound font was selected</nowiki>|#919191}} | |||
{{Text|<nowiki>'</nowiki>|#919191}} | |||
{{Text|<nowiki>' Captures both the line number and line contents for error reporting later-on</nowiki>|#919191}} | |||
{{Text|<nowiki>' in the compilation process</nowiki>|#919191}} | |||
MidiSoundFontSet = {{Text|0|#F580B1}} | |||
MidiSoundFontLine$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Text|<nowiki>' If MidiSoundFont$ is blank, then the default is used</nowiki>|#919191}} | |||
MidiSoundFont$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Text|<nowiki>'begin compilation</nowiki>|#919191}} | |||
{{Cl|FOR}} closeall = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}}: {{Cl|CLOSE}} closeall: {{Cl|NEXT}} | |||
{{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"temp.bin"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|LOCK}} {{Cl|OPEN#File_ACCESS_and_LOCK_Permissions|WRITE}} {{Cl|OPEN|AS}} #26 {{Text|<nowiki>'relock</nowiki>|#919191}} | |||
bh = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"icon.rc"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|CLOSE}} #9: {{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"debug.txt"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|APPEND}} {{Cl|OPEN|AS}} #9 | |||
{{Cl|IF}} idemode = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
qberrorhappened = {{Text|-1|#F580B1}} | |||
{{Cl|OPEN}} sourcefile$ {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|INPUT}} {{Cl|OPEN|AS}} #1 | |||
qberrorhappened1: | |||
{{Cl|IF}} qberrorhappened = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|PRINT}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"Cannot locate source file: "</nowiki>|#FFB100}} + sourcefile$ | |||
{{Cl|IF}} ConsoleMode {{Cl|THEN}} {{Cl|SYSTEM}} {{Text|1|#F580B1}} | |||
{{Cl|END}} {{Text|1|#F580B1}} | |||
{{Cl|ELSE}} | |||
{{Cl|CLOSE}} #1 | |||
{{Cl|END IF}} | |||
qberrorhappened = {{Text|0|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Text|reginternal|#55FF55}} | |||
{{Cl|IF}} qb64prefix_set {{Cl|THEN}} | |||
qb64prefix$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Text|<nowiki>'re-add internal keywords without the "_" prefix</nowiki>|#919191}} | |||
{{Text|reginternal|#55FF55}} | |||
f = HASHFLAG_TYPE + HASHFLAG_RESERVED | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"UNSIGNED"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"BIT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"BYTE"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"INTEGER64"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"OFFSET"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"FLOAT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
f = HASHFLAG_RESERVED + HASHFLAG_CUSTOMSYNTAX | |||
{{Text|HashAdd|#55FF55}} {{Text|<nowiki>"EXPLICIT"</nowiki>|#FFB100}}, f, {{Text|0|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|DIM}} {{Cl|SHARED}} GlobTxtBuf: GlobTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"global.txt"</nowiki>|#FFB100}}) | |||
defdatahandle = GlobTxtBuf | |||
{{Cl|IF}} iderecompile {{Cl|THEN}} | |||
iderecompile = {{Text|0|#F580B1}} | |||
idepass = {{Text|1|#F580B1}} {{Text|<nowiki>'prepass must be done again</nowiki>|#919191}} | |||
sendc$ = {{Cl|CHR$}}({{Text|7|#F580B1}}) {{Text|<nowiki>'repass request</nowiki>|#919191}} | |||
{{Cl|GOTO}} sendcommand | |||
{{Cl|END IF}} | |||
{{Cl|IF}} idemode {{Cl|THEN}} {{Cl|GOTO}} ideret1 | |||
{{Text|lineinput3load|#55FF55}} sourcefile$ | |||
{{Cl|DO}} | |||
{{Text|<nowiki>'### STEVE EDIT FOR CONST EXPANSION 10/11/2013</nowiki>|#919191}} | |||
wholeline$ = {{Text|lineinput3$|#55FF55}} | |||
{{Cl|IF}} wholeline$ = {{Cl|CHR$}}({{Text|13|#F580B1}}) {{Cl|THEN}} {{Cl|EXIT DO}} | |||
ideprepass: | |||
prepassLastLine: | |||
{{Cl|IF}} lastLine <> {{Text|0|#F580B1}} {{Cl|OR (boolean)|OR}} firstLine <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
lineBackup$ = wholeline$ {{Text|<nowiki>'backup the real line (will be blank when lastline is set)</nowiki>|#919191}} | |||
forceIncludeFromRoot$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} vWatchOn {{Cl|THEN}} | |||
addingvWatch = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstLine <> {{Text|0|#F580B1}} {{Cl|THEN}} forceIncludeFromRoot$ = {{Text|<nowiki>"internal\support\vwatch\vwatch.bi"</nowiki>|#FFB100}} | |||
{{Cl|IF}} lastLine <> {{Text|0|#F580B1}} {{Cl|THEN}} forceIncludeFromRoot$ = {{Text|<nowiki>"internal\support\vwatch\vwatch.bm"</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bi"</nowiki>|#919191}} | |||
{{Cl|IF}} lastLine <> {{Text|0|#F580B1}} {{Cl|THEN}} forceIncludeFromRoot$ = {{Text|<nowiki>"internal\support\vwatch\vwatch_stub.bm"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
firstLine = {{Text|0|#F580B1}}: lastLine = {{Text|0|#F580B1}} | |||
{{Cl|IF}} {{Cl|LEN}}(forceIncludeFromRoot$) {{Cl|THEN}} {{Cl|GOTO}} forceInclude_prepass | |||
forceIncludeCompleted_prepass: | |||
addingvWatch = {{Text|0|#F580B1}} | |||
wholeline$ = lineBackup$ | |||
{{Cl|END IF}} | |||
wholestv$ = wholeline$ {{Text|<nowiki>'### STEVE EDIT FOR CONST EXPANSION 10/11/2013</nowiki>|#919191}} | |||
prepass = {{Text|1|#F580B1}} | |||
layout = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
layoutok = {{Text|0|#F580B1}} | |||
linenumber = linenumber + {{Text|1|#F580B1}} | |||
reallinenumber = reallinenumber + {{Text|1|#F580B1}} | |||
{{Cl|DO...LOOP|DO UNTIL}} linenumber < {{Cl|UBOUND}}(InValidLine) {{Text|<nowiki>'color information flag for each line</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} InValidLine({{Cl|UBOUND}}(InValidLine) + {{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|LOOP}} | |||
InValidLine(linenumber) = {{Text|0|#F580B1}} | |||
{{Cl|IF}} {{Cl|LEN}}(wholeline$) {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|UCASE$}}({{Cl|_TRIM$}}(wholeline$)) = {{Text|<nowiki>"$NOPREFIX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
qb64prefix_set_desiredState = {{Text|1|#F580B1}} | |||
{{Cl|IF}} qb64prefix_set = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} qb64prefix_set_recompileAttempts = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
qb64prefix_set_recompileAttempts = qb64prefix_set_recompileAttempts + {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} do_recompile | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
wholeline$ = {{Text|lineformat|#55FF55}}(wholeline$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
temp$ = {{Cl|LTRIM$}}({{Cl|RTRIM$}}({{Cl|UCASE$}}(wholestv$))) | |||
{{Cl|IF}} temp$ = {{Text|<nowiki>"$COLOR:0"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} qb64prefix_set {{Cl|THEN}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color0_noprefix.bi"</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color0.bi"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Cl|IF}} temp$ = {{Text|<nowiki>"$COLOR:32"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} qb64prefix_set {{Cl|THEN}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color32_noprefix.bi"</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color32.bi"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Cl|IF}} temp$ = {{Text|<nowiki>"$DEBUG"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
vWatchDesiredState = {{Text|1|#F580B1}} | |||
{{Cl|IF}} vWatchOn = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} vWatchRecompileAttempts = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'this is the first time a conflict has occurred, so react immediately with a full recompilation using the desired state</nowiki>|#919191}} | |||
vWatchRecompileAttempts = vWatchRecompileAttempts + {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} do_recompile | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>'continue compilation to retrieve the final state requested and act on that as required</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp$, {{Text|4|#F580B1}}) = {{Text|<nowiki>"$IF "</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|RIGHT$}}(temp$, {{Text|5|#F580B1}}) <> {{Text|<nowiki>" THEN"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$IF without THEN"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|4|#F580B1}})) {{Text|<nowiki>'strip off the $IF and extra spaces</nowiki>|#919191}} | |||
temp$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, {{Cl|LEN}}(temp$) - {{Text|4|#F580B1}})) {{Text|<nowiki>'and strip off the THEN and extra spaces</nowiki>|#919191}} | |||
temp = {{Cl|INSTR}}(temp$, {{Text|<nowiki>"="</nowiki>|#FFB100}}) | |||
ExecCounter = ExecCounter + {{Text|1|#F580B1}} | |||
ExecLevel(ExecCounter) = {{Text|-1|#F580B1}} {{Text|<nowiki>'default to a skip value</nowiki>|#919191}} | |||
DefineElse(ExecCounter) = {{Text|1|#F580B1}} {{Text|<nowiki>'1 says we have an $IF statement at this level</nowiki>|#919191}} | |||
result = {{Text|EvalPreIF|#55FF55}}(temp$, a$) | |||
{{Cl|IF}} a$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} result <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
ExecLevel(ExecCounter) = ExecLevel(ExecCounter - {{Text|1|#F580B1}}) {{Text|<nowiki>'So we inherit the execlevel from above</nowiki>|#919191}} | |||
{{Cl|IF}} ExecLevel(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} DefineElse(ExecCounter) = DefineElse(ExecCounter) {{Cl|OR}} {{Text|4|#F580B1}} {{Text|<nowiki>'Else if used and conditon found</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishedlinepp {{Text|<nowiki>'and then we're finished -- and at this point we didn't make a match so we exit with a DONT READ type flag on our code.</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} temp$ = {{Text|<nowiki>"$ELSE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE without $IF"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$IF block already has $ELSE statement in it"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
DefineElse(ExecCounter) = DefineElse(ExecCounter) {{Cl|OR}} {{Text|2|#F580B1}} {{Text|<nowiki>'set the flag to declare an $ELSE already in this block</nowiki>|#919191}} | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|4|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'If we executed code in a previous IF or ELSE IF statement, we can't do it here</nowiki>|#919191}} | |||
ExecLevel(ExecCounter) = {{Text|-1|#F580B1}} {{Text|<nowiki>'So we inherit the execlevel from above</nowiki>|#919191}} | |||
{{Cl|ELSE}} | |||
ExecLevel(ExecCounter) = ExecLevel(ExecCounter - {{Text|1|#F580B1}}) {{Text|<nowiki>'If we were processing code before, code after this segment is going to be SKIPPED</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp$, {{Text|5|#F580B1}}) = {{Text|<nowiki>"$ELSE"</nowiki>|#FFB100}} {{Cl|THEN}} {{Text|<nowiki>'looking for $ELSE IF</nowiki>|#919191}} | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|6|#F580B1}})) | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp$, {{Text|3|#F580B1}}) = {{Text|<nowiki>"IF "</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE IF without $IF"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE IF cannot follow $ELSE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} {{Cl|RIGHT$}}(temp$, {{Text|5|#F580B1}}) <> {{Text|<nowiki>" THEN"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE IF without THEN"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|4|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'If we executed code in a previous IF or ELSE IF statement, we can't do it here</nowiki>|#919191}} | |||
ExecLevel(ExecCounter) = {{Text|-1|#F580B1}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|3|#F580B1}})) {{Text|<nowiki>'strip off the IF and extra spaces</nowiki>|#919191}} | |||
temp$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, {{Cl|LEN}}(temp$) - {{Text|4|#F580B1}})) {{Text|<nowiki>'and strip off the THEN and extra spaces</nowiki>|#919191}} | |||
result = {{Text|EvalPreIF|#55FF55}}(temp$, a$) | |||
{{Cl|IF}} a$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} result <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
ExecLevel(ExecCounter) = ExecLevel(ExecCounter - {{Text|1|#F580B1}}) {{Text|<nowiki>'So we inherit the execlevel from above</nowiki>|#919191}} | |||
{{Cl|IF}} ExecLevel(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} DefineElse(ExecCounter) = DefineElse(ExecCounter) {{Cl|OR}} {{Text|4|#F580B1}} {{Text|<nowiki>'Else if used and conditon found</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishedlinepp {{Text|<nowiki>'and then we're finished -- and at this point we didn't make a match so we exit with a DONT READ type flag on our code.</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} temp$ = {{Text|<nowiki>"$END IF"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} temp$ = {{Text|<nowiki>"$ENDIF"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$END IF without $IF"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Text|<nowiki>'We no longer have an $IF block at this level</nowiki>|#919191}} | |||
ExecCounter = ExecCounter - {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Cl|IF}} ExecLevel(ExecCounter) {{Cl|THEN}} | |||
{{Cl|DO...LOOP|DO UNTIL}} linenumber < {{Cl|UBOUND}}(InValidLine) | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} InValidLine({{Cl|UBOUND}}(InValidLine) + {{Text|1000|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} | |||
{{Cl|LOOP}} | |||
InValidLine(linenumber) = {{Text|-1|#F580B1}} | |||
{{Cl|GOTO}} finishedlinepp {{Text|<nowiki>'we don't check for anything inside lines that we've marked for skipping</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp$, {{Text|7|#F580B1}}) = {{Text|<nowiki>"$ERROR "</nowiki>|#FFB100}} {{Cl|THEN}} | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|7|#F580B1}})) | |||
a$ = {{Text|<nowiki>"Compilation check failed: "</nowiki>|#FFB100}} + temp$ | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp$, {{Text|5|#F580B1}}) = {{Text|<nowiki>"$LET "</nowiki>|#FFB100}} {{Cl|THEN}} | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|5|#F580B1}})) {{Text|<nowiki>'simply shorten our string to parse</nowiki>|#919191}} | |||
{{Text|<nowiki>'For starters, let's make certain that we have 3 elements to deal with</nowiki>|#919191}} | |||
temp = {{Cl|INSTR}}(temp$, {{Text|<nowiki>"="</nowiki>|#FFB100}}) {{Text|<nowiki>'without an = in there, we can't get a value from the left and right side</nowiki>|#919191}} | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid Syntax. $LET <flag> = <value>"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
l$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, temp - {{Text|1|#F580B1}})): r$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, temp + {{Text|1|#F580B1}})) | |||
{{Text|<nowiki>'then validate to make certain the left side looks proper</nowiki>|#919191}} | |||
{{Cl|IF}} {{Text|validname|#55FF55}}(l$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid flag name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} {{Cl|LEFT$}}(r$, {{Text|1|#F580B1}}) = {{Cl|CHR$}}({{Text|34|#F580B1}}) {{Cl|THEN}} r$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(r$, {{Text|2|#F580B1}})) | |||
{{Cl|IF}} {{Cl|RIGHT$}}(r$, {{Text|1|#F580B1}}) = {{Cl|CHR$}}({{Text|34|#F580B1}}) {{Cl|THEN}} r$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(r$, {{Cl|LEN}}(r$) - {{Text|1|#F580B1}})) | |||
{{Cl|IF}} {{Cl|LEFT$}}(r$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"-"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
r1$ = {{Text|<nowiki>"-"</nowiki>|#FFB100}} | |||
r$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(r$, {{Text|2|#F580B1}})) | |||
{{Cl|ELSE}} | |||
r1$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'then validate to make certain the left side looks proper</nowiki>|#919191}} | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(r$) | |||
a = {{Cl|ASC (function)|ASC}}(r$, i) | |||
{{Cl|SELECT CASE}} a | |||
{{Cl|CASE}} {{Text|32|#F580B1}} | |||
{{Cl|CASE}} {{Text|46|#F580B1}} {{Text|<nowiki>'periods are fine.</nowiki>|#919191}} | |||
r1$ = r1$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} | |||
{{Cl|CASE}} {{Cl|IS}} < {{Text|48|#F580B1}}, {{Cl|IS}} > {{Text|90|#F580B1}} | |||
a$ = {{Text|<nowiki>"Invalid value"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|CASE}} {{Cl|ELSE}} | |||
r1$ = r1$ + {{Cl|CHR$}}(a) | |||
{{Cl|END SELECT}} | |||
{{Cl|NEXT}} | |||
r$ = r1$ | |||
{{Text|<nowiki>'First look to see if we have an existing setting like this and if so, update it</nowiki>|#919191}} | |||
{{Cl|FOR}} i = {{Text|8|#F580B1}} {{Cl|TO}} UserDefineCount {{Text|<nowiki>'UserDefineCount 1-7 are reserved for automatic OS/BIT detection & version</nowiki>|#919191}} | |||
{{Cl|IF}} UserDefine({{Text|0|#F580B1}}, i) = l$ {{Cl|THEN}} UserDefine({{Text|1|#F580B1}}, i) = r$: {{Cl|GOTO}} finishedlinepp | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'Otherwise create a new setting and set the initial value for it</nowiki>|#919191}} | |||
UserDefineCount = UserDefineCount + {{Text|1|#F580B1}} | |||
{{Cl|IF}} UserDefineCount > {{Cl|UBOUND}}(UserDefine, {{Text|2|#F580B1}}) {{Cl|THEN}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} UserDefine({{Text|1|#F580B1}}, {{Cl|UBOUND}}(UserDefine, {{Text|2|#F580B1}}) + {{Text|10|#F580B1}}) {{Text|<nowiki>'Add another 10 elements to the array so it'll expand as the user adds to it</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
UserDefine({{Text|0|#F580B1}}, UserDefineCount) = l$ | |||
UserDefine({{Text|1|#F580B1}}, UserDefineCount) = r$ | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>' We check for Unstable flags during the preprocessing step because it</nowiki>|#919191}} | |||
{{Text|<nowiki>' impacts what valid commands there are in all the other steps</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp$, {{Text|10|#F580B1}}) = {{Text|<nowiki>"$UNSTABLE:"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
token$ = {{Cl|UCASE$}}({{Cl|LTRIM$}}({{Cl|RTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|11|#F580B1}})))) | |||
{{Cl|SELECT CASE}} token$ | |||
{{Cl|CASE}} {{Text|<nowiki>"MIDI"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|NOT}} UseMiniaudioBackend {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Midi is not supported with the old OpenAL audio backend."</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
unstableFlags(UNSTABLE_MIDI) = {{Text|-1|#F580B1}} | |||
{{Cl|CASE}} {{Text|<nowiki>"HTTP"</nowiki>|#FFB100}} | |||
unstableFlags(UNSTABLE_HTTP) = {{Text|-1|#F580B1}} | |||
{{Text|regUnstableHttp|#55FF55}} | |||
{{Cl|CASE}} {{Cl|ELSE}} | |||
a$ = {{Text|<nowiki>"Unrecognized unstable flag "</nowiki>|#FFB100}} + {{Text|AddQuotes$|#55FF55}}(token$) | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END SELECT}} | |||
{{Cl|END IF}} | |||
cwholeline$ = wholeline$ | |||
wholeline$ = {{Text|eleucase$|#55FF55}}(wholeline$) {{Text|<nowiki>'********REMOVE THIS LINE LATER********</nowiki>|#919191}} | |||
addmetadynamic = {{Text|0|#F580B1}}: addmetastatic = {{Text|0|#F580B1}} | |||
wholelinen = {{Text|numelements|#55FF55}}(wholeline$) | |||
{{Cl|IF}} wholelinen {{Cl|THEN}} | |||
wholelinei = {{Text|1|#F580B1}} | |||
{{Text|<nowiki>'skip line number?</nowiki>|#919191}} | |||
e$ = {{Text|getelement$|#55FF55}}(wholeline$, {{Text|1|#F580B1}}) | |||
{{Cl|IF}} ({{Cl|ASC (function)|ASC}}(e$) >= {{Text|48|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|ASC (function)|ASC}}(e$) <= {{Text|59|#F580B1}}) {{Cl|OR (boolean)|OR}} {{Cl|ASC (function)|ASC}}(e$) = {{Text|46|#F580B1}} {{Cl|THEN}} wholelinei = {{Text|2|#F580B1}}: {{Cl|GOTO}} ppskpl | |||
{{Text|<nowiki>'skip 'POSSIBLE' line label?</nowiki>|#919191}} | |||
{{Cl|IF}} wholelinen >= {{Text|2|#F580B1}} {{Cl|THEN}} | |||
x2 = {{Cl|INSTR}}(wholeline$, sp + {{Text|<nowiki>":"</nowiki>|#FFB100}} + sp): x3 = x2 + {{Text|2|#F580B1}} | |||
{{Cl|IF}} x2 = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|RIGHT$}}(wholeline$, {{Text|2|#F580B1}}) = sp + {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|THEN}} x2 = {{Cl|LEN}}(wholeline$) - {{Text|1|#F580B1}}: x3 = x2 + {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} x2 {{Cl|THEN}} | |||
e$ = {{Cl|LEFT$}}(wholeline$, x2 - {{Text|1|#F580B1}}) | |||
{{Cl|IF}} {{Text|validlabel|#55FF55}}(e$) {{Cl|THEN}} | |||
wholeline$ = {{Cl|RIGHT$}}(wholeline$, {{Cl|LEN}}(wholeline$) - x3) | |||
cwholeline$ = {{Cl|RIGHT$}}(cwholeline$, {{Cl|LEN}}(wholeline$) - x3) | |||
wholelinen = {{Text|numelements|#55FF55}}(wholeline$) | |||
{{Cl|GOTO}} ppskpl | |||
{{Cl|END IF}} {{Text|<nowiki>'valid</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'includes ":"</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'wholelinen>=2</nowiki>|#919191}} | |||
ppskpl: | |||
{{Cl|IF}} wholelinei <= wholelinen {{Cl|THEN}} | |||
{{Text|<nowiki>'----------------------------------------</nowiki>|#919191}} | |||
a$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
ca$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
ppblda: | |||
e$ = {{Text|getelement$|#55FF55}}(wholeline$, wholelinei) | |||
ce$ = {{Text|getelement$|#55FF55}}(cwholeline$, wholelinei) | |||
{{Cl|IF}} e$ = {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} e$ = {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} e$ = {{Text|<nowiki>"THEN"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} e$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEN}}(a$) {{Cl|THEN}} | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|PRINT (file statement)|PRINT}} #9, {{Text|<nowiki>"PP["</nowiki>|#FFB100}} + a$ + {{Text|<nowiki>"]"</nowiki>|#FFB100}} | |||
n = {{Text|numelements|#55FF55}}(a$) | |||
firstelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|1|#F580B1}}) | |||
secondelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|2|#F580B1}}) | |||
thirdelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|3|#F580B1}}) | |||
{{Text|<nowiki>'========================================</nowiki>|#919191}} | |||
{{Cl|IF}} n = {{Text|2|#F580B1}} {{Cl|AND (boolean)|AND}} firstelement$ = {{Text|<nowiki>"END"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} (secondelement$ = {{Text|<nowiki>"SUB"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"FUNCTION"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
closedsubfunc = {{Text|-1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'declare library</nowiki>|#919191}} | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"END"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} n <> {{Text|2|#F580B1}} {{Cl|OR (boolean)|OR}} secondelement$ <> {{Text|<nowiki>"DECLARE"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected END DECLARE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
declaringlibrary = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} {{Text|<nowiki>'end declare</nowiki>|#919191}} | |||
declaringlibrary = {{Text|2|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"SUB"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} firstelement$ = {{Text|<nowiki>"FUNCTION"</nowiki>|#FFB100}} {{Cl|THEN}} subfuncn = subfuncn - {{Text|1|#F580B1}}: {{Cl|GOTO}} declaresubfunc | |||
a$ = {{Text|<nowiki>"Expected SUB/FUNCTION definition or END DECLARE (#2)"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'UDT TYPE definition</nowiki>|#919191}} | |||
{{Cl|IF}} definingtype {{Cl|THEN}} | |||
i = definingtype | |||
{{Cl|IF}} n >= {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"END"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} n <> {{Text|2|#F580B1}} {{Cl|OR (boolean)|OR}} secondelement$ <> {{Text|<nowiki>"TYPE"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected END TYPE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} udtxnext(i) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"No elements defined in TYPE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
definingtype = {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'create global buffer for SWAP space</nowiki>|#919191}} | |||
siz$ = {{Text|str2$|#55FF55}}(udtxsize(i) \ {{Text|8|#F580B1}}) | |||
{{Text|WriteBufLine|#55FF55}} GlobTxtBuf, {{Text|<nowiki>"char *g_tmp_udt_"</nowiki>|#FFB100}} + {{Cl|RTRIM$}}(udtxname(i)) + {{Text|<nowiki>"=(char*)malloc("</nowiki>|#FFB100}} + siz$ + {{Text|<nowiki>");"</nowiki>|#FFB100}} | |||
{{Text|<nowiki>'print "END TYPE";udtxsize(i);udtxbytealign(i)</nowiki>|#919191}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} n < {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected element-name AS type, AS type element-list, or END TYPE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
n$ = firstelement$ | |||
{{Cl|IF}} n$ <> {{Text|<nowiki>"AS"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'traditional variable-name AS type syntax, single-element</nowiki>|#919191}} | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}} | |||
i2 = lasttypeelement | |||
{{Cl|WHILE}} i2 > {{Cl|UBOUND}}(udtenext): {{Text|increaseUDTArrays|#55FF55}}: {{Cl|WEND}} | |||
udtenext(i2) = {{Text|0|#F580B1}} | |||
ii = {{Text|2|#F580B1}} | |||
udtearrayelements(i2) = {{Text|0|#F580B1}} | |||
{{Cl|IF}} ii >= n {{Cl|OR (boolean)|OR}} {{Text|getelement$|#55FF55}}(a$, ii) <> {{Text|<nowiki>"AS"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected element-name AS type, AS type element-list, or END TYPE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
t$ = {{Text|getelements$|#55FF55}}(a$, ii + {{Text|1|#F580B1}}, n) | |||
{{Cl|IF}} t$ = {{Cl|RTRIM$}}(udtxname(definingtype)) {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid self-reference"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
typ = {{Text|typname2typ|#55FF55}}(t$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typ = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Undefined type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
typsize = typname2typsize | |||
{{Cl|IF}} {{Text|validname|#55FF55}}(n$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
udtename(i2) = n$ | |||
udtecname(i2) = {{Text|getelement$|#55FF55}}(ca$, {{Text|1|#F580B1}}) | |||
NormalTypeBlock: | |||
typeDefinitions$ = typeDefinitions$ + {{Cl|MKL$}}(i2) + {{Cl|MKL$}}({{Cl|LEN}}(n$)) + n$ | |||
udtetype(i2) = typ | |||
udtetypesize(i2) = typsize | |||
hashname$ = n$ | |||
{{Text|<nowiki>'check for name conflicts (any similar reserved or element from current UDT)</nowiki>|#919191}} | |||
hashchkflags = HASHFLAG_RESERVED + HASHFLAG_UDTELEMENT | |||
hashres = {{Text|HashFind|#55FF55}}(hashname$, hashchkflags, hashresflags, hashresref) | |||
{{Cl|DO...LOOP|DO WHILE}} hashres | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} HASHFLAG_UDTELEMENT {{Cl|THEN}} | |||
{{Cl|IF}} hashresref = i {{Cl|THEN}} a$ = {{Text|<nowiki>"Name already in use ("</nowiki>|#FFB100}} + hashname$ + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} HASHFLAG_RESERVED {{Cl|THEN}} | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} (HASHFLAG_TYPE + HASHFLAG_CUSTOMSYNTAX + HASHFLAG_OPERATOR + HASHFLAG_XELEMENTNAME) {{Cl|THEN}} a$ = {{Text|<nowiki>"Name already in use ("</nowiki>|#FFB100}} + hashname$ + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} hashres <> {{Text|1|#F580B1}} {{Cl|THEN}} hashres = {{Text|HashFindCont|#55FF55}}(hashresflags, hashresref) {{Cl|ELSE}} hashres = {{Text|0|#F580B1}} | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'add to hash table</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} hashname$, HASHFLAG_UDTELEMENT, i | |||
{{Text|<nowiki>'Calculate element's size</nowiki>|#919191}} | |||
{{Cl|IF}} typ {{Cl|AND (boolean)|AND}} ISUDT {{Cl|THEN}} | |||
u = typ {{Cl|AND}} {{Text|511|#F580B1}} | |||
udtesize(i2) = udtxsize(u) | |||
{{Cl|IF}} udtxbytealign(u) {{Cl|THEN}} udtxbytealign(i) = {{Text|1|#F580B1}}: udtebytealign(i2) = {{Text|1|#F580B1}} | |||
{{Cl|IF}} udtxvariable(u) {{Cl|THEN}} udtxvariable(i) = {{Text|-1|#F580B1}} | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} (typ {{Cl|AND (boolean)|AND}} ISSTRING) {{Cl|THEN}} | |||
{{Cl|IF}} (typ {{Cl|AND (boolean)|AND}} ISFIXEDLENGTH) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
udtesize(i2) = OFFSETTYPE {{Cl|AND}} {{Text|511|#F580B1}} | |||
udtxvariable(i) = {{Text|-1|#F580B1}} | |||
{{Cl|ELSE}} | |||
udtesize(i2) = typsize * {{Text|8|#F580B1}} | |||
{{Cl|END IF}} | |||
udtxbytealign(i) = {{Text|1|#F580B1}}: udtebytealign(i2) = {{Text|1|#F580B1}} | |||
{{Cl|ELSE}} | |||
udtesize(i2) = typ {{Cl|AND}} {{Text|511|#F580B1}} | |||
{{Cl|IF}} (typ {{Cl|AND (boolean)|AND}} ISOFFSETINBITS) = {{Text|0|#F580B1}} {{Cl|THEN}} udtxbytealign(i) = {{Text|1|#F580B1}}: udtebytealign(i2) = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'Increase block size</nowiki>|#919191}} | |||
{{Cl|IF}} udtebytealign(i2) {{Cl|THEN}} | |||
{{Cl|IF}} udtxsize(i) {{Cl|MOD}} {{Text|8|#F580B1}} {{Cl|THEN}} | |||
udtxsize(i) = udtxsize(i) + ({{Text|8|#F580B1}} - (udtxsize(i) {{Cl|MOD}} {{Text|8|#F580B1}})) | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
udtxsize(i) = udtxsize(i) + udtesize(i2) | |||
{{Text|<nowiki>'Link element to previous element</nowiki>|#919191}} | |||
{{Cl|IF}} udtxnext(i) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
udtxnext(i) = i2 | |||
{{Cl|ELSE}} | |||
udtenext(i2 - {{Text|1|#F580B1}}) = i2 | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'print "+"+rtrim$(udtename(i2));udtetype(i2);udtesize(i2);udtebytealign(i2);udtxsize(i)</nowiki>|#919191}} | |||
{{Cl|IF}} newAsTypeBlockSyntax {{Cl|THEN}} {{Cl|RETURN}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>'new AS type variable-list syntax, multiple elements</nowiki>|#919191}} | |||
ii = {{Text|2|#F580B1}} | |||
{{Cl|IF}} ii >= n {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected element-name AS type, AS type element-list, or END TYPE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
previousElement$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
t$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
lastElement$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
buildTypeName: | |||
lastElement$ = {{Text|getelement$|#55FF55}}(a$, ii) | |||
{{Cl|IF}} lastElement$ <> {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} lastElement$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
n$ = lastElement$ | |||
cn$ = {{Text|getelement$|#55FF55}}(ca$, ii) | |||
{{Cl|IF}} {{Cl|LEN}}(previousElement$) {{Cl|THEN}} t$ = t$ + previousElement$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} | |||
previousElement$ = n$ | |||
lastElement$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
ii = ii + {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} buildTypeName | |||
{{Cl|END IF}} | |||
t$ = {{Cl|RTRIM$}}(t$) | |||
{{Cl|IF}} t$ = {{Cl|RTRIM$}}(udtxname(definingtype)) {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid self-reference"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
typ = {{Text|typname2typ|#55FF55}}(t$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typ = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Undefined type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
typsize = typname2typsize | |||
previousElement$ = lastElement$ | |||
nexttypeelement: | |||
lasttypeelement = lasttypeelement + {{Text|1|#F580B1}} | |||
i2 = lasttypeelement | |||
{{Cl|WHILE}} i2 > {{Cl|UBOUND}}(udtenext): {{Text|increaseUDTArrays|#55FF55}}: {{Cl|WEND}} | |||
udtenext(i2) = {{Text|0|#F580B1}} | |||
udtearrayelements(i2) = {{Text|0|#F580B1}} | |||
udtename(i2) = n$ | |||
udtecname(i2) = cn$ | |||
{{Cl|IF}} {{Text|validname|#55FF55}}(n$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
newAsTypeBlockSyntax = {{Text|-1|#F580B1}} | |||
{{Cl|GOSUB}} NormalTypeBlock | |||
newAsTypeBlockSyntax = {{Text|0|#F580B1}} | |||
getNextElement: | |||
ii = ii + {{Text|1|#F580B1}} | |||
lastElement$ = {{Text|getelement$|#55FF55}}(a$, ii) | |||
{{Cl|IF}} lastElement$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|GOTO}} finishedlinepp | |||
{{Cl|IF}} ii = n {{Cl|AND (boolean)|AND}} lastElement$ = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected element-name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} lastElement$ = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} previousElement$ = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected element-name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
previousElement$ = lastElement$ | |||
{{Cl|GOTO}} getNextElement | |||
{{Cl|END IF}} | |||
n$ = lastElement$ | |||
{{Cl|IF}} previousElement$ <> {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ,"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
previousElement$ = lastElement$ | |||
cn$ = {{Text|getelement$|#55FF55}}(ca$, ii) | |||
{{Cl|GOTO}} nexttypeelement | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'definingtype</nowiki>|#919191}} | |||
{{Cl|IF}} definingtype {{Cl|AND (boolean)|AND}} n >= {{Text|1|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected END TYPE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} n >= {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"TYPE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} n <> {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected TYPE typename"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
lasttype = lasttype + {{Text|1|#F580B1}} | |||
typeDefinitions$ = typeDefinitions$ + {{Cl|MKL$}}({{Text|-1|#F580B1}}) + {{Cl|MKL$}}(lasttype) | |||
definingtype = lasttype | |||
i = definingtype | |||
{{Cl|WHILE}} i > {{Cl|UBOUND}}(udtenext): {{Text|increaseUDTArrays|#55FF55}}: {{Cl|WEND}} | |||
{{Cl|IF}} {{Text|validname|#55FF55}}(secondelement$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
typeDefinitions$ = typeDefinitions$ + {{Cl|MKL$}}({{Cl|LEN}}(secondelement$)) + secondelement$ | |||
udtxname(i) = secondelement$ | |||
udtxcname(i) = {{Text|getelement|#55FF55}}(ca$, {{Text|2|#F580B1}}) | |||
udtxnext(i) = {{Text|0|#F580B1}} | |||
udtxsize(i) = {{Text|0|#F580B1}} | |||
udtxvariable(i) = {{Text|0|#F580B1}} | |||
hashname$ = secondelement$ | |||
hashflags = HASHFLAG_UDT | |||
{{Text|<nowiki>'check for name conflicts (any similar reserved/sub/function/UDT name)</nowiki>|#919191}} | |||
hashchkflags = HASHFLAG_RESERVED + HASHFLAG_SUB + HASHFLAG_FUNCTION + HASHFLAG_UDT | |||
hashres = {{Text|HashFind|#55FF55}}(hashname$, hashchkflags, hashresflags, hashresref) | |||
{{Cl|DO...LOOP|DO WHILE}} hashres | |||
allow = {{Text|0|#F580B1}} | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} (HASHFLAG_SUB + HASHFLAG_FUNCTION) {{Cl|THEN}} | |||
allow = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} HASHFLAG_RESERVED {{Cl|THEN}} | |||
{{Cl|IF}} (hashresflags {{Cl|AND (boolean)|AND}} (HASHFLAG_TYPE + HASHFLAG_OPERATOR + HASHFLAG_CUSTOMSYNTAX + HASHFLAG_XTYPENAME)) = {{Text|0|#F580B1}} {{Cl|THEN}} allow = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} allow = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Name already in use ("</nowiki>|#FFB100}} + hashname$ + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} hashres <> {{Text|1|#F580B1}} {{Cl|THEN}} hashres = {{Text|HashFindCont|#55FF55}}(hashresflags, hashresref) {{Cl|ELSE}} hashres = {{Text|0|#F580B1}} | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'add to hash table</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} hashname$, hashflags, i | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} n >= {{Text|1|#F580B1}} {{Cl|AND (boolean)|AND}} firstelement$ = {{Text|<nowiki>"CONST"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'l$ = "CONST"</nowiki>|#919191}} | |||
{{Text|<nowiki>'DEF... do not change type, the expression is stored in a suitable type</nowiki>|#919191}} | |||
{{Text|<nowiki>'based on its value if type isn't forced/specified</nowiki>|#919191}} | |||
{{Cl|IF}} subfuncn > {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} closedsubfunc <> {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Statement cannot be placed between SUB/FUNCTIONs"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'convert periods to _046_</nowiki>|#919191}} | |||
i2 = {{Cl|INSTR}}(a$, sp + {{Text|<nowiki>"."</nowiki>|#FFB100}} + sp) | |||
{{Cl|IF}} i2 {{Cl|THEN}} | |||
{{Cl|DO}} | |||
a$ = {{Cl|LEFT$}}(a$, i2 - {{Text|1|#F580B1}}) + fix046$ + {{Cl|RIGHT$}}(a$, {{Cl|LEN}}(a$) - i2 - {{Text|2|#F580B1}}) | |||
ca$ = {{Cl|LEFT$}}(ca$, i2 - {{Text|1|#F580B1}}) + fix046$ + {{Cl|RIGHT$}}(ca$, {{Cl|LEN}}(ca$) - i2 - {{Text|2|#F580B1}}) | |||
i2 = {{Cl|INSTR}}(a$, sp + {{Text|<nowiki>"."</nowiki>|#FFB100}} + sp) | |||
{{Cl|DO...LOOP|LOOP UNTIL}} i2 = {{Text|0|#F580B1}} | |||
n = {{Text|numelements|#55FF55}}(a$) | |||
firstelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|1|#F580B1}}): secondelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|2|#F580B1}}): thirdelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|3|#F580B1}}) | |||
{{Cl|END IF}} | |||
{{Cl|IF}} n < {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected CONST name = value/expression"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
i = {{Text|2|#F580B1}} | |||
constdefpendingpp: | |||
pending = {{Text|0|#F580B1}} | |||
n$ = {{Text|getelement$|#55FF55}}(ca$, i): i = i + {{Text|1|#F580B1}} | |||
typeoverride = {{Text|0|#F580B1}} | |||
s$ = {{Text|removesymbol$|#55FF55}}(n$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} s$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
typeoverride = {{Text|typname2typ|#55FF55}}(s$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typeoverride {{Cl|AND (boolean)|AND}} ISFIXEDLENGTH {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid constant type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typeoverride = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid constant type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Text|getelement$|#55FF55}}(a$, i) <> {{Text|<nowiki>"="</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ="</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
i = i + {{Text|1|#F580B1}} | |||
{{Text|<nowiki>'get expression</nowiki>|#919191}} | |||
e$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
readable_e$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
B = {{Text|0|#F580B1}} | |||
{{Cl|FOR}} i2 = i {{Cl|TO}} n | |||
e2$ = {{Text|getelement$|#55FF55}}(ca$, i2) | |||
{{Cl|IF}} e2$ = {{Text|<nowiki>"("</nowiki>|#FFB100}} {{Cl|THEN}} B = B + {{Text|1|#F580B1}} | |||
{{Cl|IF}} e2$ = {{Text|<nowiki>")"</nowiki>|#FFB100}} {{Cl|THEN}} B = B - {{Text|1|#F580B1}} | |||
{{Cl|IF}} e2$ = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} B = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
pending = {{Text|1|#F580B1}} | |||
i = i2 + {{Text|1|#F580B1}} | |||
{{Cl|IF}} i > n - {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected CONST ... , name = value/expression"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|EXIT FOR}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(e$) = {{Text|0|#F580B1}} {{Cl|THEN}} e$ = e2$ {{Cl|ELSE}} e$ = e$ + sp + e2$ | |||
e3$ = e2$ | |||
{{Cl|IF}} {{Cl|LEN}}(e2$) > {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(e2$, {{Text|1|#F580B1}}) = {{Text|34|#F580B1}} {{Cl|THEN}} | |||
removeComma = {{Cl|_INSTRREV}}(e2$, {{Text|<nowiki>","</nowiki>|#FFB100}}) | |||
e3$ = {{Cl|LEFT$}}(e2$, removeComma - {{Text|1|#F580B1}}) | |||
{{Cl|ELSE}} | |||
removeComma = {{Cl|INSTR}}(e2$, {{Text|<nowiki>","</nowiki>|#FFB100}}) | |||
e3$ = {{Cl|MID$ (function)|MID$}}(e2$, removeComma + {{Text|1|#F580B1}}) | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(readable_e$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
readable_e$ = e3$ | |||
{{Cl|ELSE}} | |||
readable_e$ = readable_e$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + e3$ | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'intercept current expression and pass it through Evaluate_Expression$</nowiki>|#919191}} | |||
{{Text|<nowiki>'(unless it is a literal string)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(readable_e$, {{Text|1|#F580B1}}) <> {{Cl|CHR$}}({{Text|34|#F580B1}}) {{Cl|THEN}} | |||
temp1$ = {{Cl|_TRIM$}}({{Text|Evaluate_Expression$|#55FF55}}(readable_e$)) | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp1$, {{Text|5|#F580B1}}) <> {{Text|<nowiki>"ERROR"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} e$ <> temp1$ {{Cl|THEN}} | |||
e$ = {{Text|lineformat|#55FF55}}(temp1$) {{Text|<nowiki>'retrieve parseable format</nowiki>|#919191}} | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} temp1$ = {{Text|<nowiki>"ERROR - Division By Zero"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = temp1$: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} {{Cl|INSTR}}(temp1$, {{Text|<nowiki>"Improper operations"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Invalid CONST expression.14"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'Proceed as usual</nowiki>|#919191}} | |||
e$ = {{Text|fixoperationorder|#55FF55}}(e$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
e$ = {{Text|evaluateconst|#55FF55}}(e$, t) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISSTRING {{Cl|THEN}} {{Text|<nowiki>'string type</nowiki>|#919191}} | |||
{{Cl|IF}} typeoverride {{Cl|THEN}} | |||
{{Cl|IF}} (typeoverride {{Cl|AND (boolean)|AND}} ISSTRING) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Type mismatch"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|ELSE}} {{Text|<nowiki>'not a string type</nowiki>|#919191}} | |||
{{Cl|IF}} typeoverride {{Cl|THEN}} | |||
{{Cl|IF}} typeoverride {{Cl|AND (boolean)|AND}} ISSTRING {{Cl|THEN}} a$ = {{Text|<nowiki>"Type mismatch"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISFLOAT {{Cl|THEN}} | |||
constval## = {{Cl|_CV}}({{Cl|_FLOAT}}, e$) | |||
constval&& = constval## | |||
constval~&& = constval&& | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} (t {{Cl|AND (boolean)|AND}} ISUNSIGNED) {{Cl|AND (boolean)|AND}} (t {{Cl|AND (boolean)|AND}} {{Text|511|#F580B1}}) = {{Text|64|#F580B1}} {{Cl|THEN}} | |||
constval~&& = {{Cl|_CV}}({{Cl|_UNSIGNED}} {{Cl|_INTEGER64}}, e$) | |||
constval&& = constval~&& | |||
constval## = constval&& | |||
{{Cl|ELSE}} | |||
constval&& = {{Cl|_CV}}({{Cl|_INTEGER64}}, e$) | |||
constval## = constval&& | |||
constval~&& = constval&& | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'override type?</nowiki>|#919191}} | |||
{{Cl|IF}} typeoverride {{Cl|THEN}} | |||
{{Text|<nowiki>'range check required here (noted in todo)</nowiki>|#919191}} | |||
t = typeoverride | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'not a string type</nowiki>|#919191}} | |||
constlast = constlast + {{Text|1|#F580B1}} | |||
{{Cl|IF}} constlast > constmax {{Cl|THEN}} | |||
constmax = constmax * {{Text|2|#F580B1}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constname(constmax) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constcname(constmax) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constnamesymbol(constmax) {{Cl|AS}} {{Cl|STRING}} {{Text|<nowiki>'optional name symbol</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} consttype(constmax) {{Cl|AS}} {{Cl|LONG}} {{Text|<nowiki>'variable type number</nowiki>|#919191}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constinteger(constmax) {{Cl|AS}} {{Cl|_INTEGER64}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constuinteger(constmax) {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_INTEGER64}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constfloat(constmax) {{Cl|AS}} {{Cl|_FLOAT}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} conststring(constmax) {{Cl|AS}} {{Cl|STRING}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constsubfunc(constmax) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} constdefined(constmax) {{Cl|AS}} {{Cl|LONG}} | |||
{{Cl|END IF}} | |||
i2 = constlast | |||
constsubfunc(i2) = subfuncn | |||
{{Text|<nowiki>'IF subfunc = "" THEN constlastshared = i2</nowiki>|#919191}} | |||
{{Cl|IF}} {{Text|validname|#55FF55}}(n$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
constname(i2) = {{Cl|UCASE$}}(n$) | |||
hashname$ = n$ | |||
{{Text|<nowiki>'check for name conflicts (any similar: reserved, sub, function, constant)</nowiki>|#919191}} | |||
allow = {{Text|0|#F580B1}} | |||
const_recheck: | |||
hashchkflags = HASHFLAG_RESERVED + HASHFLAG_SUB + HASHFLAG_FUNCTION + HASHFLAG_CONSTANT | |||
hashres = {{Text|HashFind|#55FF55}}(hashname$, hashchkflags, hashresflags, hashresref) | |||
{{Cl|DO...LOOP|DO WHILE}} hashres | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} HASHFLAG_CONSTANT {{Cl|THEN}} | |||
{{Cl|IF}} constsubfunc(hashresref) = subfuncn {{Cl|THEN}} | |||
{{Text|<nowiki>'If merely redefining a CONST with same value</nowiki>|#919191}} | |||
{{Text|<nowiki>'just issue a warning instead of an error</nowiki>|#919191}} | |||
issueWarning = {{Text|0|#F580B1}} | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISSTRING {{Cl|THEN}} | |||
{{Cl|IF}} conststring(hashresref) = e$ {{Cl|THEN}} issueWarning = {{Text|-1|#F580B1}}: thisconstval$ = e$ | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISFLOAT {{Cl|THEN}} | |||
{{Cl|IF}} constfloat(hashresref) = constval## {{Cl|THEN}} issueWarning = {{Text|-1|#F580B1}}: thisconstval$ = {{Cl|STR$}}(constval##) | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISUNSIGNED {{Cl|THEN}} | |||
{{Cl|IF}} constuinteger(hashresref) = constval~&& {{Cl|THEN}} issueWarning = {{Text|-1|#F580B1}}: thisconstval$ = {{Cl|STR$}}(constval~&&) | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} constinteger(hashresref) = constval&& {{Cl|THEN}} issueWarning = {{Text|-1|#F580B1}}: thisconstval$ = {{Cl|STR$}}(constval&&) | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} issueWarning {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|NOT}} IgnoreWarnings {{Cl|THEN}} | |||
{{Text|addWarning|#55FF55}} linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), {{Text|<nowiki>"duplicate constant definition"</nowiki>|#FFB100}}, n$ + {{Text|<nowiki>" ="</nowiki>|#FFB100}} + thisconstval$ | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} constAddDone | |||
{{Cl|ELSE}} | |||
a$ = {{Text|<nowiki>"Name already in use ("</nowiki>|#FFB100}} + hashname$ + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} HASHFLAG_RESERVED {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Name already in use ("</nowiki>|#FFB100}} + hashname$ + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} hashresflags {{Cl|AND (boolean)|AND}} (HASHFLAG_SUB + HASHFLAG_FUNCTION) {{Cl|THEN}} | |||
{{Cl|IF}} ids(hashresref).internal_subfunc = {{Text|0|#F580B1}} {{Cl|OR (boolean)|OR}} {{Cl|RTRIM$}}(ids(hashresref).musthave) <> {{Text|<nowiki>"$"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Name already in use ("</nowiki>|#FFB100}} + hashname$ + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISSTRING {{Cl|THEN}} a$ = {{Text|<nowiki>"Name already in use ("</nowiki>|#FFB100}} + hashname$ + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} hashres <> {{Text|1|#F580B1}} {{Cl|THEN}} hashres = {{Text|HashFindCont|#55FF55}}(hashresflags, hashresref) {{Cl|ELSE}} hashres = {{Text|0|#F580B1}} | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'add to hash table</nowiki>|#919191}} | |||
{{Text|HashAdd|#55FF55}} hashname$, HASHFLAG_CONSTANT, i2 | |||
constdefined(i2) = {{Text|1|#F580B1}} | |||
constcname(i2) = n$ | |||
constnamesymbol(i2) = {{Text|typevalue2symbol$|#55FF55}}(t) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
consttype(i2) = t | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISSTRING {{Cl|THEN}} | |||
conststring(i2) = e$ | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISFLOAT {{Cl|THEN}} | |||
constfloat(i2) = constval## | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISUNSIGNED {{Cl|THEN}} | |||
constuinteger(i2) = constval~&& | |||
{{Cl|ELSE}} | |||
constinteger(i2) = constval&& | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
constAddDone: | |||
{{Cl|IF}} pending {{Cl|THEN}} | |||
{{Text|<nowiki>'l$ = l$ + sp2 + ","</nowiki>|#919191}} | |||
{{Cl|GOTO}} constdefpendingpp | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$</nowiki>|#919191}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'DEFINE</nowiki>|#919191}} | |||
d = {{Text|0|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DEFINT"</nowiki>|#FFB100}} {{Cl|THEN}} d = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DEFLNG"</nowiki>|#FFB100}} {{Cl|THEN}} d = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DEFSNG"</nowiki>|#FFB100}} {{Cl|THEN}} d = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DEFDBL"</nowiki>|#FFB100}} {{Cl|THEN}} d = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DEFSTR"</nowiki>|#FFB100}} {{Cl|THEN}} d = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"_DEFINE"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} (firstelement$ = {{Text|<nowiki>"DEFINE"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} qb64prefix_set = {{Text|1|#F580B1}}) {{Cl|THEN}} d = {{Text|1|#F580B1}} | |||
{{Cl|IF}} d {{Cl|THEN}} | |||
predefining = {{Text|1|#F580B1}}: {{Cl|GOTO}} predefine | |||
predefined: predefining = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'declare library</nowiki>|#919191}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DECLARE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} secondelement$ = {{Text|<nowiki>"LIBRARY"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"DYNAMIC"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"CUSTOMTYPE"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"STATIC"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
declaringlibrary = {{Text|1|#F580B1}} | |||
indirectlibrary = {{Text|0|#F580B1}} | |||
{{Cl|IF}} secondelement$ = {{Text|<nowiki>"CUSTOMTYPE"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"DYNAMIC"</nowiki>|#FFB100}} {{Cl|THEN}} indirectlibrary = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishedlinepp | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'SUB/FUNCTION</nowiki>|#919191}} | |||
dynamiclibrary = {{Text|0|#F580B1}} | |||
declaresubfunc: | |||
firstelement$ = {{Text|getelement$|#55FF55}}(a$, {{Text|1|#F580B1}}) | |||
sf = {{Text|0|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"FUNCTION"</nowiki>|#FFB100}} {{Cl|THEN}} sf = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"SUB"</nowiki>|#FFB100}} {{Cl|THEN}} sf = {{Text|2|#F580B1}} | |||
{{Cl|IF}} sf {{Cl|THEN}} | |||
subfuncn = subfuncn + {{Text|1|#F580B1}} | |||
closedsubfunc = {{Text|0|#F580B1}} | |||
{{Cl|IF}} n = {{Text|1|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected name after SUB/FUNCTION"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'convert periods to _046_</nowiki>|#919191}} | |||
i2 = {{Cl|INSTR}}(a$, sp + {{Text|<nowiki>"."</nowiki>|#FFB100}} + sp) | |||
{{Cl|IF}} i2 {{Cl|THEN}} | |||
{{Cl|DO}} | |||
a$ = {{Cl|LEFT$}}(a$, i2 - {{Text|1|#F580B1}}) + fix046$ + {{Cl|RIGHT$}}(a$, {{Cl|LEN}}(a$) - i2 - {{Text|2|#F580B1}}) | |||
ca$ = {{Cl|LEFT$}}(ca$, i2 - {{Text|1|#F580B1}}) + fix046$ + {{Cl|RIGHT$}}(ca$, {{Cl|LEN}}(ca$) - i2 - {{Text|2|#F580B1}}) | |||
i2 = {{Cl|INSTR}}(a$, sp + {{Text|<nowiki>"."</nowiki>|#FFB100}} + sp) | |||
{{Cl|DO...LOOP|LOOP UNTIL}} i2 = {{Text|0|#F580B1}} | |||
n = {{Text|numelements|#55FF55}}(a$) | |||
firstelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|1|#F580B1}}): secondelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|2|#F580B1}}): thirdelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|3|#F580B1}}) | |||
{{Cl|END IF}} | |||
n$ = {{Text|getelement$|#55FF55}}(ca$, {{Text|2|#F580B1}}) | |||
symbol$ = {{Text|removesymbol$|#55FF55}}(n$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} sf = {{Text|2|#F580B1}} {{Cl|AND (boolean)|AND}} symbol$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Type symbols after a SUB name are invalid"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'remove STATIC (which is ignored)</nowiki>|#919191}} | |||
e$ = {{Text|getelement$|#55FF55}}(a$, n): {{Cl|IF}} e$ = {{Text|<nowiki>"STATIC"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Cl|LEFT$}}(a$, {{Cl|LEN}}(a$) - {{Text|7|#F580B1}}): ca$ = {{Cl|LEFT$}}(ca$, {{Cl|LEN}}(ca$) - {{Text|7|#F580B1}}): n = n - {{Text|1|#F580B1}} | |||
{{Text|<nowiki>'check for ALIAS</nowiki>|#919191}} | |||
aliasname$ = n$ {{Text|<nowiki>'use given name by default</nowiki>|#919191}} | |||
{{Cl|IF}} n > {{Text|2|#F580B1}} {{Cl|THEN}} | |||
e$ = {{Text|getelement$|#55FF55}}(a$, {{Text|3|#F580B1}}) | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"ALIAS"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} declaringlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"ALIAS can only be used with DECLARE LIBRARY"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} n = {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ALIAS name-in-library"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
e$ = {{Text|getelement$|#55FF55}}(ca$, {{Text|4|#F580B1}}) | |||
{{Text|<nowiki>'strip string content (optional)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(e$, {{Text|1|#F580B1}}) = {{Cl|CHR$}}({{Text|34|#F580B1}}) {{Cl|THEN}} | |||
e$ = {{Cl|RIGHT$}}(e$, {{Cl|LEN}}(e$) - {{Text|1|#F580B1}}) | |||
x = {{Cl|INSTR}}(e$, {{Cl|CHR$}}({{Text|34|#F580B1}})): {{Cl|IF}} x = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
e$ = {{Cl|LEFT$}}(e$, x - {{Text|1|#F580B1}}) | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'strip fix046$ (created by unquoted periods)</nowiki>|#919191}} | |||
{{Cl|DO...LOOP|DO WHILE}} {{Cl|INSTR}}(e$, fix046$) | |||
x = {{Cl|INSTR}}(e$, fix046$): e$ = {{Cl|LEFT$}}(e$, x - {{Text|1|#F580B1}}) + {{Text|<nowiki>"."</nowiki>|#FFB100}} + {{Cl|RIGHT$}}(e$, {{Cl|LEN}}(e$) - x + {{Text|1|#F580B1}} - {{Cl|LEN}}(fix046$)) | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'validate alias name</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(e$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ALIAS name-in-library"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|FOR}} x = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(e$) | |||
a = {{Cl|ASC (function)|ASC}}(e$, x) | |||
{{Cl|IF}} alphanumeric(a) = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} a <> ASC_FULLSTOP {{Cl|AND (boolean)|AND}} a <> ASC_COLON {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ALIAS name-in-library"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|NEXT}} | |||
aliasname$ = e$ | |||
{{Text|<nowiki>'remove ALIAS section from line</nowiki>|#919191}} | |||
{{Cl|IF}} n <= {{Text|4|#F580B1}} {{Cl|THEN}} a$ = {{Text|getelements|#55FF55}}(a$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) | |||
{{Cl|IF}} n >= {{Text|5|#F580B1}} {{Cl|THEN}} a$ = {{Text|getelements|#55FF55}}(a$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) + sp + {{Text|getelements|#55FF55}}(a$, {{Text|5|#F580B1}}, n) | |||
{{Cl|IF}} n <= {{Text|4|#F580B1}} {{Cl|THEN}} ca$ = {{Text|getelements|#55FF55}}(ca$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) | |||
{{Cl|IF}} n >= {{Text|5|#F580B1}} {{Cl|THEN}} ca$ = {{Text|getelements|#55FF55}}(ca$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) + sp + {{Text|getelements|#55FF55}}(ca$, {{Text|5|#F580B1}}, n) | |||
n = n - {{Text|2|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
{{Cl|IF}} indirectlibrary {{Cl|THEN}} | |||
aliasname$ = n$ {{Text|<nowiki>'override the alias name</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
params = {{Text|0|#F580B1}} | |||
params$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
paramsize$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
nele$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
nelereq$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} n > {{Text|2|#F580B1}} {{Cl|THEN}} | |||
e$ = {{Text|getelement$|#55FF55}}(a$, {{Text|3|#F580B1}}) | |||
{{Cl|IF}} e$ <> {{Text|<nowiki>"("</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ("</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
e$ = {{Text|getelement$|#55FF55}}(a$, n) | |||
{{Cl|IF}} e$ <> {{Text|<nowiki>")"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected )"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} n < {{Text|4|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ( ... )"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} n = {{Text|4|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} nosfparams | |||
B = {{Text|0|#F580B1}} | |||
a2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|FOR}} i = {{Text|4|#F580B1}} {{Cl|TO}} n - {{Text|1|#F580B1}} | |||
e$ = {{Text|getelement$|#55FF55}}(a$, i) | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"("</nowiki>|#FFB100}} {{Cl|THEN}} B = B + {{Text|1|#F580B1}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>")"</nowiki>|#FFB100}} {{Cl|THEN}} B = B - {{Text|1|#F580B1}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} B = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} i = n - {{Text|1|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected , ... )"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
getlastparam: | |||
{{Cl|IF}} a2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ... ,"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
a2$ = {{Cl|LEFT$}}(a2$, {{Cl|LEN}}(a2$) - {{Text|1|#F580B1}}) | |||
{{Text|<nowiki>'possible format: [BYVAL]a[%][(1)][AS][type]</nowiki>|#919191}} | |||
n2 = {{Text|numelements|#55FF55}}(a2$) | |||
array = {{Text|0|#F580B1}} | |||
t2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
i2 = {{Text|1|#F580B1}} | |||
e$ = {{Text|getelement$|#55FF55}}(a2$, i2): i2 = i2 + {{Text|1|#F580B1}} | |||
byvalue = {{Text|0|#F580B1}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"BYVAL"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} declaringlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"BYVAL can currently only be used with DECLARE LIBRARY"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
e$ = {{Text|getelement$|#55FF55}}(a2$, i2): i2 = i2 + {{Text|1|#F580B1}}: byvalue = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
n2$ = e$ | |||
symbol2$ = {{Text|removesymbol$|#55FF55}}(n2$) | |||
{{Cl|IF}} {{Text|validname|#55FF55}}(n2$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
m = {{Text|0|#F580B1}} | |||
{{Cl|FOR}} i2 = i2 {{Cl|TO}} n2 | |||
e$ = {{Text|getelement$|#55FF55}}(a2$, i2) | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"("</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} m <> {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Syntax error - too many opening brackets"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
m = {{Text|1|#F580B1}} | |||
array = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} gotaa | |||
{{Cl|END IF}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>")"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} m <> {{Text|1|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Syntax error - closing bracket without opening bracket"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
m = {{Text|2|#F580B1}} | |||
{{Cl|GOTO}} gotaa | |||
{{Cl|END IF}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"AS"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} m <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} m <> {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Syntax error - check your brackets"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
m = {{Text|3|#F580B1}} | |||
{{Cl|GOTO}} gotaa | |||
{{Cl|END IF}} | |||
{{Cl|IF}} m = {{Text|1|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} gotaa {{Text|<nowiki>'ignore contents of bracket</nowiki>|#919191}} | |||
{{Cl|IF}} m <> {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Syntax error - check your brackets"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} t2$ = e$ {{Cl|ELSE}} t2$ = t2$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + e$ | |||
gotaa: | |||
{{Cl|NEXT}} i2 | |||
params = params + {{Text|1|#F580B1}}: {{Cl|IF}} params > {{Text|100|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"SUB/FUNCTION exceeds 100 parameter limit"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
argnelereq = {{Text|0|#F580B1}} | |||
{{Cl|IF}} symbol2$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} t2$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Syntax error - check parameter types"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} e$ = {{Text|<nowiki>"AS"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected AS type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} t2$ = symbol2$ | |||
{{Cl|IF}} t2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(n2$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"_"</nowiki>|#FFB100}} {{Cl|THEN}} v = {{Text|27|#F580B1}} {{Cl|ELSE}} v = {{Cl|ASC (function)|ASC}}({{Cl|UCASE$}}(n2$)) - {{Text|64|#F580B1}} | |||
t2$ = defineaz(v) | |||
{{Cl|END IF}} | |||
paramsize = {{Text|0|#F580B1}} | |||
{{Cl|IF}} array = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
t = {{Text|typname2typ|#55FF55}}(t2$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Illegal SUB/FUNCTION parameter"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} (t {{Cl|AND (boolean)|AND}} ISFIXEDLENGTH) {{Cl|THEN}} paramsize = typname2typsize | |||
t = t + ISARRAY | |||
{{Text|<nowiki>'check for recompilation override</nowiki>|#919191}} | |||
{{Cl|FOR}} i10 = {{Text|0|#F580B1}} {{Cl|TO}} sflistn | |||
{{Cl|IF}} sfidlist(i10) = idn + {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} sfarglist(i10) = params {{Cl|THEN}} | |||
argnelereq = sfelelist(i10) | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
{{Cl|ELSE}} | |||
t = {{Text|typname2typ|#55FF55}}(t2$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Illegal SUB/FUNCTION parameter"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} (t {{Cl|AND (boolean)|AND}} ISFIXEDLENGTH) {{Cl|THEN}} paramsize = typname2typsize | |||
{{Cl|IF}} byvalue {{Cl|THEN}} | |||
{{Cl|IF}} t {{Cl|AND (boolean)|AND}} ISPOINTER {{Cl|THEN}} t = t - ISPOINTER | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
nelereq$ = nelereq$ + {{Cl|CHR$}}(argnelereq) | |||
{{Text|<nowiki>'consider changing 0 in following line too!</nowiki>|#919191}} | |||
nele$ = nele$ + {{Cl|CHR$}}({{Text|0|#F580B1}}) | |||
paramsize$ = paramsize$ + {{Cl|MKL$}}(paramsize) | |||
params$ = params$ + {{Cl|MKL$}}(t) | |||
a2$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
a2$ = a2$ + e$ + sp | |||
{{Cl|IF}} i = n - {{Text|1|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} getlastparam | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} i | |||
{{Cl|END IF}} {{Text|<nowiki>'n>2</nowiki>|#919191}} | |||
nosfparams: | |||
{{Cl|IF}} sf = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'function</nowiki>|#919191}} | |||
{{Text|clearid|#55FF55}} | |||
id.n = n$ | |||
id.subfunc = {{Text|1|#F580B1}} | |||
id.callname = {{Text|<nowiki>"FUNC_"</nowiki>|#FFB100}} + {{Cl|UCASE$}}(n$) | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
id.ccall = {{Text|1|#F580B1}} | |||
{{Cl|IF}} indirectlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} id.callname = aliasname$ | |||
{{Cl|END IF}} | |||
id.args = params | |||
id.arg = params$ | |||
id.argsize = paramsize$ | |||
id.nele = nele$ | |||
id.nelereq = nelereq$ | |||
{{Cl|IF}} symbol$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
id.ret = {{Text|typname2typ|#55FF55}}(symbol$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(n$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"_"</nowiki>|#FFB100}} {{Cl|THEN}} v = {{Text|27|#F580B1}} {{Cl|ELSE}} v = {{Cl|ASC (function)|ASC}}({{Cl|UCASE$}}(n$)) - {{Text|64|#F580B1}} | |||
symbol$ = defineaz(v) | |||
id.ret = {{Text|typname2typ|#55FF55}}(symbol$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} id.ret = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid FUNCTION return type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
ctype$ = {{Text|typ2ctyp$|#55FF55}}(id.ret, {{Text|<nowiki>""</nowiki>|#FFB100}}) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} ctype$ = {{Text|<nowiki>"qbs"</nowiki>|#FFB100}} {{Cl|THEN}} ctype$ = {{Text|<nowiki>"char*"</nowiki>|#FFB100}} | |||
id.callname = {{Text|<nowiki>"( "</nowiki>|#FFB100}} + ctype$ + {{Text|<nowiki>" )"</nowiki>|#FFB100}} + {{Cl|RTRIM$}}(id.callname) | |||
{{Cl|END IF}} | |||
s$ = {{Cl|LEFT$}}(symbol$, {{Text|1|#F580B1}}) | |||
{{Cl|IF}} s$ <> {{Text|<nowiki>"~"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} s$ <> {{Text|<nowiki>"`"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} s$ <> {{Text|<nowiki>"%"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} s$ <> {{Text|<nowiki>"&"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} s$ <> {{Text|<nowiki>"!"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} s$ <> {{Text|<nowiki>"#"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} s$ <> {{Text|<nowiki>"$"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
symbol$ = {{Text|type2symbol$|#55FF55}}(symbol$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
id.mayhave = symbol$ | |||
{{Cl|IF}} id.ret {{Cl|AND (boolean)|AND}} ISPOINTER {{Cl|THEN}} | |||
{{Cl|IF}} (id.ret {{Cl|AND (boolean)|AND}} ISSTRING) = {{Text|0|#F580B1}} {{Cl|THEN}} id.ret = id.ret - ISPOINTER | |||
{{Cl|END IF}} | |||
{{Text|regid|#55FF55}} | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>'sub</nowiki>|#919191}} | |||
{{Text|clearid|#55FF55}} | |||
id.n = n$ | |||
id.subfunc = {{Text|2|#F580B1}} | |||
id.callname = {{Text|<nowiki>"SUB_"</nowiki>|#FFB100}} + {{Cl|UCASE$}}(n$) | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
id.ccall = {{Text|1|#F580B1}} | |||
{{Cl|IF}} indirectlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} id.callname = aliasname$ | |||
{{Cl|END IF}} | |||
id.args = params | |||
id.arg = params$ | |||
id.argsize = paramsize$ | |||
id.nele = nele$ | |||
id.nelereq = nelereq$ | |||
{{Cl|IF}} {{Cl|UCASE$}}(n$) = {{Text|<nowiki>"_GL"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} params = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} UseGL = {{Text|0|#F580B1}} {{Cl|THEN}} reginternalsubfunc = {{Text|1|#F580B1}}: UseGL = {{Text|1|#F580B1}}: id.n = {{Text|<nowiki>"_GL"</nowiki>|#FFB100}}: DEPENDENCY(DEPENDENCY_GL) = {{Text|1|#F580B1}} | |||
{{Text|regid|#55FF55}} | |||
reginternalsubfunc = {{Text|0|#F580B1}} | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'========================================</nowiki>|#919191}} | |||
finishedlinepp: | |||
firstLine = {{Text|0|#F580B1}} | |||
{{Cl|END IF}} | |||
a$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
ca$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} a$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = e$: ca$ = ce$ {{Cl|ELSE}} a$ = a$ + sp + e$: ca$ = ca$ + sp + ce$ | |||
{{Cl|END IF}} | |||
{{Cl|IF}} wholelinei <= wholelinen {{Cl|THEN}} wholelinei = wholelinei + {{Text|1|#F580B1}}: {{Cl|GOTO}} ppblda | |||
{{Text|<nowiki>'----------------------------------------</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'wholelinei<=wholelinen</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'wholelinen</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'len(wholeline$)</nowiki>|#919191}} | |||
{{Text|<nowiki>'Include Manager #1</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(addmetainclude$) {{Cl|THEN}} | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|PRINT (file statement)|PRINT}} #9, {{Text|<nowiki>"Pre-pass:INCLUDE$-ing file:'"</nowiki>|#FFB100}} + addmetainclude$ + {{Text|<nowiki>"':On line"</nowiki>|#FFB100}}; linenumber | |||
a$ = addmetainclude$: addmetainclude$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Text|<nowiki>'read/clear message</nowiki>|#919191}} | |||
{{Cl|IF}} inclevel = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
includingFromRoot = {{Text|0|#F580B1}} | |||
forceIncludingFile = {{Text|0|#F580B1}} | |||
forceInclude_prepass: | |||
{{Cl|IF}} forceIncludeFromRoot$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
a$ = forceIncludeFromRoot$ | |||
forceIncludeFromRoot$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
forceIncludingFile = {{Text|1|#F580B1}} | |||
includingFromRoot = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} inclevel = {{Text|100|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Too many indwelling INCLUDE files"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'1. Verify file exists (location is either (a)relative to source file or (b)absolute)</nowiki>|#919191}} | |||
fh = {{Text|99|#F580B1}} + inclevel + {{Text|1|#F580B1}} | |||
firstTryMethod = {{Text|1|#F580B1}} | |||
{{Cl|IF}} includingFromRoot <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} inclevel = {{Text|0|#F580B1}} {{Cl|THEN}} firstTryMethod = {{Text|2|#F580B1}} | |||
{{Cl|FOR}} try = firstTryMethod {{Cl|TO}} {{Text|2|#F580B1}} {{Text|<nowiki>'if including file from root, do not attempt including from relative location</nowiki>|#919191}} | |||
{{Cl|IF}} try = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} inclevel = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} idemode {{Cl|THEN}} p$ = idepath$ + pathsep$ {{Cl|ELSE}} p$ = {{Text|getfilepath$|#55FF55}}(sourcefile$) | |||
{{Cl|ELSE}} | |||
p$ = {{Text|getfilepath$|#55FF55}}(incname(inclevel)) | |||
{{Cl|END IF}} | |||
f$ = p$ + a$ | |||
{{Cl|END IF}} | |||
{{Cl|IF}} try = {{Text|2|#F580B1}} {{Cl|THEN}} f$ = a$ | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(f$) {{Cl|THEN}} | |||
qberrorhappened = {{Text|-3|#F580B1}} | |||
{{Text|<nowiki>'We're using the faster LINE INPUT, which requires a BINARY open.</nowiki>|#919191}} | |||
{{Cl|OPEN}} f$ {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|BINARY}} {{Cl|OPEN|AS}} #fh | |||
{{Text|<nowiki>'And another line below edited</nowiki>|#919191}} | |||
qberrorhappened3: | |||
{{Cl|IF}} qberrorhappened = {{Text|-3|#F580B1}} {{Cl|THEN}} {{Cl|EXIT FOR}} | |||
{{Cl|END IF}} | |||
qberrorhappened = {{Text|0|#F580B1}} | |||
{{Cl|NEXT}} | |||
{{Cl|IF}} qberrorhappened <> {{Text|-3|#F580B1}} {{Cl|THEN}} qberrorhappened = {{Text|0|#F580B1}}: a$ = {{Text|<nowiki>"File "</nowiki>|#FFB100}} + a$ + {{Text|<nowiki>" not found"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
inclevel = inclevel + {{Text|1|#F580B1}}: incname$(inclevel) = f$: inclinenumber(inclevel) = {{Text|0|#F580B1}} | |||
{{Cl|END IF}} {{Text|<nowiki>'fall through to next section...</nowiki>|#919191}} | |||
{{Text|<nowiki>'--------------------</nowiki>|#919191}} | |||
{{Cl|DO...LOOP|DO WHILE}} inclevel | |||
fh = {{Text|99|#F580B1}} + inclevel | |||
{{Text|<nowiki>'2. Feed next line</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|EOF}}(fh) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|LINE INPUT (file statement)|LINE INPUT}} #fh, x$ | |||
wholeline$ = x$ | |||
inclinenumber(inclevel) = inclinenumber(inclevel) + {{Text|1|#F580B1}} | |||
{{Text|<nowiki>'create extended error string 'incerror$'</nowiki>|#919191}} | |||
errorLineInInclude = inclinenumber(inclevel) | |||
e$ = {{Text|<nowiki>" in line "</nowiki>|#FFB100}} + {{Text|str2|#55FF55}}(inclinenumber(inclevel)) + {{Text|<nowiki>" of "</nowiki>|#FFB100}} + incname$(inclevel) + {{Text|<nowiki>" included"</nowiki>|#FFB100}} | |||
{{Cl|IF}} inclevel > {{Text|1|#F580B1}} {{Cl|THEN}} | |||
e$ = e$ + {{Text|<nowiki>" (through "</nowiki>|#FFB100}} | |||
{{Cl|FOR}} x = {{Text|1|#F580B1}} {{Cl|TO}} inclevel - {{Text|1|#F580B1}} {{Cl|STEP}} {{Text|1|#F580B1}} | |||
e$ = e$ + incname$(x) | |||
{{Cl|IF}} x < inclevel - {{Text|1|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'a sep is req</nowiki>|#919191}} | |||
{{Cl|IF}} x = inclevel - {{Text|2|#F580B1}} {{Cl|THEN}} | |||
e$ = e$ + {{Text|<nowiki>" then "</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
e$ = e$ + {{Text|<nowiki>", "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
e$ = e$ + {{Text|<nowiki>")"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
incerror$ = e$ | |||
linenumber = linenumber - {{Text|1|#F580B1}} {{Text|<nowiki>'lower official linenumber to counter later increment</nowiki>|#919191}} | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|PRINT (file statement)|PRINT}} #9, {{Text|<nowiki>"Pre-pass:Feeding INCLUDE$ line:["</nowiki>|#FFB100}} + wholeline$ + {{Text|<nowiki>"]"</nowiki>|#FFB100}} | |||
{{Cl|IF}} idemode {{Cl|THEN}} sendc$ = {{Cl|CHR$}}({{Text|10|#F580B1}}) + wholeline$: {{Cl|GOTO}} sendcommand {{Text|<nowiki>'passback</nowiki>|#919191}} | |||
{{Cl|GOTO}} ideprepass | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'3. Close & return control</nowiki>|#919191}} | |||
{{Cl|CLOSE}} #fh | |||
inclevel = inclevel - {{Text|1|#F580B1}} | |||
{{Cl|IF}} forceIncludingFile = {{Text|1|#F580B1}} {{Cl|AND (boolean)|AND}} inclevel = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
forceIncludingFile = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} forceIncludeCompleted_prepass | |||
{{Cl|END IF}} | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'(end manager)</nowiki>|#919191}} | |||
{{Cl|IF}} idemode {{Cl|THEN}} {{Cl|GOTO}} ideret2 | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'add final line</nowiki>|#919191}} | |||
{{Cl|IF}} lastLineReturn = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
lastLineReturn = {{Text|1|#F580B1}} | |||
lastLine = {{Text|1|#F580B1}} | |||
wholeline$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} prepassLastLine | |||
{{Cl|END IF}} | |||
{{Cl|IF}} definingtype {{Cl|THEN}} definingtype = {{Text|0|#F580B1}} {{Text|<nowiki>'ignore this error so that auto-formatting can be performed and catch it again later</nowiki>|#919191}} | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} declaringlibrary = {{Text|0|#F580B1}} {{Text|<nowiki>'ignore this error so that auto-formatting can be performed and catch it again later</nowiki>|#919191}} | |||
totallinenumber = reallinenumber | |||
{{Text|<nowiki>'IF idemode = 0 AND NOT QuietMode THEN PRINT "first pass finished.": PRINT "Translating code... "</nowiki>|#919191}} | |||
{{Text|<nowiki>'prepass finished</nowiki>|#919191}} | |||
lineinput3index = {{Text|1|#F580B1}} {{Text|<nowiki>'reset input line</nowiki>|#919191}} | |||
{{Text|<nowiki>'ide specific</nowiki>|#919191}} | |||
ide3: | |||
addmetainclude$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Text|<nowiki>'reset stray meta-includes</nowiki>|#919191}} | |||
{{Text|<nowiki>'reset altered variables</nowiki>|#919191}} | |||
DataOffset = {{Text|0|#F580B1}} | |||
inclevel = {{Text|0|#F580B1}} | |||
subfuncn = {{Text|0|#F580B1}} | |||
lastLineReturn = {{Text|0|#F580B1}} | |||
lastLine = {{Text|0|#F580B1}} | |||
firstLine = {{Text|1|#F580B1}} | |||
UserDefineCount = {{Text|7|#F580B1}} | |||
{{Cl|FOR}} i = {{Text|0|#F580B1}} {{Cl|TO}} constlast: constdefined(i) = {{Text|0|#F580B1}}: {{Cl|NEXT}} {{Text|<nowiki>'undefine constants</nowiki>|#919191}} | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|27|#F580B1}}: defineaz(i) = {{Text|<nowiki>"SINGLE"</nowiki>|#FFB100}}: defineextaz(i) = {{Text|<nowiki>"!"</nowiki>|#FFB100}}: {{Cl|NEXT}} | |||
{{Cl|DIM}} {{Cl|SHARED}} DataBinBuf: DataBinBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"data.bin"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} MainTxtBuf: MainTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"main.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} DataTxtBuf: DataTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"maindata.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} RegTxtBuf: RegTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"regsf.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} FreeTxtBuf: FreeTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"mainfree.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} RunTxtBuf: RunTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"runline.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} ErrTxtBuf: ErrTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"mainerr.txt"</nowiki>|#FFB100}}) | |||
{{Text|<nowiki>'i. check the value of error_line</nowiki>|#919191}} | |||
{{Text|<nowiki>'ii. jump to the appropriate label</nowiki>|#919191}} | |||
errorlabels = {{Text|0|#F580B1}} | |||
{{Text|WriteBufLine|#55FF55}} ErrTxtBuf, {{Text|<nowiki>"if (error_occurred){ error_occurred=0;"</nowiki>|#FFB100}} | |||
{{Cl|DIM}} {{Cl|SHARED}} ChainTxtBuf: ChainTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"chain.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} InpChainTxtBuf: InpChainTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"inpchain.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} TimeTxtBuf: TimeTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"ontimer.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} TimejTxtBuf: TimejTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"ontimerj.txt"</nowiki>|#FFB100}}) | |||
{{Text|<nowiki>'*****#26 used for locking qb64pe</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} KeyTxtBuf: KeyTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"onkey.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} KeyjTxtBuf: KeyjTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"onkeyj.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} StrigTxtBuf: StrigTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"onstrig.txt"</nowiki>|#FFB100}}) | |||
{{Cl|DIM}} {{Cl|SHARED}} StrigjTxtBuf: StrigjTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"onstrigj.txt"</nowiki>|#FFB100}}) | |||
gosubid = {{Text|1|#F580B1}} | |||
{{Text|<nowiki>'to be included whenever return without a label is called</nowiki>|#919191}} | |||
{{Text|<nowiki>'return [label] in QBASIC was not possible in a sub/function, but QB64 will support this</nowiki>|#919191}} | |||
{{Text|<nowiki>'special codes will represent special return conditions:</nowiki>|#919191}} | |||
{{Text|<nowiki>'0=return from main to calling sub/function/proc by return [NULL];</nowiki>|#919191}} | |||
{{Text|<nowiki>'1... a global number representing a return point after a gosub</nowiki>|#919191}} | |||
{{Text|<nowiki>'note: RETURN [label] should fail if a "return [NULL];" type return is required</nowiki>|#919191}} | |||
{{Cl|DIM}} {{Cl|SHARED}} RetTxtBuf: RetTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"ret0.txt"</nowiki>|#FFB100}}) | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"if (next_return_point){"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"next_return_point--;"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"switch(return_point[next_return_point]){"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"case 0:"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"return;"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"break;"</nowiki>|#FFB100}} | |||
continueline = {{Text|0|#F580B1}} | |||
endifs = {{Text|0|#F580B1}} | |||
lineelseused = {{Text|0|#F580B1}} | |||
continuelinefrom = {{Text|0|#F580B1}} | |||
linenumber = {{Text|0|#F580B1}} | |||
reallinenumber = {{Text|0|#F580B1}} | |||
declaringlibrary = {{Text|0|#F580B1}} | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"S_0:;"</nowiki>|#FFB100}} {{Text|<nowiki>'note: REQUIRED by run statement</nowiki>|#919191}} | |||
{{Cl|IF}} UseGL {{Cl|THEN}} {{Text|gl_include_content|#55FF55}} | |||
{{Text|<nowiki>'ide specific</nowiki>|#919191}} | |||
{{Cl|IF}} idemode {{Cl|THEN}} {{Cl|GOTO}} ideret3 | |||
{{Cl|DO}} | |||
ide4: | |||
includeline: | |||
mainpassLastLine: | |||
{{Cl|IF}} lastLine <> {{Text|0|#F580B1}} {{Cl|OR (boolean)|OR}} firstLine <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
lineBackup$ = a3$ {{Text|<nowiki>'backup the real first line (will be blank when lastline is set)</nowiki>|#919191}} | |||
forceIncludeFromRoot$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} vWatchOn {{Cl|THEN}} | |||
addingvWatch = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstLine <> {{Text|0|#F580B1}} {{Cl|THEN}} forceIncludeFromRoot$ = {{Text|<nowiki>"internal\support\vwatch\vwatch.bi"</nowiki>|#FFB100}} | |||
{{Cl|IF}} lastLine <> {{Text|0|#F580B1}} {{Cl|THEN}} forceIncludeFromRoot$ = {{Text|<nowiki>"internal\support\vwatch\vwatch.bm"</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bi"</nowiki>|#919191}} | |||
{{Cl|IF}} lastLine <> {{Text|0|#F580B1}} {{Cl|THEN}} forceIncludeFromRoot$ = {{Text|<nowiki>"internal\support\vwatch\vwatch_stub.bm"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
firstLine = {{Text|0|#F580B1}}: lastLine = {{Text|0|#F580B1}} | |||
{{Cl|IF}} {{Cl|LEN}}(forceIncludeFromRoot$) {{Cl|THEN}} {{Cl|GOTO}} forceInclude | |||
forceIncludeCompleted: | |||
addingvWatch = {{Text|0|#F580B1}} | |||
a3$ = lineBackup$ | |||
{{Cl|END IF}} | |||
prepass = {{Text|0|#F580B1}} | |||
stringprocessinghappened = {{Text|0|#F580B1}} | |||
{{Cl|IF}} continuelinefrom {{Cl|THEN}} | |||
start = continuelinefrom | |||
continuelinefrom = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} contline | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'begin a new line</nowiki>|#919191}} | |||
impliedendif = {{Text|0|#F580B1}} | |||
THENGOTO = {{Text|0|#F580B1}} | |||
continueline = {{Text|0|#F580B1}} | |||
endifs = {{Text|0|#F580B1}} | |||
lineelseused = {{Text|0|#F580B1}} | |||
newif = {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'apply metacommands from previous line</nowiki>|#919191}} | |||
{{Cl|IF}} addmetadynamic = {{Text|1|#F580B1}} {{Cl|THEN}} addmetadynamic = {{Text|0|#F580B1}}: DynamicMode = {{Text|1|#F580B1}} | |||
{{Cl|IF}} addmetastatic = {{Text|1|#F580B1}} {{Cl|THEN}} addmetastatic = {{Text|0|#F580B1}}: DynamicMode = {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'a3$ is passed in idemode and when using $include</nowiki>|#919191}} | |||
{{Cl|IF}} idemode = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} inclevel = {{Text|0|#F580B1}} {{Cl|THEN}} a3$ = {{Text|lineinput3$|#55FF55}} | |||
{{Cl|IF}} a3$ = {{Cl|CHR$}}({{Text|13|#F580B1}}) {{Cl|THEN}} {{Cl|EXIT DO}} | |||
linenumber = linenumber + {{Text|1|#F580B1}} | |||
reallinenumber = reallinenumber + {{Text|1|#F580B1}} | |||
{{Cl|IF}} InValidLine(linenumber) {{Cl|THEN}} | |||
layoutok = {{Text|1|#F580B1}} | |||
layout$ = {{Cl|SPACE$}}(controllevel + {{Text|1|#F580B1}}) + {{Cl|LTRIM$}}({{Cl|RTRIM$}}(a3$)) | |||
{{Cl|IF}} idemode {{Cl|GOTO}} ideret4 {{Cl|ELSE}} {{Cl|GOTO}} skipide4 | |||
{{Cl|END IF}} | |||
layout = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
layoutok = {{Text|1|#F580B1}} | |||
{{Cl|IF}} idemode = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|NOT}} QuietMode {{Cl|THEN}} | |||
{{Text|<nowiki>'IF LEN(a3$) THEN</nowiki>|#919191}} | |||
{{Text|<nowiki>' dotlinecount = dotlinecount + 1: IF dotlinecount >= 100 THEN dotlinecount = 0: PRINT ".";</nowiki>|#919191}} | |||
{{Text|<nowiki>'END IF</nowiki>|#919191}} | |||
maxprogresswidth = {{Text|50|#F580B1}} {{Text|<nowiki>'arbitrary</nowiki>|#919191}} | |||
percentage = {{Cl|INT}}(reallinenumber / totallinenumber * {{Text|100|#F580B1}}) | |||
percentagechars = {{Cl|INT}}(maxprogresswidth * reallinenumber / totallinenumber) | |||
{{Cl|IF}} percentage <> prevpercentage {{Cl|AND (boolean)|AND}} percentagechars <> prevpercentagechars {{Cl|THEN}} | |||
prevpercentage = percentage | |||
prevpercentagechars = percentagechars | |||
{{Cl|IF}} ConsoleMode {{Cl|THEN}} | |||
{{Cl|PRINT}} {{Text|<nowiki>"["</nowiki>|#FFB100}} + {{Cl|STRING$}}(percentagechars, {{Text|<nowiki>"."</nowiki>|#FFB100}}) + {{Cl|SPACE$}}(maxprogresswidth - percentagechars) + {{Text|<nowiki>"]"</nowiki>|#FFB100}} + {{Cl|STR$}}(percentage) + {{Text|<nowiki>"%"</nowiki>|#FFB100}}; | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|PRINT}} {{Cl|CHR$}}({{Text|27|#F580B1}}) + {{Text|<nowiki>"[A"</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
{{Cl|PRINT}} {{Cl|CHR$}}({{Text|13|#F580B1}}); | |||
{{Cl|END IF}} | |||
{{Cl|ELSE}} | |||
{{Cl|LOCATE}} , {{Text|1|#F580B1}} | |||
{{Cl|PRINT}} {{Cl|STRING$}}(percentagechars, {{Text|219|#F580B1}}) + {{Cl|STRING$}}(maxprogresswidth - percentagechars, {{Text|176|#F580B1}}) + {{Cl|STR$}}(percentage) + {{Text|<nowiki>"%"</nowiki>|#FFB100}}; | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
a3$ = {{Cl|LTRIM$}}({{Cl|RTRIM$}}(a3$)) | |||
wholeline = a3$ | |||
layoutoriginal$ = a3$ | |||
layoutcomment$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Text|<nowiki>'clear any previous layout comment</nowiki>|#919191}} | |||
lhscontrollevel = controllevel | |||
linefragment = {{Text|<nowiki>"[INFORMATION UNAVAILABLE]"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(a3$) = {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} finishednonexec | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|PRINT (file statement)|PRINT}} #9, {{Text|<nowiki>"########"</nowiki>|#FFB100}} + a3$ + {{Text|<nowiki>"########"</nowiki>|#FFB100}} | |||
layoutdone = {{Text|1|#F580B1}} {{Text|<nowiki>'validates layout of any following goto finishednonexec/finishedline</nowiki>|#919191}} | |||
{{Text|<nowiki>'We've already figured out in the prepass which lines are invalidated by the precompiler</nowiki>|#919191}} | |||
{{Text|<nowiki>'No need to go over those lines again.</nowiki>|#919191}} | |||
{{Text|<nowiki>'IF InValidLine(linenumber) THEN goto skipide4 'layoutdone = 0: GOTO finishednonexec</nowiki>|#919191}} | |||
a3u$ = {{Cl|UCASE$}}(a3$) | |||
{{Text|<nowiki>'QB64 Metacommands</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(a3$) = {{Text|36|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'$</nowiki>|#919191}} | |||
{{Text|<nowiki>'precompiler commands should always be executed FIRST.</nowiki>|#919191}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$END IF"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} a3u$ = {{Text|<nowiki>"$ENDIF"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$END IF without $IF"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Text|<nowiki>'We no longer have an $IF block at this level</nowiki>|#919191}} | |||
ExecCounter = ExecCounter - {{Text|1|#F580B1}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$End If"</nowiki>|#FFB100}}) | |||
controltype(controllevel) = {{Text|0|#F580B1}} | |||
controllevel = controllevel - {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(a3u$, {{Text|4|#F580B1}}) = {{Text|<nowiki>"$IF "</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'prevents code from being placed before 'CASE condition' in a SELECT CASE block</nowiki>|#919191}} | |||
{{Cl|IF}} SelectCaseCounter > {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} SelectCaseHasCaseBlock(SelectCaseCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Expected CASE expression"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(a3u$, {{Text|4|#F580B1}})) {{Text|<nowiki>'strip off the $IF and extra spaces</nowiki>|#919191}} | |||
temp$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, {{Cl|LEN}}(temp$) - {{Text|4|#F580B1}})) {{Text|<nowiki>'and strip off the THEN and extra spaces</nowiki>|#919191}} | |||
temp = {{Text|0|#F580B1}} | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>"<="</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$) | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>"=<"</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$): tempOp$ = {{Text|<nowiki>"<="</nowiki>|#FFB100}} | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>">="</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$) | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>"=>"</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$): tempOp$ = {{Text|<nowiki>">="</nowiki>|#FFB100}} | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>"<>"</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$) | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>"><"</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$): tempOp$ = {{Text|<nowiki>"<>"</nowiki>|#FFB100}} | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>"="</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$) | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>">"</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$) | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} tempOp$ = {{Text|<nowiki>"<"</nowiki>|#FFB100}}: temp = {{Cl|INSTR}}(temp$, tempOp$) | |||
ExecCounter = ExecCounter + {{Text|1|#F580B1}} | |||
ExecLevel(ExecCounter) = {{Text|-1|#F580B1}} {{Text|<nowiki>'default to a skip value</nowiki>|#919191}} | |||
DefineElse(ExecCounter) = {{Text|1|#F580B1}} {{Text|<nowiki>'1 says we have an $IF statement at this level</nowiki>|#919191}} | |||
result = {{Text|EvalPreIF|#55FF55}}(temp$, a$) | |||
{{Cl|IF}} a$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} result <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
ExecLevel(ExecCounter) = ExecLevel(ExecCounter - {{Text|1|#F580B1}}) {{Text|<nowiki>'So we inherit the execlevel from above</nowiki>|#919191}} | |||
{{Cl|IF}} ExecLevel(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} DefineElse(ExecCounter) = DefineElse(ExecCounter) {{Cl|OR}} {{Text|4|#F580B1}} {{Text|<nowiki>'Else if used and conditon found</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
controllevel = controllevel + {{Text|1|#F580B1}} | |||
controltype(controllevel) = {{Text|6|#F580B1}} | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$If "</nowiki>|#FFB100}}) + temp$ + {{Text|SCase$|#55FF55}}({{Text|<nowiki>" Then"</nowiki>|#FFB100}}): {{Cl|GOTO}} finishednonexec {{Text|<nowiki>'no = sign in the $IF statement, so we're going to assume the user is doing something like $IF flag</nowiki>|#919191}} | |||
l$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, temp - {{Text|1|#F580B1}})): r$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, temp + {{Cl|LEN}}(tempOp$))) | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$If "</nowiki>|#FFB100}}) + l$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + tempOp$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + r$ + {{Text|SCase$|#55FF55}}({{Text|<nowiki>" Then"</nowiki>|#FFB100}}) | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$ELSE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE without $IF"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$IF block already has $ELSE statement in it"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
DefineElse(ExecCounter) = DefineElse(ExecCounter) {{Cl|OR}} {{Text|2|#F580B1}} {{Text|<nowiki>'set the flag to declare an $ELSE already in this block</nowiki>|#919191}} | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|4|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'If we executed code in a previous IF or ELSE IF statement, we can't do it here</nowiki>|#919191}} | |||
ExecLevel(ExecCounter) = {{Text|-1|#F580B1}} {{Text|<nowiki>'So we inherit the execlevel from above</nowiki>|#919191}} | |||
{{Cl|ELSE}} | |||
ExecLevel(ExecCounter) = ExecLevel(ExecCounter - {{Text|1|#F580B1}}) {{Text|<nowiki>'If we were processing code before, code after this segment is going to be SKIPPED</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Else"</nowiki>|#FFB100}}) | |||
lhscontrollevel = lhscontrollevel - {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(a3u$, {{Text|5|#F580B1}}) = {{Text|<nowiki>"$ELSE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(a3u$, {{Text|6|#F580B1}})) | |||
{{Cl|IF}} {{Cl|LEFT$}}(temp$, {{Text|3|#F580B1}}) = {{Text|<nowiki>"IF "</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} DefineElse(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE IF without $IF"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE IF cannot follow $ELSE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} {{Cl|RIGHT$}}(temp$, {{Text|5|#F580B1}}) <> {{Text|<nowiki>" THEN"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"$ELSE IF without THEN"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|3|#F580B1}})) {{Text|<nowiki>'strip off the IF and extra spaces</nowiki>|#919191}} | |||
temp$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, {{Cl|LEN}}(temp$) - {{Text|4|#F580B1}})) {{Text|<nowiki>'and strip off the THEN and extra spaces</nowiki>|#919191}} | |||
{{Cl|IF}} DefineElse(ExecCounter) {{Cl|AND (boolean)|AND}} {{Text|4|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'If we executed code in a previous IF or ELSE IF statement, we can't do it here</nowiki>|#919191}} | |||
ExecLevel(ExecCounter) = {{Text|-1|#F580B1}} | |||
{{Cl|ELSE}} | |||
result = {{Text|EvalPreIF|#55FF55}}(temp$, a$) | |||
{{Cl|IF}} a$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} result <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
ExecLevel(ExecCounter) = ExecLevel(ExecCounter - {{Text|1|#F580B1}}) {{Text|<nowiki>'So we inherit the execlevel from above</nowiki>|#919191}} | |||
{{Cl|IF}} ExecLevel(ExecCounter) = {{Text|0|#F580B1}} {{Cl|THEN}} DefineElse(ExecCounter) = DefineElse(ExecCounter) {{Cl|OR}} {{Text|4|#F580B1}} {{Text|<nowiki>'Else if used and conditon found</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
lhscontrollevel = lhscontrollevel - {{Text|1|#F580B1}} | |||
temp = {{Cl|INSTR}}(temp$, {{Text|<nowiki>"="</nowiki>|#FFB100}}) | |||
{{Cl|IF}} temp = {{Text|0|#F580B1}} {{Cl|THEN}} layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$ElseIf "</nowiki>|#FFB100}}) + temp$ + {{Text|SCase$|#55FF55}}({{Text|<nowiki>" Then"</nowiki>|#FFB100}}): {{Cl|GOTO}} finishednonexec {{Text|<nowiki>'no = sign in the $IF statement, so we're going to assume the user is doing something like $IF flag</nowiki>|#919191}} | |||
l$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, temp - {{Text|1|#F580B1}})): r$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, temp + {{Text|1|#F580B1}})) | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$ElseIf "</nowiki>|#FFB100}}) + l$ + {{Text|<nowiki>" = "</nowiki>|#FFB100}} + r$ + {{Text|SCase$|#55FF55}}({{Text|<nowiki>" Then"</nowiki>|#FFB100}}) | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} ExecLevel(ExecCounter) {{Cl|THEN}} {{Text|<nowiki>'don't check for any more metacommands except the one's which worth with the precompiler</nowiki>|#919191}} | |||
layoutdone = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec {{Text|<nowiki>'we don't check for anything inside lines that we've marked for skipping</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(a3u$, {{Text|5|#F580B1}}) = {{Text|<nowiki>"$LET "</nowiki>|#FFB100}} {{Cl|THEN}} | |||
temp$ = a3u$ | |||
temp$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, {{Text|5|#F580B1}})) {{Text|<nowiki>'simply shorten our string to parse</nowiki>|#919191}} | |||
{{Text|<nowiki>'For starters, let's make certain that we have 3 elements to deal with</nowiki>|#919191}} | |||
temp = {{Cl|INSTR}}(temp$, {{Text|<nowiki>"="</nowiki>|#FFB100}}) {{Text|<nowiki>'without an = in there, we can't get a value from the left and right side</nowiki>|#919191}} | |||
l$ = {{Cl|RTRIM$}}({{Cl|LEFT$}}(temp$, temp - {{Text|1|#F580B1}})): r$ = {{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(temp$, temp + {{Text|1|#F580B1}})) | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Let "</nowiki>|#FFB100}}) + l$ + {{Text|<nowiki>" = "</nowiki>|#FFB100}} + r$ | |||
{{Text|<nowiki>'First look to see if we have an existing setting like this and if so, update it</nowiki>|#919191}} | |||
{{Cl|FOR}} i = {{Text|7|#F580B1}} {{Cl|TO}} UserDefineCount {{Text|<nowiki>'UserDefineCount 1-7 are reserved for automatic OS/BIT detection & version</nowiki>|#919191}} | |||
{{Cl|IF}} UserDefine({{Text|0|#F580B1}}, i) = l$ {{Cl|THEN}} UserDefine({{Text|1|#F580B1}}, i) = r$: {{Cl|GOTO}} finishednonexec | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'Otherwise create a new setting and set the initial value for it</nowiki>|#919191}} | |||
UserDefineCount = UserDefineCount + {{Text|1|#F580B1}} | |||
{{Cl|IF}} UserDefineCount > {{Cl|UBOUND}}(UserDefine, {{Text|2|#F580B1}}) {{Cl|THEN}} | |||
{{Cl|REDIM}} {{Cl|_PRESERVE}} UserDefine({{Text|1|#F580B1}}, {{Cl|UBOUND}}(UserDefine, {{Text|2|#F580B1}}) + {{Text|10|#F580B1}}) {{Text|<nowiki>'Add another 10 elements to the array so it'll expand as the user adds to it</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
UserDefine({{Text|0|#F580B1}}, UserDefineCount) = l$ | |||
UserDefine({{Text|1|#F580B1}}, UserDefineCount) = r$ | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$COLOR:0"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Color:0"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} qb64prefix_set {{Cl|THEN}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color0_noprefix.bi"</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color0.bi"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
layoutdone = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$COLOR:32"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Color:32"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} qb64prefix_set {{Cl|THEN}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color32_noprefix.bi"</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
addmetainclude$ = {{Text|getfilepath$|#55FF55}}({{Cl|COMMAND$}}({{Text|0|#F580B1}})) + {{Text|<nowiki>"internal"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"support"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color"</nowiki>|#FFB100}} + pathsep$ + {{Text|<nowiki>"color32.bi"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
layoutdone = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$NOPREFIX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'already set in prepass</nowiki>|#919191}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$NoPrefix"</nowiki>|#FFB100}}) | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$VIRTUALKEYBOARD:ON"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'Deprecated; does nothing.</nowiki>|#919191}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VirtualKeyboard:On"</nowiki>|#FFB100}}) | |||
{{Text|addWarning|#55FF55}} linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), {{Text|<nowiki>"Deprecated feature"</nowiki>|#FFB100}}, {{Text|<nowiki>"$VirtualKeyboard"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$VIRTUALKEYBOARD:OFF"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'Deprecated; does nothing.</nowiki>|#919191}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VirtualKeyboard:Off"</nowiki>|#FFB100}}) | |||
{{Text|addWarning|#55FF55}} linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), {{Text|<nowiki>"Deprecated feature"</nowiki>|#FFB100}}, {{Text|<nowiki>"$VirtualKeyboard"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$DEBUG"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Debug"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} NoIDEMode {{Cl|THEN}} | |||
{{Text|addWarning|#55FF55}} linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), {{Text|<nowiki>"$Debug"</nowiki>|#FFB100}}, {{Text|<nowiki>"$Debug features only work from the IDE"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$CHECKING:OFF"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Checking:Off"</nowiki>|#FFB100}}) | |||
NoChecks = {{Text|1|#F580B1}} | |||
{{Cl|IF}} vWatchOn <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} NoIDEMode = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} inclevel = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|addWarning|#55FF55}} linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), {{Text|<nowiki>"$Debug"</nowiki>|#FFB100}}, {{Text|<nowiki>"$Debug features won't work in $Checking:Off blocks"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$CHECKING:ON"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Checking:On"</nowiki>|#FFB100}}) | |||
NoChecks = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$CONSOLE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Console"</nowiki>|#FFB100}}) | |||
Console = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$CONSOLE:ONLY"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Console:Only"</nowiki>|#FFB100}}) | |||
DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) = DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) {{Cl|OR}} {{Text|1|#F580B1}} | |||
Console = {{Text|1|#F580B1}} | |||
{{Cl|IF}} prepass = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} NoChecks = {{Text|0|#F580B1}} {{Cl|THEN}} {{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"do{"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"sub__dest(func__console());"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"sub__source(func__console());"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} finishedline2 | |||
{{Cl|ELSE}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$ASSERTS"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Asserts"</nowiki>|#FFB100}}) | |||
Asserts = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$ASSERTS:CONSOLE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Asserts:Console"</nowiki>|#FFB100}}) | |||
Asserts = {{Text|1|#F580B1}} | |||
Console = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$SCREENHIDE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$ScreenHide"</nowiki>|#FFB100}}) | |||
ScreenHide = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$SCREENSHOW"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$ScreenShow"</nowiki>|#FFB100}}) | |||
ScreenHide = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$RESIZE:OFF"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Resize:Off"</nowiki>|#FFB100}}) | |||
Resize = {{Text|0|#F580B1}}: Resize_Scale = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$RESIZE:ON"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Resize:On"</nowiki>|#FFB100}}) | |||
Resize = {{Text|1|#F580B1}}: Resize_Scale = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$RESIZE:STRETCH"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Resize:Stretch"</nowiki>|#FFB100}}) | |||
Resize = {{Text|1|#F580B1}}: Resize_Scale = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} a3u$ = {{Text|<nowiki>"$RESIZE:SMOOTH"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$Resize:Smooth"</nowiki>|#FFB100}}) | |||
Resize = {{Text|1|#F580B1}}: Resize_Scale = {{Text|2|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(a3u$, {{Text|12|#F580B1}}) = {{Text|<nowiki>"$VERSIONINFO"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'Embed version info into the final binary (Windows only)</nowiki>|#919191}} | |||
FirstDelimiter = {{Cl|INSTR}}(a3u$, {{Text|<nowiki>":"</nowiki>|#FFB100}}) | |||
SecondDelimiter = {{Cl|INSTR}}(FirstDelimiter + {{Text|1|#F580B1}}, a3u$, {{Text|<nowiki>"="</nowiki>|#FFB100}}) | |||
{{Cl|IF}} FirstDelimiter = {{Text|0|#F580B1}} {{Cl|OR (boolean)|OR}} SecondDelimiter = {{Text|0|#F580B1}} {{Cl|OR (boolean)|OR}} SecondDelimiter = FirstDelimiter + {{Text|1|#F580B1}} {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Expected $VERSIONINFO:key=value"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
VersionInfoKey$ = {{Cl|LTRIM$}}({{Cl|RTRIM$}}({{Cl|MID$ (function)|MID$}}(a3u$, FirstDelimiter + {{Text|1|#F580B1}}, SecondDelimiter - FirstDelimiter - {{Text|1|#F580B1}}))) | |||
VersionInfoValue$ = {{Text|StrReplace$|#55FF55}}({{Cl|LTRIM$}}({{Cl|RTRIM$}}({{Cl|MID$ (function)|MID$}}(a3$, SecondDelimiter + {{Text|1|#F580B1}}))), {{Cl|CHR$}}({{Text|34|#F580B1}}), {{Text|<nowiki>"'"</nowiki>|#FFB100}}) | |||
{{Cl|SELECT CASE}} VersionInfoKey$ | |||
{{Cl|CASE}} {{Text|<nowiki>"FILEVERSION#"</nowiki>|#FFB100}} | |||
{{Cl|GOSUB}} ValidateVersion | |||
viFileVersionNum$ = VersionInfoValue$ | |||
{{Cl|IF}} viFileVersion$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} viFileVersion$ = viFileVersionNum$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:FILEVERSION#="</nowiki>|#FFB100}}) + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"PRODUCTVERSION#"</nowiki>|#FFB100}} | |||
{{Cl|GOSUB}} ValidateVersion | |||
viProductVersionNum$ = VersionInfoValue$ | |||
{{Cl|IF}} viProductVersion$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} viProductVersion$ = viProductVersionNum$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:PRODUCTVERSION#="</nowiki>|#FFB100}}) + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"COMPANYNAME"</nowiki>|#FFB100}} | |||
viCompanyName$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"CompanyName="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"FILEDESCRIPTION"</nowiki>|#FFB100}} | |||
viFileDescription$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"FileDescription="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"FILEVERSION"</nowiki>|#FFB100}} | |||
viFileVersion$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"FileVersion="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"INTERNALNAME"</nowiki>|#FFB100}} | |||
viInternalName$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"InternalName="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"LEGALCOPYRIGHT"</nowiki>|#FFB100}} | |||
viLegalCopyright$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"LegalCopyright="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"LEGALTRADEMARKS"</nowiki>|#FFB100}} | |||
viLegalTrademarks$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"LegalTrademarks="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"ORIGINALFILENAME"</nowiki>|#FFB100}} | |||
viOriginalFilename$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"OriginalFilename="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"PRODUCTNAME"</nowiki>|#FFB100}} | |||
viProductName$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"ProductName="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"PRODUCTVERSION"</nowiki>|#FFB100}} | |||
viProductVersion$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"ProductVersion="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"COMMENTS"</nowiki>|#FFB100}} | |||
viComments$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"Comments="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Text|<nowiki>"WEB"</nowiki>|#FFB100}} | |||
viWeb$ = VersionInfoValue$ | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$VersionInfo:"</nowiki>|#FFB100}}) + {{Text|<nowiki>"Web="</nowiki>|#FFB100}} + VersionInfoValue$ | |||
{{Cl|CASE}} {{Cl|ELSE}} | |||
a$ = {{Text|<nowiki>"Invalid key. (Use FILEVERSION#, PRODUCTVERSION#, CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, LegalTrademarks, OriginalFilename, ProductName, ProductVersion, Comments or Web)"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END SELECT}} | |||
VersionInfoSet = {{Text|-1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
ValidateVersion: | |||
{{Text|<nowiki>'Check if only numbers and commas (4 comma-separated values)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(VersionInfoValue$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected $VERSIONINFO:"</nowiki>|#FFB100}} + VersionInfoKey$ + {{Text|<nowiki>"=#,#,#,# (4 comma-separated numeric values: major, minor, revision and build)"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
viCommas = {{Text|0|#F580B1}} | |||
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(VersionInfoValue$) | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(VersionInfoValue$, i) = {{Text|44|#F580B1}} {{Cl|THEN}} viCommas = viCommas + {{Text|1|#F580B1}} | |||
{{Cl|IF}} {{Cl|INSTR}}({{Text|<nowiki>"0123456789,"</nowiki>|#FFB100}}, {{Cl|MID$ (function)|MID$}}(VersionInfoValue$, i, {{Text|1|#F580B1}})) = {{Text|0|#F580B1}} {{Cl|OR (boolean)|OR}} (i = {{Cl|LEN}}(VersionInfoValue$) {{Cl|AND (boolean)|AND}} viCommas <> {{Text|3|#F580B1}}) {{Cl|OR (boolean)|OR}} {{Cl|RIGHT$}}(VersionInfoValue$, {{Text|1|#F580B1}}) = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Expected $VERSIONINFO:"</nowiki>|#FFB100}} + VersionInfoKey$ + {{Text|<nowiki>"=#,#,#,# (4 comma-separated numeric values: major, minor, revision and build)"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
{{Cl|RETURN}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(a3u$, {{Text|8|#F580B1}}) = {{Text|<nowiki>"$EXEICON"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'Basic syntax check. Multi-platform.</nowiki>|#919191}} | |||
{{Cl|IF}} ExeIconSet {{Cl|THEN}} a$ = {{Text|<nowiki>"$EXEICON already defined"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
FirstDelimiter = {{Cl|INSTR}}(a3u$, {{Text|<nowiki>"'"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} FirstDelimiter = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Expected $EXEICON:'filename'"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|ELSE}} | |||
SecondDelimiter = {{Cl|INSTR}}(FirstDelimiter + {{Text|1|#F580B1}}, a3u$, {{Text|<nowiki>"'"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} SecondDelimiter = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected $EXEICON:'filename'"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
ExeIconFile$ = {{Cl|RTRIM$}}({{Cl|LTRIM$}}({{Cl|MID$ (function)|MID$}}(a3$, FirstDelimiter + {{Text|1|#F580B1}}, SecondDelimiter - FirstDelimiter - {{Text|1|#F580B1}}))) | |||
{{Cl|IF}} {{Cl|LEN}}(ExeIconFile$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected $EXEICON:'filename'"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$ExeIcon:'"</nowiki>|#FFB100}}) + ExeIconFile$ + {{Text|<nowiki>"'"</nowiki>|#FFB100}} + {{Cl|MID$ (function)|MID$}}(a3$, SecondDelimiter + {{Text|1|#F580B1}}) | |||
IconPath$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(ExeIconFile$, {{Text|2|#F580B1}}) = {{Text|<nowiki>"./"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} {{Cl|LEFT$}}(ExeIconFile$, {{Text|2|#F580B1}}) = {{Text|<nowiki>".\"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'Relative to source file's folder</nowiki>|#919191}} | |||
{{Cl|IF}} NoIDEMode {{Cl|THEN}} | |||
IconPath$ = path.source$ | |||
{{Cl|IF}} {{Cl|LEN}}(IconPath$) > {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|RIGHT$}}(IconPath$, {{Text|1|#F580B1}}) <> pathsep$ {{Cl|THEN}} IconPath$ = IconPath$ + pathsep$ | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} {{Cl|LEN}}(ideprogname) {{Cl|THEN}} IconPath$ = idepath$ + pathsep$ | |||
{{Cl|END IF}} | |||
ExeIconFile$ = IconPath$ + {{Cl|MID$ (function)|MID$}}(ExeIconFile$, {{Text|3|#F580B1}}) | |||
{{Cl|ELSEIF}} {{Cl|INSTR}}(ExeIconFile$, {{Text|<nowiki>"/"</nowiki>|#FFB100}}) {{Cl|OR (boolean)|OR}} {{Cl|INSTR}}(ExeIconFile$, {{Text|<nowiki>"\"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
{{Cl|FOR}} i = {{Cl|LEN}}(ExeIconFile$) {{Cl|TO}} {{Text|1|#F580B1}} {{Cl|STEP}} {{Text|-1|#F580B1}} | |||
{{Cl|IF}} {{Cl|MID$ (function)|MID$}}(ExeIconFile$, i, {{Text|1|#F580B1}}) = {{Text|<nowiki>"/"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} {{Cl|MID$ (function)|MID$}}(ExeIconFile$, i, {{Text|1|#F580B1}}) = {{Text|<nowiki>"\"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
IconPath$ = {{Cl|LEFT$}}(ExeIconFile$, i) | |||
ExeIconFileOnly$ = {{Cl|MID$ (function)|MID$}}(ExeIconFile$, i + {{Text|1|#F580B1}}) | |||
{{Cl|IF}} {{Cl|_DIREXISTS}}(IconPath$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"File '"</nowiki>|#FFB100}} + ExeIconFileOnly$ + {{Text|<nowiki>"' not found"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
currentdir$ = {{Cl|_CWD$}} | |||
{{Cl|CHDIR}} IconPath$ | |||
IconPath$ = {{Cl|_CWD$}} | |||
{{Cl|CHDIR}} currentdir$ | |||
ExeIconFile$ = IconPath$ + pathsep$ + ExeIconFileOnly$ | |||
{{Cl|EXIT FOR}} | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(ExeIconFile$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"File '"</nowiki>|#FFB100}} + ExeIconFile$ + {{Text|<nowiki>"' not found"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
ExeIconSet = linenumber | |||
{{Text|SetDependency|#55FF55}} DEPENDENCY_ICON | |||
{{Cl|IF}} NoChecks = {{Text|0|#F580B1}} {{Cl|THEN}} {{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"do{"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"sub__icon(NULL,NULL,0);"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} finishedline2 | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(a3u$, {{Text|10|#F580B1}}) = {{Text|<nowiki>"$UNSTABLE:"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
layout$ = {{Text|SCase|#55FF55}}({{Text|<nowiki>"$Unstable:"</nowiki>|#FFB100}}) | |||
token$ = {{Cl|LTRIM$}}({{Cl|RTRIM$}}({{Cl|MID$ (function)|MID$}}(a3u$, {{Text|11|#F580B1}}))) | |||
{{Cl|SELECT CASE}} token$ | |||
{{Cl|CASE}} {{Text|<nowiki>"MIDI"</nowiki>|#FFB100}} | |||
layout$ = layout$ + {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Midi"</nowiki>|#FFB100}}) | |||
{{Cl|CASE}} {{Text|<nowiki>"HTTP"</nowiki>|#FFB100}} | |||
layout$ = layout$ + {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Http"</nowiki>|#FFB100}}) | |||
{{Cl|END SELECT}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} unstableFlags(UNSTABLE_MIDI) {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(a3u$, {{Text|15|#F580B1}}) = {{Text|<nowiki>"$MIDISOUNDFONT:"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} MidiSoundFontSet {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"$MIDISOUNDFONT already defined"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
layout$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"$MidiSoundFont:"</nowiki>|#FFB100}}) | |||
MidiSoundFont$ = {{Cl|LTRIM$}}({{Cl|RTRIM$}}({{Cl|MID$ (function)|MID$}}(a3$, {{Text|16|#F580B1}}))) | |||
{{Cl|IF}} {{Cl|MID$ (function)|MID$}}(MidiSoundFont$, {{Text|1|#F580B1}}, {{Text|1|#F580B1}}) = {{Cl|CHR$}}({{Text|34|#F580B1}}) {{Cl|THEN}} | |||
{{Text|<nowiki>' We have a quoted filename, verify it is valid</nowiki>|#919191}} | |||
{{Text|<nowiki>' We don't touch the filename in the formatting</nowiki>|#919191}} | |||
layout$ = layout$ + MidiSoundFont$ | |||
{{Text|<nowiki>' Strip the leading quote</nowiki>|#919191}} | |||
MidiSoundFont$ = {{Cl|MID$ (function)|MID$}}(MidiSoundFont$, {{Text|2|#F580B1}}) | |||
{{Text|<nowiki>' Verify that there is a quote character at the end</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|INSTR}}(MidiSoundFont$, {{Cl|CHR$}}({{Text|34|#F580B1}})) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>" character at the end of the file name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>' Verify there are no extra characters after end quote</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|INSTR}}(MidiSoundFont$, {{Cl|CHR$}}({{Text|34|#F580B1}})) <> {{Cl|LEN}}(MidiSoundFont$) {{Cl|THEN}} a$ = {{Text|<nowiki>"Unexpected characters after the quoted file name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
MidiSoundFont$ = {{Cl|MID$ (function)|MID$}}(MidiSoundFont$, {{Text|1|#F580B1}}, {{Cl|LEN}}(MidiSoundFont$) - {{Text|1|#F580B1}}) | |||
{{Cl|IF}} {{Cl|NOT}} {{Cl|_FILEEXISTS}}(MidiSoundFont$) {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"Soundfont file "</nowiki>|#FFB100}} + {{Text|AddQuotes$|#55FF55}}(MidiSoundFont$) + {{Text|<nowiki>" could not be found!"</nowiki>|#FFB100}} | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>' Constant values, only one for now</nowiki>|#919191}} | |||
{{Cl|SELECT CASE}} {{Cl|UCASE$}}(MidiSoundFont$) | |||
{{Cl|CASE}} {{Text|<nowiki>"DEFAULT"</nowiki>|#FFB100}} | |||
layout$ = layout$ + {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Default"</nowiki>|#FFB100}}) | |||
{{Text|<nowiki>' Clear MidiSoundFont$ to indicate the default should be used</nowiki>|#919191}} | |||
MidiSoundFont$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|CASE}} {{Cl|ELSE}} | |||
a$ = {{Text|<nowiki>"Unrecognized Soundfont option "</nowiki>|#FFB100}} + {{Text|AddQuotes$|#55FF55}}(MidiSoundFont$) | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END SELECT}} | |||
{{Cl|END IF}} | |||
MidiSoundFontSet = linenumber | |||
MidiSoundFontLine$ = layout$ | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'QB64 Metacommands</nowiki>|#919191}} | |||
{{Cl|IF}} ExecLevel(ExecCounter) {{Cl|THEN}} | |||
layoutdone = {{Text|0|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec {{Text|<nowiki>'we don't check for anything inside lines that we've marked for skipping</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
linedataoffset = DataOffset | |||
entireline$ = {{Text|lineformat|#55FF55}}(a3$): {{Cl|IF}} {{Cl|LEN}}(entireline$) = {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} finishednonexec | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
u$ = {{Cl|UCASE$}}(entireline$) | |||
newif = {{Text|0|#F580B1}} | |||
{{Text|<nowiki>'Convert "CASE ELSE" to "CASE C-EL" to avoid confusing compiler</nowiki>|#919191}} | |||
{{Text|<nowiki>'note: CASE does not have to begin on a new line</nowiki>|#919191}} | |||
s = {{Text|1|#F580B1}} | |||
i = {{Cl|INSTR}}(s, u$, {{Text|<nowiki>"CASE"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}}) | |||
{{Cl|DO...LOOP|DO WHILE}} i | |||
skip = {{Text|0|#F580B1}} | |||
{{Cl|IF}} i <> {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|MID$ (function)|MID$}}(u$, i - {{Text|1|#F580B1}}, {{Text|1|#F580B1}}) <> sp {{Cl|THEN}} skip = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} i <> {{Cl|LEN}}(u$) - {{Text|8|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|MID$ (function)|MID$}}(u$, i + {{Text|9|#F580B1}}, {{Text|1|#F580B1}}) <> sp {{Cl|THEN}} skip = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} skip = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|MID$}}(entireline$, i) = {{Text|<nowiki>"CASE"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"C-EL"</nowiki>|#FFB100}} | |||
u$ = {{Cl|UCASE$}}(entireline$) | |||
{{Cl|END IF}} | |||
s = i + {{Text|9|#F580B1}} | |||
i = {{Cl|INSTR}}(s, u$, {{Text|<nowiki>"CASE"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}}) | |||
{{Cl|LOOP}} | |||
n = {{Text|numelements|#55FF55}}(entireline$) | |||
{{Text|<nowiki>'line number?</nowiki>|#919191}} | |||
a = {{Cl|ASC (function)|ASC}}(entireline$) | |||
{{Cl|IF}} (a >= {{Text|48|#F580B1}} {{Cl|AND (boolean)|AND}} a <= {{Text|57|#F580B1}}) {{Cl|OR (boolean)|OR}} a = {{Text|46|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'numeric</nowiki>|#919191}} | |||
label$ = {{Text|getelement|#55FF55}}(entireline$, {{Text|1|#F580B1}}) | |||
{{Cl|IF}} {{Text|validlabel|#55FF55}}(label$) {{Cl|THEN}} | |||
{{Cl|IF}} closedmain <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} subfunc = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Labels cannot be placed between SUB/FUNCTIONs"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
v = {{Text|HashFind|#55FF55}}(label$, HASHFLAG_LABEL, ignore, r) | |||
addlabchk100: | |||
{{Cl|IF}} v {{Cl|THEN}} | |||
s = Labels(r).{{Text|Scope|#55FF55}} | |||
{{Cl|IF}} s = subfuncn {{Cl|OR (boolean)|OR}} s = {{Text|-1|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'same scope?</nowiki>|#919191}} | |||
{{Cl|IF}} s = {{Text|-1|#F580B1}} {{Cl|THEN}} Labels(r).{{Text|Scope|#55FF55}} = subfuncn {{Text|<nowiki>'acquire scope</nowiki>|#919191}} | |||
{{Cl|IF}} Labels(r).State = {{Text|1|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Duplicate label ("</nowiki>|#FFB100}} + {{Cl|RTRIM$}}(Labels(r).cn) + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'aquire state 0 types</nowiki>|#919191}} | |||
tlayout$ = {{Cl|RTRIM$}}(Labels(r).cn) | |||
{{Cl|GOTO}} addlabaq100 | |||
{{Cl|END IF}} {{Text|<nowiki>'same scope</nowiki>|#919191}} | |||
{{Cl|IF}} v = {{Text|2|#F580B1}} {{Cl|THEN}} v = {{Text|HashFindCont|#55FF55}}(ignore, r): {{Cl|GOTO}} addlabchk100 | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'does not exist</nowiki>|#919191}} | |||
nLabels = nLabels + {{Text|1|#F580B1}}: {{Cl|IF}} nLabels > Labels_Ubound {{Cl|THEN}} Labels_Ubound = Labels_Ubound * {{Text|2|#F580B1}}: {{Cl|REDIM}} {{Cl|_PRESERVE}} Labels({{Text|1|#F580B1}} {{Cl|TO}} Labels_Ubound) {{Cl|AS}} Label_Type | |||
Labels(nLabels) = Empty_Label | |||
{{Text|HashAdd|#55FF55}} label$, HASHFLAG_LABEL, nLabels | |||
r = nLabels | |||
Labels(r).cn = tlayout$ | |||
Labels(r).{{Text|Scope|#55FF55}} = subfuncn | |||
addlabaq100: | |||
Labels(r).State = {{Text|1|#F580B1}} | |||
Labels(r).Data_Offset = linedataoffset | |||
layout$ = tlayout$ | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"LABEL_"</nowiki>|#FFB100}} + label$ + {{Text|<nowiki>":;"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|INSTR}}(label$, {{Text|<nowiki>"p"</nowiki>|#FFB100}}) {{Cl|THEN}} {{Cl|MID$}}(label$, {{Cl|INSTR}}(label$, {{Text|<nowiki>"p"</nowiki>|#FFB100}}), {{Text|1|#F580B1}}) = {{Text|<nowiki>"."</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|RIGHT$}}(label$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"d"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} {{Cl|RIGHT$}}(label$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"s"</nowiki>|#FFB100}} {{Cl|THEN}} label$ = {{Cl|LEFT$}}(label$, {{Cl|LEN}}(label$) - {{Text|1|#F580B1}}) | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"last_line="</nowiki>|#FFB100}} + label$ + {{Text|<nowiki>";"</nowiki>|#FFB100}} | |||
inclinenump$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} inclinenumber(inclevel) {{Cl|THEN}} | |||
inclinenump$ = {{Text|<nowiki>","</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(inclinenumber(inclevel)) | |||
thisincname$ = {{Text|getfilepath$|#55FF55}}(incname$(inclevel)) | |||
thisincname$ = {{Cl|MID$ (function)|MID$}}(incname$(inclevel), {{Cl|LEN}}(thisincname$) + {{Text|1|#F580B1}}) | |||
inclinenump$ = inclinenump$ + {{Text|<nowiki>","</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + thisincname$ + {{Cl|CHR$}}({{Text|34|#F580B1}}) | |||
{{Cl|END IF}} | |||
{{Cl|IF}} NoChecks = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} vWatchOn {{Cl|AND (boolean)|AND}} inclinenumber(inclevel) = {{Text|0|#F580B1}} {{Cl|THEN}} temp$ = vWatchErrorCall$ {{Cl|ELSE}} temp$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"if(qbevent){"</nowiki>|#FFB100}} + temp$ + {{Text|<nowiki>"evnt("</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(linenumber) + inclinenump$ + {{Text|<nowiki>");r=0;}"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} n = {{Text|1|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} finishednonexec | |||
entireline$ = {{Text|getelements|#55FF55}}(entireline$, {{Text|2|#F580B1}}, n): u$ = {{Cl|UCASE$}}(entireline$): n = n - {{Text|1|#F580B1}} | |||
{{Text|<nowiki>'note: fall through, numeric labels can be followed by alphanumeric label</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'validlabel</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'numeric</nowiki>|#919191}} | |||
{{Text|<nowiki>'it wasn't a line number</nowiki>|#919191}} | |||
{{Text|<nowiki>'label?</nowiki>|#919191}} | |||
{{Text|<nowiki>'note: ignores possibility that this could be a single command SUB/FUNCTION (as in QBASIC?)</nowiki>|#919191}} | |||
{{Cl|IF}} n >= {{Text|2|#F580B1}} {{Cl|THEN}} | |||
x2 = {{Cl|INSTR}}(entireline$, sp + {{Text|<nowiki>":"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} x2 {{Cl|THEN}} | |||
{{Cl|IF}} x2 = {{Cl|LEN}}(entireline$) - {{Text|1|#F580B1}} {{Cl|THEN}} x3 = x2 + {{Text|1|#F580B1}} {{Cl|ELSE}} x3 = x2 + {{Text|2|#F580B1}} | |||
a$ = {{Cl|LEFT$}}(entireline$, x2 - {{Text|1|#F580B1}}) | |||
CreatingLabel = {{Text|1|#F580B1}} | |||
{{Cl|IF}} {{Text|validlabel|#55FF55}}(a$) {{Cl|THEN}} | |||
{{Cl|IF}} {{Text|validname|#55FF55}}(a$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} closedmain <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} subfunc = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Labels cannot be placed between SUB/FUNCTIONs"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
v = {{Text|HashFind|#55FF55}}(a$, HASHFLAG_LABEL, ignore, r) | |||
addlabchk: | |||
{{Cl|IF}} v {{Cl|THEN}} | |||
s = Labels(r).{{Text|Scope|#55FF55}} | |||
{{Cl|IF}} s = subfuncn {{Cl|OR (boolean)|OR}} s = {{Text|-1|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'same scope?</nowiki>|#919191}} | |||
{{Cl|IF}} s = {{Text|-1|#F580B1}} {{Cl|THEN}} Labels(r).{{Text|Scope|#55FF55}} = subfuncn {{Text|<nowiki>'acquire scope</nowiki>|#919191}} | |||
{{Cl|IF}} Labels(r).State = {{Text|1|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Duplicate label ("</nowiki>|#FFB100}} + {{Cl|RTRIM$}}(Labels(r).cn) + {{Text|<nowiki>")"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'aquire state 0 types</nowiki>|#919191}} | |||
tlayout$ = {{Cl|RTRIM$}}(Labels(r).cn) | |||
{{Cl|GOTO}} addlabaq | |||
{{Cl|END IF}} {{Text|<nowiki>'same scope</nowiki>|#919191}} | |||
{{Cl|IF}} v = {{Text|2|#F580B1}} {{Cl|THEN}} v = {{Text|HashFindCont|#55FF55}}(ignore, r): {{Cl|GOTO}} addlabchk | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'does not exist</nowiki>|#919191}} | |||
nLabels = nLabels + {{Text|1|#F580B1}}: {{Cl|IF}} nLabels > Labels_Ubound {{Cl|THEN}} Labels_Ubound = Labels_Ubound * {{Text|2|#F580B1}}: {{Cl|REDIM}} {{Cl|_PRESERVE}} Labels({{Text|1|#F580B1}} {{Cl|TO}} Labels_Ubound) {{Cl|AS}} Label_Type | |||
Labels(nLabels) = Empty_Label | |||
{{Text|HashAdd|#55FF55}} a$, HASHFLAG_LABEL, nLabels | |||
r = nLabels | |||
Labels(r).cn = tlayout$ | |||
Labels(r).{{Text|Scope|#55FF55}} = subfuncn | |||
addlabaq: | |||
Labels(r).State = {{Text|1|#F580B1}} | |||
Labels(r).Data_Offset = linedataoffset | |||
Labels(r).SourceLineNumber = linenumber | |||
{{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + tlayout$ + {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|ELSE}} layout$ = tlayout$ + {{Text|<nowiki>":"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"LABEL_"</nowiki>|#FFB100}} + a$ + {{Text|<nowiki>":;"</nowiki>|#FFB100}} | |||
inclinenump$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} inclinenumber(inclevel) {{Cl|THEN}} | |||
inclinenump$ = {{Text|<nowiki>","</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(inclinenumber(inclevel)) | |||
thisincname$ = {{Text|getfilepath$|#55FF55}}(incname$(inclevel)) | |||
thisincname$ = {{Cl|MID$ (function)|MID$}}(incname$(inclevel), {{Cl|LEN}}(thisincname$) + {{Text|1|#F580B1}}) | |||
inclinenump$ = inclinenump$ + {{Text|<nowiki>","</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + thisincname$ + {{Cl|CHR$}}({{Text|34|#F580B1}}) | |||
{{Cl|END IF}} | |||
{{Cl|IF}} NoChecks = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} vWatchOn {{Cl|AND (boolean)|AND}} inclinenumber(inclevel) = {{Text|0|#F580B1}} {{Cl|THEN}} temp$ = vWatchErrorCall$ {{Cl|ELSE}} temp$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} MainTxtBuf, {{Text|<nowiki>"if(qbevent){"</nowiki>|#FFB100}} + temp$ + {{Text|<nowiki>"evnt("</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(linenumber) + inclinenump$ + {{Text|<nowiki>");r=0;}"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
entireline$ = {{Cl|RIGHT$}}(entireline$, {{Cl|LEN}}(entireline$) - x3): u$ = {{Cl|UCASE$}}(entireline$) | |||
n = {{Text|numelements|#55FF55}}(entireline$): {{Cl|IF}} n = {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} {{Text|<nowiki>'valid</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'includes sp+":"</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'n>=2</nowiki>|#919191}} | |||
{{Text|<nowiki>'remove leading ":"</nowiki>|#919191}} | |||
{{Cl|DO...LOOP|DO WHILE}} {{Cl|ASC (function)|ASC}}(u$) = {{Text|58|#F580B1}} {{Text|<nowiki>'":"</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp2 + {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|ELSE}} layout$ = {{Text|<nowiki>":"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(u$) = {{Text|1|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} finishednonexec | |||
entireline$ = {{Text|getelements|#55FF55}}(entireline$, {{Text|2|#F580B1}}, n): u$ = {{Cl|UCASE$}}(entireline$): n = n - {{Text|1|#F580B1}} | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'ELSE at the beginning of a line</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(u$) = {{Text|69|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'"E"</nowiki>|#919191}} | |||
e1$ = {{Text|getelement|#55FF55}}(u$, {{Text|1|#F580B1}}) | |||
{{Cl|IF}} e1$ = {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
a$ = {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}} | |||
{{Cl|IF}} n > {{Text|1|#F580B1}} {{Cl|THEN}} continuelinefrom = {{Text|2|#F580B1}} | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} | |||
{{Cl|IF}} e1$ = {{Text|<nowiki>"ELSEIF"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} n < {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ... THEN"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} {{Text|getelement|#55FF55}}(u$, n) = {{Text|<nowiki>"THEN"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = entireline$: {{Cl|GOTO}} gotcommand | |||
{{Cl|FOR}} i = {{Text|3|#F580B1}} {{Cl|TO}} n - {{Text|1|#F580B1}} | |||
{{Cl|IF}} {{Text|getelement|#55FF55}}(u$, i) = {{Text|<nowiki>"THEN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
a$ = {{Text|getelements|#55FF55}}(entireline$, {{Text|1|#F580B1}}, i) | |||
continuelinefrom = i + {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
a$ = {{Text|<nowiki>"Expected THEN"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'"E"</nowiki>|#919191}} | |||
start = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} skipcontinit | |||
contline: | |||
n = {{Text|numelements|#55FF55}}(entireline$) | |||
u$ = {{Cl|UCASE$}}(entireline$) | |||
skipcontinit: | |||
{{Text|<nowiki>'jargon:</nowiki>|#919191}} | |||
{{Text|<nowiki>'lineelseused - counts how many line ELSEs can POSSIBLY follow</nowiki>|#919191}} | |||
{{Text|<nowiki>'endifs - how many C++ endifs "}" need to be added at the end of the line</nowiki>|#919191}} | |||
{{Text|<nowiki>'lineelseused - counts the number of indwelling ELSE statements on a line</nowiki>|#919191}} | |||
{{Text|<nowiki>'impliedendif - stops autoformat from adding "END IF"</nowiki>|#919191}} | |||
a$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|FOR}} i = start {{Cl|TO}} n | |||
e$ = {{Text|getelement|#55FF55}}(u$, i) | |||
{{Cl|IF}} e$ = {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} i = start {{Cl|THEN}} | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp2 + {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|ELSE}} layout$ = {{Text|<nowiki>":"</nowiki>|#FFB100}} | |||
{{Cl|IF}} i <> n {{Cl|THEN}} continuelinefrom = i + {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|IF}} i <> n {{Cl|THEN}} continuelinefrom = i | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'begin scanning an 'IF' statement</nowiki>|#919191}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"IF"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} a$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} newif = {{Text|1|#F580B1}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"THEN"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} (e$ = {{Text|<nowiki>"GOTO"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} newif = {{Text|1|#F580B1}}) {{Cl|THEN}} | |||
{{Cl|IF}} newif = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"THEN without IF"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
newif = {{Text|0|#F580B1}} | |||
{{Cl|IF}} lineelseused > {{Text|0|#F580B1}} {{Cl|THEN}} lineelseused = lineelseused - {{Text|1|#F580B1}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"GOTO"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} i = n {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected IF expression GOTO label"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
i = i - {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
a$ = a$ + sp + e$ {{Text|<nowiki>'+"THEN"/"GOTO"</nowiki>|#919191}} | |||
{{Cl|IF}} i <> n {{Cl|THEN}} continuelinefrom = i + {{Text|1|#F580B1}}: endifs = endifs + {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} | |||
{{Cl|IF}} e$ = {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} start = i {{Cl|THEN}} | |||
{{Cl|IF}} lineelseused >= {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'note: more than one else used (in a row) on this line, so close first if with an 'END IF' first</nowiki>|#919191}} | |||
{{Text|<nowiki>'note: parses 'END IF' then (after continuelinefrom) parses 'ELSE'</nowiki>|#919191}} | |||
{{Text|<nowiki>'consider the following: (square brackets make reading easier)</nowiki>|#919191}} | |||
{{Text|<nowiki>'eg. if a=1 then [if b=2 then c=2 else d=2] else e=3</nowiki>|#919191}} | |||
impliedendif = {{Text|1|#F580B1}}: a$ = {{Text|<nowiki>"END"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"IF"</nowiki>|#FFB100}} | |||
endifs = endifs - {{Text|1|#F580B1}} | |||
continuelinefrom = i | |||
lineelseused = lineelseused - {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'follow up previously encountered 'ELSE' by applying 'ELSE'</nowiki>|#919191}} | |||
a$ = {{Text|<nowiki>"ELSE"</nowiki>|#FFB100}}: continuelinefrom = i + {{Text|1|#F580B1}} | |||
lineelseused = lineelseused + {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} {{Text|<nowiki>'start=i</nowiki>|#919191}} | |||
{{Text|<nowiki>'apply everything up to (but not including) 'ELSE'</nowiki>|#919191}} | |||
continuelinefrom = i | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} {{Text|<nowiki>'"ELSE"</nowiki>|#919191}} | |||
e$ = {{Text|getelement|#55FF55}}(entireline$, i): {{Cl|IF}} a$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = e$ {{Cl|ELSE}} a$ = a$ + sp + e$ | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'we're reached the end of the line</nowiki>|#919191}} | |||
{{Cl|IF}} endifs > {{Text|0|#F580B1}} {{Cl|THEN}} | |||
endifs = endifs - {{Text|1|#F580B1}} | |||
impliedendif = {{Text|1|#F580B1}}: entireline$ = entireline$ + sp + {{Text|<nowiki>":"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"END"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"IF"</nowiki>|#FFB100}}: n = n + {{Text|3|#F580B1}} | |||
i = i + {{Text|1|#F580B1}} {{Text|<nowiki>'skip the ":" (i is now equal to n+2)</nowiki>|#919191}} | |||
continuelinefrom = i | |||
{{Cl|GOTO}} gotcommand | |||
{{Cl|END IF}} | |||
gotcommand: | |||
dynscope = {{Text|0|#F580B1}} | |||
ca$ = a$ | |||
a$ = {{Text|eleucase$|#55FF55}}(ca$) {{Text|<nowiki>'***REVISE THIS SECTION LATER***</nowiki>|#919191}} | |||
layoutdone = {{Text|0|#F580B1}} | |||
linefragment = a$ | |||
{{Cl|IF}} Debug {{Cl|THEN}} {{Cl|PRINT (file statement)|PRINT}} #9, a$ | |||
n = {{Text|numelements|#55FF55}}(a$) | |||
{{Cl|IF}} n = {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|GOTO}} finishednonexec | |||
{{Text|<nowiki>'convert non-UDT dimensioned periods to _046_</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|INSTR}}(ca$, sp + {{Text|<nowiki>"."</nowiki>|#FFB100}} + sp) {{Cl|THEN}} | |||
a3$ = {{Text|getelement|#55FF55}}(ca$, {{Text|1|#F580B1}}) | |||
except = {{Text|0|#F580B1}} | |||
aa$ = a3$ + sp {{Text|<nowiki>'rebuilt a$ (always has a trailing spacer)</nowiki>|#919191}} | |||
lastfuse = {{Text|-1|#F580B1}} | |||
{{Cl|FOR}} x = {{Text|2|#F580B1}} {{Cl|TO}} n | |||
a2$ = {{Text|getelement|#55FF55}}(ca$, x) | |||
{{Cl|IF}} except = {{Text|1|#F580B1}} {{Cl|THEN}} except = {{Text|2|#F580B1}}: {{Cl|GOTO}} udtperiod {{Text|<nowiki>'skip element name</nowiki>|#919191}} | |||
{{Cl|IF}} a2$ = {{Text|<nowiki>"."</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} x <> n {{Cl|THEN}} | |||
{{Cl|IF}} except = {{Text|2|#F580B1}} {{Cl|THEN}} except = {{Text|1|#F580B1}}: {{Cl|GOTO}} udtperiod {{Text|<nowiki>'sub-element of UDT</nowiki>|#919191}} | |||
{{Cl|IF}} a3$ = {{Text|<nowiki>")"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'assume it was something like typevar(???).x and treat as a UDT</nowiki>|#919191}} | |||
except = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} udtperiod | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'find an ID of that type</nowiki>|#919191}} | |||
try = {{Text|findid|#55FF55}}({{Cl|UCASE$}}(a3$)) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|DO...LOOP|DO WHILE}} try | |||
{{Cl|IF}} ((id.t {{Cl|AND (boolean)|AND}} ISUDT) <> {{Text|0|#F580B1}}) {{Cl|OR (boolean)|OR}} ((id.arraytype {{Cl|AND (boolean)|AND}} ISUDT) <> {{Text|0|#F580B1}}) {{Cl|THEN}} | |||
except = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} udtperiod | |||
{{Cl|END IF}} | |||
{{Cl|IF}} try = {{Text|2|#F580B1}} {{Cl|THEN}} findanotherid = {{Text|1|#F580B1}}: try = {{Text|findid|#55FF55}}({{Cl|UCASE$}}(a3$)) {{Cl|ELSE}} try = {{Text|0|#F580B1}} | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|LOOP}} | |||
{{Text|<nowiki>'not a udt; fuse lhs & rhs with _046_</nowiki>|#919191}} | |||
{{Cl|IF}} isalpha({{Cl|ASC (function)|ASC}}(a3$)) = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} lastfuse <> x - {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Invalid '.'"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
aa$ = {{Cl|LEFT$}}(aa$, {{Cl|LEN}}(aa$) - {{Text|1|#F580B1}}) + fix046$ | |||
lastfuse = x | |||
{{Cl|GOTO}} periodfused | |||
{{Cl|END IF}} {{Text|<nowiki>'"."</nowiki>|#919191}} | |||
except = {{Text|0|#F580B1}} | |||
udtperiod: | |||
aa$ = aa$ + a2$ + sp | |||
periodfused: | |||
a3$ = a2$ | |||
{{Cl|NEXT}} | |||
a$ = {{Cl|LEFT$}}(aa$, {{Cl|LEN}}(aa$) - {{Text|1|#F580B1}}) | |||
ca$ = a$ | |||
a$ = {{Text|eleucase$|#55FF55}}(ca$) | |||
n = {{Text|numelements|#55FF55}}(a$) | |||
{{Cl|END IF}} | |||
arrayprocessinghappened = {{Text|0|#F580B1}} | |||
firstelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|1|#F580B1}}) | |||
secondelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|2|#F580B1}}) | |||
thirdelement$ = {{Text|getelement|#55FF55}}(a$, {{Text|3|#F580B1}}) | |||
{{Text|<nowiki>'non-executable section</nowiki>|#919191}} | |||
{{Cl|IF}} n = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"'"</nowiki>|#FFB100}} {{Cl|THEN}} layoutdone = {{Text|1|#F580B1}}: {{Cl|GOTO}} finishednonexec {{Text|<nowiki>'nop</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} n <= {{Text|2|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DATA"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Data"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} n = {{Text|2|#F580B1}} {{Cl|THEN}} | |||
e$ = {{Cl|SPACE$}}(({{Cl|LEN}}(secondelement$) - {{Text|1|#F580B1}}) \ {{Text|2|#F580B1}}) | |||
{{Cl|FOR}} x = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(e$) | |||
v1 = {{Cl|ASC (function)|ASC}}(secondelement$, x * {{Text|2|#F580B1}}) | |||
v2 = {{Cl|ASC (function)|ASC}}(secondelement$, x * {{Text|2|#F580B1}} + {{Text|1|#F580B1}}) | |||
{{Cl|IF}} v1 < {{Text|65|#F580B1}} {{Cl|THEN}} v1 = v1 - {{Text|48|#F580B1}} {{Cl|ELSE}} v1 = v1 - {{Text|55|#F580B1}} | |||
{{Cl|IF}} v2 < {{Text|65|#F580B1}} {{Cl|THEN}} v2 = v2 - {{Text|48|#F580B1}} {{Cl|ELSE}} v2 = v2 - {{Text|55|#F580B1}} | |||
{{Cl|ASC}}(e$, x) = v1 + v2 * {{Text|16|#F580B1}} | |||
{{Cl|NEXT}} | |||
l$ = l$ + sp + e$ | |||
{{Cl|END IF}} {{Text|<nowiki>'n=2</nowiki>|#919191}} | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + l$ {{Cl|ELSE}} layout$ = l$ | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'declare library</nowiki>|#919191}} | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"END"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} n <> {{Text|2|#F580B1}} {{Cl|OR (boolean)|OR}} secondelement$ <> {{Text|<nowiki>"DECLARE"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected END DECLARE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
declaringlibrary = {{Text|0|#F580B1}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"End"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Declare"</nowiki>|#FFB100}}) | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + l$ {{Cl|ELSE}} layout$ = l$ | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} {{Text|<nowiki>'end declare</nowiki>|#919191}} | |||
declaringlibrary = {{Text|2|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"SUB"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} firstelement$ = {{Text|<nowiki>"FUNCTION"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|GOTO}} declaresubfunc2 | |||
{{Cl|END IF}} | |||
a$ = {{Text|<nowiki>"Expected SUB/FUNCTION definition or END DECLARE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} {{Text|<nowiki>'declaringlibrary</nowiki>|#919191}} | |||
{{Text|<nowiki>'check TYPE declarations (created on prepass)</nowiki>|#919191}} | |||
{{Cl|IF}} definingtype {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"END"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} n <> {{Text|2|#F580B1}} {{Cl|OR (boolean)|OR}} secondelement$ <> {{Text|<nowiki>"TYPE"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected END TYPE"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
definingtype = {{Text|0|#F580B1}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"End"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Type"</nowiki>|#FFB100}}) | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + l$ {{Cl|ELSE}} layout$ = l$ | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'IF n < 3 THEN definingtypeerror = linenumber: a$ = "Expected element-name AS type or AS type element-list": GOTO errmes</nowiki>|#919191}} | |||
{{Cl|IF}} n < {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected element-name AS type or AS type element-list"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
definingtype = {{Text|2|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"AS"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"As"</nowiki>|#FFB100}}) | |||
t$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
wordsInTypeName = {{Text|0|#F580B1}} | |||
{{Cl|DO}} | |||
nextElement$ = {{Text|getelement$|#55FF55}}(a$, {{Text|2|#F580B1}} + wordsInTypeName) | |||
{{Cl|IF}} nextElement$ = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'element-list</nowiki>|#919191}} | |||
wordsInTypeName = wordsInTypeName - {{Text|2|#F580B1}} | |||
{{Cl|EXIT DO}} | |||
{{Cl|END IF}} | |||
wordsInTypeName = wordsInTypeName + {{Text|1|#F580B1}} | |||
{{Cl|IF}} wordsInTypeName = n - {{Text|2|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'single element in line</nowiki>|#919191}} | |||
wordsInTypeName = wordsInTypeName - {{Text|1|#F580B1}} | |||
{{Cl|EXIT DO}} | |||
{{Cl|END IF}} | |||
{{Cl|LOOP}} | |||
t$ = {{Text|getelements$|#55FF55}}(a$, {{Text|2|#F580B1}}, {{Text|2|#F580B1}} + wordsInTypeName) | |||
typ = {{Text|typname2typ|#55FF55}}(t$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typ = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Undefined type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typ {{Cl|AND (boolean)|AND}} ISUDT {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|UCASE$}}({{Cl|RTRIM$}}(t$)) = {{Text|<nowiki>"MEM"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} {{Cl|RTRIM$}}(udtxcname(typ {{Cl|AND (boolean)|AND}} {{Text|511|#F580B1}})) = {{Text|<nowiki>"_MEM"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} qb64prefix_set = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
t$ = {{Cl|MID$ (function)|MID$}}({{Cl|RTRIM$}}(udtxcname(typ {{Cl|AND}} {{Text|511|#F580B1}})), {{Text|2|#F580B1}}) | |||
{{Cl|ELSE}} | |||
t$ = {{Cl|RTRIM$}}(udtxcname(typ {{Cl|AND}} {{Text|511|#F580B1}})) | |||
{{Cl|END IF}} | |||
l$ = l$ + sp + t$ | |||
{{Cl|ELSE}} | |||
l$ = l$ + sp + {{Text|SCase2$|#55FF55}}(t$) | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'Now add each variable:</nowiki>|#919191}} | |||
{{Cl|FOR}} i = {{Text|3|#F580B1}} + wordsInTypeName {{Cl|TO}} n | |||
thisElement$ = {{Text|getelement$|#55FF55}}(ca$, i) | |||
{{Cl|IF}} thisElement$ = {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} | |||
l$ = l$ + thisElement$ | |||
{{Cl|ELSE}} | |||
l$ = l$ + sp + thisElement$ | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + l$ {{Cl|ELSE}} layout$ = l$ | |||
{{Cl|ELSE}} | |||
l$ = {{Text|getelement|#55FF55}}(ca$, {{Text|1|#F580B1}}) + sp + {{Text|SCase$|#55FF55}}({{Text|<nowiki>"As"</nowiki>|#FFB100}}) | |||
t$ = {{Text|getelements$|#55FF55}}(a$, {{Text|3|#F580B1}}, n) | |||
typ = {{Text|typname2typ|#55FF55}}(t$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typ = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Undefined type"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} typ {{Cl|AND (boolean)|AND}} ISUDT {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|UCASE$}}({{Cl|RTRIM$}}(t$)) = {{Text|<nowiki>"MEM"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} {{Cl|RTRIM$}}(udtxcname(typ {{Cl|AND (boolean)|AND}} {{Text|511|#F580B1}})) = {{Text|<nowiki>"_MEM"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} qb64prefix_set = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
t$ = {{Cl|MID$ (function)|MID$}}({{Cl|RTRIM$}}(udtxcname(typ {{Cl|AND}} {{Text|511|#F580B1}})), {{Text|2|#F580B1}}) | |||
{{Cl|ELSE}} | |||
t$ = {{Cl|RTRIM$}}(udtxcname(typ {{Cl|AND}} {{Text|511|#F580B1}})) | |||
{{Cl|END IF}} | |||
l$ = l$ + sp + t$ | |||
{{Cl|ELSE}} | |||
l$ = l$ + sp + {{Text|SCase2$|#55FF55}}(t$) | |||
{{Cl|END IF}} | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + l$ {{Cl|ELSE}} layout$ = l$ | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} {{Text|<nowiki>'defining type</nowiki>|#919191}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"TYPE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} n <> {{Text|2|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected TYPE type-name"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Type"</nowiki>|#FFB100}}) + sp + {{Text|getelement|#55FF55}}(ca$, {{Text|2|#F580B1}}) | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + l$ {{Cl|ELSE}} layout$ = l$ | |||
definingtype = {{Text|1|#F580B1}} | |||
definingtypeerror = linenumber | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'skip DECLARE SUB/FUNCTION</nowiki>|#919191}} | |||
{{Cl|IF}} n >= {{Text|1|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"DECLARE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} secondelement$ = {{Text|<nowiki>"LIBRARY"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"DYNAMIC"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"CUSTOMTYPE"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} secondelement$ = {{Text|<nowiki>"STATIC"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
declaringlibrary = {{Text|1|#F580B1}} | |||
dynamiclibrary = {{Text|0|#F580B1}} | |||
customtypelibrary = {{Text|0|#F580B1}} | |||
indirectlibrary = {{Text|0|#F580B1}} | |||
staticlinkedlibrary = {{Text|0|#F580B1}} | |||
x = {{Text|3|#F580B1}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Declare"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Library"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} secondelement$ = {{Text|<nowiki>"DYNAMIC"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
e$ = {{Text|getelement$|#55FF55}}(a$, {{Text|3|#F580B1}}): {{Cl|IF}} e$ <> {{Text|<nowiki>"LIBRARY"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected DYNAMIC LIBRARY "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"..."</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
dynamiclibrary = {{Text|1|#F580B1}} | |||
x = {{Text|4|#F580B1}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Declare"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Dynamic"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Library"</nowiki>|#FFB100}}) | |||
{{Cl|IF}} n = {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected DECLARE DYNAMIC LIBRARY "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"..."</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
indirectlibrary = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} secondelement$ = {{Text|<nowiki>"CUSTOMTYPE"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
e$ = {{Text|getelement$|#55FF55}}(a$, {{Text|3|#F580B1}}): {{Cl|IF}} e$ <> {{Text|<nowiki>"LIBRARY"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected CUSTOMTYPE LIBRARY"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
customtypelibrary = {{Text|1|#F580B1}} | |||
x = {{Text|4|#F580B1}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Declare"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"CustomType"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Library"</nowiki>|#FFB100}}) | |||
indirectlibrary = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} secondelement$ = {{Text|<nowiki>"STATIC"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
e$ = {{Text|getelement$|#55FF55}}(a$, {{Text|3|#F580B1}}): {{Cl|IF}} e$ <> {{Text|<nowiki>"LIBRARY"</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected STATIC LIBRARY"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
x = {{Text|4|#F580B1}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Declare"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Static"</nowiki>|#FFB100}} + sp + {{Text|<nowiki>"Library"</nowiki>|#FFB100}}) | |||
staticlinkedlibrary = {{Text|1|#F580B1}} | |||
{{Cl|END IF}} | |||
sfdeclare = {{Text|0|#F580B1}}: sfheader = {{Text|0|#F580B1}} | |||
{{Cl|IF}} n >= x {{Cl|THEN}} | |||
sfdeclare = {{Text|1|#F580B1}} | |||
addlibrary: | |||
libname$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
headername$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Text|<nowiki>'assume library name in double quotes follows</nowiki>|#919191}} | |||
{{Text|<nowiki>'assume library is in main qb64pe folder</nowiki>|#919191}} | |||
x$ = {{Text|getelement$|#55FF55}}(ca$, x) | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(x$) <> {{Text|34|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected LIBRARY "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"..."</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
x$ = {{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - {{Text|1|#F580B1}}) | |||
z = {{Cl|INSTR}}(x$, {{Cl|CHR$}}({{Text|34|#F580B1}})) | |||
{{Cl|IF}} z = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected LIBRARY "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"..."</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
x$ = {{Cl|LEFT$}}(x$, z - {{Text|1|#F580B1}}) | |||
{{Cl|IF}} dynamiclibrary <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|LEN}}(x$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected DECLARE DYNAMIC LIBRARY "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"..."</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
{{Cl|IF}} customtypelibrary <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|LEN}}(x$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected DECLARE CUSTOMTYPE LIBRARY "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"..."</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'convert '\\' to '\'</nowiki>|#919191}} | |||
{{Cl|WHILE}} {{Cl|INSTR}}(x$, {{Text|<nowiki>"\\"</nowiki>|#FFB100}}) | |||
z = {{Cl|INSTR}}(x$, {{Text|<nowiki>"\\"</nowiki>|#FFB100}}) | |||
x$ = {{Cl|LEFT$}}(x$, z - {{Text|1|#F580B1}}) + {{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - z) | |||
{{Cl|WEND}} | |||
autoformat_x$ = x$ {{Text|<nowiki>'used for autolayout purposes</nowiki>|#919191}} | |||
{{Text|<nowiki>'Remove version number from library name</nowiki>|#919191}} | |||
{{Text|<nowiki>'Eg. libname:1.0 becomes libname <-> 1.0 which later becomes libname.so.1.0</nowiki>|#919191}} | |||
v$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
striplibver: | |||
{{Cl|FOR}} z = {{Cl|LEN}}(x$) {{Cl|TO}} {{Text|1|#F580B1}} {{Cl|STEP}} {{Text|-1|#F580B1}} | |||
a = {{Cl|ASC (function)|ASC}}(x$, z) | |||
{{Cl|IF}} a = ASC_BACKSLASH {{Cl|OR (boolean)|OR}} a = ASC_FORWARDSLASH {{Cl|THEN}} {{Cl|EXIT FOR}} | |||
{{Cl|IF}} a = ASC_FULLSTOP {{Cl|OR (boolean)|OR}} a = ASC_COLON {{Cl|THEN}} | |||
{{Cl|IF}} {{Text|isuinteger|#55FF55}}({{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - z)) {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEN}}(v$) {{Cl|THEN}} v$ = {{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - z) + {{Text|<nowiki>"."</nowiki>|#FFB100}} + v$ {{Cl|ELSE}} v$ = {{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - z) | |||
x$ = {{Cl|LEFT$}}(x$, z - {{Text|1|#F580B1}}) | |||
{{Cl|IF}} a = ASC_COLON {{Cl|THEN}} {{Cl|EXIT FOR}} | |||
{{Cl|GOTO}} striplibver | |||
{{Cl|ELSE}} | |||
{{Cl|EXIT FOR}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
libver$ = v$ | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'convert forward-slashes to back-slashes</nowiki>|#919191}} | |||
{{Cl|DO...LOOP|DO WHILE}} {{Cl|INSTR}}(x$, {{Text|<nowiki>"/"</nowiki>|#FFB100}}) | |||
z = {{Cl|INSTR}}(x$, {{Text|<nowiki>"/"</nowiki>|#FFB100}}) | |||
x$ = {{Cl|LEFT$}}(x$, z - {{Text|1|#F580B1}}) + {{Text|<nowiki>"\"</nowiki>|#FFB100}} + {{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - z) | |||
{{Cl|LOOP}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'convert any back-slashes to forward-slashes</nowiki>|#919191}} | |||
{{Cl|DO...LOOP|DO WHILE}} {{Cl|INSTR}}(x$, {{Text|<nowiki>"\"</nowiki>|#FFB100}}) | |||
z = {{Cl|INSTR}}(x$, {{Text|<nowiki>"\"</nowiki>|#FFB100}}) | |||
x$ = {{Cl|LEFT$}}(x$, z - {{Text|1|#F580B1}}) + {{Text|<nowiki>"/"</nowiki>|#FFB100}} + {{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - z) | |||
{{Cl|LOOP}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'Separate path from name</nowiki>|#919191}} | |||
libpath$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|FOR}} z = {{Cl|LEN}}(x$) {{Cl|TO}} {{Text|1|#F580B1}} {{Cl|STEP}} {{Text|-1|#F580B1}} | |||
a = {{Cl|ASC (function)|ASC}}(x$, z) | |||
{{Cl|IF}} a = {{Text|47|#F580B1}} {{Cl|OR (boolean)|OR}} a = {{Text|92|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'\ or /</nowiki>|#919191}} | |||
libpath$ = {{Cl|LEFT$}}(x$, z) | |||
x$ = {{Cl|RIGHT$}}(x$, {{Cl|LEN}}(x$) - z) | |||
{{Cl|EXIT FOR}} | |||
{{Cl|END IF}} | |||
{{Cl|NEXT}} | |||
{{Text|<nowiki>'Accept ./ and .\ as a reference to the source file</nowiki>|#919191}} | |||
{{Text|<nowiki>'folder, replacing it with the actual full path, if available</nowiki>|#919191}} | |||
{{Cl|IF}} libpath$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} libpath$ = {{Text|<nowiki>".\"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
libpath$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|IF}} NoIDEMode {{Cl|THEN}} | |||
libpath$ = path.source$ | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) > {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|RIGHT$}}(libpath$, {{Text|1|#F580B1}}) <> pathsep$ {{Cl|THEN}} libpath$ = libpath$ + pathsep$ | |||
{{Cl|ELSE}} | |||
{{Cl|IF}} {{Cl|LEN}}(ideprogname) {{Cl|THEN}} libpath$ = idepath$ + pathsep$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'Create a path which can be used for inline code (uses \\ instead of \)</nowiki>|#919191}} | |||
libpath_inline$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
{{Cl|FOR}} z = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(libpath$) | |||
a = {{Cl|ASC (function)|ASC}}(libpath$, z) | |||
libpath_inline$ = libpath_inline$ + {{Cl|CHR$}}(a) | |||
{{Cl|IF}} a = {{Text|92|#F580B1}} {{Cl|THEN}} libpath_inline$ = libpath_inline$ + {{Text|<nowiki>"\"</nowiki>|#FFB100}} | |||
{{Cl|NEXT}} | |||
{{Cl|IF}} {{Cl|LEN}}(x$) {{Cl|THEN}} | |||
{{Cl|IF}} dynamiclibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'Static library</nowiki>|#919191}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'check for .lib</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".lib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + x$ + {{Text|<nowiki>".lib"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + x$ + {{Text|<nowiki>".lib"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .o</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .lib</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".lib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = x$ + {{Text|<nowiki>".lib"</nowiki>|#FFB100}} | |||
inlinelibname$ = x$ + {{Text|<nowiki>".lib"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .o</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
inlinelibname$ = x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'Windows</nowiki>|#919191}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} staticlinkedlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath "</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath "</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath "</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath "</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .o (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} staticlinkedlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'check for .so (usr/lib64)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib64/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib64/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a (usr/lib64)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} staticlinkedlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEN}}(libpath$) {{Cl|THEN}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} {{Cl|ELSE}} mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'--------------------------(without path)------------------------------</nowiki>|#919191}} | |||
{{Cl|IF}} staticlinkedlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath ./ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .o (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".o"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} staticlinkedlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'check for .so (usr/lib64)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib64/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib64/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a (usr/lib64)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} staticlinkedlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .a (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".a"</nowiki>|#FFB100}} | |||
mylibopt$ = mylibopt$ + {{Text|<nowiki>" -Wl,-rpath /usr/lib/ "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'Linux</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for header</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(headername$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = libpath_inline$ + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = libpath_inline$ + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'--------------------------(without path)------------------------------</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'Windows</nowiki>|#919191}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = libpath_inline$ + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = libpath_inline$ + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + libpath$ + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = {{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + libpath_inline$ + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + libpath$ + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = {{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + libpath_inline$ + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'--------------------------(without path)------------------------------</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = {{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".h"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
headername$ = {{Text|<nowiki>"/usr/include/"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".hpp"</nowiki>|#FFB100}} | |||
{{Cl|IF}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|THEN}} sfdeclare = {{Text|0|#F580B1}} | |||
sfheader = {{Text|1|#F580B1}} | |||
{{Cl|GOTO}} GotHeader | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'Linux</nowiki>|#919191}} | |||
GotHeader: | |||
{{Cl|END IF}} | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>'dynamic library</nowiki>|#919191}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'check for .dll (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .dll (system32)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Cl|ENVIRON$}}({{Text|<nowiki>"SYSTEMROOT"</nowiki>|#FFB100}}) + {{Text|<nowiki>"\System32\"</nowiki>|#FFB100}} + libpath$ + x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'--------------------------(without path)------------------------------</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dll (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
inlinelibname$ = x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .dll (system32)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Cl|ENVIRON$}}({{Text|<nowiki>"SYSTEMROOT"</nowiki>|#FFB100}}) + {{Text|<nowiki>"\System32\"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
inlinelibname$ = x$ + {{Text|<nowiki>".dll"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'Windows</nowiki>|#919191}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|<nowiki>'Note: STATIC libraries (.a/.o) cannot be loaded as dynamic objects</nowiki>|#919191}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(libpath$, {{Text|1|#F580B1}}) <> {{Text|<nowiki>"/"</nowiki>|#FFB100}} {{Cl|THEN}} libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(libpath$, {{Text|1|#F580B1}}) <> {{Text|<nowiki>"/"</nowiki>|#FFB100}} {{Cl|THEN}} libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|IF}} {{Cl|LEFT$}}(libpath$, {{Text|1|#F580B1}}) <> {{Text|<nowiki>"/"</nowiki>|#FFB100}} {{Cl|THEN}} libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}(libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(libpath$, {{Text|1|#F580B1}}) <> {{Text|<nowiki>"/"</nowiki>|#FFB100}} {{Cl|THEN}} libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (usr/lib64)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + libpath_inline$ + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'--------------------------(without path)------------------------------</nowiki>|#919191}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (direct)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
libname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + libname$: inlinelibname$ = {{Text|<nowiki>"./"</nowiki>|#FFB100}} + inlinelibname$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (usr/lib64)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib64/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} MacOSX {{Cl|THEN}} {{Text|<nowiki>'dylib support</nowiki>|#919191}} | |||
{{Text|<nowiki>'check for .dylib (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>"."</nowiki>|#FFB100}} + libver$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".dylib"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'check for .so (usr/lib)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so."</nowiki>|#FFB100}} + libver$ | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|_FILEEXISTS}}({{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}}) {{Cl|THEN}} | |||
libname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
inlinelibname$ = {{Text|<nowiki>"/usr/lib/"</nowiki>|#FFB100}} + {{Text|<nowiki>"lib"</nowiki>|#FFB100}} + x$ + {{Text|<nowiki>".so"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'Linux</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'Dynamic</nowiki>|#919191}} | |||
{{Text|<nowiki>'library found?</nowiki>|#919191}} | |||
{{Cl|IF}} dynamiclibrary <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"DYNAMIC LIBRARY not found"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|LEN}}(headername$) = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"LIBRARY not found"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Text|<nowiki>'***actual method should cull redundant header and library entries***</nowiki>|#919191}} | |||
{{Cl|IF}} dynamiclibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|<nowiki>'static</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(libname$) {{Cl|THEN}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|MID$ (function)|MID$}}(libname$, {{Text|2|#F580B1}}, {{Text|1|#F580B1}}) = {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} {{Cl|LEFT$}}(libname$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"\"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
mylib$ = mylib$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + libname$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
mylib$ = mylib$ + {{Text|<nowiki>" ..\..\"</nowiki>|#FFB100}} + libname$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(libname$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"/"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
mylib$ = mylib$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + libname$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
mylib$ = mylib$ + {{Text|<nowiki>" ../../"</nowiki>|#FFB100}} + libname$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|ELSE}} | |||
{{Text|<nowiki>'dynamic</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(headername$) = {{Text|0|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'no header</nowiki>|#919191}} | |||
{{Cl|IF}} subfuncn {{Cl|THEN}} | |||
f = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"A"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"maindata.txt"</nowiki>|#FFB100}}) | |||
{{Cl|ELSE}} | |||
f = DataTxtBuf | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'make name a C-appropriate variable name</nowiki>|#919191}} | |||
{{Text|<nowiki>'by converting everything except numbers and</nowiki>|#919191}} | |||
{{Text|<nowiki>'letters to underscores</nowiki>|#919191}} | |||
x2$ = x$ | |||
{{Cl|FOR}} x2 = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(x2$) | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(x2$, x2) < {{Text|48|#F580B1}} {{Cl|THEN}} {{Cl|ASC}}(x2$, x2) = {{Text|95|#F580B1}} | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(x2$, x2) > {{Text|57|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|ASC (function)|ASC}}(x2$, x2) < {{Text|65|#F580B1}} {{Cl|THEN}} {{Cl|ASC}}(x2$, x2) = {{Text|95|#F580B1}} | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(x2$, x2) > {{Text|90|#F580B1}} {{Cl|AND (boolean)|AND}} {{Cl|ASC (function)|ASC}}(x2$, x2) < {{Text|97|#F580B1}} {{Cl|THEN}} {{Cl|ASC}}(x2$, x2) = {{Text|95|#F580B1}} | |||
{{Cl|IF}} {{Cl|ASC (function)|ASC}}(x2$, x2) > {{Text|122|#F580B1}} {{Cl|THEN}} {{Cl|ASC}}(x2$, x2) = {{Text|95|#F580B1}} | |||
{{Cl|NEXT}} | |||
DLLname$ = x2$ | |||
{{Cl|IF}} sfdeclare {{Cl|THEN}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|WriteBufLine|#55FF55}} RegTxtBuf, {{Text|<nowiki>"HINSTANCE DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>"=NULL;"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"if (!DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>"){"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>"=LoadLibrary("</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + inlinelibname$ + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>");"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"if (!DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>") error(259);"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"}"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|WriteBufLine|#55FF55}} RegTxtBuf, {{Text|<nowiki>"void *DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>"=NULL;"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"if (!DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>"){"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>"=dlopen("</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + inlinelibname$ + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>",RTLD_LAZY);"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"if (!DLL_"</nowiki>|#FFB100}} + x2$ + {{Text|<nowiki>") error(259);"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} f, {{Text|<nowiki>"}"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'no header</nowiki>|#919191}} | |||
{{Cl|END IF}} {{Text|<nowiki>'dynamiclibrary</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEN}}(headername$) {{Cl|THEN}} | |||
{{Cl|IF}} (os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} ({{Cl|MID$ (function)|MID$}}(headername$, {{Text|2|#F580B1}}, {{Text|1|#F580B1}}) = {{Text|<nowiki>":"</nowiki>|#FFB100}} {{Cl|OR (boolean)|OR}} {{Cl|LEFT$}}(headername$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"\"</nowiki>|#FFB100}})) _ | |||
{{Cl|OR (boolean)|OR}} (os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|AND (boolean)|AND}} ({{Cl|LEFT$}}(headername$, {{Text|1|#F580B1}}) = {{Text|<nowiki>"/"</nowiki>|#FFB100}})) {{Cl|THEN}} | |||
{{Text|WriteBufLine|#55FF55}} RegTxtBuf, {{Text|<nowiki>"#include "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + headername$ + {{Cl|CHR$}}({{Text|34|#F580B1}}) | |||
{{Cl|ELSE}} | |||
{{Text|WriteBufLine|#55FF55}} RegTxtBuf, {{Text|<nowiki>"#include "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"../../"</nowiki>|#FFB100}} + headername$ + {{Cl|CHR$}}({{Text|34|#F580B1}}) | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
l$ = l$ + sp + {{Cl|CHR$}}({{Text|34|#F580B1}}) + autoformat_x$ + {{Cl|CHR$}}({{Text|34|#F580B1}}) | |||
{{Cl|IF}} n > x {{Cl|THEN}} | |||
{{Cl|IF}} dynamiclibrary {{Cl|THEN}} a$ = {{Text|<nowiki>"Cannot specify multiple DYNAMIC LIBRARY names in a single DECLARE statement"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
x = x + {{Text|1|#F580B1}}: x2$ = {{Text|getelement$|#55FF55}}(a$, x): {{Cl|IF}} x2$ <> {{Text|<nowiki>","</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ,"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
l$ = l$ + sp2 + {{Text|<nowiki>","</nowiki>|#FFB100}} | |||
x = x + {{Text|1|#F580B1}}: {{Cl|IF}} x > n {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected , ..."</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|GOTO}} addlibrary | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} {{Text|<nowiki>'n>=x</nowiki>|#919191}} | |||
layoutdone = {{Text|1|#F580B1}}: {{Cl|IF}} {{Cl|LEN}}(layout$) {{Cl|THEN}} layout$ = layout$ + sp + l$ {{Cl|ELSE}} layout$ = l$ | |||
{{Cl|GOTO}} finishednonexec | |||
{{Cl|END IF}} | |||
{{Cl|GOTO}} finishednonexec {{Text|<nowiki>'note: no layout required</nowiki>|#919191}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'begin SUB/FUNCTION</nowiki>|#919191}} | |||
{{Cl|IF}} n >= {{Text|1|#F580B1}} {{Cl|THEN}} | |||
dynamiclibrary = {{Text|0|#F580B1}} | |||
declaresubfunc2: | |||
sf = {{Text|0|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"FUNCTION"</nowiki>|#FFB100}} {{Cl|THEN}} sf = {{Text|1|#F580B1}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"SUB"</nowiki>|#FFB100}} {{Cl|THEN}} sf = {{Text|2|#F580B1}} | |||
{{Cl|IF}} sf {{Cl|THEN}} | |||
{{Cl|IF}} declaringlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} {{Cl|LEN}}(subfunc) {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected END SUB/FUNCTION before "</nowiki>|#FFB100}} + firstelement$: {{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} n = {{Text|1|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected name after SUB/FUNCTION"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
e$ = {{Text|getelement$|#55FF55}}(ca$, {{Text|2|#F580B1}}) | |||
symbol$ = {{Text|removesymbol$|#55FF55}}(e$) {{Text|<nowiki>'$,%,etc.</nowiki>|#919191}} | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} sf = {{Text|2|#F580B1}} {{Cl|AND (boolean)|AND}} symbol$ <> {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Type symbols after a SUB name are invalid"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
try = {{Text|findid|#55FF55}}(e$) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|DO...LOOP|DO WHILE}} try | |||
{{Cl|IF}} id.subfunc = sf {{Cl|THEN}} {{Cl|GOTO}} createsf | |||
{{Cl|IF}} try = {{Text|2|#F580B1}} {{Cl|THEN}} findanotherid = {{Text|1|#F580B1}}: try = {{Text|findid|#55FF55}}(e$) {{Cl|ELSE}} try = {{Text|0|#F580B1}} | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|LOOP}} | |||
a$ = {{Text|<nowiki>"Unregistered SUB/FUNCTION encountered"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
createsf: | |||
{{Cl|IF}} {{Cl|UCASE$}}(e$) = {{Text|<nowiki>"_GL"</nowiki>|#FFB100}} {{Cl|THEN}} e$ = {{Text|<nowiki>"_GL"</nowiki>|#FFB100}} | |||
{{Cl|IF}} firstelement$ = {{Text|<nowiki>"SUB"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Sub"</nowiki>|#FFB100}}) + sp + e$ + symbol$ | |||
{{Cl|ELSE}} | |||
l$ = {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Function"</nowiki>|#FFB100}}) + sp + e$ + symbol$ | |||
{{Cl|END IF}} | |||
id2 = id | |||
targetid = currentid | |||
{{Text|<nowiki>'check for ALIAS</nowiki>|#919191}} | |||
aliasname$ = {{Cl|RTRIM$}}(id.cn) | |||
{{Cl|IF}} n > {{Text|2|#F580B1}} {{Cl|THEN}} | |||
ee$ = {{Text|getelement$|#55FF55}}(a$, {{Text|3|#F580B1}}) | |||
{{Cl|IF}} ee$ = {{Text|<nowiki>"ALIAS"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Cl|IF}} declaringlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"ALIAS can only be used with DECLARE LIBRARY"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
{{Cl|IF}} n = {{Text|3|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected ALIAS name-in-library"</nowiki>|#FFB100}}: {{Cl|GOTO}} errmes | |||
ee$ = {{Text|getelement$|#55FF55}}(ca$, {{Text|4|#F580B1}}) | |||
{{Text|<nowiki>'strip string content (optional)</nowiki>|#919191}} | |||
{{Cl|IF}} {{Cl|LEFT$}}(ee$, {{Text|1|#F580B1}}) = {{Cl|CHR$}}({{Text|34|#F580B1}}) {{Cl|THEN}} | |||
ee$ = {{Cl|RIGHT$}}(ee$, {{Cl|LEN}}(ee$) - {{Text|1|#F580B1}}) | |||
x = {{Cl|INSTR}}(ee$, {{Cl|CHR$}}({{Text|34|#F580B1}})): {{Cl|IF}} x = {{Text|0|#F580B1}} {{Cl|THEN}} a$ = {{Text|<nowiki>"Expected "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}): {{Cl|GOTO}} errmes | |||
ee$ = {{Cl|LEFT$}}(ee$, x - {{Text|1|#F580B1}}) | |||
l$ = l$ + sp + {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Alias"</nowiki>|#FFB100}}) + sp + CHR_QUOTE + ee$ + CHR_QUOTE | |||
{{Cl|ELSE}} | |||
l$ = l$ + sp + {{Text|SCase$|#55FF55}}({{Text|<nowiki>"Alias"</nowiki>|#FFB100}}) + sp + ee$ | |||
{{Cl|END IF}} | |||
{{Text|<nowiki>'strip fix046$ (created by unquoted periods)</nowiki>|#919191}} | |||
{{Cl|DO...LOOP|DO WHILE}} {{Cl|INSTR}}(ee$, fix046$) | |||
x = {{Cl|INSTR}}(ee$, fix046$): ee$ = {{Cl|LEFT$}}(ee$, x - {{Text|1|#F580B1}}) + {{Text|<nowiki>"."</nowiki>|#FFB100}} + {{Cl|RIGHT$}}(ee$, {{Cl|LEN}}(ee$) - x + {{Text|1|#F580B1}} - {{Cl|LEN}}(fix046$)) | |||
{{Cl|LOOP}} | |||
aliasname$ = ee$ | |||
{{Text|<nowiki>'remove ALIAS section from line</nowiki>|#919191}} | |||
{{Cl|IF}} n <= {{Text|4|#F580B1}} {{Cl|THEN}} a$ = {{Text|getelements|#55FF55}}(a$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) | |||
{{Cl|IF}} n >= {{Text|5|#F580B1}} {{Cl|THEN}} a$ = {{Text|getelements|#55FF55}}(a$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) + sp + {{Text|getelements|#55FF55}}(a$, {{Text|5|#F580B1}}, n) | |||
{{Cl|IF}} n <= {{Text|4|#F580B1}} {{Cl|THEN}} ca$ = {{Text|getelements|#55FF55}}(ca$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) | |||
{{Cl|IF}} n >= {{Text|5|#F580B1}} {{Cl|THEN}} ca$ = {{Text|getelements|#55FF55}}(ca$, {{Text|1|#F580B1}}, {{Text|2|#F580B1}}) + sp + {{Text|getelements|#55FF55}}(ca$, {{Text|5|#F580B1}}, n) | |||
n = n - {{Text|2|#F580B1}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} {{Cl|GOTO}} declibjmp1 | |||
{{Cl|IF}} closedmain = {{Text|0|#F580B1}} {{Cl|THEN}} {{Text|closemain|#55FF55}} | |||
{{Text|<nowiki>'check for open controls (copy #2)</nowiki>|#919191}} | |||
{{Cl|IF}} controllevel <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} controltype(controllevel) <> {{Text|6|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'It's OK for subs to be inside $IF blocks</nowiki>|#919191}} | |||
a$ = {{Text|<nowiki>"Unidentified open control block"</nowiki>|#FFB100}} | |||
{{Cl|SELECT CASE}} controltype(controllevel) | |||
{{Cl|CASE}} {{Text|1|#F580B1}}: a$ = {{Text|<nowiki>"IF without END IF"</nowiki>|#FFB100}} | |||
{{Cl|CASE}} {{Text|2|#F580B1}}: a$ = {{Text|<nowiki>"FOR without NEXT"</nowiki>|#FFB100}} | |||
{{Cl|CASE}} {{Text|3|#F580B1}}, {{Text|4|#F580B1}}: a$ = {{Text|<nowiki>"DO without LOOP"</nowiki>|#FFB100}} | |||
{{Cl|CASE}} {{Text|5|#F580B1}}: a$ = {{Text|<nowiki>"WHILE without WEND"</nowiki>|#FFB100}} | |||
{{Cl|CASE}} {{Text|10|#F580B1}} {{Cl|TO}} {{Text|19|#F580B1}}: a$ = {{Text|<nowiki>"SELECT CASE without END SELECT"</nowiki>|#FFB100}} | |||
{{Cl|END SELECT}} | |||
linenumber = controlref(controllevel) | |||
{{Cl|GOTO}} errmes | |||
{{Cl|END IF}} | |||
{{Cl|IF}} ideindentsubs {{Cl|THEN}} | |||
controllevel = controllevel + {{Text|1|#F580B1}} | |||
controltype(controllevel) = {{Text|32|#F580B1}} | |||
controlref(controllevel) = linenumber | |||
{{Cl|END IF}} | |||
subfunc = {{Cl|RTRIM$}}(id.callname) {{Text|<nowiki>'SUB_..."</nowiki>|#919191}} | |||
{{Cl|IF}} id.subfunc = {{Text|1|#F580B1}} {{Cl|THEN}} subfuncoriginalname$ = {{Text|<nowiki>"FUNCTION "</nowiki>|#FFB100}} {{Cl|ELSE}} subfuncoriginalname$ = {{Text|<nowiki>"SUB "</nowiki>|#FFB100}} | |||
subfuncoriginalname$ = subfuncoriginalname$ + {{Cl|RTRIM$}}(id.cn) | |||
subfuncn = subfuncn + {{Text|1|#F580B1}} | |||
closedsubfunc = {{Text|0|#F580B1}} | |||
subfuncid = targetid | |||
subfuncret$ = {{Text|<nowiki>""</nowiki>|#FFB100}} | |||
DataTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"data"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(subfuncn) + {{Text|<nowiki>".txt"</nowiki>|#FFB100}}) | |||
FreeTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"free"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(subfuncn) + {{Text|<nowiki>".txt"</nowiki>|#FFB100}}) | |||
RetTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"ret"</nowiki>|#FFB100}} + {{Text|str2$|#55FF55}}(subfuncn) + {{Text|<nowiki>".txt"</nowiki>|#FFB100}}) | |||
defdatahandle = DataTxtBuf | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"if (next_return_point){"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"next_return_point--;"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"switch(return_point[next_return_point]){"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"case 0:"</nowiki>|#FFB100}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"error(3);"</nowiki>|#FFB100}} {{Text|<nowiki>'return without gosub!</nowiki>|#919191}} | |||
{{Text|WriteBufLine|#55FF55}} RetTxtBuf, {{Text|<nowiki>"break;"</nowiki>|#FFB100}} | |||
declibjmp1: | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
{{Cl|IF}} sfdeclare = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} indirectlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
RegTxtBuf = {{Text|OpenBuffer%|#55FF55}}({{Text|<nowiki>"O"</nowiki>|#FFB100}}, tmpdir$ + {{Text|<nowiki>"regsf_ignore.txt"</nowiki>|#FFB100}}) | |||
{{Cl|END IF}} | |||
{{Cl|IF}} sfdeclare = {{Text|1|#F580B1}} {{Cl|AND (boolean)|AND}} customtypelibrary = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} dynamiclibrary = {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} indirectlibrary = {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|WriteBufLine|#55FF55}} RegTxtBuf, {{Text|<nowiki>"#include "</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) + {{Text|<nowiki>"externtype"</nowiki>|#FFB100}} + {{Text|str2|#55FF55}}(ResolveStaticFunctions + {{Text|1|#F580B1}}) + {{Text|<nowiki>".txt"</nowiki>|#FFB100}} + {{Cl|CHR$}}({{Text|34|#F580B1}}) | |||
fh = {{Cl|FREEFILE}}: {{Cl|OPEN}} tmpdir$ + {{Text|<nowiki>"externtype"</nowiki>|#FFB100}} + {{Text|str2|#55FF55}}(ResolveStaticFunctions + {{Text|1|#F580B1}}) + {{Text|<nowiki>".txt"</nowiki>|#FFB100}} {{Cl|OPEN#File_Access_Modes|FOR}} {{Cl|OPEN#File_Access_Modes|OUTPUT}} {{Cl|OPEN|AS}} #fh: {{Cl|CLOSE}} #fh | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} sf = {{Text|1|#F580B1}} {{Cl|THEN}} | |||
rettyp = id.ret | |||
t$ = {{Text|typ2ctyp$|#55FF55}}(id.ret, {{Text|<nowiki>""</nowiki>|#FFB100}}) | |||
{{Cl|IF}} Error_Happened {{Cl|THEN}} {{Cl|GOTO}} errmes | |||
{{Cl|IF}} t$ = {{Text|<nowiki>"qbs"</nowiki>|#FFB100}} {{Cl|THEN}} t$ = {{Text|<nowiki>"qbs*"</nowiki>|#FFB100}} | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} | |||
{{Cl|IF}} rettyp {{Cl|AND (boolean)|AND}} ISSTRING {{Cl|THEN}} | |||
t$ = {{Text|<nowiki>"char*"</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} declaringlibrary <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} dynamiclibrary <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"WIN"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|WriteBufRawData|#55FF55}} RegTxtBuf, {{Text|<nowiki>"typedef "</nowiki>|#FFB100}} + t$ + {{Text|<nowiki>" (CALLBACK* DLLCALL_"</nowiki>|#FFB100}} + {{Text|removecast$|#55FF55}}({{Cl|RTRIM$}}(id.callname)) + {{Text|<nowiki>")("</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} os$ = {{Text|<nowiki>"LNX"</nowiki>|#FFB100}} {{Cl|THEN}} | |||
{{Text|WriteBufRawData|#55FF55}} RegTxtBuf, {{Text|<nowiki>"typedef "</nowiki>|#FFB100}} + t$ + {{Text|<nowiki>" (*DLLCALL_"</nowiki>|#FFB100}} + {{Text|removecast$|#55FF55}}({{Cl|RTRIM$}}(id.callname)) + {{Text|<nowiki>")("</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|ELSEIF}} declaringlibrary <> {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} customtypelibrary <> {{Text|0|#F580B1}} {{Cl|THEN}} | |||
{{Text|WriteBufRawData|#55FF55}} RegTxtBuf, {{Text|<nowiki>"typedef "</nowiki>|#FFB100}} + t$ + {{Text|<nowiki>" CUSTOMCALL_"</nowiki>|#FFB100}} + {{Text|removecast$|#55FF55}}({{Cl|RTRIM$}}(id.callname)) + {{Text|<nowiki>"("</nowiki>|#FFB100}} | |||
{{Cl|ELSE}} | |||
{{Text|WriteBufRawData|#55FF55}} RegTxtBuf, t$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + {{Text|removecast$|#55FF55}}({{Cl|RTRIM$}}(id.callname)) + {{Text|<nowiki>"("</nowiki>|#FFB100}} | |||
{{Cl|END IF}} | |||
{{Cl|IF}} declaringlibrary {{Cl|THEN}} {{Cl|GOTO}} declibjmp2 | |||
{{Text|WriteBufRawData|#55FF55}} MainTxtBuf, t$ + {{Text|<nowiki>" "</nowiki>|#FFB100}} + {{Text|removecast$|#55FF55}}({{Cl|RTRIM$}}(id.callname)) + {{Text|<nowiki>"("</nowiki>|#FFB100}} | |||
{{Text|<nowiki>'create variable to return result</nowiki>|#919191}} | |||
{{Text|<nowiki>'if type wasn't specified, define it</nowiki>|#919191}} | |||
{{Cl|IF}} symbol$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} | |||
a = {{Cl|ASC (function)|ASC}}({{Cl|UCASE$}}(e$)): {{Cl|IF}} a = {{Text|95|#F580B1}} {{Cl|THEN}} a = {{Text|91|#F580B1}} | |||
a = a - {{Text|64|#F580B1}} {{Text|<nowiki>'so A=1, Z=27 and _=28</nowiki>|#919191}} | |||
symbol$ = defineextaz(a) | |||
{{Cl|END IF}} | |||
{{CodeEnd}} |
Revision as of 22:56, 17 March 2023
The _BlankPage serves as a skeleton for new Wiki pages.
Syntax
- _BlankSub arg1[, arg2]
- result% = _BlankFunc(arg1[, arg2])
Parameters
- arg1 is a mandatory argument
- the arg2 is optional
Description
To use this skeleton click on the Edit tab above the page, then copy the raw text of this page and paste it into your new page. Change/remove sections as needed. Use this for italic and this for bold text style. To color your writings use the Text template. It takes either a color name or a #RRGGBB 32bit color, if the color part is omitted it will default to gray.
You can inline simple code one liners like w = _WIDTH
- an askerisk marks a list point
- two askerisks will indent the list
- three askerisks will indent even more
- two askerisks will indent the list
- This is a definition list
- The first description can follow right after a colon
- or in a new line
- more descriptions can follow
- using list bullets with an askerisk
- as already seen in the syntax above, you may use desciptions without a defininition too
- you may also nest descriptions
- but at some point it's cluttering the page so please use it sparingly
- you may also nest descriptions
This is a nice piece of paper for quotes and similar things. In case of short code snippets you may use the "Cb" (code blue) template to highlight and link keywords to the Wiki pages. FOR x = 1 TO 5 PRINT "Hello World!" NEXT x END As you see, this Text block is suitable for preformatted text, but note that the browser is still allowed to wrap too long lines. If you really need your preformatted text to be shown as is, then use a fixed text block instaed, see below. |
Use this fixed text block for preformatted text, which is not even allowed to wrap long lines, such as tables etc.. As you see this very long line goes far over the display width, so please limit youself to the available space to not clutter the display too much. |
Notes
- This may be a sub-section for further notes like special behavior, required prerequisites etc.
- If used/required, then this should always be a sub-section under the Description main section
Errors
- If used/required, then this also should be a sub-section under the Description main section
- This is not intended for the regular errors a SUB/FUNCTION could throw, those should be handled in the main description section.
- Rather use it for subtle things, known mis-behavior, tendency for stack overflows and seg faults etc.
Availability
- The capability to load from memory was introduced in QB64-PE v3.5.0.
Examples
- Example 1
- Each example should have a short description.
'Place your code example here 'The "Cl" (code link) template can be used to link keywords to its 'respective Wiki page. Those words will also get highlighted. COLOR 15,4 PRINT "Hello World!" |
- The output block is available for the SCREEN 0 background colors 0-7
- Inside the output block use the "Ot" (output text) template for coloring
Hello World!
|
See also
'All variables will be of type LONG unless explicitly defined DEFLNG A-Z 'All arrays will be dynamically allocated so they can be REDIM-ed '$DYNAMIC 'We need console access to support command-line compilation via the -x command line compile option $CONSOLE 'Initially the "SCREEN" will be hidden, if the -x option is used it will never be created $SCREENHIDE $EXEICON:'./qb64pe.ico' $VERSIONINFO:CompanyName=QB64 Phoenix Edition $VERSIONINFO:FileDescription=QB64 IDE and Compiler $VERSIONINFO:InternalName=qb64pe.bas $VERSIONINFO:LegalCopyright=MIT $VERSIONINFO:LegalTrademarks= $VERSIONINFO:OriginalFilename=qb64pe.exe $VERSIONINFO:ProductName=QB64-PE $VERSIONINFO:Comments=QB64 is a modern extended BASIC programming language that retains QB4.5/QBasic compatibility and compiles native binaries for Windows, Linux and macOS. '$INCLUDE:'global\version.bas' '$INCLUDE:'global\settings.bas' '$INCLUDE:'global\constants.bas' '$INCLUDE:'subs_functions\extensions\opengl\opengl_global.bas' '$INCLUDE:'utilities\ini-manager\ini.bi' '$INCLUDE:'utilities\s-buffer\simplebuffer.bi' DEFLNG A-Z '-------- Optional IDE Component (1/2) -------- '$INCLUDE:'ide\ide_global.bas' REDIM SHARED OName(1000) AS STRING 'Operation Name REDIM SHARED PL(1000) AS INTEGER 'Priority Level REDIM SHARED PP_TypeMod(0) AS STRING, PP_ConvertedMod(0) AS STRING 'Prepass Name Conversion variables. Set_OrderOfOperations DIM SHARED NoExeSaved AS INTEGER DIM SHARED vWatchOn, vWatchRecompileAttempts, vWatchDesiredState, vWatchErrorCall$ DIM SHARED vWatchNewVariable$, vWatchVariableExclusions$ vWatchErrorCall$ = "if (stop_program) {*__LONG_VWATCH_LINENUMBER=0; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);};if(new_error){bkp_new_error=new_error;new_error=0;*__LONG_VWATCH_LINENUMBER=-1; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);new_error=bkp_new_error;};" vWatchVariableExclusions$ = "@__LONG_VWATCH_LINENUMBER@__LONG_VWATCH_SUBLEVEL@__LONG_VWATCH_GOTO@" + _ "@__STRING_VWATCH_SUBNAME@__STRING_VWATCH_CALLSTACK@__ARRAY_BYTE_VWATCH_BREAKPOINTS" + _ "@__ARRAY_BYTE_VWATCH_SKIPLINES@__STRING_VWATCH_INTERNALSUBNAME@__ARRAY_STRING_VWATCH_STACK@" DIM SHARED nativeDataTypes$ nativeDataTypes$ = "@_OFFSET@OFFSET@_UNSIGNED _OFFSET@UNSIGNED OFFSET@_BIT@BIT@_UNSIGNED _BIT@UNSIGNED BIT@_BYTE@_UNSIGNED _BYTE@BYTE@UNSIGNED BYTE@INTEGER@_UNSIGNED INTEGER@UNSIGNED INTEGER@LONG@_UNSIGNED LONG@UNSIGNED LONG@_INTEGER64@INTEGER64@_UNSIGNED _INTEGER64@UNSIGNED INTEGER64@SINGLE@DOUBLE@_FLOAT@FLOAT@STRING@" DIM SHARED qb64prefix_set_recompileAttempts, qb64prefix_set_desiredState DIM SHARED opex_recompileAttempts, opex_desiredState DIM SHARED opexarray_recompileAttempts, opexarray_desiredState REDIM EveryCaseSet(100), SelectCaseCounter AS _UNSIGNED LONG REDIM SelectCaseHasCaseBlock(100) DIM ExecLevel(255), ExecCounter AS INTEGER REDIM SHARED UserDefine(1, 100) AS STRING '0 element is the name, 1 element is the string value REDIM SHARED InValidLine(10000) AS _BYTE DIM DefineElse(255) AS _BYTE DIM SHARED UserDefineCount AS INTEGER, UserDefineList$ UserDefineList$ = "@DEFINED@UNDEFINED@WINDOWS@WIN@LINUX@MAC@MACOSX@32BIT@64BIT@VERSION@" UserDefine(0, 0) = "WINDOWS": UserDefine(0, 1) = "WIN" UserDefine(0, 2) = "LINUX" UserDefine(0, 3) = "MAC": UserDefine(0, 4) = "MACOSX" UserDefine(0, 5) = "32BIT": UserDefine(0, 6) = "64BIT" UserDefine(0, 7) = "VERSION" IF INSTR(_OS$, "WIN") THEN UserDefine(1, 0) = "-1": UserDefine(1, 1) = "-1" ELSE UserDefine(1, 0) = "0": UserDefine(1, 1) = "0" IF INSTR(_OS$, "LINUX") THEN UserDefine(1, 2) = "-1" ELSE UserDefine(1, 2) = "0" IF INSTR(_OS$, "MAC") THEN UserDefine(1, 3) = "-1": UserDefine(1, 4) = "-1" ELSE UserDefine(1, 3) = "0": UserDefine(1, 4) = "0" IF INSTR(_OS$, "32BIT") THEN UserDefine(1, 5) = "-1": UserDefine(1, 6) = "0" ELSE UserDefine(1, 5) = "0": UserDefine(1, 6) = "-1" UserDefine(1, 7) = Version$ DIM SHARED QB64_uptime! QB64_uptime! = TIMER NoInternalFolder: IF _DIREXISTS("internal") = 0 THEN _SCREENSHOW PRINT "QB64-PE cannot locate the 'internal' folder" PRINT PRINT "Check that QB64-PE has been extracted properly." PRINT "For MacOSX, launch 'qb64pe_start.command' or enter './qb64pe' in Terminal." PRINT "For Linux, in the console enter './qb64pe'." DO _LIMIT 1 LOOP UNTIL INKEY$ <> "" SYSTEM 1 END IF DIM SHARED Include_GDB_Debugging_Info 'set using "options.bin" DIM SHARED DEPENDENCY_LAST CONST DEPENDENCY_LOADFONT = 1: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_AUDIO_CONVERSION = 2: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_AUDIO_DECODE = 3: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_AUDIO_OUT = 4: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_GL = 5: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_IMAGE_CODEC = 6: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_CONSOLE_ONLY = 7: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 '=2 if via -g switch, =1 if via metacommand $CONSOLE:ONLY CONST DEPENDENCY_SOCKETS = 8: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_PRINTER = 9: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_ICON = 10: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_SCREENIMAGE = 11: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 CONST DEPENDENCY_DEVICEINPUT = 12: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 'removes support for gamepad input if not present CONST DEPENDENCY_ZLIB = 13: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 'ZLIB library linkage, if desired, for compression/decompression. DIM SHARED DEPENDENCY(1 TO DEPENDENCY_LAST) DIM SHARED UseGL 'declared SUB _GL (no params) DIM SHARED OS_BITS AS LONG, WindowTitle AS STRING OS_BITS = 64: IF INSTR(_OS$, "[32BIT]") THEN OS_BITS = 32 IF OS_BITS = 32 THEN WindowTitle = "QB64 Phoenix Edition (x32)" ELSE WindowTitle = "QB64 Phoenix Edition (x64)" _TITLE WindowTitle DIM SHARED ConsoleMode, No_C_Compile_Mode, NoIDEMode DIM SHARED ShowWarnings AS _BYTE, QuietMode AS _BYTE, CMDLineFile AS STRING DIM SHARED MonochromeLoggingMode AS _BYTE TYPE usedVarList AS LONG id, linenumber, includeLevel, includedLine, scope, localIndex AS LONG arrayElementSize AS _BYTE used, watch, isarray, displayFormat 'displayFormat: 0=DEC;1=HEX;2=BIN;3=OCT AS STRING name, cname, varType, includedFile, subfunc AS STRING watchRange, indexes, elements, elementTypes 'for Arrays and UDTs AS STRING elementOffset, storage END TYPE REDIM SHARED backupUsedVariableList(1000) AS usedVarList DIM SHARED typeDefinitions$, backupTypeDefinitions$ DIM SHARED totalVariablesCreated AS LONG, totalMainVariablesCreated AS LONG DIM SHARED bypassNextVariable AS _BYTE DIM SHARED totalWarnings AS LONG, warningListItems AS LONG, lastWarningHeader AS STRING DIM SHARED duplicateConstWarning AS _BYTE, warningsissued AS _BYTE DIM SHARED emptySCWarning AS _BYTE, maxLineNumber AS LONG DIM SHARED ExeIconSet AS LONG, qb64prefix$, qb64prefix_set DIM SHARED VersionInfoSet AS _BYTE 'Variables to handle $VERSIONINFO metacommand: DIM SHARED viFileVersionNum$, viProductVersionNum$, viCompanyName$ DIM SHARED viFileDescription$, viFileVersion$, viInternalName$ DIM SHARED viLegalCopyright$, viLegalTrademarks$, viOriginalFilename$ DIM SHARED viProductName$, viProductVersion$, viComments$, viWeb$ DIM SHARED NoChecks DIM SHARED Console DIM SHARED ScreenHide DIM SHARED Asserts DIM SHARED OptMax AS LONG OptMax = 256 REDIM SHARED Opt(1 TO OptMax, 1 TO 10) AS STRING * 256 ' (1,1)="READ" ' (1,2)="WRITE" ' (1,3)="READ WRITE" REDIM SHARED OptWords(1 TO OptMax, 1 TO 10) AS INTEGER 'The number of words of each opt () element ' (1,1)=1 '"READ" ' (1,2)=1 '"WRITE" ' (1,3)=2 '"READ WRITE" REDIM SHARED T(1 TO OptMax) AS INTEGER 'The type of the entry ' t is 0 for ? opts ' ---------- 0 means ? , 1+ means a symbol or {}block ---------- ' t is 1 for symbol opts ' t is the number of rhs opt () index enteries for {READ|WRITE|READ WRITE} like opts REDIM SHARED Lev(1 TO OptMax) AS INTEGER 'The indwelling level of each opt () element (the lowest is 0) REDIM SHARED EntryLev(1 TO OptMax) AS INTEGER 'The level required from which this opt () can be validly be entered/checked-for REDIM SHARED DitchLev(1 TO OptMax) AS INTEGER 'The lowest level recorded between the previous Opt and this Opt REDIM SHARED DontPass(1 TO OptMax) AS INTEGER 'Set to 1 or 0, with 1 meaning don't pass 'Determines whether the opt () entry needs to actually be passed to the C++ sub/function REDIM SHARED TempList(1 TO OptMax) AS INTEGER REDIM SHARED PassRule(1 TO OptMax) AS LONG '0 means no pass rule 'negative values refer to an opt () element 'positive values refer to a flag value REDIM SHARED LevelEntered(OptMax) 'up to 64 levels supported REDIM SHARED separgs(OptMax + 1) AS STRING REDIM SHARED separgslayout(OptMax + 1) AS STRING REDIM SHARED separgs2(OptMax + 1) AS STRING REDIM SHARED separgslayout2(OptMax + 1) AS STRING DIM SHARED E DIM SHARED ResolveStaticFunctions REDIM SHARED ResolveStaticFunction_File(1 TO 100) AS STRING REDIM SHARED ResolveStaticFunction_Name(1 TO 100) AS STRING REDIM SHARED ResolveStaticFunction_Method(1 TO 100) AS LONG DIM SHARED Error_Happened AS LONG DIM SHARED Error_Message AS STRING DIM SHARED os AS STRING os$ = "WIN" IF INSTR(_OS$, "[LINUX]") THEN os$ = "LNX" DIM SHARED MacOSX AS LONG IF INSTR(_OS$, "[MACOSX]") THEN MacOSX = 1 DIM SHARED inline_DATA IF MacOSX THEN inline_DATA = 1 DIM SHARED BATCHFILE_EXTENSION AS STRING BATCHFILE_EXTENSION = ".bat" IF os$ = "LNX" THEN BATCHFILE_EXTENSION = ".sh" IF MacOSX THEN BATCHFILE_EXTENSION = ".command" DIM inlinedatastr(255) AS STRING FOR i = 0 TO 255 inlinedatastr(i) = str2$(i) + "," NEXT DIM SHARED extension AS STRING DIM SHARED path.exe$, path.source$, lastBinaryGenerated$ extension$ = ".exe" IF os$ = "LNX" THEN extension$ = "" 'no extension under Linux DIM SHARED pathsep AS STRING * 1 pathsep$ = "\" IF os$ = "LNX" THEN pathsep$ = "/" 'note: QB64 handles OS specific path separators automatically except under SHELL calls ON ERROR GOTO qberror_test DIM SHARED tmpdir AS STRING, tmpdir2 AS STRING IF os$ = "WIN" THEN tmpdir$ = ".\internal\temp\": tmpdir2$ = "..\\temp\\" IF os$ = "LNX" THEN tmpdir$ = "./internal/temp/": tmpdir2$ = "../temp/" IF NOT _DIREXISTS(tmpdir$) THEN MKDIR tmpdir$ DECLARE LIBRARY FUNCTION getpid& () END DECLARE thisinstancepid = getpid& DIM SHARED tempfolderindex IF INSTR(_OS$, "LINUX") THEN fh = FREEFILE OPEN ".\internal\temp\tempfoldersearch.bin" FOR RANDOM AS #fh LEN = LEN(tempfolderindex) tempfolderrecords = LOF(fh) / LEN(tempfolderindex) i = 1 IF tempfolderrecords = 0 THEN 'first run ever? PUT #fh, 1, thisinstancepid ELSE FOR i = 1 TO tempfolderrecords 'check if any of the temp folders is being used = pid still active GET #fh, i, tempfoldersearch SHELL _HIDE "ps -p " + STR$(tempfoldersearch) + " > /dev/null 2>&1; echo $? > internal/temp/checkpid.bin" fh2 = FREEFILE OPEN "internal/temp/checkpid.bin" FOR BINARY AS #fh2 LINE INPUT #fh2, checkpid$ CLOSE #fh2 IF VAL(checkpid$) = 1 THEN 'This temp folder was locked by an instance that's no longer active, so 'this will be our temp folder PUT #fh, i, thisinstancepid EXIT FOR END IF NEXT IF i > tempfolderrecords THEN 'All indexes were busy. Let's initiate a new one: PUT #fh, i, thisinstancepid END IF END IF CLOSE #fh IF i > 1 THEN tmpdir$ = "./internal/temp" + str2$(i) + "/": tmpdir2$ = "../temp" + str2$(i) + "/" IF _DIREXISTS(tmpdir$) = 0 THEN MKDIR tmpdir$ END IF END IF OPEN tmpdir$ + "temp.bin" FOR OUTPUT LOCK WRITE AS #26 ELSE ON ERROR GOTO qberror_test E = 0 i = 1 OPEN tmpdir$ + "temp.bin" FOR OUTPUT LOCK WRITE AS #26 DO WHILE E i = i + 1 IF i = 1000 THEN PRINT "Unable to locate the 'internal' folder": END 1 MKDIR ".\internal\temp" + str2$(i) IF os$ = "WIN" THEN tmpdir$ = ".\internal\temp" + str2$(i) + "\": tmpdir2$ = "..\\temp" + str2$(i) + "\\" IF os$ = "LNX" THEN tmpdir$ = "./internal/temp" + str2$(i) + "/": tmpdir2$ = "../temp" + str2$(i) + "/" E = 0 OPEN tmpdir$ + "temp.bin" FOR OUTPUT LOCK WRITE AS #26 LOOP END IF 'temp folder established tempfolderindex = i IF i > 1 THEN 'create modified version of qbx.cpp OPEN ".\internal\c\qbx" + str2$(i) + ".cpp" FOR OUTPUT AS #2 OPEN ".\internal\c\qbx.cpp" FOR BINARY AS #1 DO UNTIL EOF(1) LINE INPUT #1, a$ x = INSTR(a$, "..\\temp\\"): IF x THEN a$ = LEFT$(a$, x - 1) + "..\\temp" + str2$(i) + "\\" + RIGHT$(a$, LEN(a$) - (x + 9)) x = INSTR(a$, "../temp/"): IF x THEN a$ = LEFT$(a$, x - 1) + "../temp" + str2$(i) + "/" + RIGHT$(a$, LEN(a$) - (x + 7)) PRINT #2, a$ LOOP CLOSE #1, #2 END IF IF Debug THEN OPEN tmpdir$ + "debug.txt" FOR OUTPUT AS #9 ON ERROR GOTO qberror DIM SHARED tempfolderindexstr AS STRING 'appended to "Untitled" DIM SHARED tempfolderindexstr2 AS STRING IF tempfolderindex <> 1 THEN tempfolderindexstr$ = "(" + str2$(tempfolderindex) + ")": tempfolderindexstr2$ = str2$(tempfolderindex) DIM SHARED idedebuginfo DIM SHARED seperateargs_error DIM SHARED seperateargs_error_message AS STRING DIM SHARED compfailed DIM SHARED reginternalsubfunc DIM SHARED reginternalvariable DIM SHARED symboltype_size symboltype_size = 0 DIM SHARED use_global_byte_elements use_global_byte_elements = 0 'compiler-side IDE data & definitions 'SHARED variables "passed" to/from the compiler & IDE DIM SHARED idecommand AS STRING 'a 1 byte message-type code, followed by optional string data DIM SHARED idereturn AS STRING 'used to pass formatted-lines and return information back to the IDE DIM SHARED ideerror AS LONG DIM SHARED idecompiled AS LONG DIM SHARED idemode '1 if using the IDE to compile DIM SHARED ideerrorline AS LONG 'set by qb64-error(...) to the line number it would have reported, this number 'is later passed to the ide in message #8 DIM SHARED idemessage AS STRING 'set by qb64-error(...) to the error message to be reported, this 'is later passed to the ide in message #8 DIM SHARED optionexplicit AS _BYTE DIM SHARED optionexplicitarray AS _BYTE DIM SHARED optionexplicit_cmd AS _BYTE DIM SHARED ideStartAtLine AS LONG, errorLineInInclude AS LONG DIM SHARED warningInInclude AS LONG, warningInIncludeLine AS LONG DIM SHARED outputfile_cmd$ DIM SHARED compilelog$ '$INCLUDE:'global\IDEsettings.bas' DIM OutputIsRelativeToStartDir AS LONG CMDLineFile = ParseCMDLineArgs$ IF CMDLineFile <> "" AND _FILEEXISTS(_STARTDIR$ + "/" + CMDLineFile) THEN CMDLineFile = _STARTDIR$ + "/" + CMDLineFile OutputIsRelativeToStartDir = -1 END IF IF ConsoleMode THEN _DEST _CONSOLE ELSE _CONSOLE OFF _SCREENSHOW _ICON END IF 'the function ?=ide(?) should always be passed 0, it returns a message code number, any further information 'is passed back in idereturn 'message code numbers: '0 no ide present (auto defined array ide() return 0) '1 launch ide & with passed filename (compiler->ide) '2 begin new compilation with returned line of code (compiler<-ide) ' [2][line of code] '3 request next line (compiler->ide) ' [3] '4 next line of code returned (compiler<-ide) ' [4][line of code] '5 no more lines of code exist (compiler<-ide) ' [5] '6 code is OK/ready (compiler->ide) ' [6] '7 repass the code from the beginning (compiler->ide) ' [7] '8 an error has occurred with 'this' message on 'this' line(compiler->ide) ' [8][error message][line as LONG] '9 C++ compile (if necessary) and run with 'this' name (compiler<-ide) ' [9][name(no path, no .bas)] '10 The line requires more time to process ' Pass-back 'line of code' using method [4] when ready ' [10][line of code] '11 ".EXE file created" message '12 The name of the exe I'll create is '...' (compiler->ide) ' [12][exe name without .exe] '255 A qb error happened in the IDE (compiler->ide) ' note: detected by the fact that ideerror was not set to 0 ' [255] 'hash table data TYPE HashListItem Flags AS LONG Reference AS LONG NextItem AS LONG PrevItem AS LONG LastItem AS LONG 'note: this value is only valid on the first item in the list 'note: name is stored in a seperate array of strings END TYPE DIM SHARED HashFind_NextListItem AS LONG DIM SHARED HashFind_Reverse AS LONG DIM SHARED HashFind_SearchFlags AS LONG DIM SHARED HashFind_Name AS STRING DIM SHARED HashRemove_LastFound AS LONG DIM SHARED HashListSize AS LONG DIM SHARED HashListNext AS LONG DIM SHARED HashListFreeSize AS LONG DIM SHARED HashListFreeLast AS LONG 'hash lookup tables DIM SHARED hash1char(255) AS INTEGER DIM SHARED hash2char(65535) AS INTEGER FOR x = 1 TO 26 hash1char(64 + x) = x hash1char(96 + x) = x NEXT hash1char(95) = 27 '_ hash1char(48) = 28 '0 hash1char(49) = 29 '1 hash1char(50) = 30 '2 hash1char(51) = 31 '3 hash1char(52) = 23 '4 'note: x, y, z and beginning alphabet letters avoided because of common usage (eg. a2, y3) hash1char(53) = 22 '5 hash1char(54) = 20 '6 hash1char(55) = 19 '7 hash1char(56) = 18 '8 hash1char(57) = 17 '9 FOR c1 = 0 TO 255 FOR c2 = 0 TO 255 hash2char(c1 + c2 * 256) = hash1char(c1) + hash1char(c2) * 32 NEXT NEXT 'init HashListSize = 65536 HashListNext = 1 HashListFreeSize = 1024 HashListFreeLast = 0 REDIM SHARED HashList(1 TO HashListSize) AS HashListItem REDIM SHARED HashListName(1 TO HashListSize) AS STRING * 256 REDIM SHARED HashListFree(1 TO HashListFreeSize) AS LONG REDIM SHARED HashTable(16777215) AS LONG '64MB lookup table with indexes to the hashlist CONST HASHFLAG_LABEL = 2 CONST HASHFLAG_TYPE = 4 CONST HASHFLAG_RESERVED = 8 CONST HASHFLAG_OPERATOR = 16 CONST HASHFLAG_CUSTOMSYNTAX = 32 CONST HASHFLAG_SUB = 64 CONST HASHFLAG_FUNCTION = 128 CONST HASHFLAG_UDT = 256 CONST HASHFLAG_UDTELEMENT = 512 CONST HASHFLAG_CONSTANT = 1024 CONST HASHFLAG_VARIABLE = 2048 CONST HASHFLAG_ARRAY = 4096 CONST HASHFLAG_XELEMENTNAME = 8192 CONST HASHFLAG_XTYPENAME = 16384 TYPE Label_Type State AS _UNSIGNED _BYTE '0=label referenced, 1=label created cn AS STRING * 256 Scope AS LONG Data_Offset AS _INTEGER64 'offset within data Data_Referenced AS _UNSIGNED _BYTE 'set to 1 if data is referenced (data_offset will be used to create the data offset variable) Error_Line AS LONG 'the line number to reference on errors Scope_Restriction AS LONG 'cannot exist inside this scope (post checked) SourceLineNumber AS LONG END TYPE DIM SHARED nLabels, Labels_Ubound Labels_Ubound = 100 REDIM SHARED Labels(1 TO Labels_Ubound) AS Label_Type DIM SHARED Empty_Label AS Label_Type DIM SHARED PossibleSubNameLabels AS STRING 'format: name+sp+name+sp+name <-ucase$'d DIM SHARED SubNameLabels AS STRING 'format: name+sp+name+sp+name <-ucase$'d DIM SHARED CreatingLabel AS LONG DIM SHARED AllowLocalName AS LONG DIM SHARED DataOffset DIM SHARED prepass DIM SHARED autoarray DIM SHARED ontimerid, onkeyid, onstrigid DIM SHARED revertmaymusthave(1 TO 10000) DIM SHARED revertmaymusthaven DIM SHARED linecontinuation DIM SHARED dim2typepassback AS STRING 'passes back correct case sensitive version of type DIM SHARED inclevel DIM SHARED incname(100) AS STRING 'must be full path as given DIM SHARED inclinenumber(100) AS LONG DIM SHARED incerror AS STRING DIM SHARED fix046 AS STRING fix046$ = "__" + "ASCII" + "_" + "CHR" + "_" + "046" + "__" 'broken up to avoid detection for layout reversion DIM SHARED layout AS STRING 'passed to IDE DIM SHARED layoutok AS LONG 'tracks status of entire line DIM SHARED layoutcomment AS STRING DIM SHARED tlayout AS STRING 'temporary layout string set by supporting functions DIM SHARED layoutdone AS LONG 'tracks status of single command DIM SHARED fooindwel DIM SHARED alphanumeric(255) FOR i = 48 TO 57 alphanumeric(i) = -1 NEXT FOR i = 65 TO 90 alphanumeric(i) = -1 NEXT FOR i = 97 TO 122 alphanumeric(i) = -1 NEXT '_ is treated as an alphabet letter alphanumeric(95) = -1 DIM SHARED isalpha(255) FOR i = 65 TO 90 isalpha(i) = -1 NEXT FOR i = 97 TO 122 isalpha(i) = -1 NEXT '_ is treated as an alphabet letter isalpha(95) = -1 DIM SHARED isnumeric(255) FOR i = 48 TO 57 isnumeric(i) = -1 NEXT DIM SHARED lfsinglechar(255) lfsinglechar(40) = 1 '( lfsinglechar(41) = 1 ') lfsinglechar(42) = 1 '* lfsinglechar(43) = 1 '+ lfsinglechar(45) = 1 '- lfsinglechar(47) = 1 '/ lfsinglechar(60) = 1 '< lfsinglechar(61) = 1 '= lfsinglechar(62) = 1 '> lfsinglechar(92) = 1 '\ lfsinglechar(94) = 1 '^ lfsinglechar(44) = 1 ', lfsinglechar(46) = 1 '. lfsinglechar(58) = 1 ': lfsinglechar(59) = 1 '; lfsinglechar(35) = 1 '# (file no only) lfsinglechar(36) = 1 '$ (metacommand only) lfsinglechar(63) = 1 '? (print macro) lfsinglechar(95) = 1 '_ DIM SHARED nextrunlineindex AS LONG DIM SHARED lineinput3buffer AS STRING DIM SHARED lineinput3index AS LONG DIM SHARED dimstatic AS LONG DIM SHARED staticarraylist AS STRING DIM SHARED staticarraylistn AS LONG DIM SHARED commonarraylist AS STRING DIM SHARED commonarraylistn AS LONG 'CONST support DIM SHARED constmax AS LONG constmax = 100 DIM SHARED constlast AS LONG constlast = -1 REDIM SHARED constname(constmax) AS STRING REDIM SHARED constcname(constmax) AS STRING REDIM SHARED constnamesymbol(constmax) AS STRING 'optional name symbol ' `1 and `no-number must be handled correctly 'DIM SHARED constlastshared AS LONG 'so any defined inside a sub/function after this index can be "forgotten" when sub/function exits 'constlastshared = -1 REDIM SHARED consttype(constmax) AS LONG 'variable type number 'consttype determines storage REDIM SHARED constinteger(constmax) AS _INTEGER64 REDIM SHARED constuinteger(constmax) AS _UNSIGNED _INTEGER64 REDIM SHARED constfloat(constmax) AS _FLOAT REDIM SHARED conststring(constmax) AS STRING REDIM SHARED constsubfunc(constmax) AS LONG REDIM SHARED constdefined(constmax) AS LONG 'UDT 'names DIM SHARED lasttype AS LONG DIM SHARED lasttypeelement AS LONG TYPE idstruct n AS STRING * 256 'name cn AS STRING * 256 'case sensitive version of n arraytype AS LONG 'similar to t arrayelements AS INTEGER staticarray AS INTEGER 'set for arrays declared in the main module with static elements mayhave AS STRING * 8 'mayhave and musthave are exclusive of each other musthave AS STRING * 8 t AS LONG 'type tsize AS LONG subfunc AS INTEGER 'if function=1, sub=2 (max 100 arguments) Dependency AS INTEGER internal_subfunc AS INTEGER callname AS STRING * 256 ccall AS INTEGER overloaded AS _BYTE args AS INTEGER minargs AS INTEGER arg AS STRING * 400 'similar to t argsize AS STRING * 400 'similar to tsize (used for fixed length strings) specialformat AS STRING * 256 secondargmustbe AS STRING * 256 secondargcantbe AS STRING * 256 ret AS LONG 'the value it returns if it is a function (again like t) insubfunc AS STRING * 256 insubfuncn AS LONG share AS INTEGER nele AS STRING * 100 nelereq AS STRING * 100 linkid AS LONG linkarg AS INTEGER staticscope AS INTEGER 'For variables which are arguments passed to a sub/function sfid AS LONG 'id number of variable's parent sub/function sfarg AS INTEGER 'argument/parameter # within call (1=first) hr_syntax AS STRING END TYPE DIM SHARED id AS idstruct DIM SHARED idn AS LONG DIM SHARED ids_max AS LONG ids_max = 1024 REDIM SHARED ids(1 TO ids_max) AS idstruct REDIM SHARED cmemlist(1 TO ids_max + 1) AS INTEGER 'variables that must be in cmem REDIM SHARED sfcmemargs(1 TO ids_max + 1) AS STRING * 100 's/f arg that must be in cmem REDIM SHARED arrayelementslist(1 TO ids_max + 1) AS INTEGER 'arrayelementslist (like cmemlist) helps to resolve the number of elements in arrays with an unknown number of elements. Note: arrays with an unknown number of elements have .arrayelements=-1 'create blank id template for idclear to copy (stops strings being set to chr$(0)) DIM SHARED cleariddata AS idstruct cleariddata.cn = "" cleariddata.n = "" cleariddata.mayhave = "" cleariddata.musthave = "" cleariddata.callname = "" cleariddata.arg = "" cleariddata.argsize = "" cleariddata.specialformat = "" cleariddata.secondargmustbe = "" cleariddata.secondargcantbe = "" cleariddata.insubfunc = "" cleariddata.nele = "" cleariddata.nelereq = "" DIM SHARED ISSTRING AS LONG DIM SHARED ISFLOAT AS LONG DIM SHARED ISUNSIGNED AS LONG DIM SHARED ISPOINTER AS LONG DIM SHARED ISFIXEDLENGTH AS LONG DIM SHARED ISINCONVENTIONALMEMORY AS LONG DIM SHARED ISOFFSETINBITS AS LONG DIM SHARED ISARRAY AS LONG DIM SHARED ISREFERENCE AS LONG DIM SHARED ISUDT AS LONG DIM SHARED ISOFFSET AS LONG DIM SHARED STRINGTYPE AS LONG DIM SHARED BITTYPE AS LONG DIM SHARED UBITTYPE AS LONG DIM SHARED BYTETYPE AS LONG DIM SHARED UBYTETYPE AS LONG DIM SHARED INTEGERTYPE AS LONG DIM SHARED UINTEGERTYPE AS LONG DIM SHARED LONGTYPE AS LONG DIM SHARED ULONGTYPE AS LONG DIM SHARED INTEGER64TYPE AS LONG DIM SHARED UINTEGER64TYPE AS LONG DIM SHARED SINGLETYPE AS LONG DIM SHARED DOUBLETYPE AS LONG DIM SHARED FLOATTYPE AS LONG DIM SHARED OFFSETTYPE AS LONG DIM SHARED UOFFSETTYPE AS LONG DIM SHARED UDTTYPE AS LONG DIM SHARED gosubid AS LONG DIM SHARED redimoption AS INTEGER DIM SHARED dimoption AS INTEGER DIM SHARED arraydesc AS INTEGER DIM SHARED qberrorhappened AS INTEGER DIM SHARED qberrorcode AS INTEGER DIM SHARED qberrorline AS INTEGER 'COMMON SHARED defineaz() AS STRING 'COMMON SHARED defineextaz() AS STRING DIM SHARED sourcefile AS STRING 'the full path and filename DIM SHARED file AS STRING 'name of the file (without .bas or path) 'COMMON SHARED separgs() AS STRING DIM SHARED constequation AS INTEGER DIM SHARED DynamicMode AS INTEGER DIM SHARED findidsecondarg AS STRING DIM SHARED findanotherid AS INTEGER DIM SHARED findidinternal AS LONG DIM SHARED currentid AS LONG 'is the index of the last ID accessed DIM SHARED linenumber AS LONG, reallinenumber AS LONG, totallinenumber AS LONG, definingtypeerror AS LONG DIM SHARED wholeline AS STRING DIM SHARED firstLineNumberLabelvWatch AS LONG, lastLineNumberLabelvWatch AS LONG DIM SHARED vWatchUsedLabels AS STRING, vWatchUsedSkipLabels AS STRING DIM SHARED linefragment AS STRING 'COMMON SHARED bitmask() AS _INTEGER64 'COMMON SHARED bitmaskinv() AS _INTEGER64 DIM SHARED arrayprocessinghappened AS INTEGER DIM SHARED stringprocessinghappened AS INTEGER DIM SHARED cleanupstringprocessingcall AS STRING DIM SHARED inputfunctioncalled AS _BYTE DIM SHARED recompile AS INTEGER 'forces recompilation 'COMMON SHARED cmemlist() AS INTEGER DIM SHARED optionbase AS INTEGER DIM SHARED addmetastatic AS INTEGER DIM SHARED addmetadynamic AS INTEGER DIM SHARED addmetainclude AS STRING DIM SHARED closedmain AS INTEGER DIM SHARED module AS STRING DIM SHARED subfunc AS STRING DIM SHARED subfuncn AS LONG DIM SHARED closedsubfunc AS _BYTE DIM SHARED subfuncid AS LONG DIM SHARED defdatahandle AS INTEGER DIM SHARED dimsfarray AS INTEGER DIM SHARED dimshared AS INTEGER 'Allows passing of known elements to recompilation DIM SHARED sflistn AS INTEGER 'COMMON SHARED sfidlist() AS LONG 'COMMON SHARED sfarglist() AS INTEGER 'COMMON SHARED sfelelist() AS INTEGER DIM SHARED glinkid AS LONG DIM SHARED glinkarg AS INTEGER DIM SHARED typname2typsize AS LONG DIM SHARED uniquenumbern AS LONG 'CLEAR , , 16384 DIM SHARED bitmask(1 TO 64) AS _INTEGER64 DIM SHARED bitmaskinv(1 TO 64) AS _INTEGER64 DIM SHARED defineextaz(1 TO 27) AS STRING DIM SHARED defineaz(1 TO 27) AS STRING '27 is an underscore ISSTRING = 1073741824 ISFLOAT = 536870912 ISUNSIGNED = 268435456 ISPOINTER = 134217728 ISFIXEDLENGTH = 67108864 'only set for strings with pointer flag ISINCONVENTIONALMEMORY = 33554432 ISOFFSETINBITS = 16777216 ISARRAY = 8388608 ISREFERENCE = 4194304 ISUDT = 2097152 ISOFFSET = 1048576 STRINGTYPE = ISSTRING + ISPOINTER BITTYPE = 1& + ISPOINTER + ISOFFSETINBITS UBITTYPE = 1& + ISPOINTER + ISUNSIGNED + ISOFFSETINBITS 'QB64 will also support BIT*n, eg. DIM bitarray[10] AS _UNSIGNED _BIT*10 BYTETYPE = 8& + ISPOINTER UBYTETYPE = 8& + ISPOINTER + ISUNSIGNED INTEGERTYPE = 16& + ISPOINTER UINTEGERTYPE = 16& + ISPOINTER + ISUNSIGNED LONGTYPE = 32& + ISPOINTER ULONGTYPE = 32& + ISPOINTER + ISUNSIGNED INTEGER64TYPE = 64& + ISPOINTER UINTEGER64TYPE = 64& + ISPOINTER + ISUNSIGNED SINGLETYPE = 32& + ISFLOAT + ISPOINTER DOUBLETYPE = 64& + ISFLOAT + ISPOINTER FLOATTYPE = 256& + ISFLOAT + ISPOINTER '8-32 bytes OFFSETTYPE = 64& + ISOFFSET + ISPOINTER: IF OS_BITS = 32 THEN OFFSETTYPE = 32& + ISOFFSET + ISPOINTER UOFFSETTYPE = 64& + ISOFFSET + ISUNSIGNED + ISPOINTER: IF OS_BITS = 32 THEN UOFFSETTYPE = 32& + ISOFFSET + ISUNSIGNED + ISPOINTER UDTTYPE = ISUDT + ISPOINTER DIM SHARED statementn AS LONG DIM SHARED everycasenewcase AS LONG DIM SHARED controllevel AS INTEGER '0=not in a control block DIM SHARED controltype(1000) AS INTEGER '1=IF (awaiting END IF) '2=FOR (awaiting NEXT) '3=DO (awaiting LOOP [UNTIL|WHILE param]) '4=DO WHILE/UNTIL (awaiting LOOP) '5=WHILE (awaiting WEND) '6=$IF (precompiler) '10=SELECT CASE qbs (awaiting END SELECT/CASE) '11=SELECT CASE int64 (awaiting END SELECT/CASE) '12=SELECT CASE uint64 (awaiting END SELECT/CASE) '13=SELECT CASE LONG double (awaiting END SELECT/CASE/CASE ELSE) '14=SELECT CASE float ... '15=SELECT CASE double '16=SELECT CASE int32 '17=SELECT CASE uint32 '18=CASE (awaiting END SELECT/CASE/CASE ELSE) '19=CASE ELSE (awaiting END SELECT) '32=SUB/FUNCTION (awaiting END SUB/FUNCTION) DIM controlid(1000) AS LONG DIM controlvalue(1000) AS LONG DIM controlstate(1000) AS INTEGER DIM SHARED controlref(1000) AS LONG 'the line number the control was created on ' ' Collection of flags indicating which unstable features should be used during compilation ' REDIM SHARED unstableFlags(1 TO 2) AS _BYTE DIM UNSTABLE_MIDI AS LONG DIM UNSTABLE_HTTP AS LONG UNSTABLE_MIDI = 1 UNSTABLE_HTTP = 2 ON ERROR GOTO qberror i2&& = 1 FOR i&& = 1 TO 64 bitmask(i&&) = i2&& bitmaskinv(i&&) = NOT i2&& i2&& = i2&& + 2 ^ i&& NEXT DIM id2 AS idstruct cleanupstringprocessingcall$ = "qbs_cleanup(qbs_tmp_base," DIM SHARED sfidlist(1000) AS LONG DIM SHARED sfarglist(1000) AS INTEGER DIM SHARED sfelelist(1000) AS INTEGER '----------------ripgl.bas-------------------------------------------------------------------------------- gl_scan_header '----------------ripgl.bas-------------------------------------------------------------------------------- '-----------------------QB64 COMPILER ONCE ONLY SETUP CODE ENDS HERE--------------------------------------- IF NoIDEMode THEN IDE_AutoPosition = 0: GOTO noide DIM FileDropEnabled AS _BYTE IF FileDropEnabled = 0 THEN FileDropEnabled = -1: _ACCEPTFILEDROP IF IDE_AutoPosition AND NOT IDE_BypassAutoPosition THEN _SCREENMOVE IDE_LeftPosition, IDE_TopPosition idemode = 1 sendc$ = "" 'no initial message IF CMDLineFile <> "" THEN sendc$ = CHR$(1) + CMDLineFile sendcommand: idecommand$ = sendc$ C = ide(0) ideerror = 0 IF C = 0 THEN idemode = 0: GOTO noide c$ = idereturn$ IF C = 2 THEN 'begin ideerrorline = 0 'addresses invalid prepass error line numbers being reported idepass = 1 GOTO fullrecompile ideret1: wholeline$ = c$ GOTO ideprepass ideret2: IF lastLineReturn THEN GOTO lastLineReturn sendc$ = CHR$(3) 'request next line GOTO sendcommand END IF IF C = 4 THEN 'next line IF idepass = 1 THEN wholeline$ = c$ GOTO ideprepass '(returns to ideret2: above) END IF 'assume idepass>1 a3$ = c$ continuelinefrom = 0 GOTO ide4 ideret4: IF lastLineReturn THEN GOTO lastLineReturn sendc$ = CHR$(3) 'request next line GOTO sendcommand END IF IF C = 5 THEN 'end of program reached lastLine = 1 lastLineReturn = 1 IF idepass = 1 THEN wholeline$ = "" GOTO ideprepass '(returns to ideret2: above, then to lastLinePrepassReturn below) END IF 'idepass>1 a3$ = "" continuelinefrom = 0 GOTO ide4 'returns to ideret4, then to lastLinePrepassReturn below lastLineReturn: lastLineReturn = 0 lastLine = 0 IF idepass = 1 THEN 'prepass complete idepass = 2 GOTO ide3 ideret3: sendc$ = CHR$(7) 'repass request firstLine = 1 GOTO sendcommand END IF 'assume idepass=2 'finalize program GOTO ide5 ideret5: 'note: won't return here if a recompile was required! sendc$ = CHR$(6) 'ready idecompiled = 0 GOTO sendcommand END IF IF C = 9 THEN 'run IF idecompiled = 0 THEN 'exe needs to be compiled file$ = c$ 'locate accessible file and truncate f$ = file$ path.exe$ = "" IF SaveExeWithSource THEN IF LEN(ideprogname) THEN path.exe$ = idepath$ + pathsep$ END IF i = 1 nextexeindex: IF _FILEEXISTS(path.exe$ + file$ + extension$) THEN E = 0 ON ERROR GOTO qberror_test KILL path.exe$ + file$ + extension$ ON ERROR GOTO qberror IF E = 1 THEN i = i + 1 file$ = f$ + "(" + str2$(i) + ")" GOTO nextexeindex END IF END IF 'inform IDE of name change if necessary (IDE will respond with message 9 and corrected name) IF i <> 1 THEN sendc$ = CHR$(12) + file$ GOTO sendcommand END IF ideerrorline = 0 'addresses C++ comp. error's line number GOTO ide6 ideret6: idecompiled = 1 END IF IF iderunmode = 2 THEN sendc$ = CHR$(11) '.EXE file created GOTO sendcommand END IF 'execute program IF iderunmode = 1 THEN IF NoExeSaved THEN 'This is the section which deals with if the user selected to run the program without 'saving an EXE file to the disk. 'We start off by first running the EXE, and then we delete it from the drive. 'making it a temporary file when all is said and done. IF os$ = "WIN" THEN SHELL QuotedFilename$(CHR$(34) + lastBinaryGenerated$ + CHR$(34)) + ModifyCOMMAND$ 'run the newly created program SHELL _HIDE _DONTWAIT "del " + QuotedFilename$(CHR$(34) + lastBinaryGenerated$ + CHR$(34)) 'kill it END IF IF path.exe$ = "" THEN path.exe$ = "./" IF os$ = "LNX" THEN IF LEFT$(lastBinaryGenerated$, LEN(path.exe$)) = path.exe$ THEN SHELL QuotedFilename$(lastBinaryGenerated$) + ModifyCOMMAND$ KILL lastBinaryGenerated$ ELSE SHELL QuotedFilename$(path.exe$ + lastBinaryGenerated$) + ModifyCOMMAND$ KILL path.exe$ + lastBinaryGenerated$ END IF END IF IF path.exe$ = "./" THEN path.exe$ = "" NoExeSaved = 0 'reset the flag for a temp EXE sendc$ = CHR$(6) 'ready GOTO sendcommand END IF IF os$ = "WIN" THEN SHELL _DONTWAIT QuotedFilename$(CHR$(34) + lastBinaryGenerated$ + CHR$(34)) + ModifyCOMMAND$ IF path.exe$ = "" THEN path.exe$ = "./" IF os$ = "LNX" THEN IF LEFT$(lastBinaryGenerated$, LEN(path.exe$)) = path.exe$ THEN SHELL _DONTWAIT QuotedFilename$(lastBinaryGenerated$) + ModifyCOMMAND$ ELSE SHELL _DONTWAIT QuotedFilename$(path.exe$ + lastBinaryGenerated$) + ModifyCOMMAND$ END IF END IF IF path.exe$ = "./" THEN path.exe$ = "" ELSE IF os$ = "WIN" THEN SHELL QuotedFilename$(CHR$(34) + lastBinaryGenerated$ + CHR$(34)) + ModifyCOMMAND$ IF path.exe$ = "" THEN path.exe$ = "./" IF os$ = "LNX" THEN IF LEFT$(lastBinaryGenerated$, LEN(path.exe$)) = path.exe$ THEN SHELL QuotedFilename$(lastBinaryGenerated$) + ModifyCOMMAND$ ELSE SHELL QuotedFilename$(path.exe$ + lastBinaryGenerated$) + ModifyCOMMAND$ END IF END IF IF path.exe$ = "./" THEN path.exe$ = "" DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL _KEYHIT = 0 END IF IF idemode THEN 'Darken fg/bg colors dummy = DarkenFGBG(0) END IF IF vWatchOn THEN sendc$ = CHR$(254) 'launch debug interface ELSE sendc$ = CHR$(6) 'ready END IF GOTO sendcommand END IF PRINT "Invalid IDE message": END ideerror: IF INSTR(idemessage$, sp$) THEN 'Something went wrong here, so let's give a generic error message to the user. '(No error message should contain sp$ - that is, CHR$(13), when not in Debug mode) terrmsg$ = _ERRORMESSAGE$ IF terrmsg$ = "No error" THEN terrmsg$ = "Internal error" idemessage$ = "Compiler error (check for syntax errors) (" + terrmsg$ + ":" IF ERR THEN idemessage$ = idemessage$ + str2$(ERR) + "-" IF _ERRORLINE THEN idemessage$ = idemessage$ + str2$(_ERRORLINE) IF _INCLERRORLINE THEN idemessage$ = idemessage$ + "-" + _INCLERRORFILE$ + "-" + str2$(_INCLERRORLINE) idemessage$ = idemessage$ + ")" IF inclevel > 0 THEN idemessage$ = idemessage$ + incerror$ END IF sendc$ = CHR$(8) + idemessage$ + MKL$(ideerrorline) GOTO sendcommand noide: IF (qb64versionprinted = 0 OR ConsoleMode = 0) AND NOT QuietMode THEN qb64versionprinted = -1 PRINT "QB64-PE Compiler V" + Version$ END IF IF CMDLineFile = "" THEN LINE INPUT ; "COMPILE (.bas)>", f$ ELSE f$ = CMDLineFile END IF f$ = LTRIM$(RTRIM$(f$)) IF FileHasExtension(f$) = 0 THEN f$ = f$ + ".bas" sourcefile$ = f$ CMDLineFile = sourcefile$ 'derive name from sourcefile f$ = RemoveFileExtension$(f$) path.exe$ = "" currentdir$ = _CWD$ path.source$ = getfilepath$(sourcefile$) IF LEN(path.source$) THEN IF _DIREXISTS(path.source$) = 0 THEN PRINT PRINT "Cannot locate source file: " + sourcefile$ IF ConsoleMode THEN SYSTEM 1 END 1 END IF CHDIR path.source$ path.source$ = _CWD$ IF RIGHT$(path.source$, 1) <> pathsep$ THEN path.source$ = path.source$ + pathsep$ CHDIR currentdir$ END IF IF SaveExeWithSource THEN path.exe$ = path.source$ FOR x = LEN(f$) TO 1 STEP -1 a$ = MID$(f$, x, 1) IF a$ = "/" OR a$ = "\" THEN f$ = RIGHT$(f$, LEN(f$) - x) EXIT FOR END IF NEXT file$ = f$ 'if cmemlist(currentid+1)<>0 before calling regid the variable 'MUST be defined in cmem! fullrecompile: IF idemode = 0 AND NOT QuietMode THEN PRINT PRINT "Beginning C++ output from QB64 code... " END IF BU_DEPENDENCY_CONSOLE_ONLY = DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) FOR i = 1 TO UBOUND(DEPENDENCY): DEPENDENCY(i) = 0: NEXT DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) = BU_DEPENDENCY_CONSOLE_ONLY AND 2 'Restore -g switch if used Error_Happened = 0 FOR closeall = 1 TO 255: CLOSE closeall: NEXT OPEN tmpdir$ + "temp.bin" FOR OUTPUT LOCK WRITE AS #26 'relock bh = OpenBuffer%("O", tmpdir$ + "dyninfo.txt") IF Debug THEN CLOSE #9: OPEN tmpdir$ + "debug.txt" FOR OUTPUT AS #9 FOR i = 1 TO ids_max + 1 arrayelementslist(i) = 0 cmemlist(i) = 0 sfcmemargs(i) = "" NEXT 'erase cmemlist 'erase sfcmemargs lastunresolved = -1 'first pass sflistn = -1 'no entries SubNameLabels = sp 'QB64 will perform a repass to resolve sub names used as labels vWatchDesiredState = 0 vWatchRecompileAttempts = 0 qb64prefix_set_desiredState = 0 qb64prefix_set_recompileAttempts = 0 opex_desiredState = 0 opex_recompileAttempts = 0 opexarray_desiredState = 0 opexarray_recompileAttempts = 0 recompile: vWatchOn = vWatchDesiredState vWatchVariable "", -1 'reset internal variables list qb64prefix_set = qb64prefix_set_desiredState qb64prefix$ = "_" optionexplicit = opex_desiredState IF optionexplicit_cmd = -1 AND NoIDEMode = 1 THEN optionexplicit = -1 optionexplicitarray = opexarray_desiredState lastLineReturn = 0 lastLine = 0 firstLine = 1 Resize = 0 Resize_Scale = 0 UseGL = 0 Error_Happened = 0 HashClear 'clear the hash table 'add reserved words to hashtable f = HASHFLAG_TYPE + HASHFLAG_RESERVED HashAdd "_UNSIGNED", f, 0 HashAdd "_BIT", f, 0 HashAdd "_BYTE", f, 0 HashAdd "INTEGER", f, 0 HashAdd "LONG", f, 0 HashAdd "_INTEGER64", f, 0 HashAdd "_OFFSET", f, 0 HashAdd "SINGLE", f, 0 HashAdd "DOUBLE", f, 0 HashAdd "_FLOAT", f, 0 HashAdd "STRING", f, 0 HashAdd "ANY", f, 0 f = HASHFLAG_OPERATOR + HASHFLAG_RESERVED HashAdd "NOT", f, 0 HashAdd "IMP", f, 0 HashAdd "EQV", f, 0 HashAdd "AND", f, 0 HashAdd "OR", f, 0 HashAdd "XOR", f, 0 HashAdd "MOD", f, 0 f = HASHFLAG_RESERVED + HASHFLAG_CUSTOMSYNTAX HashAdd "LIST", f, 0 HashAdd "BASE", f, 0 HashAdd "_EXPLICIT", f, 0 HashAdd "AS", f, 0 HashAdd "IS", f, 0 HashAdd "OFF", f, 0 HashAdd "ON", f, 0 HashAdd "STOP", f, 0 HashAdd "TO", f, 0 HashAdd "USING", f, 0 'PUT(graphics) statement: HashAdd "PRESET", f, 0 HashAdd "PSET", f, 0 'OPEN statement: HashAdd "FOR", f, 0 HashAdd "OUTPUT", f, 0 HashAdd "RANDOM", f, 0 HashAdd "BINARY", f, 0 HashAdd "APPEND", f, 0 HashAdd "SHARED", f, 0 HashAdd "ACCESS", f, 0 HashAdd "LOCK", f, 0 HashAdd "READ", f, 0 HashAdd "WRITE", f, 0 'LINE statement: HashAdd "STEP", f, 0 'WIDTH statement: HashAdd "LPRINT", f, 0 'VIEW statement: HashAdd "PRINT", f, 0 f = HASHFLAG_RESERVED + HASHFLAG_XELEMENTNAME + HASHFLAG_XTYPENAME 'A 'B 'C HashAdd "COMMON", f, 0 HashAdd "CALL", f, 0 HashAdd "CASE", f - HASHFLAG_XELEMENTNAME, 0 HashAdd "COM", f, 0 '(ON...) HashAdd "CONST", f, 0 'D HashAdd "DATA", f, 0 HashAdd "DECLARE", f, 0 HashAdd "DEF", f, 0 HashAdd "DEFDBL", f, 0 HashAdd "DEFINT", f, 0 HashAdd "DEFLNG", f, 0 HashAdd "DEFSNG", f, 0 HashAdd "DEFSTR", f, 0 HashAdd "DIM", f, 0 HashAdd "DO", f - HASHFLAG_XELEMENTNAME, 0 'E HashAdd "ERROR", f - HASHFLAG_XELEMENTNAME, 0 '(ON ...) HashAdd "ELSE", f, 0 HashAdd "ELSEIF", f, 0 HashAdd "ENDIF", f, 0 HashAdd "EXIT", f - HASHFLAG_XELEMENTNAME, 0 'F HashAdd "FIELD", f - HASHFLAG_XELEMENTNAME, 0 HashAdd "FUNCTION", f, 0 'G HashAdd "GOSUB", f, 0 HashAdd "GOTO", f, 0 'H 'I HashAdd "INPUT", f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, 0 '(INPUT$ function exists, so conflicts if allowed as custom syntax) HashAdd "IF", f, 0 'K HashAdd "KEY", f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, 0 '(ON...) 'L HashAdd "LET", f - HASHFLAG_XELEMENTNAME, 0 HashAdd "LOOP", f - HASHFLAG_XELEMENTNAME, 0 HashAdd "LEN", f - HASHFLAG_XELEMENTNAME, 0 '(LEN function exists, so conflicts if allowed as custom syntax) 'M 'N HashAdd "NEXT", f - HASHFLAG_XELEMENTNAME, 0 'O 'P HashAdd "PLAY", f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, 0 '(ON...) HashAdd "PEN", f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, 0 '(ON...) 'Q 'R HashAdd "REDIM", f, 0 HashAdd "REM", f, 0 HashAdd "RESTORE", f - HASHFLAG_XELEMENTNAME, 0 HashAdd "RESUME", f - HASHFLAG_XELEMENTNAME, 0 HashAdd "RETURN", f - HASHFLAG_XELEMENTNAME, 0 HashAdd "RUN", f - HASHFLAG_XELEMENTNAME, 0 'S HashAdd "STATIC", f, 0 HashAdd "STRIG", f, 0 '(ON...) HashAdd "SEG", f, 0 HashAdd "SELECT", f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, 0 HashAdd "SUB", f, 0 HashAdd "SCREEN", f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, 0 'T HashAdd "THEN", f, 0 HashAdd "TIMER", f - HASHFLAG_XELEMENTNAME - HASHFLAG_XTYPENAME, 0 '(ON...) HashAdd "TYPE", f - HASHFLAG_XELEMENTNAME, 0 'U HashAdd "UNTIL", f, 0 HashAdd "UEVENT", f, 0 'V 'W HashAdd "WEND", f, 0 HashAdd "WHILE", f, 0 'X 'Y 'Z 'clear/init variables Console = 0 ScreenHide = 0 Asserts = 0 ResolveStaticFunctions = 0 dynamiclibrary = 0 dimsfarray = 0 dimstatic = 0 AllowLocalName = 0 PossibleSubNameLabels = sp 'QB64 will perform a repass to resolve sub names used as labels use_global_byte_elements = 0 dimshared = 0: dimmethod = 0: dimoption = 0: redimoption = 0: commonoption = 0 mylib$ = "": mylibopt$ = "" declaringlibrary = 0 nLabels = 0 dynscope = 0 elsefollowup = 0 ontimerid = 0: onkeyid = 0: onstrigid = 0 commonarraylist = "": commonarraylistn = 0 staticarraylist = "": staticarraylistn = 0 fooindwel = 0 layout = "" layoutok = 0 NoChecks = 0 inclevel = 0 errorLineInInclude = 0 addmetainclude$ = "" nextrunlineindex = 1 lasttype = 0 lasttypeelement = 0 REDIM SHARED udtxname(1000) AS STRING * 256 REDIM SHARED udtxcname(1000) AS STRING * 256 REDIM SHARED udtxsize(1000) AS LONG REDIM SHARED udtxbytealign(1000) AS INTEGER 'first element MUST be on a byte alignment & size is a multiple of 8 REDIM SHARED udtxnext(1000) AS LONG REDIM SHARED udtxvariable(1000) AS INTEGER 'true if the udt contains variable length elements 'elements REDIM SHARED udtename(1000) AS STRING * 256 REDIM SHARED udtecname(1000) AS STRING * 256 REDIM SHARED udtebytealign(1000) AS INTEGER REDIM SHARED udtesize(1000) AS LONG REDIM SHARED udtetype(1000) AS LONG REDIM SHARED udtetypesize(1000) AS LONG REDIM SHARED udtearrayelements(1000) AS LONG REDIM SHARED udtenext(1000) AS LONG definingtype = 0 definingtypeerror = 0 constlast = -1 'constlastshared = -1 closedmain = 0 addmetastatic = 0 addmetadynamic = 0 DynamicMode = 0 optionbase = 0 ExeIconSet = 0 VersionInfoSet = 0 viFileVersionNum$ = "": viProductVersionNum$ = "": viCompanyName$ = "" viFileDescription$ = "": viFileVersion$ = "": viInternalName$ = "" viLegalCopyright$ = "": viLegalTrademarks$ = "": viOriginalFilename$ = "" viProductName$ = "": viProductVersion$ = "": viComments$ = "": viWeb$ = "" DataOffset = 0 statementn = 0 everycasenewcase = 0 qberrorhappened = 0: qberrorcode = 0: qberrorline = 0 FOR i = 1 TO 27: defineaz(i) = "SINGLE": defineextaz(i) = "!": NEXT controllevel = 0 findidsecondarg$ = "": findanotherid = 0: findidinternal = 0: currentid = 0 linenumber = 0 wholeline$ = "" linefragment$ = "" idn = 0 arrayprocessinghappened = 0 stringprocessinghappened = 0 inputfunctioncalled = 0 subfuncn = 0 closedsubfunc = 0 subfunc = "" SelectCaseCounter = 0 ExecCounter = 0 UserDefineCount = 7 totalVariablesCreated = 0 typeDefinitions$ = "" totalMainVariablesCreated = 0 REDIM SHARED usedVariableList(1000) AS usedVarList totalWarnings = 0 duplicateConstWarning = 0 emptySCWarning = 0 warningListItems = 0 lastWarningHeader = "" vWatchUsedLabels = SPACE$(1000) vWatchUsedSkipLabels = SPACE$(1000) firstLineNumberLabelvWatch = 0 REDIM SHARED warning$(1000) REDIM SHARED warningLines(1000) AS LONG REDIM SHARED warningIncLines(1000) AS LONG REDIM SHARED warningIncFiles(1000) AS STRING maxLineNumber = 0 uniquenumbern = 0 ''create a type for storing memory blocks ''UDT ''names 'DIM SHARED lasttype AS LONG 'DIM SHARED udtxname(1000) AS STRING * 256 'DIM SHARED udtxcname(1000) AS STRING * 256 'DIM SHARED udtxsize(1000) AS LONG 'DIM SHARED udtxbytealign(1000) AS INTEGER 'first element MUST be on a byte alignment & size is a multiple of 8 'DIM SHARED udtxnext(1000) AS LONG ''elements 'DIM SHARED lasttypeelement AS LONG 'DIM SHARED udtename(1000) AS STRING * 256 'DIM SHARED udtecname(1000) AS STRING * 256 'DIM SHARED udtebytealign(1000) AS INTEGER 'DIM SHARED udtesize(1000) AS LONG 'DIM SHARED udtetype(1000) AS LONG 'DIM SHARED udtetypesize(1000) AS LONG 'DIM SHARED udtearrayelements(1000) AS LONG 'DIM SHARED udtenext(1000) AS LONG 'import _MEM type ptrsz = OS_BITS \ 8 lasttype = lasttype + 1: i = lasttype udtxname(i) = "_MEM" udtxcname(i) = "_MEM" udtxsize(i) = ((ptrsz) * 5 + (4) * 2 + (8) * 1) * 8 udtxbytealign(i) = 1 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "OFFSET" udtecname(i2) = "OFFSET" udtebytealign(i2) = 1 udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * 8 udtetypesize(i2) = 0 'tsize udtxnext(i) = i2 i3 = i2 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "SIZE" udtecname(i2) = "SIZE" udtebytealign(i2) = 1 udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * 8 udtetypesize(i2) = 0 'tsize udtenext(i3) = i2 i3 = i2 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "$_LOCK_ID" udtecname(i2) = "$_LOCK_ID" udtebytealign(i2) = 1 udtetype(i2) = INTEGER64TYPE: udtesize(i2) = 64 udtetypesize(i2) = 0 'tsize udtenext(i3) = i2 i3 = i2 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "$_LOCK_OFFSET" udtecname(i2) = "$_LOCK_OFFSET" udtebytealign(i2) = 1 udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * 8 udtetypesize(i2) = 0 'tsize udtenext(i3) = i2 i3 = i2 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "TYPE" udtecname(i2) = "TYPE" udtebytealign(i2) = 1 udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * 8 udtetypesize(i2) = 0 'tsize udtenext(i3) = i2 i3 = i2 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "ELEMENTSIZE" udtecname(i2) = "ELEMENTSIZE" udtebytealign(i2) = 1 udtetype(i2) = OFFSETTYPE: udtesize(i2) = ptrsz * 8 udtetypesize(i2) = 0 'tsize udtenext(i3) = i2 udtenext(i2) = 0 i3 = i2 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "IMAGE" udtecname(i2) = "IMAGE" udtebytealign(i2) = 1 udtetype(i2) = LONGTYPE: udtesize(i2) = 32 udtetypesize(i2) = 0 'tsize udtenext(i3) = i2 udtenext(i2) = 0 i3 = i2 lasttypeelement = lasttypeelement + 1: i2 = lasttypeelement udtename(i2) = "SOUND" udtecname(i2) = "SOUND" udtebytealign(i2) = 1 udtetype(i2) = LONGTYPE: udtesize(i2) = 32 udtetypesize(i2) = 0 'tsize udtenext(i3) = i2 udtenext(i2) = 0 ' Reset all unstable flags FOR i = 1 TO UBOUND(unstableFlags): unstableFlags(i) = 0: NEXT ' Indicates if a MIDI sound font was selected ' ' Captures both the line number and line contents for error reporting later-on ' in the compilation process MidiSoundFontSet = 0 MidiSoundFontLine$ = "" ' If MidiSoundFont$ is blank, then the default is used MidiSoundFont$ = "" 'begin compilation FOR closeall = 1 TO 255: CLOSE closeall: NEXT OPEN tmpdir$ + "temp.bin" FOR OUTPUT LOCK WRITE AS #26 'relock bh = OpenBuffer%("O", tmpdir$ + "icon.rc") IF Debug THEN CLOSE #9: OPEN tmpdir$ + "debug.txt" FOR APPEND AS #9 IF idemode = 0 THEN qberrorhappened = -1 OPEN sourcefile$ FOR INPUT AS #1 qberrorhappened1: IF qberrorhappened = 1 THEN PRINT PRINT "Cannot locate source file: " + sourcefile$ IF ConsoleMode THEN SYSTEM 1 END 1 ELSE CLOSE #1 END IF qberrorhappened = 0 END IF reginternal IF qb64prefix_set THEN qb64prefix$ = "" 're-add internal keywords without the "_" prefix reginternal f = HASHFLAG_TYPE + HASHFLAG_RESERVED HashAdd "UNSIGNED", f, 0 HashAdd "BIT", f, 0 HashAdd "BYTE", f, 0 HashAdd "INTEGER64", f, 0 HashAdd "OFFSET", f, 0 HashAdd "FLOAT", f, 0 f = HASHFLAG_RESERVED + HASHFLAG_CUSTOMSYNTAX HashAdd "EXPLICIT", f, 0 END IF DIM SHARED GlobTxtBuf: GlobTxtBuf = OpenBuffer%("O", tmpdir$ + "global.txt") defdatahandle = GlobTxtBuf IF iderecompile THEN iderecompile = 0 idepass = 1 'prepass must be done again sendc$ = CHR$(7) 'repass request GOTO sendcommand END IF IF idemode THEN GOTO ideret1 lineinput3load sourcefile$ DO '### STEVE EDIT FOR CONST EXPANSION 10/11/2013 wholeline$ = lineinput3$ IF wholeline$ = CHR$(13) THEN EXIT DO ideprepass: prepassLastLine: IF lastLine <> 0 OR firstLine <> 0 THEN lineBackup$ = wholeline$ 'backup the real line (will be blank when lastline is set) forceIncludeFromRoot$ = "" IF vWatchOn THEN addingvWatch = 1 IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bi" IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bm" ELSE 'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bi" IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bm" END IF firstLine = 0: lastLine = 0 IF LEN(forceIncludeFromRoot$) THEN GOTO forceInclude_prepass forceIncludeCompleted_prepass: addingvWatch = 0 wholeline$ = lineBackup$ END IF wholestv$ = wholeline$ '### STEVE EDIT FOR CONST EXPANSION 10/11/2013 prepass = 1 layout = "" layoutok = 0 linenumber = linenumber + 1 reallinenumber = reallinenumber + 1 DO UNTIL linenumber < UBOUND(InValidLine) 'color information flag for each line REDIM _PRESERVE InValidLine(UBOUND(InValidLine) + 1000) AS _BYTE LOOP InValidLine(linenumber) = 0 IF LEN(wholeline$) THEN IF UCASE$(_TRIM$(wholeline$)) = "$NOPREFIX" THEN qb64prefix_set_desiredState = 1 IF qb64prefix_set = 0 THEN IF qb64prefix_set_recompileAttempts = 0 THEN qb64prefix_set_recompileAttempts = qb64prefix_set_recompileAttempts + 1 GOTO do_recompile END IF END IF END IF wholeline$ = lineformat(wholeline$) IF Error_Happened THEN GOTO errmes temp$ = LTRIM$(RTRIM$(UCASE$(wholestv$))) IF temp$ = "$COLOR:0" THEN IF qb64prefix_set THEN addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0_noprefix.bi" ELSE addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0.bi" END IF GOTO finishedlinepp END IF IF temp$ = "$COLOR:32" THEN IF qb64prefix_set THEN addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32_noprefix.bi" ELSE addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32.bi" END IF GOTO finishedlinepp END IF IF temp$ = "$DEBUG" THEN vWatchDesiredState = 1 IF vWatchOn = 0 THEN IF vWatchRecompileAttempts = 0 THEN 'this is the first time a conflict has occurred, so react immediately with a full recompilation using the desired state vWatchRecompileAttempts = vWatchRecompileAttempts + 1 GOTO do_recompile ELSE 'continue compilation to retrieve the final state requested and act on that as required END IF END IF END IF IF LEFT$(temp$, 4) = "$IF " THEN IF RIGHT$(temp$, 5) <> " THEN" THEN a$ = "$IF without THEN": GOTO errmes temp$ = LTRIM$(MID$(temp$, 4)) 'strip off the $IF and extra spaces temp$ = RTRIM$(LEFT$(temp$, LEN(temp$) - 4)) 'and strip off the THEN and extra spaces temp = INSTR(temp$, "=") ExecCounter = ExecCounter + 1 ExecLevel(ExecCounter) = -1 'default to a skip value DefineElse(ExecCounter) = 1 '1 says we have an $IF statement at this level result = EvalPreIF(temp$, a$) IF a$ <> "" THEN GOTO errmes IF result <> 0 THEN ExecLevel(ExecCounter) = ExecLevel(ExecCounter - 1) 'So we inherit the execlevel from above IF ExecLevel(ExecCounter) = 0 THEN DefineElse(ExecCounter) = DefineElse(ExecCounter) OR 4 'Else if used and conditon found END IF GOTO finishedlinepp 'and then we're finished -- and at this point we didn't make a match so we exit with a DONT READ type flag on our code. END IF IF temp$ = "$ELSE" THEN IF DefineElse(ExecCounter) = 0 THEN a$ = "$ELSE without $IF": GOTO errmes IF DefineElse(ExecCounter) AND 2 THEN a$ = "$IF block already has $ELSE statement in it": GOTO errmes DefineElse(ExecCounter) = DefineElse(ExecCounter) OR 2 'set the flag to declare an $ELSE already in this block IF DefineElse(ExecCounter) AND 4 THEN 'If we executed code in a previous IF or ELSE IF statement, we can't do it here ExecLevel(ExecCounter) = -1 'So we inherit the execlevel from above ELSE ExecLevel(ExecCounter) = ExecLevel(ExecCounter - 1) 'If we were processing code before, code after this segment is going to be SKIPPED END IF GOTO finishedlinepp END IF IF LEFT$(temp$, 5) = "$ELSE" THEN 'looking for $ELSE IF temp$ = LTRIM$(MID$(temp$, 6)) IF LEFT$(temp$, 3) = "IF " THEN IF DefineElse(ExecCounter) = 0 THEN a$ = "$ELSE IF without $IF": GOTO errmes IF DefineElse(ExecCounter) AND 2 THEN a$ = "$ELSE IF cannot follow $ELSE": GOTO errmes IF RIGHT$(temp$, 5) <> " THEN" THEN a$ = "$ELSE IF without THEN": GOTO errmes IF DefineElse(ExecCounter) AND 4 THEN 'If we executed code in a previous IF or ELSE IF statement, we can't do it here ExecLevel(ExecCounter) = -1 GOTO finishedlinepp END IF temp$ = LTRIM$(MID$(temp$, 3)) 'strip off the IF and extra spaces temp$ = RTRIM$(LEFT$(temp$, LEN(temp$) - 4)) 'and strip off the THEN and extra spaces result = EvalPreIF(temp$, a$) IF a$ <> "" THEN GOTO errmes IF result <> 0 THEN ExecLevel(ExecCounter) = ExecLevel(ExecCounter - 1) 'So we inherit the execlevel from above IF ExecLevel(ExecCounter) = 0 THEN DefineElse(ExecCounter) = DefineElse(ExecCounter) OR 4 'Else if used and conditon found END IF GOTO finishedlinepp 'and then we're finished -- and at this point we didn't make a match so we exit with a DONT READ type flag on our code. END IF END IF IF temp$ = "$END IF" OR temp$ = "$ENDIF" THEN IF DefineElse(ExecCounter) = 0 THEN a$ = "$END IF without $IF": GOTO errmes DefineElse(ExecCounter) = 0 'We no longer have an $IF block at this level ExecCounter = ExecCounter - 1 GOTO finishedlinepp END IF IF ExecLevel(ExecCounter) THEN DO UNTIL linenumber < UBOUND(InValidLine) REDIM _PRESERVE InValidLine(UBOUND(InValidLine) + 1000) AS _BYTE LOOP InValidLine(linenumber) = -1 GOTO finishedlinepp 'we don't check for anything inside lines that we've marked for skipping END IF IF LEFT$(temp$, 7) = "$ERROR " THEN temp$ = LTRIM$(MID$(temp$, 7)) a$ = "Compilation check failed: " + temp$ GOTO errmes END IF IF LEFT$(temp$, 5) = "$LET " THEN temp$ = LTRIM$(MID$(temp$, 5)) 'simply shorten our string to parse 'For starters, let's make certain that we have 3 elements to deal with temp = INSTR(temp$, "=") 'without an = in there, we can't get a value from the left and right side IF temp = 0 THEN a$ = "Invalid Syntax. $LET <flag> = <value>": GOTO errmes l$ = RTRIM$(LEFT$(temp$, temp - 1)): r$ = LTRIM$(MID$(temp$, temp + 1)) 'then validate to make certain the left side looks proper IF validname(l$) = 0 THEN a$ = "Invalid flag name": GOTO errmes IF LEFT$(r$, 1) = CHR$(34) THEN r$ = LTRIM$(MID$(r$, 2)) IF RIGHT$(r$, 1) = CHR$(34) THEN r$ = RTRIM$(LEFT$(r$, LEN(r$) - 1)) IF LEFT$(r$, 1) = "-" THEN r1$ = "-" r$ = LTRIM$(MID$(r$, 2)) ELSE r1$ = "" END IF 'then validate to make certain the left side looks proper FOR i = 1 TO LEN(r$) a = ASC(r$, i) SELECT CASE a CASE 32 CASE 46 'periods are fine. r1$ = r1$ + "." CASE IS < 48, IS > 90 a$ = "Invalid value": GOTO errmes CASE ELSE r1$ = r1$ + CHR$(a) END SELECT NEXT r$ = r1$ 'First look to see if we have an existing setting like this and if so, update it FOR i = 8 TO UserDefineCount 'UserDefineCount 1-7 are reserved for automatic OS/BIT detection & version IF UserDefine(0, i) = l$ THEN UserDefine(1, i) = r$: GOTO finishedlinepp NEXT 'Otherwise create a new setting and set the initial value for it UserDefineCount = UserDefineCount + 1 IF UserDefineCount > UBOUND(UserDefine, 2) THEN REDIM _PRESERVE UserDefine(1, UBOUND(UserDefine, 2) + 10) 'Add another 10 elements to the array so it'll expand as the user adds to it END IF UserDefine(0, UserDefineCount) = l$ UserDefine(1, UserDefineCount) = r$ GOTO finishedlinepp END IF ' We check for Unstable flags during the preprocessing step because it ' impacts what valid commands there are in all the other steps IF LEFT$(temp$, 10) = "$UNSTABLE:" THEN token$ = UCASE$(LTRIM$(RTRIM$(MID$(temp$, 11)))) SELECT CASE token$ CASE "MIDI" IF NOT UseMiniaudioBackend THEN a$ = "Midi is not supported with the old OpenAL audio backend." GOTO errmes END IF unstableFlags(UNSTABLE_MIDI) = -1 CASE "HTTP" unstableFlags(UNSTABLE_HTTP) = -1 regUnstableHttp CASE ELSE a$ = "Unrecognized unstable flag " + AddQuotes$(token$) GOTO errmes END SELECT END IF cwholeline$ = wholeline$ wholeline$ = eleucase$(wholeline$) '********REMOVE THIS LINE LATER******** addmetadynamic = 0: addmetastatic = 0 wholelinen = numelements(wholeline$) IF wholelinen THEN wholelinei = 1 'skip line number? e$ = getelement$(wholeline$, 1) IF (ASC(e$) >= 48 AND ASC(e$) <= 59) OR ASC(e$) = 46 THEN wholelinei = 2: GOTO ppskpl 'skip 'POSSIBLE' line label? IF wholelinen >= 2 THEN x2 = INSTR(wholeline$, sp + ":" + sp): x3 = x2 + 2 IF x2 = 0 THEN IF RIGHT$(wholeline$, 2) = sp + ":" THEN x2 = LEN(wholeline$) - 1: x3 = x2 + 1 END IF IF x2 THEN e$ = LEFT$(wholeline$, x2 - 1) IF validlabel(e$) THEN wholeline$ = RIGHT$(wholeline$, LEN(wholeline$) - x3) cwholeline$ = RIGHT$(cwholeline$, LEN(wholeline$) - x3) wholelinen = numelements(wholeline$) GOTO ppskpl END IF 'valid END IF 'includes ":" END IF 'wholelinen>=2 ppskpl: IF wholelinei <= wholelinen THEN '---------------------------------------- a$ = "" ca$ = "" ppblda: e$ = getelement$(wholeline$, wholelinei) ce$ = getelement$(cwholeline$, wholelinei) IF e$ = ":" OR e$ = "ELSE" OR e$ = "THEN" OR e$ = "" THEN IF LEN(a$) THEN IF Debug THEN PRINT #9, "PP[" + a$ + "]" n = numelements(a$) firstelement$ = getelement(a$, 1) secondelement$ = getelement(a$, 2) thirdelement$ = getelement(a$, 3) '======================================== IF n = 2 AND firstelement$ = "END" AND (secondelement$ = "SUB" OR secondelement$ = "FUNCTION") THEN closedsubfunc = -1 END IF 'declare library IF declaringlibrary THEN IF firstelement$ = "END" THEN IF n <> 2 OR secondelement$ <> "DECLARE" THEN a$ = "Expected END DECLARE": GOTO errmes declaringlibrary = 0 GOTO finishedlinepp END IF 'end declare declaringlibrary = 2 IF firstelement$ = "SUB" OR firstelement$ = "FUNCTION" THEN subfuncn = subfuncn - 1: GOTO declaresubfunc a$ = "Expected SUB/FUNCTION definition or END DECLARE (#2)": GOTO errmes END IF 'UDT TYPE definition IF definingtype THEN i = definingtype IF n >= 1 THEN IF firstelement$ = "END" THEN IF n <> 2 OR secondelement$ <> "TYPE" THEN a$ = "Expected END TYPE": GOTO errmes IF udtxnext(i) = 0 THEN a$ = "No elements defined in TYPE": GOTO errmes definingtype = 0 'create global buffer for SWAP space siz$ = str2$(udtxsize(i) \ 8) WriteBufLine GlobTxtBuf, "char *g_tmp_udt_" + RTRIM$(udtxname(i)) + "=(char*)malloc(" + siz$ + ");" 'print "END TYPE";udtxsize(i);udtxbytealign(i) GOTO finishedlinepp END IF END IF IF n < 3 THEN a$ = "Expected element-name AS type, AS type element-list, or END TYPE": GOTO errmes n$ = firstelement$ IF n$ <> "AS" THEN 'traditional variable-name AS type syntax, single-element lasttypeelement = lasttypeelement + 1 i2 = lasttypeelement WHILE i2 > UBOUND(udtenext): increaseUDTArrays: WEND udtenext(i2) = 0 ii = 2 udtearrayelements(i2) = 0 IF ii >= n OR getelement$(a$, ii) <> "AS" THEN a$ = "Expected element-name AS type, AS type element-list, or END TYPE": GOTO errmes t$ = getelements$(a$, ii + 1, n) IF t$ = RTRIM$(udtxname(definingtype)) THEN a$ = "Invalid self-reference": GOTO errmes typ = typname2typ(t$) IF Error_Happened THEN GOTO errmes IF typ = 0 THEN a$ = "Undefined type": GOTO errmes typsize = typname2typsize IF validname(n$) = 0 THEN a$ = "Invalid name": GOTO errmes udtename(i2) = n$ udtecname(i2) = getelement$(ca$, 1) NormalTypeBlock: typeDefinitions$ = typeDefinitions$ + MKL$(i2) + MKL$(LEN(n$)) + n$ udtetype(i2) = typ udtetypesize(i2) = typsize hashname$ = n$ 'check for name conflicts (any similar reserved or element from current UDT) hashchkflags = HASHFLAG_RESERVED + HASHFLAG_UDTELEMENT hashres = HashFind(hashname$, hashchkflags, hashresflags, hashresref) DO WHILE hashres IF hashresflags AND HASHFLAG_UDTELEMENT THEN IF hashresref = i THEN a$ = "Name already in use (" + hashname$ + ")": GOTO errmes END IF IF hashresflags AND HASHFLAG_RESERVED THEN IF hashresflags AND (HASHFLAG_TYPE + HASHFLAG_CUSTOMSYNTAX + HASHFLAG_OPERATOR + HASHFLAG_XELEMENTNAME) THEN a$ = "Name already in use (" + hashname$ + ")": GOTO errmes END IF IF hashres <> 1 THEN hashres = HashFindCont(hashresflags, hashresref) ELSE hashres = 0 LOOP 'add to hash table HashAdd hashname$, HASHFLAG_UDTELEMENT, i 'Calculate element's size IF typ AND ISUDT THEN u = typ AND 511 udtesize(i2) = udtxsize(u) IF udtxbytealign(u) THEN udtxbytealign(i) = 1: udtebytealign(i2) = 1 IF udtxvariable(u) THEN udtxvariable(i) = -1 ELSE IF (typ AND ISSTRING) THEN IF (typ AND ISFIXEDLENGTH) = 0 THEN udtesize(i2) = OFFSETTYPE AND 511 udtxvariable(i) = -1 ELSE udtesize(i2) = typsize * 8 END IF udtxbytealign(i) = 1: udtebytealign(i2) = 1 ELSE udtesize(i2) = typ AND 511 IF (typ AND ISOFFSETINBITS) = 0 THEN udtxbytealign(i) = 1: udtebytealign(i2) = 1 END IF END IF 'Increase block size IF udtebytealign(i2) THEN IF udtxsize(i) MOD 8 THEN udtxsize(i) = udtxsize(i) + (8 - (udtxsize(i) MOD 8)) END IF END IF udtxsize(i) = udtxsize(i) + udtesize(i2) 'Link element to previous element IF udtxnext(i) = 0 THEN udtxnext(i) = i2 ELSE udtenext(i2 - 1) = i2 END IF 'print "+"+rtrim$(udtename(i2));udtetype(i2);udtesize(i2);udtebytealign(i2);udtxsize(i) IF newAsTypeBlockSyntax THEN RETURN GOTO finishedlinepp ELSE 'new AS type variable-list syntax, multiple elements ii = 2 IF ii >= n THEN a$ = "Expected element-name AS type, AS type element-list, or END TYPE": GOTO errmes previousElement$ = "" t$ = "" lastElement$ = "" buildTypeName: lastElement$ = getelement$(a$, ii) IF lastElement$ <> "," AND lastElement$ <> "" THEN n$ = lastElement$ cn$ = getelement$(ca$, ii) IF LEN(previousElement$) THEN t$ = t$ + previousElement$ + " " previousElement$ = n$ lastElement$ = "" ii = ii + 1 GOTO buildTypeName END IF t$ = RTRIM$(t$) IF t$ = RTRIM$(udtxname(definingtype)) THEN a$ = "Invalid self-reference": GOTO errmes typ = typname2typ(t$) IF Error_Happened THEN GOTO errmes IF typ = 0 THEN a$ = "Undefined type": GOTO errmes typsize = typname2typsize previousElement$ = lastElement$ nexttypeelement: lasttypeelement = lasttypeelement + 1 i2 = lasttypeelement WHILE i2 > UBOUND(udtenext): increaseUDTArrays: WEND udtenext(i2) = 0 udtearrayelements(i2) = 0 udtename(i2) = n$ udtecname(i2) = cn$ IF validname(n$) = 0 THEN a$ = "Invalid name": GOTO errmes newAsTypeBlockSyntax = -1 GOSUB NormalTypeBlock newAsTypeBlockSyntax = 0 getNextElement: ii = ii + 1 lastElement$ = getelement$(a$, ii) IF lastElement$ = "" THEN GOTO finishedlinepp IF ii = n AND lastElement$ = "," THEN a$ = "Expected element-name": GOTO errmes IF lastElement$ = "," THEN IF previousElement$ = "," THEN a$ = "Expected element-name": GOTO errmes previousElement$ = lastElement$ GOTO getNextElement END IF n$ = lastElement$ IF previousElement$ <> "," THEN a$ = "Expected ,": GOTO errmes previousElement$ = lastElement$ cn$ = getelement$(ca$, ii) GOTO nexttypeelement END IF END IF 'definingtype IF definingtype AND n >= 1 THEN a$ = "Expected END TYPE": GOTO errmes IF n >= 1 THEN IF firstelement$ = "TYPE" THEN IF n <> 2 THEN a$ = "Expected TYPE typename": GOTO errmes lasttype = lasttype + 1 typeDefinitions$ = typeDefinitions$ + MKL$(-1) + MKL$(lasttype) definingtype = lasttype i = definingtype WHILE i > UBOUND(udtenext): increaseUDTArrays: WEND IF validname(secondelement$) = 0 THEN a$ = "Invalid name": GOTO errmes typeDefinitions$ = typeDefinitions$ + MKL$(LEN(secondelement$)) + secondelement$ udtxname(i) = secondelement$ udtxcname(i) = getelement(ca$, 2) udtxnext(i) = 0 udtxsize(i) = 0 udtxvariable(i) = 0 hashname$ = secondelement$ hashflags = HASHFLAG_UDT 'check for name conflicts (any similar reserved/sub/function/UDT name) hashchkflags = HASHFLAG_RESERVED + HASHFLAG_SUB + HASHFLAG_FUNCTION + HASHFLAG_UDT hashres = HashFind(hashname$, hashchkflags, hashresflags, hashresref) DO WHILE hashres allow = 0 IF hashresflags AND (HASHFLAG_SUB + HASHFLAG_FUNCTION) THEN allow = 1 END IF IF hashresflags AND HASHFLAG_RESERVED THEN IF (hashresflags AND (HASHFLAG_TYPE + HASHFLAG_OPERATOR + HASHFLAG_CUSTOMSYNTAX + HASHFLAG_XTYPENAME)) = 0 THEN allow = 1 END IF IF allow = 0 THEN a$ = "Name already in use (" + hashname$ + ")": GOTO errmes IF hashres <> 1 THEN hashres = HashFindCont(hashresflags, hashresref) ELSE hashres = 0 LOOP 'add to hash table HashAdd hashname$, hashflags, i GOTO finishedlinepp END IF END IF IF n >= 1 AND firstelement$ = "CONST" THEN 'l$ = "CONST" 'DEF... do not change type, the expression is stored in a suitable type 'based on its value if type isn't forced/specified IF subfuncn > 0 AND closedsubfunc <> 0 THEN a$ = "Statement cannot be placed between SUB/FUNCTIONs": GOTO errmes 'convert periods to _046_ i2 = INSTR(a$, sp + "." + sp) IF i2 THEN DO a$ = LEFT$(a$, i2 - 1) + fix046$ + RIGHT$(a$, LEN(a$) - i2 - 2) ca$ = LEFT$(ca$, i2 - 1) + fix046$ + RIGHT$(ca$, LEN(ca$) - i2 - 2) i2 = INSTR(a$, sp + "." + sp) LOOP UNTIL i2 = 0 n = numelements(a$) firstelement$ = getelement(a$, 1): secondelement$ = getelement(a$, 2): thirdelement$ = getelement(a$, 3) END IF IF n < 3 THEN a$ = "Expected CONST name = value/expression": GOTO errmes i = 2 constdefpendingpp: pending = 0 n$ = getelement$(ca$, i): i = i + 1 typeoverride = 0 s$ = removesymbol$(n$) IF Error_Happened THEN GOTO errmes IF s$ <> "" THEN typeoverride = typname2typ(s$) IF Error_Happened THEN GOTO errmes IF typeoverride AND ISFIXEDLENGTH THEN a$ = "Invalid constant type": GOTO errmes IF typeoverride = 0 THEN a$ = "Invalid constant type": GOTO errmes END IF IF getelement$(a$, i) <> "=" THEN a$ = "Expected =": GOTO errmes i = i + 1 'get expression e$ = "" readable_e$ = "" B = 0 FOR i2 = i TO n e2$ = getelement$(ca$, i2) IF e2$ = "(" THEN B = B + 1 IF e2$ = ")" THEN B = B - 1 IF e2$ = "," AND B = 0 THEN pending = 1 i = i2 + 1 IF i > n - 2 THEN a$ = "Expected CONST ... , name = value/expression": GOTO errmes EXIT FOR END IF IF LEN(e$) = 0 THEN e$ = e2$ ELSE e$ = e$ + sp + e2$ e3$ = e2$ IF LEN(e2$) > 1 THEN IF ASC(e2$, 1) = 34 THEN removeComma = _INSTRREV(e2$, ",") e3$ = LEFT$(e2$, removeComma - 1) ELSE removeComma = INSTR(e2$, ",") e3$ = MID$(e2$, removeComma + 1) END IF END IF IF LEN(readable_e$) = 0 THEN readable_e$ = e3$ ELSE readable_e$ = readable_e$ + " " + e3$ END IF NEXT 'intercept current expression and pass it through Evaluate_Expression$ '(unless it is a literal string) IF LEFT$(readable_e$, 1) <> CHR$(34) THEN temp1$ = _TRIM$(Evaluate_Expression$(readable_e$)) IF LEFT$(temp1$, 5) <> "ERROR" AND e$ <> temp1$ THEN e$ = lineformat(temp1$) 'retrieve parseable format ELSE IF temp1$ = "ERROR - Division By Zero" THEN a$ = temp1$: GOTO errmes IF INSTR(temp1$, "Improper operations") THEN a$ = "Invalid CONST expression.14": GOTO errmes END IF END IF END IF 'Proceed as usual e$ = fixoperationorder(e$) IF Error_Happened THEN GOTO errmes e$ = evaluateconst(e$, t) IF Error_Happened THEN GOTO errmes IF t AND ISSTRING THEN 'string type IF typeoverride THEN IF (typeoverride AND ISSTRING) = 0 THEN a$ = "Type mismatch": GOTO errmes END IF ELSE 'not a string type IF typeoverride THEN IF typeoverride AND ISSTRING THEN a$ = "Type mismatch": GOTO errmes END IF IF t AND ISFLOAT THEN constval## = _CV(_FLOAT, e$) constval&& = constval## constval~&& = constval&& ELSE IF (t AND ISUNSIGNED) AND (t AND 511) = 64 THEN constval~&& = _CV(_UNSIGNED _INTEGER64, e$) constval&& = constval~&& constval## = constval&& ELSE constval&& = _CV(_INTEGER64, e$) constval## = constval&& constval~&& = constval&& END IF END IF 'override type? IF typeoverride THEN 'range check required here (noted in todo) t = typeoverride END IF END IF 'not a string type constlast = constlast + 1 IF constlast > constmax THEN constmax = constmax * 2 REDIM _PRESERVE constname(constmax) AS STRING REDIM _PRESERVE constcname(constmax) AS STRING REDIM _PRESERVE constnamesymbol(constmax) AS STRING 'optional name symbol REDIM _PRESERVE consttype(constmax) AS LONG 'variable type number REDIM _PRESERVE constinteger(constmax) AS _INTEGER64 REDIM _PRESERVE constuinteger(constmax) AS _UNSIGNED _INTEGER64 REDIM _PRESERVE constfloat(constmax) AS _FLOAT REDIM _PRESERVE conststring(constmax) AS STRING REDIM _PRESERVE constsubfunc(constmax) AS LONG REDIM _PRESERVE constdefined(constmax) AS LONG END IF i2 = constlast constsubfunc(i2) = subfuncn 'IF subfunc = "" THEN constlastshared = i2 IF validname(n$) = 0 THEN a$ = "Invalid name": GOTO errmes constname(i2) = UCASE$(n$) hashname$ = n$ 'check for name conflicts (any similar: reserved, sub, function, constant) allow = 0 const_recheck: hashchkflags = HASHFLAG_RESERVED + HASHFLAG_SUB + HASHFLAG_FUNCTION + HASHFLAG_CONSTANT hashres = HashFind(hashname$, hashchkflags, hashresflags, hashresref) DO WHILE hashres IF hashresflags AND HASHFLAG_CONSTANT THEN IF constsubfunc(hashresref) = subfuncn THEN 'If merely redefining a CONST with same value 'just issue a warning instead of an error issueWarning = 0 IF t AND ISSTRING THEN IF conststring(hashresref) = e$ THEN issueWarning = -1: thisconstval$ = e$ ELSE IF t AND ISFLOAT THEN IF constfloat(hashresref) = constval## THEN issueWarning = -1: thisconstval$ = STR$(constval##) ELSE IF t AND ISUNSIGNED THEN IF constuinteger(hashresref) = constval~&& THEN issueWarning = -1: thisconstval$ = STR$(constval~&&) ELSE IF constinteger(hashresref) = constval&& THEN issueWarning = -1: thisconstval$ = STR$(constval&&) END IF END IF END IF IF issueWarning THEN IF NOT IgnoreWarnings THEN addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "duplicate constant definition", n$ + " =" + thisconstval$ END IF GOTO constAddDone ELSE a$ = "Name already in use (" + hashname$ + ")": GOTO errmes END IF END IF END IF IF hashresflags AND HASHFLAG_RESERVED THEN a$ = "Name already in use (" + hashname$ + ")": GOTO errmes END IF IF hashresflags AND (HASHFLAG_SUB + HASHFLAG_FUNCTION) THEN IF ids(hashresref).internal_subfunc = 0 OR RTRIM$(ids(hashresref).musthave) <> "$" THEN a$ = "Name already in use (" + hashname$ + ")": GOTO errmes IF t AND ISSTRING THEN a$ = "Name already in use (" + hashname$ + ")": GOTO errmes END IF IF hashres <> 1 THEN hashres = HashFindCont(hashresflags, hashresref) ELSE hashres = 0 LOOP 'add to hash table HashAdd hashname$, HASHFLAG_CONSTANT, i2 constdefined(i2) = 1 constcname(i2) = n$ constnamesymbol(i2) = typevalue2symbol$(t) IF Error_Happened THEN GOTO errmes consttype(i2) = t IF t AND ISSTRING THEN conststring(i2) = e$ ELSE IF t AND ISFLOAT THEN constfloat(i2) = constval## ELSE IF t AND ISUNSIGNED THEN constuinteger(i2) = constval~&& ELSE constinteger(i2) = constval&& END IF END IF END IF constAddDone: IF pending THEN 'l$ = l$ + sp2 + "," GOTO constdefpendingpp END IF 'layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ GOTO finishedlinepp END IF 'DEFINE d = 0 IF firstelement$ = "DEFINT" THEN d = 1 IF firstelement$ = "DEFLNG" THEN d = 1 IF firstelement$ = "DEFSNG" THEN d = 1 IF firstelement$ = "DEFDBL" THEN d = 1 IF firstelement$ = "DEFSTR" THEN d = 1 IF firstelement$ = "_DEFINE" OR (firstelement$ = "DEFINE" AND qb64prefix_set = 1) THEN d = 1 IF d THEN predefining = 1: GOTO predefine predefined: predefining = 0 GOTO finishedlinepp END IF 'declare library IF firstelement$ = "DECLARE" THEN IF secondelement$ = "LIBRARY" OR secondelement$ = "DYNAMIC" OR secondelement$ = "CUSTOMTYPE" OR secondelement$ = "STATIC" THEN declaringlibrary = 1 indirectlibrary = 0 IF secondelement$ = "CUSTOMTYPE" OR secondelement$ = "DYNAMIC" THEN indirectlibrary = 1 GOTO finishedlinepp END IF END IF 'SUB/FUNCTION dynamiclibrary = 0 declaresubfunc: firstelement$ = getelement$(a$, 1) sf = 0 IF firstelement$ = "FUNCTION" THEN sf = 1 IF firstelement$ = "SUB" THEN sf = 2 IF sf THEN subfuncn = subfuncn + 1 closedsubfunc = 0 IF n = 1 THEN a$ = "Expected name after SUB/FUNCTION": GOTO errmes 'convert periods to _046_ i2 = INSTR(a$, sp + "." + sp) IF i2 THEN DO a$ = LEFT$(a$, i2 - 1) + fix046$ + RIGHT$(a$, LEN(a$) - i2 - 2) ca$ = LEFT$(ca$, i2 - 1) + fix046$ + RIGHT$(ca$, LEN(ca$) - i2 - 2) i2 = INSTR(a$, sp + "." + sp) LOOP UNTIL i2 = 0 n = numelements(a$) firstelement$ = getelement(a$, 1): secondelement$ = getelement(a$, 2): thirdelement$ = getelement(a$, 3) END IF n$ = getelement$(ca$, 2) symbol$ = removesymbol$(n$) IF Error_Happened THEN GOTO errmes IF sf = 2 AND symbol$ <> "" THEN a$ = "Type symbols after a SUB name are invalid": GOTO errmes 'remove STATIC (which is ignored) e$ = getelement$(a$, n): IF e$ = "STATIC" THEN a$ = LEFT$(a$, LEN(a$) - 7): ca$ = LEFT$(ca$, LEN(ca$) - 7): n = n - 1 'check for ALIAS aliasname$ = n$ 'use given name by default IF n > 2 THEN e$ = getelement$(a$, 3) IF e$ = "ALIAS" THEN IF declaringlibrary = 0 THEN a$ = "ALIAS can only be used with DECLARE LIBRARY": GOTO errmes IF n = 3 THEN a$ = "Expected ALIAS name-in-library": GOTO errmes e$ = getelement$(ca$, 4) 'strip string content (optional) IF LEFT$(e$, 1) = CHR$(34) THEN e$ = RIGHT$(e$, LEN(e$) - 1) x = INSTR(e$, CHR$(34)): IF x = 0 THEN a$ = "Expected " + CHR$(34): GOTO errmes e$ = LEFT$(e$, x - 1) END IF 'strip fix046$ (created by unquoted periods) DO WHILE INSTR(e$, fix046$) x = INSTR(e$, fix046$): e$ = LEFT$(e$, x - 1) + "." + RIGHT$(e$, LEN(e$) - x + 1 - LEN(fix046$)) LOOP 'validate alias name IF LEN(e$) = 0 THEN a$ = "Expected ALIAS name-in-library": GOTO errmes FOR x = 1 TO LEN(e$) a = ASC(e$, x) IF alphanumeric(a) = 0 AND a <> ASC_FULLSTOP AND a <> ASC_COLON THEN a$ = "Expected ALIAS name-in-library": GOTO errmes NEXT aliasname$ = e$ 'remove ALIAS section from line IF n <= 4 THEN a$ = getelements(a$, 1, 2) IF n >= 5 THEN a$ = getelements(a$, 1, 2) + sp + getelements(a$, 5, n) IF n <= 4 THEN ca$ = getelements(ca$, 1, 2) IF n >= 5 THEN ca$ = getelements(ca$, 1, 2) + sp + getelements(ca$, 5, n) n = n - 2 END IF END IF IF declaringlibrary THEN IF indirectlibrary THEN aliasname$ = n$ 'override the alias name END IF END IF params = 0 params$ = "" paramsize$ = "" nele$ = "" nelereq$ = "" IF n > 2 THEN e$ = getelement$(a$, 3) IF e$ <> "(" THEN a$ = "Expected (": GOTO errmes e$ = getelement$(a$, n) IF e$ <> ")" THEN a$ = "Expected )": GOTO errmes IF n < 4 THEN a$ = "Expected ( ... )": GOTO errmes IF n = 4 THEN GOTO nosfparams B = 0 a2$ = "" FOR i = 4 TO n - 1 e$ = getelement$(a$, i) IF e$ = "(" THEN B = B + 1 IF e$ = ")" THEN B = B - 1 IF e$ = "," AND B = 0 THEN IF i = n - 1 THEN a$ = "Expected , ... )": GOTO errmes getlastparam: IF a2$ = "" THEN a$ = "Expected ... ,": GOTO errmes a2$ = LEFT$(a2$, LEN(a2$) - 1) 'possible format: [BYVAL]a[%][(1)][AS][type] n2 = numelements(a2$) array = 0 t2$ = "" i2 = 1 e$ = getelement$(a2$, i2): i2 = i2 + 1 byvalue = 0 IF e$ = "BYVAL" THEN IF declaringlibrary = 0 THEN a$ = "BYVAL can currently only be used with DECLARE LIBRARY": GOTO errmes e$ = getelement$(a2$, i2): i2 = i2 + 1: byvalue = 1 END IF n2$ = e$ symbol2$ = removesymbol$(n2$) IF validname(n2$) = 0 THEN a$ = "Invalid name": GOTO errmes IF Error_Happened THEN GOTO errmes m = 0 FOR i2 = i2 TO n2 e$ = getelement$(a2$, i2) IF e$ = "(" THEN IF m <> 0 THEN a$ = "Syntax error - too many opening brackets": GOTO errmes m = 1 array = 1 GOTO gotaa END IF IF e$ = ")" THEN IF m <> 1 THEN a$ = "Syntax error - closing bracket without opening bracket": GOTO errmes m = 2 GOTO gotaa END IF IF e$ = "AS" THEN IF m <> 0 AND m <> 2 THEN a$ = "Syntax error - check your brackets": GOTO errmes m = 3 GOTO gotaa END IF IF m = 1 THEN GOTO gotaa 'ignore contents of bracket IF m <> 3 THEN a$ = "Syntax error - check your brackets": GOTO errmes IF t2$ = "" THEN t2$ = e$ ELSE t2$ = t2$ + " " + e$ gotaa: NEXT i2 params = params + 1: IF params > 100 THEN a$ = "SUB/FUNCTION exceeds 100 parameter limit": GOTO errmes argnelereq = 0 IF symbol2$ <> "" AND t2$ <> "" THEN a$ = "Syntax error - check parameter types": GOTO errmes IF t2$ = "" AND e$ = "AS" THEN a$ = "Expected AS type": GOTO errmes IF t2$ = "" THEN t2$ = symbol2$ IF t2$ = "" THEN IF LEFT$(n2$, 1) = "_" THEN v = 27 ELSE v = ASC(UCASE$(n2$)) - 64 t2$ = defineaz(v) END IF paramsize = 0 IF array = 1 THEN t = typname2typ(t2$) IF Error_Happened THEN GOTO errmes IF t = 0 THEN a$ = "Illegal SUB/FUNCTION parameter": GOTO errmes IF (t AND ISFIXEDLENGTH) THEN paramsize = typname2typsize t = t + ISARRAY 'check for recompilation override FOR i10 = 0 TO sflistn IF sfidlist(i10) = idn + 1 THEN IF sfarglist(i10) = params THEN argnelereq = sfelelist(i10) END IF END IF NEXT ELSE t = typname2typ(t2$) IF Error_Happened THEN GOTO errmes IF t = 0 THEN a$ = "Illegal SUB/FUNCTION parameter": GOTO errmes IF (t AND ISFIXEDLENGTH) THEN paramsize = typname2typsize IF byvalue THEN IF t AND ISPOINTER THEN t = t - ISPOINTER END IF END IF nelereq$ = nelereq$ + CHR$(argnelereq) 'consider changing 0 in following line too! nele$ = nele$ + CHR$(0) paramsize$ = paramsize$ + MKL$(paramsize) params$ = params$ + MKL$(t) a2$ = "" ELSE a2$ = a2$ + e$ + sp IF i = n - 1 THEN GOTO getlastparam END IF NEXT i END IF 'n>2 nosfparams: IF sf = 1 THEN 'function clearid id.n = n$ id.subfunc = 1 id.callname = "FUNC_" + UCASE$(n$) IF declaringlibrary THEN id.ccall = 1 IF indirectlibrary = 0 THEN id.callname = aliasname$ END IF id.args = params id.arg = params$ id.argsize = paramsize$ id.nele = nele$ id.nelereq = nelereq$ IF symbol$ <> "" THEN id.ret = typname2typ(symbol$) IF Error_Happened THEN GOTO errmes ELSE IF LEFT$(n$, 1) = "_" THEN v = 27 ELSE v = ASC(UCASE$(n$)) - 64 symbol$ = defineaz(v) id.ret = typname2typ(symbol$) IF Error_Happened THEN GOTO errmes END IF IF id.ret = 0 THEN a$ = "Invalid FUNCTION return type": GOTO errmes IF declaringlibrary THEN ctype$ = typ2ctyp$(id.ret, "") IF Error_Happened THEN GOTO errmes IF ctype$ = "qbs" THEN ctype$ = "char*" id.callname = "( " + ctype$ + " )" + RTRIM$(id.callname) END IF s$ = LEFT$(symbol$, 1) IF s$ <> "~" AND s$ <> "`" AND s$ <> "%" AND s$ <> "&" AND s$ <> "!" AND s$ <> "#" AND s$ <> "$" THEN symbol$ = type2symbol$(symbol$) IF Error_Happened THEN GOTO errmes END IF id.mayhave = symbol$ IF id.ret AND ISPOINTER THEN IF (id.ret AND ISSTRING) = 0 THEN id.ret = id.ret - ISPOINTER END IF regid IF Error_Happened THEN GOTO errmes ELSE 'sub clearid id.n = n$ id.subfunc = 2 id.callname = "SUB_" + UCASE$(n$) IF declaringlibrary THEN id.ccall = 1 IF indirectlibrary = 0 THEN id.callname = aliasname$ END IF id.args = params id.arg = params$ id.argsize = paramsize$ id.nele = nele$ id.nelereq = nelereq$ IF UCASE$(n$) = "_GL" AND params = 0 AND UseGL = 0 THEN reginternalsubfunc = 1: UseGL = 1: id.n = "_GL": DEPENDENCY(DEPENDENCY_GL) = 1 regid reginternalsubfunc = 0 IF Error_Happened THEN GOTO errmes END IF END IF '======================================== finishedlinepp: firstLine = 0 END IF a$ = "" ca$ = "" ELSE IF a$ = "" THEN a$ = e$: ca$ = ce$ ELSE a$ = a$ + sp + e$: ca$ = ca$ + sp + ce$ END IF IF wholelinei <= wholelinen THEN wholelinei = wholelinei + 1: GOTO ppblda '---------------------------------------- END IF 'wholelinei<=wholelinen END IF 'wholelinen END IF 'len(wholeline$) 'Include Manager #1 IF LEN(addmetainclude$) THEN IF Debug THEN PRINT #9, "Pre-pass:INCLUDE$-ing file:'" + addmetainclude$ + "':On line"; linenumber a$ = addmetainclude$: addmetainclude$ = "" 'read/clear message IF inclevel = 0 THEN includingFromRoot = 0 forceIncludingFile = 0 forceInclude_prepass: IF forceIncludeFromRoot$ <> "" THEN a$ = forceIncludeFromRoot$ forceIncludeFromRoot$ = "" forceIncludingFile = 1 includingFromRoot = 1 END IF END IF IF inclevel = 100 THEN a$ = "Too many indwelling INCLUDE files": GOTO errmes '1. Verify file exists (location is either (a)relative to source file or (b)absolute) fh = 99 + inclevel + 1 firstTryMethod = 1 IF includingFromRoot <> 0 AND inclevel = 0 THEN firstTryMethod = 2 FOR try = firstTryMethod TO 2 'if including file from root, do not attempt including from relative location IF try = 1 THEN IF inclevel = 0 THEN IF idemode THEN p$ = idepath$ + pathsep$ ELSE p$ = getfilepath$(sourcefile$) ELSE p$ = getfilepath$(incname(inclevel)) END IF f$ = p$ + a$ END IF IF try = 2 THEN f$ = a$ IF _FILEEXISTS(f$) THEN qberrorhappened = -3 'We're using the faster LINE INPUT, which requires a BINARY open. OPEN f$ FOR BINARY AS #fh 'And another line below edited qberrorhappened3: IF qberrorhappened = -3 THEN EXIT FOR END IF qberrorhappened = 0 NEXT IF qberrorhappened <> -3 THEN qberrorhappened = 0: a$ = "File " + a$ + " not found": GOTO errmes inclevel = inclevel + 1: incname$(inclevel) = f$: inclinenumber(inclevel) = 0 END IF 'fall through to next section... '-------------------- DO WHILE inclevel fh = 99 + inclevel '2. Feed next line IF EOF(fh) = 0 THEN LINE INPUT #fh, x$ wholeline$ = x$ inclinenumber(inclevel) = inclinenumber(inclevel) + 1 'create extended error string 'incerror$' errorLineInInclude = inclinenumber(inclevel) e$ = " in line " + str2(inclinenumber(inclevel)) + " of " + incname$(inclevel) + " included" IF inclevel > 1 THEN e$ = e$ + " (through " FOR x = 1 TO inclevel - 1 STEP 1 e$ = e$ + incname$(x) IF x < inclevel - 1 THEN 'a sep is req IF x = inclevel - 2 THEN e$ = e$ + " then " ELSE e$ = e$ + ", " END IF END IF NEXT e$ = e$ + ")" END IF incerror$ = e$ linenumber = linenumber - 1 'lower official linenumber to counter later increment IF Debug THEN PRINT #9, "Pre-pass:Feeding INCLUDE$ line:[" + wholeline$ + "]" IF idemode THEN sendc$ = CHR$(10) + wholeline$: GOTO sendcommand 'passback GOTO ideprepass END IF '3. Close & return control CLOSE #fh inclevel = inclevel - 1 IF forceIncludingFile = 1 AND inclevel = 0 THEN forceIncludingFile = 0 GOTO forceIncludeCompleted_prepass END IF LOOP '(end manager) IF idemode THEN GOTO ideret2 LOOP 'add final line IF lastLineReturn = 0 THEN lastLineReturn = 1 lastLine = 1 wholeline$ = "" GOTO prepassLastLine END IF IF definingtype THEN definingtype = 0 'ignore this error so that auto-formatting can be performed and catch it again later IF declaringlibrary THEN declaringlibrary = 0 'ignore this error so that auto-formatting can be performed and catch it again later totallinenumber = reallinenumber 'IF idemode = 0 AND NOT QuietMode THEN PRINT "first pass finished.": PRINT "Translating code... " 'prepass finished lineinput3index = 1 'reset input line 'ide specific ide3: addmetainclude$ = "" 'reset stray meta-includes 'reset altered variables DataOffset = 0 inclevel = 0 subfuncn = 0 lastLineReturn = 0 lastLine = 0 firstLine = 1 UserDefineCount = 7 FOR i = 0 TO constlast: constdefined(i) = 0: NEXT 'undefine constants FOR i = 1 TO 27: defineaz(i) = "SINGLE": defineextaz(i) = "!": NEXT DIM SHARED DataBinBuf: DataBinBuf = OpenBuffer%("O", tmpdir$ + "data.bin") DIM SHARED MainTxtBuf: MainTxtBuf = OpenBuffer%("O", tmpdir$ + "main.txt") DIM SHARED DataTxtBuf: DataTxtBuf = OpenBuffer%("O", tmpdir$ + "maindata.txt") DIM SHARED RegTxtBuf: RegTxtBuf = OpenBuffer%("O", tmpdir$ + "regsf.txt") DIM SHARED FreeTxtBuf: FreeTxtBuf = OpenBuffer%("O", tmpdir$ + "mainfree.txt") DIM SHARED RunTxtBuf: RunTxtBuf = OpenBuffer%("O", tmpdir$ + "runline.txt") DIM SHARED ErrTxtBuf: ErrTxtBuf = OpenBuffer%("O", tmpdir$ + "mainerr.txt") 'i. check the value of error_line 'ii. jump to the appropriate label errorlabels = 0 WriteBufLine ErrTxtBuf, "if (error_occurred){ error_occurred=0;" DIM SHARED ChainTxtBuf: ChainTxtBuf = OpenBuffer%("O", tmpdir$ + "chain.txt") DIM SHARED InpChainTxtBuf: InpChainTxtBuf = OpenBuffer%("O", tmpdir$ + "inpchain.txt") DIM SHARED TimeTxtBuf: TimeTxtBuf = OpenBuffer%("O", tmpdir$ + "ontimer.txt") DIM SHARED TimejTxtBuf: TimejTxtBuf = OpenBuffer%("O", tmpdir$ + "ontimerj.txt") '*****#26 used for locking qb64pe DIM SHARED KeyTxtBuf: KeyTxtBuf = OpenBuffer%("O", tmpdir$ + "onkey.txt") DIM SHARED KeyjTxtBuf: KeyjTxtBuf = OpenBuffer%("O", tmpdir$ + "onkeyj.txt") DIM SHARED StrigTxtBuf: StrigTxtBuf = OpenBuffer%("O", tmpdir$ + "onstrig.txt") DIM SHARED StrigjTxtBuf: StrigjTxtBuf = OpenBuffer%("O", tmpdir$ + "onstrigj.txt") gosubid = 1 'to be included whenever return without a label is called 'return [label] in QBASIC was not possible in a sub/function, but QB64 will support this 'special codes will represent special return conditions: '0=return from main to calling sub/function/proc by return [NULL]; '1... a global number representing a return point after a gosub 'note: RETURN [label] should fail if a "return [NULL];" type return is required DIM SHARED RetTxtBuf: RetTxtBuf = OpenBuffer%("O", tmpdir$ + "ret0.txt") WriteBufLine RetTxtBuf, "if (next_return_point){" WriteBufLine RetTxtBuf, "next_return_point--;" WriteBufLine RetTxtBuf, "switch(return_point[next_return_point]){" WriteBufLine RetTxtBuf, "case 0:" WriteBufLine RetTxtBuf, "return;" WriteBufLine RetTxtBuf, "break;" continueline = 0 endifs = 0 lineelseused = 0 continuelinefrom = 0 linenumber = 0 reallinenumber = 0 declaringlibrary = 0 WriteBufLine MainTxtBuf, "S_0:;" 'note: REQUIRED by run statement IF UseGL THEN gl_include_content 'ide specific IF idemode THEN GOTO ideret3 DO ide4: includeline: mainpassLastLine: IF lastLine <> 0 OR firstLine <> 0 THEN lineBackup$ = a3$ 'backup the real first line (will be blank when lastline is set) forceIncludeFromRoot$ = "" IF vWatchOn THEN addingvWatch = 1 IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bi" IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bm" ELSE 'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bi" IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bm" END IF firstLine = 0: lastLine = 0 IF LEN(forceIncludeFromRoot$) THEN GOTO forceInclude forceIncludeCompleted: addingvWatch = 0 a3$ = lineBackup$ END IF prepass = 0 stringprocessinghappened = 0 IF continuelinefrom THEN start = continuelinefrom continuelinefrom = 0 GOTO contline END IF 'begin a new line impliedendif = 0 THENGOTO = 0 continueline = 0 endifs = 0 lineelseused = 0 newif = 0 'apply metacommands from previous line IF addmetadynamic = 1 THEN addmetadynamic = 0: DynamicMode = 1 IF addmetastatic = 1 THEN addmetastatic = 0: DynamicMode = 0 'a3$ is passed in idemode and when using $include IF idemode = 0 AND inclevel = 0 THEN a3$ = lineinput3$ IF a3$ = CHR$(13) THEN EXIT DO linenumber = linenumber + 1 reallinenumber = reallinenumber + 1 IF InValidLine(linenumber) THEN layoutok = 1 layout$ = SPACE$(controllevel + 1) + LTRIM$(RTRIM$(a3$)) IF idemode GOTO ideret4 ELSE GOTO skipide4 END IF layout = "" layoutok = 1 IF idemode = 0 AND NOT QuietMode THEN 'IF LEN(a3$) THEN ' dotlinecount = dotlinecount + 1: IF dotlinecount >= 100 THEN dotlinecount = 0: PRINT "."; 'END IF maxprogresswidth = 50 'arbitrary percentage = INT(reallinenumber / totallinenumber * 100) percentagechars = INT(maxprogresswidth * reallinenumber / totallinenumber) IF percentage <> prevpercentage AND percentagechars <> prevpercentagechars THEN prevpercentage = percentage prevpercentagechars = percentagechars IF ConsoleMode THEN PRINT "[" + STRING$(percentagechars, ".") + SPACE$(maxprogresswidth - percentagechars) + "]" + STR$(percentage) + "%"; IF os$ = "LNX" THEN PRINT CHR$(27) + "[A" ELSE PRINT CHR$(13); END IF ELSE LOCATE , 1 PRINT STRING$(percentagechars, 219) + STRING$(maxprogresswidth - percentagechars, 176) + STR$(percentage) + "%"; END IF END IF END IF a3$ = LTRIM$(RTRIM$(a3$)) wholeline = a3$ layoutoriginal$ = a3$ layoutcomment$ = "" 'clear any previous layout comment lhscontrollevel = controllevel linefragment = "[INFORMATION UNAVAILABLE]" IF LEN(a3$) = 0 THEN GOTO finishednonexec IF Debug THEN PRINT #9, "########" + a3$ + "########" layoutdone = 1 'validates layout of any following goto finishednonexec/finishedline 'We've already figured out in the prepass which lines are invalidated by the precompiler 'No need to go over those lines again. 'IF InValidLine(linenumber) THEN goto skipide4 'layoutdone = 0: GOTO finishednonexec a3u$ = UCASE$(a3$) 'QB64 Metacommands IF ASC(a3$) = 36 THEN '$ 'precompiler commands should always be executed FIRST. IF a3u$ = "$END IF" OR a3u$ = "$ENDIF" THEN IF DefineElse(ExecCounter) = 0 THEN a$ = "$END IF without $IF": GOTO errmes DefineElse(ExecCounter) = 0 'We no longer have an $IF block at this level ExecCounter = ExecCounter - 1 layout$ = SCase$("$End If") controltype(controllevel) = 0 controllevel = controllevel - 1 GOTO finishednonexec END IF IF LEFT$(a3u$, 4) = "$IF " THEN 'prevents code from being placed before 'CASE condition' in a SELECT CASE block IF SelectCaseCounter > 0 AND SelectCaseHasCaseBlock(SelectCaseCounter) = 0 THEN a$ = "Expected CASE expression": GOTO errmes END IF temp$ = LTRIM$(MID$(a3u$, 4)) 'strip off the $IF and extra spaces temp$ = RTRIM$(LEFT$(temp$, LEN(temp$) - 4)) 'and strip off the THEN and extra spaces temp = 0 IF temp = 0 THEN tempOp$ = "<=": temp = INSTR(temp$, tempOp$) IF temp = 0 THEN tempOp$ = "=<": temp = INSTR(temp$, tempOp$): tempOp$ = "<=" IF temp = 0 THEN tempOp$ = ">=": temp = INSTR(temp$, tempOp$) IF temp = 0 THEN tempOp$ = "=>": temp = INSTR(temp$, tempOp$): tempOp$ = ">=" IF temp = 0 THEN tempOp$ = "<>": temp = INSTR(temp$, tempOp$) IF temp = 0 THEN tempOp$ = "><": temp = INSTR(temp$, tempOp$): tempOp$ = "<>" IF temp = 0 THEN tempOp$ = "=": temp = INSTR(temp$, tempOp$) IF temp = 0 THEN tempOp$ = ">": temp = INSTR(temp$, tempOp$) IF temp = 0 THEN tempOp$ = "<": temp = INSTR(temp$, tempOp$) ExecCounter = ExecCounter + 1 ExecLevel(ExecCounter) = -1 'default to a skip value DefineElse(ExecCounter) = 1 '1 says we have an $IF statement at this level result = EvalPreIF(temp$, a$) IF a$ <> "" THEN GOTO errmes IF result <> 0 THEN ExecLevel(ExecCounter) = ExecLevel(ExecCounter - 1) 'So we inherit the execlevel from above IF ExecLevel(ExecCounter) = 0 THEN DefineElse(ExecCounter) = DefineElse(ExecCounter) OR 4 'Else if used and conditon found END IF controllevel = controllevel + 1 controltype(controllevel) = 6 IF temp = 0 THEN layout$ = SCase$("$If ") + temp$ + SCase$(" Then"): GOTO finishednonexec 'no = sign in the $IF statement, so we're going to assume the user is doing something like $IF flag l$ = RTRIM$(LEFT$(temp$, temp - 1)): r$ = LTRIM$(MID$(temp$, temp + LEN(tempOp$))) layout$ = SCase$("$If ") + l$ + " " + tempOp$ + " " + r$ + SCase$(" Then") GOTO finishednonexec END IF IF a3u$ = "$ELSE" THEN IF DefineElse(ExecCounter) = 0 THEN a$ = "$ELSE without $IF": GOTO errmes IF DefineElse(ExecCounter) AND 2 THEN a$ = "$IF block already has $ELSE statement in it": GOTO errmes DefineElse(ExecCounter) = DefineElse(ExecCounter) OR 2 'set the flag to declare an $ELSE already in this block IF DefineElse(ExecCounter) AND 4 THEN 'If we executed code in a previous IF or ELSE IF statement, we can't do it here ExecLevel(ExecCounter) = -1 'So we inherit the execlevel from above ELSE ExecLevel(ExecCounter) = ExecLevel(ExecCounter - 1) 'If we were processing code before, code after this segment is going to be SKIPPED END IF layout$ = SCase$("$Else") lhscontrollevel = lhscontrollevel - 1 GOTO finishednonexec END IF IF LEFT$(a3u$, 5) = "$ELSE" THEN temp$ = LTRIM$(MID$(a3u$, 6)) IF LEFT$(temp$, 3) = "IF " THEN IF DefineElse(ExecCounter) = 0 THEN a$ = "$ELSE IF without $IF": GOTO errmes IF DefineElse(ExecCounter) AND 2 THEN a$ = "$ELSE IF cannot follow $ELSE": GOTO errmes IF RIGHT$(temp$, 5) <> " THEN" THEN a$ = "$ELSE IF without THEN": GOTO errmes temp$ = LTRIM$(MID$(temp$, 3)) 'strip off the IF and extra spaces temp$ = RTRIM$(LEFT$(temp$, LEN(temp$) - 4)) 'and strip off the THEN and extra spaces IF DefineElse(ExecCounter) AND 4 THEN 'If we executed code in a previous IF or ELSE IF statement, we can't do it here ExecLevel(ExecCounter) = -1 ELSE result = EvalPreIF(temp$, a$) IF a$ <> "" THEN GOTO errmes IF result <> 0 THEN ExecLevel(ExecCounter) = ExecLevel(ExecCounter - 1) 'So we inherit the execlevel from above IF ExecLevel(ExecCounter) = 0 THEN DefineElse(ExecCounter) = DefineElse(ExecCounter) OR 4 'Else if used and conditon found END IF END IF lhscontrollevel = lhscontrollevel - 1 temp = INSTR(temp$, "=") IF temp = 0 THEN layout$ = SCase$("$ElseIf ") + temp$ + SCase$(" Then"): GOTO finishednonexec 'no = sign in the $IF statement, so we're going to assume the user is doing something like $IF flag l$ = RTRIM$(LEFT$(temp$, temp - 1)): r$ = LTRIM$(MID$(temp$, temp + 1)) layout$ = SCase$("$ElseIf ") + l$ + " = " + r$ + SCase$(" Then") GOTO finishednonexec END IF END IF IF ExecLevel(ExecCounter) THEN 'don't check for any more metacommands except the one's which worth with the precompiler layoutdone = 0 GOTO finishednonexec 'we don't check for anything inside lines that we've marked for skipping END IF IF LEFT$(a3u$, 5) = "$LET " THEN temp$ = a3u$ temp$ = LTRIM$(MID$(temp$, 5)) 'simply shorten our string to parse 'For starters, let's make certain that we have 3 elements to deal with temp = INSTR(temp$, "=") 'without an = in there, we can't get a value from the left and right side l$ = RTRIM$(LEFT$(temp$, temp - 1)): r$ = LTRIM$(MID$(temp$, temp + 1)) layout$ = SCase$("$Let ") + l$ + " = " + r$ 'First look to see if we have an existing setting like this and if so, update it FOR i = 7 TO UserDefineCount 'UserDefineCount 1-7 are reserved for automatic OS/BIT detection & version IF UserDefine(0, i) = l$ THEN UserDefine(1, i) = r$: GOTO finishednonexec NEXT 'Otherwise create a new setting and set the initial value for it UserDefineCount = UserDefineCount + 1 IF UserDefineCount > UBOUND(UserDefine, 2) THEN REDIM _PRESERVE UserDefine(1, UBOUND(UserDefine, 2) + 10) 'Add another 10 elements to the array so it'll expand as the user adds to it END IF UserDefine(0, UserDefineCount) = l$ UserDefine(1, UserDefineCount) = r$ GOTO finishednonexec END IF IF a3u$ = "$COLOR:0" THEN layout$ = SCase$("$Color:0") IF qb64prefix_set THEN addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0_noprefix.bi" ELSE addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0.bi" END IF layoutdone = 1 GOTO finishednonexec END IF IF a3u$ = "$COLOR:32" THEN layout$ = SCase$("$Color:32") IF qb64prefix_set THEN addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32_noprefix.bi" ELSE addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32.bi" END IF layoutdone = 1 GOTO finishednonexec END IF IF a3u$ = "$NOPREFIX" THEN 'already set in prepass layout$ = SCase$("$NoPrefix") GOTO finishednonexec END IF IF a3u$ = "$VIRTUALKEYBOARD:ON" THEN 'Deprecated; does nothing. layout$ = SCase$("$VirtualKeyboard:On") addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Deprecated feature", "$VirtualKeyboard" GOTO finishednonexec END IF IF a3u$ = "$VIRTUALKEYBOARD:OFF" THEN 'Deprecated; does nothing. layout$ = SCase$("$VirtualKeyboard:Off") addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Deprecated feature", "$VirtualKeyboard" GOTO finishednonexec END IF IF a3u$ = "$DEBUG" THEN layout$ = SCase$("$Debug") IF NoIDEMode THEN addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "$Debug", "$Debug features only work from the IDE" END IF GOTO finishednonexec END IF IF a3u$ = "$CHECKING:OFF" THEN layout$ = SCase$("$Checking:Off") NoChecks = 1 IF vWatchOn <> 0 AND NoIDEMode = 0 AND inclevel = 0 THEN addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "$Debug", "$Debug features won't work in $Checking:Off blocks" END IF GOTO finishednonexec END IF IF a3u$ = "$CHECKING:ON" THEN layout$ = SCase$("$Checking:On") NoChecks = 0 GOTO finishednonexec END IF IF a3u$ = "$CONSOLE" THEN layout$ = SCase$("$Console") Console = 1 GOTO finishednonexec END IF IF a3u$ = "$CONSOLE:ONLY" THEN layout$ = SCase$("$Console:Only") DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) = DEPENDENCY(DEPENDENCY_CONSOLE_ONLY) OR 1 Console = 1 IF prepass = 0 THEN IF NoChecks = 0 THEN WriteBufLine MainTxtBuf, "do{" WriteBufLine MainTxtBuf, "sub__dest(func__console());" WriteBufLine MainTxtBuf, "sub__source(func__console());" GOTO finishedline2 ELSE GOTO finishednonexec END IF END IF IF a3u$ = "$ASSERTS" THEN layout$ = SCase$("$Asserts") Asserts = 1 GOTO finishednonexec END IF IF a3u$ = "$ASSERTS:CONSOLE" THEN layout$ = SCase$("$Asserts:Console") Asserts = 1 Console = 1 GOTO finishednonexec END IF IF a3u$ = "$SCREENHIDE" THEN layout$ = SCase$("$ScreenHide") ScreenHide = 1 GOTO finishednonexec END IF IF a3u$ = "$SCREENSHOW" THEN layout$ = SCase$("$ScreenShow") ScreenHide = 0 GOTO finishednonexec END IF IF a3u$ = "$RESIZE:OFF" THEN layout$ = SCase$("$Resize:Off") Resize = 0: Resize_Scale = 0 GOTO finishednonexec END IF IF a3u$ = "$RESIZE:ON" THEN layout$ = SCase$("$Resize:On") Resize = 1: Resize_Scale = 0 GOTO finishednonexec END IF IF a3u$ = "$RESIZE:STRETCH" THEN layout$ = SCase$("$Resize:Stretch") Resize = 1: Resize_Scale = 1 GOTO finishednonexec END IF IF a3u$ = "$RESIZE:SMOOTH" THEN layout$ = SCase$("$Resize:Smooth") Resize = 1: Resize_Scale = 2 GOTO finishednonexec END IF IF LEFT$(a3u$, 12) = "$VERSIONINFO" THEN 'Embed version info into the final binary (Windows only) FirstDelimiter = INSTR(a3u$, ":") SecondDelimiter = INSTR(FirstDelimiter + 1, a3u$, "=") IF FirstDelimiter = 0 OR SecondDelimiter = 0 OR SecondDelimiter = FirstDelimiter + 1 THEN a$ = "Expected $VERSIONINFO:key=value": GOTO errmes END IF VersionInfoKey$ = LTRIM$(RTRIM$(MID$(a3u$, FirstDelimiter + 1, SecondDelimiter - FirstDelimiter - 1))) VersionInfoValue$ = StrReplace$(LTRIM$(RTRIM$(MID$(a3$, SecondDelimiter + 1))), CHR$(34), "'") SELECT CASE VersionInfoKey$ CASE "FILEVERSION#" GOSUB ValidateVersion viFileVersionNum$ = VersionInfoValue$ IF viFileVersion$ = "" THEN viFileVersion$ = viFileVersionNum$ layout$ = SCase$("$VersionInfo:FILEVERSION#=") + VersionInfoValue$ CASE "PRODUCTVERSION#" GOSUB ValidateVersion viProductVersionNum$ = VersionInfoValue$ IF viProductVersion$ = "" THEN viProductVersion$ = viProductVersionNum$ layout$ = SCase$("$VersionInfo:PRODUCTVERSION#=") + VersionInfoValue$ CASE "COMPANYNAME" viCompanyName$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "CompanyName=" + VersionInfoValue$ CASE "FILEDESCRIPTION" viFileDescription$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "FileDescription=" + VersionInfoValue$ CASE "FILEVERSION" viFileVersion$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "FileVersion=" + VersionInfoValue$ CASE "INTERNALNAME" viInternalName$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "InternalName=" + VersionInfoValue$ CASE "LEGALCOPYRIGHT" viLegalCopyright$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "LegalCopyright=" + VersionInfoValue$ CASE "LEGALTRADEMARKS" viLegalTrademarks$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "LegalTrademarks=" + VersionInfoValue$ CASE "ORIGINALFILENAME" viOriginalFilename$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "OriginalFilename=" + VersionInfoValue$ CASE "PRODUCTNAME" viProductName$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "ProductName=" + VersionInfoValue$ CASE "PRODUCTVERSION" viProductVersion$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "ProductVersion=" + VersionInfoValue$ CASE "COMMENTS" viComments$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "Comments=" + VersionInfoValue$ CASE "WEB" viWeb$ = VersionInfoValue$ layout$ = SCase$("$VersionInfo:") + "Web=" + VersionInfoValue$ CASE ELSE a$ = "Invalid key. (Use FILEVERSION#, PRODUCTVERSION#, CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, LegalTrademarks, OriginalFilename, ProductName, ProductVersion, Comments or Web)" GOTO errmes END SELECT VersionInfoSet = -1 GOTO finishednonexec ValidateVersion: 'Check if only numbers and commas (4 comma-separated values) IF LEN(VersionInfoValue$) = 0 THEN a$ = "Expected $VERSIONINFO:" + VersionInfoKey$ + "=#,#,#,# (4 comma-separated numeric values: major, minor, revision and build)": GOTO errmes viCommas = 0 FOR i = 1 TO LEN(VersionInfoValue$) IF ASC(VersionInfoValue$, i) = 44 THEN viCommas = viCommas + 1 IF INSTR("0123456789,", MID$(VersionInfoValue$, i, 1)) = 0 OR (i = LEN(VersionInfoValue$) AND viCommas <> 3) OR RIGHT$(VersionInfoValue$, 1) = "," THEN a$ = "Expected $VERSIONINFO:" + VersionInfoKey$ + "=#,#,#,# (4 comma-separated numeric values: major, minor, revision and build)": GOTO errmes END IF NEXT RETURN END IF IF LEFT$(a3u$, 8) = "$EXEICON" THEN 'Basic syntax check. Multi-platform. IF ExeIconSet THEN a$ = "$EXEICON already defined": GOTO errmes FirstDelimiter = INSTR(a3u$, "'") IF FirstDelimiter = 0 THEN a$ = "Expected $EXEICON:'filename'": GOTO errmes ELSE SecondDelimiter = INSTR(FirstDelimiter + 1, a3u$, "'") IF SecondDelimiter = 0 THEN a$ = "Expected $EXEICON:'filename'": GOTO errmes END IF ExeIconFile$ = RTRIM$(LTRIM$(MID$(a3$, FirstDelimiter + 1, SecondDelimiter - FirstDelimiter - 1))) IF LEN(ExeIconFile$) = 0 THEN a$ = "Expected $EXEICON:'filename'": GOTO errmes layout$ = SCase$("$ExeIcon:'") + ExeIconFile$ + "'" + MID$(a3$, SecondDelimiter + 1) IconPath$ = "" IF LEFT$(ExeIconFile$, 2) = "./" OR LEFT$(ExeIconFile$, 2) = ".\" THEN 'Relative to source file's folder IF NoIDEMode THEN IconPath$ = path.source$ IF LEN(IconPath$) > 0 AND RIGHT$(IconPath$, 1) <> pathsep$ THEN IconPath$ = IconPath$ + pathsep$ ELSE IF LEN(ideprogname) THEN IconPath$ = idepath$ + pathsep$ END IF ExeIconFile$ = IconPath$ + MID$(ExeIconFile$, 3) ELSEIF INSTR(ExeIconFile$, "/") OR INSTR(ExeIconFile$, "\") THEN FOR i = LEN(ExeIconFile$) TO 1 STEP -1 IF MID$(ExeIconFile$, i, 1) = "/" OR MID$(ExeIconFile$, i, 1) = "\" THEN IconPath$ = LEFT$(ExeIconFile$, i) ExeIconFileOnly$ = MID$(ExeIconFile$, i + 1) IF _DIREXISTS(IconPath$) = 0 THEN a$ = "File '" + ExeIconFileOnly$ + "' not found": GOTO errmes currentdir$ = _CWD$ CHDIR IconPath$ IconPath$ = _CWD$ CHDIR currentdir$ ExeIconFile$ = IconPath$ + pathsep$ + ExeIconFileOnly$ EXIT FOR END IF NEXT END IF IF _FILEEXISTS(ExeIconFile$) = 0 THEN a$ = "File '" + ExeIconFile$ + "' not found": GOTO errmes ExeIconSet = linenumber SetDependency DEPENDENCY_ICON IF NoChecks = 0 THEN WriteBufLine MainTxtBuf, "do{" WriteBufLine MainTxtBuf, "sub__icon(NULL,NULL,0);" GOTO finishedline2 END IF IF LEFT$(a3u$, 10) = "$UNSTABLE:" THEN layout$ = SCase("$Unstable:") token$ = LTRIM$(RTRIM$(MID$(a3u$, 11))) SELECT CASE token$ CASE "MIDI" layout$ = layout$ + SCase$("Midi") CASE "HTTP" layout$ = layout$ + SCase$("Http") END SELECT GOTO finishednonexec END IF IF unstableFlags(UNSTABLE_MIDI) THEN IF LEFT$(a3u$, 15) = "$MIDISOUNDFONT:" THEN IF MidiSoundFontSet THEN a$ = "$MIDISOUNDFONT already defined" GOTO errmes END IF layout$ = SCase$("$MidiSoundFont:") MidiSoundFont$ = LTRIM$(RTRIM$(MID$(a3$, 16))) IF MID$(MidiSoundFont$, 1, 1) = CHR$(34) THEN ' We have a quoted filename, verify it is valid ' We don't touch the filename in the formatting layout$ = layout$ + MidiSoundFont$ ' Strip the leading quote MidiSoundFont$ = MID$(MidiSoundFont$, 2) ' Verify that there is a quote character at the end IF INSTR(MidiSoundFont$, CHR$(34)) = 0 THEN a$ = "Expected " + CHR$(34) + " character at the end of the file name": GOTO errmes ' Verify there are no extra characters after end quote IF INSTR(MidiSoundFont$, CHR$(34)) <> LEN(MidiSoundFont$) THEN a$ = "Unexpected characters after the quoted file name": GOTO errmes MidiSoundFont$ = MID$(MidiSoundFont$, 1, LEN(MidiSoundFont$) - 1) IF NOT _FILEEXISTS(MidiSoundFont$) THEN a$ = "Soundfont file " + AddQuotes$(MidiSoundFont$) + " could not be found!" GOTO errmes END IF ELSE ' Constant values, only one for now SELECT CASE UCASE$(MidiSoundFont$) CASE "DEFAULT" layout$ = layout$ + SCase$("Default") ' Clear MidiSoundFont$ to indicate the default should be used MidiSoundFont$ = "" CASE ELSE a$ = "Unrecognized Soundfont option " + AddQuotes$(MidiSoundFont$) GOTO errmes END SELECT END IF MidiSoundFontSet = linenumber MidiSoundFontLine$ = layout$ GOTO finishednonexec END IF END IF END IF 'QB64 Metacommands IF ExecLevel(ExecCounter) THEN layoutdone = 0 GOTO finishednonexec 'we don't check for anything inside lines that we've marked for skipping END IF linedataoffset = DataOffset entireline$ = lineformat(a3$): IF LEN(entireline$) = 0 THEN GOTO finishednonexec IF Error_Happened THEN GOTO errmes u$ = UCASE$(entireline$) newif = 0 'Convert "CASE ELSE" to "CASE C-EL" to avoid confusing compiler 'note: CASE does not have to begin on a new line s = 1 i = INSTR(s, u$, "CASE" + sp + "ELSE") DO WHILE i skip = 0 IF i <> 1 THEN IF MID$(u$, i - 1, 1) <> sp THEN skip = 1 END IF IF i <> LEN(u$) - 8 THEN IF MID$(u$, i + 9, 1) <> sp THEN skip = 1 END IF IF skip = 0 THEN MID$(entireline$, i) = "CASE" + sp + "C-EL" u$ = UCASE$(entireline$) END IF s = i + 9 i = INSTR(s, u$, "CASE" + sp + "ELSE") LOOP n = numelements(entireline$) 'line number? a = ASC(entireline$) IF (a >= 48 AND a <= 57) OR a = 46 THEN 'numeric label$ = getelement(entireline$, 1) IF validlabel(label$) THEN IF closedmain <> 0 AND subfunc = "" THEN a$ = "Labels cannot be placed between SUB/FUNCTIONs": GOTO errmes v = HashFind(label$, HASHFLAG_LABEL, ignore, r) addlabchk100: IF v THEN s = Labels(r).Scope IF s = subfuncn OR s = -1 THEN 'same scope? IF s = -1 THEN Labels(r).Scope = subfuncn 'acquire scope IF Labels(r).State = 1 THEN a$ = "Duplicate label (" + RTRIM$(Labels(r).cn) + ")": GOTO errmes 'aquire state 0 types tlayout$ = RTRIM$(Labels(r).cn) GOTO addlabaq100 END IF 'same scope IF v = 2 THEN v = HashFindCont(ignore, r): GOTO addlabchk100 END IF 'does not exist nLabels = nLabels + 1: IF nLabels > Labels_Ubound THEN Labels_Ubound = Labels_Ubound * 2: REDIM _PRESERVE Labels(1 TO Labels_Ubound) AS Label_Type Labels(nLabels) = Empty_Label HashAdd label$, HASHFLAG_LABEL, nLabels r = nLabels Labels(r).cn = tlayout$ Labels(r).Scope = subfuncn addlabaq100: Labels(r).State = 1 Labels(r).Data_Offset = linedataoffset layout$ = tlayout$ WriteBufLine MainTxtBuf, "LABEL_" + label$ + ":;" IF INSTR(label$, "p") THEN MID$(label$, INSTR(label$, "p"), 1) = "." IF RIGHT$(label$, 1) = "d" OR RIGHT$(label$, 1) = "s" THEN label$ = LEFT$(label$, LEN(label$) - 1) WriteBufLine MainTxtBuf, "last_line=" + label$ + ";" inclinenump$ = "" IF inclinenumber(inclevel) THEN inclinenump$ = "," + str2$(inclinenumber(inclevel)) thisincname$ = getfilepath$(incname$(inclevel)) thisincname$ = MID$(incname$(inclevel), LEN(thisincname$) + 1) inclinenump$ = inclinenump$ + "," + CHR$(34) + thisincname$ + CHR$(34) END IF IF NoChecks = 0 THEN IF vWatchOn AND inclinenumber(inclevel) = 0 THEN temp$ = vWatchErrorCall$ ELSE temp$ = "" WriteBufLine MainTxtBuf, "if(qbevent){" + temp$ + "evnt(" + str2$(linenumber) + inclinenump$ + ");r=0;}" END IF IF n = 1 THEN GOTO finishednonexec entireline$ = getelements(entireline$, 2, n): u$ = UCASE$(entireline$): n = n - 1 'note: fall through, numeric labels can be followed by alphanumeric label END IF 'validlabel END IF 'numeric 'it wasn't a line number 'label? 'note: ignores possibility that this could be a single command SUB/FUNCTION (as in QBASIC?) IF n >= 2 THEN x2 = INSTR(entireline$, sp + ":") IF x2 THEN IF x2 = LEN(entireline$) - 1 THEN x3 = x2 + 1 ELSE x3 = x2 + 2 a$ = LEFT$(entireline$, x2 - 1) CreatingLabel = 1 IF validlabel(a$) THEN IF validname(a$) = 0 THEN a$ = "Invalid name": GOTO errmes IF closedmain <> 0 AND subfunc = "" THEN a$ = "Labels cannot be placed between SUB/FUNCTIONs": GOTO errmes v = HashFind(a$, HASHFLAG_LABEL, ignore, r) addlabchk: IF v THEN s = Labels(r).Scope IF s = subfuncn OR s = -1 THEN 'same scope? IF s = -1 THEN Labels(r).Scope = subfuncn 'acquire scope IF Labels(r).State = 1 THEN a$ = "Duplicate label (" + RTRIM$(Labels(r).cn) + ")": GOTO errmes 'aquire state 0 types tlayout$ = RTRIM$(Labels(r).cn) GOTO addlabaq END IF 'same scope IF v = 2 THEN v = HashFindCont(ignore, r): GOTO addlabchk END IF 'does not exist nLabels = nLabels + 1: IF nLabels > Labels_Ubound THEN Labels_Ubound = Labels_Ubound * 2: REDIM _PRESERVE Labels(1 TO Labels_Ubound) AS Label_Type Labels(nLabels) = Empty_Label HashAdd a$, HASHFLAG_LABEL, nLabels r = nLabels Labels(r).cn = tlayout$ Labels(r).Scope = subfuncn addlabaq: Labels(r).State = 1 Labels(r).Data_Offset = linedataoffset Labels(r).SourceLineNumber = linenumber IF LEN(layout$) THEN layout$ = layout$ + sp + tlayout$ + ":" ELSE layout$ = tlayout$ + ":" WriteBufLine MainTxtBuf, "LABEL_" + a$ + ":;" inclinenump$ = "" IF inclinenumber(inclevel) THEN inclinenump$ = "," + str2$(inclinenumber(inclevel)) thisincname$ = getfilepath$(incname$(inclevel)) thisincname$ = MID$(incname$(inclevel), LEN(thisincname$) + 1) inclinenump$ = inclinenump$ + "," + CHR$(34) + thisincname$ + CHR$(34) END IF IF NoChecks = 0 THEN IF vWatchOn AND inclinenumber(inclevel) = 0 THEN temp$ = vWatchErrorCall$ ELSE temp$ = "" WriteBufLine MainTxtBuf, "if(qbevent){" + temp$ + "evnt(" + str2$(linenumber) + inclinenump$ + ");r=0;}" END IF entireline$ = RIGHT$(entireline$, LEN(entireline$) - x3): u$ = UCASE$(entireline$) n = numelements(entireline$): IF n = 0 THEN GOTO finishednonexec END IF 'valid END IF 'includes sp+":" END IF 'n>=2 'remove leading ":" DO WHILE ASC(u$) = 58 '":" IF LEN(layout$) THEN layout$ = layout$ + sp2 + ":" ELSE layout$ = ":" IF LEN(u$) = 1 THEN GOTO finishednonexec entireline$ = getelements(entireline$, 2, n): u$ = UCASE$(entireline$): n = n - 1 LOOP 'ELSE at the beginning of a line IF ASC(u$) = 69 THEN '"E" e1$ = getelement(u$, 1) IF e1$ = "ELSE" THEN a$ = "ELSE" IF n > 1 THEN continuelinefrom = 2 GOTO gotcommand END IF IF e1$ = "ELSEIF" THEN IF n < 3 THEN a$ = "Expected ... THEN": GOTO errmes IF getelement(u$, n) = "THEN" THEN a$ = entireline$: GOTO gotcommand FOR i = 3 TO n - 1 IF getelement(u$, i) = "THEN" THEN a$ = getelements(entireline$, 1, i) continuelinefrom = i + 1 GOTO gotcommand END IF NEXT a$ = "Expected THEN": GOTO errmes END IF END IF '"E" start = 1 GOTO skipcontinit contline: n = numelements(entireline$) u$ = UCASE$(entireline$) skipcontinit: 'jargon: 'lineelseused - counts how many line ELSEs can POSSIBLY follow 'endifs - how many C++ endifs "}" need to be added at the end of the line 'lineelseused - counts the number of indwelling ELSE statements on a line 'impliedendif - stops autoformat from adding "END IF" a$ = "" FOR i = start TO n e$ = getelement(u$, i) IF e$ = ":" THEN IF i = start THEN layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp2 + ":" ELSE layout$ = ":" IF i <> n THEN continuelinefrom = i + 1 GOTO finishednonexec END IF IF i <> n THEN continuelinefrom = i GOTO gotcommand END IF 'begin scanning an 'IF' statement IF e$ = "IF" AND a$ = "" THEN newif = 1 IF e$ = "THEN" OR (e$ = "GOTO" AND newif = 1) THEN IF newif = 0 THEN a$ = "THEN without IF": GOTO errmes newif = 0 IF lineelseused > 0 THEN lineelseused = lineelseused - 1 IF e$ = "GOTO" THEN IF i = n THEN a$ = "Expected IF expression GOTO label": GOTO errmes i = i - 1 END IF a$ = a$ + sp + e$ '+"THEN"/"GOTO" IF i <> n THEN continuelinefrom = i + 1: endifs = endifs + 1 GOTO gotcommand END IF IF e$ = "ELSE" THEN IF start = i THEN IF lineelseused >= 1 THEN 'note: more than one else used (in a row) on this line, so close first if with an 'END IF' first 'note: parses 'END IF' then (after continuelinefrom) parses 'ELSE' 'consider the following: (square brackets make reading easier) 'eg. if a=1 then [if b=2 then c=2 else d=2] else e=3 impliedendif = 1: a$ = "END" + sp + "IF" endifs = endifs - 1 continuelinefrom = i lineelseused = lineelseused - 1 GOTO gotcommand END IF 'follow up previously encountered 'ELSE' by applying 'ELSE' a$ = "ELSE": continuelinefrom = i + 1 lineelseused = lineelseused + 1 GOTO gotcommand END IF 'start=i 'apply everything up to (but not including) 'ELSE' continuelinefrom = i GOTO gotcommand END IF '"ELSE" e$ = getelement(entireline$, i): IF a$ = "" THEN a$ = e$ ELSE a$ = a$ + sp + e$ NEXT 'we're reached the end of the line IF endifs > 0 THEN endifs = endifs - 1 impliedendif = 1: entireline$ = entireline$ + sp + ":" + sp + "END" + sp + "IF": n = n + 3 i = i + 1 'skip the ":" (i is now equal to n+2) continuelinefrom = i GOTO gotcommand END IF gotcommand: dynscope = 0 ca$ = a$ a$ = eleucase$(ca$) '***REVISE THIS SECTION LATER*** layoutdone = 0 linefragment = a$ IF Debug THEN PRINT #9, a$ n = numelements(a$) IF n = 0 THEN GOTO finishednonexec 'convert non-UDT dimensioned periods to _046_ IF INSTR(ca$, sp + "." + sp) THEN a3$ = getelement(ca$, 1) except = 0 aa$ = a3$ + sp 'rebuilt a$ (always has a trailing spacer) lastfuse = -1 FOR x = 2 TO n a2$ = getelement(ca$, x) IF except = 1 THEN except = 2: GOTO udtperiod 'skip element name IF a2$ = "." AND x <> n THEN IF except = 2 THEN except = 1: GOTO udtperiod 'sub-element of UDT IF a3$ = ")" THEN 'assume it was something like typevar(???).x and treat as a UDT except = 1 GOTO udtperiod END IF 'find an ID of that type try = findid(UCASE$(a3$)) IF Error_Happened THEN GOTO errmes DO WHILE try IF ((id.t AND ISUDT) <> 0) OR ((id.arraytype AND ISUDT) <> 0) THEN except = 1 GOTO udtperiod END IF IF try = 2 THEN findanotherid = 1: try = findid(UCASE$(a3$)) ELSE try = 0 IF Error_Happened THEN GOTO errmes LOOP 'not a udt; fuse lhs & rhs with _046_ IF isalpha(ASC(a3$)) = 0 AND lastfuse <> x - 2 THEN a$ = "Invalid '.'": GOTO errmes aa$ = LEFT$(aa$, LEN(aa$) - 1) + fix046$ lastfuse = x GOTO periodfused END IF '"." except = 0 udtperiod: aa$ = aa$ + a2$ + sp periodfused: a3$ = a2$ NEXT a$ = LEFT$(aa$, LEN(aa$) - 1) ca$ = a$ a$ = eleucase$(ca$) n = numelements(a$) END IF arrayprocessinghappened = 0 firstelement$ = getelement(a$, 1) secondelement$ = getelement(a$, 2) thirdelement$ = getelement(a$, 3) 'non-executable section IF n = 1 THEN IF firstelement$ = "'" THEN layoutdone = 1: GOTO finishednonexec 'nop END IF IF n <= 2 THEN IF firstelement$ = "DATA" THEN l$ = SCase$("Data") IF n = 2 THEN e$ = SPACE$((LEN(secondelement$) - 1) \ 2) FOR x = 1 TO LEN(e$) v1 = ASC(secondelement$, x * 2) v2 = ASC(secondelement$, x * 2 + 1) IF v1 < 65 THEN v1 = v1 - 48 ELSE v1 = v1 - 55 IF v2 < 65 THEN v2 = v2 - 48 ELSE v2 = v2 - 55 ASC(e$, x) = v1 + v2 * 16 NEXT l$ = l$ + sp + e$ END IF 'n=2 layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ GOTO finishednonexec END IF END IF 'declare library IF declaringlibrary THEN IF firstelement$ = "END" THEN IF n <> 2 OR secondelement$ <> "DECLARE" THEN a$ = "Expected END DECLARE": GOTO errmes declaringlibrary = 0 l$ = SCase$("End" + sp + "Declare") layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ GOTO finishednonexec END IF 'end declare declaringlibrary = 2 IF firstelement$ = "SUB" OR firstelement$ = "FUNCTION" THEN GOTO declaresubfunc2 END IF a$ = "Expected SUB/FUNCTION definition or END DECLARE": GOTO errmes END IF 'declaringlibrary 'check TYPE declarations (created on prepass) IF definingtype THEN IF firstelement$ = "END" THEN IF n <> 2 OR secondelement$ <> "TYPE" THEN a$ = "Expected END TYPE": GOTO errmes definingtype = 0 l$ = SCase$("End" + sp + "Type") layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ GOTO finishednonexec END IF 'IF n < 3 THEN definingtypeerror = linenumber: a$ = "Expected element-name AS type or AS type element-list": GOTO errmes IF n < 3 THEN a$ = "Expected element-name AS type or AS type element-list": GOTO errmes definingtype = 2 IF firstelement$ = "AS" THEN l$ = SCase$("As") t$ = "" wordsInTypeName = 0 DO nextElement$ = getelement$(a$, 2 + wordsInTypeName) IF nextElement$ = "," THEN 'element-list wordsInTypeName = wordsInTypeName - 2 EXIT DO END IF wordsInTypeName = wordsInTypeName + 1 IF wordsInTypeName = n - 2 THEN 'single element in line wordsInTypeName = wordsInTypeName - 1 EXIT DO END IF LOOP t$ = getelements$(a$, 2, 2 + wordsInTypeName) typ = typname2typ(t$) IF Error_Happened THEN GOTO errmes IF typ = 0 THEN a$ = "Undefined type": GOTO errmes IF typ AND ISUDT THEN IF UCASE$(RTRIM$(t$)) = "MEM" AND RTRIM$(udtxcname(typ AND 511)) = "_MEM" AND qb64prefix_set = 1 THEN t$ = MID$(RTRIM$(udtxcname(typ AND 511)), 2) ELSE t$ = RTRIM$(udtxcname(typ AND 511)) END IF l$ = l$ + sp + t$ ELSE l$ = l$ + sp + SCase2$(t$) END IF 'Now add each variable: FOR i = 3 + wordsInTypeName TO n thisElement$ = getelement$(ca$, i) IF thisElement$ = "," THEN l$ = l$ + thisElement$ ELSE l$ = l$ + sp + thisElement$ END IF NEXT layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ ELSE l$ = getelement(ca$, 1) + sp + SCase$("As") t$ = getelements$(a$, 3, n) typ = typname2typ(t$) IF Error_Happened THEN GOTO errmes IF typ = 0 THEN a$ = "Undefined type": GOTO errmes IF typ AND ISUDT THEN IF UCASE$(RTRIM$(t$)) = "MEM" AND RTRIM$(udtxcname(typ AND 511)) = "_MEM" AND qb64prefix_set = 1 THEN t$ = MID$(RTRIM$(udtxcname(typ AND 511)), 2) ELSE t$ = RTRIM$(udtxcname(typ AND 511)) END IF l$ = l$ + sp + t$ ELSE l$ = l$ + sp + SCase2$(t$) END IF layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ END IF GOTO finishednonexec END IF 'defining type IF firstelement$ = "TYPE" THEN IF n <> 2 THEN a$ = "Expected TYPE type-name": GOTO errmes l$ = SCase$("Type") + sp + getelement(ca$, 2) layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ definingtype = 1 definingtypeerror = linenumber GOTO finishednonexec END IF 'skip DECLARE SUB/FUNCTION IF n >= 1 THEN IF firstelement$ = "DECLARE" THEN IF secondelement$ = "LIBRARY" OR secondelement$ = "DYNAMIC" OR secondelement$ = "CUSTOMTYPE" OR secondelement$ = "STATIC" THEN declaringlibrary = 1 dynamiclibrary = 0 customtypelibrary = 0 indirectlibrary = 0 staticlinkedlibrary = 0 x = 3 l$ = SCase$("Declare" + sp + "Library") IF secondelement$ = "DYNAMIC" THEN e$ = getelement$(a$, 3): IF e$ <> "LIBRARY" THEN a$ = "Expected DYNAMIC LIBRARY " + CHR$(34) + "..." + CHR$(34): GOTO errmes dynamiclibrary = 1 x = 4 l$ = SCase$("Declare" + sp + "Dynamic" + sp + "Library") IF n = 3 THEN a$ = "Expected DECLARE DYNAMIC LIBRARY " + CHR$(34) + "..." + CHR$(34): GOTO errmes indirectlibrary = 1 END IF IF secondelement$ = "CUSTOMTYPE" THEN e$ = getelement$(a$, 3): IF e$ <> "LIBRARY" THEN a$ = "Expected CUSTOMTYPE LIBRARY": GOTO errmes customtypelibrary = 1 x = 4 l$ = SCase$("Declare" + sp + "CustomType" + sp + "Library") indirectlibrary = 1 END IF IF secondelement$ = "STATIC" THEN e$ = getelement$(a$, 3): IF e$ <> "LIBRARY" THEN a$ = "Expected STATIC LIBRARY": GOTO errmes x = 4 l$ = SCase$("Declare" + sp + "Static" + sp + "Library") staticlinkedlibrary = 1 END IF sfdeclare = 0: sfheader = 0 IF n >= x THEN sfdeclare = 1 addlibrary: libname$ = "" headername$ = "" 'assume library name in double quotes follows 'assume library is in main qb64pe folder x$ = getelement$(ca$, x) IF ASC(x$) <> 34 THEN a$ = "Expected LIBRARY " + CHR$(34) + "..." + CHR$(34): GOTO errmes x$ = RIGHT$(x$, LEN(x$) - 1) z = INSTR(x$, CHR$(34)) IF z = 0 THEN a$ = "Expected LIBRARY " + CHR$(34) + "..." + CHR$(34): GOTO errmes x$ = LEFT$(x$, z - 1) IF dynamiclibrary <> 0 AND LEN(x$) = 0 THEN a$ = "Expected DECLARE DYNAMIC LIBRARY " + CHR$(34) + "..." + CHR$(34): GOTO errmes IF customtypelibrary <> 0 AND LEN(x$) = 0 THEN a$ = "Expected DECLARE CUSTOMTYPE LIBRARY " + CHR$(34) + "..." + CHR$(34): GOTO errmes 'convert '\\' to '\' WHILE INSTR(x$, "\\") z = INSTR(x$, "\\") x$ = LEFT$(x$, z - 1) + RIGHT$(x$, LEN(x$) - z) WEND autoformat_x$ = x$ 'used for autolayout purposes 'Remove version number from library name 'Eg. libname:1.0 becomes libname <-> 1.0 which later becomes libname.so.1.0 v$ = "" striplibver: FOR z = LEN(x$) TO 1 STEP -1 a = ASC(x$, z) IF a = ASC_BACKSLASH OR a = ASC_FORWARDSLASH THEN EXIT FOR IF a = ASC_FULLSTOP OR a = ASC_COLON THEN IF isuinteger(RIGHT$(x$, LEN(x$) - z)) THEN IF LEN(v$) THEN v$ = RIGHT$(x$, LEN(x$) - z) + "." + v$ ELSE v$ = RIGHT$(x$, LEN(x$) - z) x$ = LEFT$(x$, z - 1) IF a = ASC_COLON THEN EXIT FOR GOTO striplibver ELSE EXIT FOR END IF END IF NEXT libver$ = v$ IF os$ = "WIN" THEN 'convert forward-slashes to back-slashes DO WHILE INSTR(x$, "/") z = INSTR(x$, "/") x$ = LEFT$(x$, z - 1) + "\" + RIGHT$(x$, LEN(x$) - z) LOOP END IF IF os$ = "LNX" THEN 'convert any back-slashes to forward-slashes DO WHILE INSTR(x$, "\") z = INSTR(x$, "\") x$ = LEFT$(x$, z - 1) + "/" + RIGHT$(x$, LEN(x$) - z) LOOP END IF 'Separate path from name libpath$ = "" FOR z = LEN(x$) TO 1 STEP -1 a = ASC(x$, z) IF a = 47 OR a = 92 THEN '\ or / libpath$ = LEFT$(x$, z) x$ = RIGHT$(x$, LEN(x$) - z) EXIT FOR END IF NEXT 'Accept ./ and .\ as a reference to the source file 'folder, replacing it with the actual full path, if available IF libpath$ = "./" OR libpath$ = ".\" THEN libpath$ = "" IF NoIDEMode THEN libpath$ = path.source$ IF LEN(libpath$) > 0 AND RIGHT$(libpath$, 1) <> pathsep$ THEN libpath$ = libpath$ + pathsep$ ELSE IF LEN(ideprogname) THEN libpath$ = idepath$ + pathsep$ END IF END IF 'Create a path which can be used for inline code (uses \\ instead of \) libpath_inline$ = "" FOR z = 1 TO LEN(libpath$) a = ASC(libpath$, z) libpath_inline$ = libpath_inline$ + CHR$(a) IF a = 92 THEN libpath_inline$ = libpath_inline$ + "\" NEXT IF LEN(x$) THEN IF dynamiclibrary = 0 THEN 'Static library IF os$ = "WIN" THEN 'check for .lib IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + x$ + ".lib") THEN libname$ = libpath$ + x$ + ".lib" inlinelibname$ = libpath_inline$ + x$ + ".lib" END IF END IF 'check for .a IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + x$ + ".a") THEN libname$ = libpath$ + x$ + ".a" inlinelibname$ = libpath_inline$ + x$ + ".a" END IF END IF 'check for .o IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + x$ + ".o") THEN libname$ = libpath$ + x$ + ".o" inlinelibname$ = libpath_inline$ + x$ + ".o" END IF END IF 'check for .lib IF LEN(libname$) = 0 THEN IF _FILEEXISTS(x$ + ".lib") THEN libname$ = x$ + ".lib" inlinelibname$ = x$ + ".lib" END IF END IF 'check for .a IF LEN(libname$) = 0 THEN IF _FILEEXISTS(x$ + ".a") THEN libname$ = x$ + ".a" inlinelibname$ = x$ + ".a" END IF END IF 'check for .o IF LEN(libname$) = 0 THEN IF _FILEEXISTS(x$ + ".o") THEN libname$ = x$ + ".o" inlinelibname$ = x$ + ".o" END IF END IF END IF 'Windows IF os$ = "LNX" THEN IF staticlinkedlibrary = 0 THEN IF MacOSX THEN 'dylib support 'check for .dylib (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = libpath$ + "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = libpath_inline$ + "lib" + x$ + "." + libver$ + ".dylib" IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath " + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".dylib") THEN libname$ = libpath$ + "lib" + x$ + ".dylib" inlinelibname$ = libpath_inline$ + "lib" + x$ + ".dylib" IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath " + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF END IF 'check for .so (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".so." + libver$) THEN libname$ = libpath$ + "lib" + x$ + ".so." + libver$ inlinelibname$ = libpath_inline$ + "lib" + x$ + ".so." + libver$ IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath " + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".so") THEN libname$ = libpath$ + "lib" + x$ + ".so" inlinelibname$ = libpath_inline$ + "lib" + x$ + ".so" IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath " + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF END IF 'check for .a (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".a") THEN libname$ = libpath$ + "lib" + x$ + ".a" inlinelibname$ = libpath_inline$ + "lib" + x$ + ".a" END IF END IF 'check for .o (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".o") THEN libname$ = libpath$ + "lib" + x$ + ".o" inlinelibname$ = libpath_inline$ + "lib" + x$ + ".o" END IF END IF IF staticlinkedlibrary = 0 THEN 'check for .so (usr/lib64) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + libpath$ + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib64/" + libpath$ + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib64/" + libpath_inline$ + "lib" + x$ + ".so." + libver$ IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib64/" + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib64/ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + libpath$ + "lib" + x$ + ".so") THEN libname$ = "/usr/lib64/" + libpath$ + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib64/" + libpath_inline$ + "lib" + x$ + ".so" IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib64/" + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib64/ " END IF END IF END IF 'check for .a (usr/lib64) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + libpath$ + "lib" + x$ + ".a") THEN libname$ = "/usr/lib64/" + libpath$ + "lib" + x$ + ".a" inlinelibname$ = "/usr/lib64/" + libpath_inline$ + "lib" + x$ + ".a" END IF END IF IF staticlinkedlibrary = 0 THEN IF MacOSX THEN 'dylib support 'check for .dylib (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + "." + libver$ + ".dylib" IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/" + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + ".dylib") THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + ".dylib" inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + ".dylib" IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/" + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/ " END IF END IF END IF 'check for .so (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + ".so." + libver$ IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/" + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + ".so") THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + ".so" IF LEN(libpath$) THEN mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/" + libpath$ + " " ELSE mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/ " END IF END IF END IF 'check for .a (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + ".a") THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + ".a" inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + ".a" END IF END IF '--------------------------(without path)------------------------------ IF staticlinkedlibrary = 0 THEN IF MacOSX THEN 'dylib support 'check for .dylib (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = "lib" + x$ + "." + libver$ + ".dylib" mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".dylib") THEN libname$ = "lib" + x$ + ".dylib" inlinelibname$ = "lib" + x$ + ".dylib" mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF END IF 'check for .so (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".so." + libver$) THEN libname$ = "lib" + x$ + ".so." + libver$ inlinelibname$ = "lib" + x$ + ".so." + libver$ mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".so") THEN libname$ = "lib" + x$ + ".so" inlinelibname$ = "lib" + x$ + ".so" mylibopt$ = mylibopt$ + " -Wl,-rpath ./ " END IF END IF END IF 'check for .a (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".a") THEN libname$ = "lib" + x$ + ".a" inlinelibname$ = "lib" + x$ + ".a" END IF END IF 'check for .o (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".o") THEN libname$ = "lib" + x$ + ".o" inlinelibname$ = "lib" + x$ + ".o" END IF END IF IF staticlinkedlibrary = 0 THEN 'check for .so (usr/lib64) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib64/" + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib64/" + "lib" + x$ + ".so." + libver$ mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib64/ " END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + "lib" + x$ + ".so") THEN libname$ = "/usr/lib64/" + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib64/" + "lib" + x$ + ".so" mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib64/ " END IF END IF END IF 'check for .a (usr/lib64) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + "lib" + x$ + ".a") THEN libname$ = "/usr/lib64/" + "lib" + x$ + ".a" inlinelibname$ = "/usr/lib64/" + "lib" + x$ + ".a" END IF END IF IF staticlinkedlibrary = 0 THEN IF MacOSX THEN 'dylib support 'check for .dylib (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = "/usr/lib/" + "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = "/usr/lib/" + "lib" + x$ + "." + libver$ + ".dylib" END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + ".dylib") THEN libname$ = "/usr/lib/" + "lib" + x$ + ".dylib" inlinelibname$ = "/usr/lib/" + "lib" + x$ + ".dylib" mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/ " END IF END IF END IF 'check for .so (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib/" + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib/" + "lib" + x$ + ".so." + libver$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + ".so") THEN libname$ = "/usr/lib/" + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib/" + "lib" + x$ + ".so" mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/ " END IF END IF END IF 'check for .a (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + ".a") THEN libname$ = "/usr/lib/" + "lib" + x$ + ".a" inlinelibname$ = "/usr/lib/" + "lib" + x$ + ".a" mylibopt$ = mylibopt$ + " -Wl,-rpath /usr/lib/ " END IF END IF END IF 'Linux 'check for header IF LEN(headername$) = 0 THEN IF os$ = "WIN" THEN IF _FILEEXISTS(libpath$ + x$ + ".h") THEN headername$ = libpath_inline$ + x$ + ".h" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS(libpath$ + x$ + ".hpp") THEN headername$ = libpath_inline$ + x$ + ".hpp" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF '--------------------------(without path)------------------------------ IF _FILEEXISTS(x$ + ".h") THEN headername$ = x$ + ".h" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS(x$ + ".hpp") THEN headername$ = x$ + ".hpp" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF END IF 'Windows IF os$ = "LNX" THEN IF _FILEEXISTS(libpath$ + x$ + ".h") THEN headername$ = libpath_inline$ + x$ + ".h" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS(libpath$ + x$ + ".hpp") THEN headername$ = libpath_inline$ + x$ + ".hpp" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS("/usr/include/" + libpath$ + x$ + ".h") THEN headername$ = "/usr/include/" + libpath_inline$ + x$ + ".h" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS("/usr/include/" + libpath$ + x$ + ".hpp") THEN headername$ = "/usr/include/" + libpath_inline$ + x$ + ".hpp" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF '--------------------------(without path)------------------------------ IF _FILEEXISTS(x$ + ".h") THEN headername$ = x$ + ".h" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS(x$ + ".hpp") THEN headername$ = x$ + ".hpp" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS("/usr/include/" + x$ + ".h") THEN headername$ = "/usr/include/" + x$ + ".h" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF IF _FILEEXISTS("/usr/include/" + x$ + ".hpp") THEN headername$ = "/usr/include/" + x$ + ".hpp" IF customtypelibrary = 0 THEN sfdeclare = 0 sfheader = 1 GOTO GotHeader END IF END IF 'Linux GotHeader: END IF ELSE 'dynamic library IF os$ = "WIN" THEN 'check for .dll (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + x$ + ".dll") THEN libname$ = libpath$ + x$ + ".dll" inlinelibname$ = libpath_inline$ + x$ + ".dll" END IF END IF 'check for .dll (system32) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(ENVIRON$("SYSTEMROOT") + "\System32\" + libpath$ + x$ + ".dll") THEN libname$ = libpath$ + x$ + ".dll" inlinelibname$ = libpath_inline$ + x$ + ".dll" END IF END IF '--------------------------(without path)------------------------------ 'check for .dll (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(x$ + ".dll") THEN libname$ = x$ + ".dll" inlinelibname$ = x$ + ".dll" END IF END IF 'check for .dll (system32) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(ENVIRON$("SYSTEMROOT") + "\System32\" + x$ + ".dll") THEN libname$ = x$ + ".dll" inlinelibname$ = x$ + ".dll" END IF END IF END IF 'Windows IF os$ = "LNX" THEN 'Note: STATIC libraries (.a/.o) cannot be loaded as dynamic objects IF MacOSX THEN 'dylib support 'check for .dylib (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = libpath$ + "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = libpath_inline$ + "lib" + x$ + "." + libver$ + ".dylib" IF LEFT$(libpath$, 1) <> "/" THEN libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".dylib") THEN libname$ = libpath$ + "lib" + x$ + ".dylib" inlinelibname$ = libpath_inline$ + "lib" + x$ + ".dylib" IF LEFT$(libpath$, 1) <> "/" THEN libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF END IF 'check for .so (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".so." + libver$) THEN libname$ = libpath$ + "lib" + x$ + ".so." + libver$ inlinelibname$ = libpath_inline$ + "lib" + x$ + ".so." + libver$ IF LEFT$(libpath$, 1) <> "/" THEN libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS(libpath$ + "lib" + x$ + ".so") THEN libname$ = libpath$ + "lib" + x$ + ".so" inlinelibname$ = libpath_inline$ + "lib" + x$ + ".so" IF LEFT$(libpath$, 1) <> "/" THEN libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF 'check for .so (usr/lib64) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + libpath$ + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib64/" + libpath$ + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib64/" + libpath_inline$ + "lib" + x$ + ".so." + libver$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + libpath$ + "lib" + x$ + ".so") THEN libname$ = "/usr/lib64/" + libpath$ + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib64/" + libpath_inline$ + "lib" + x$ + ".so" END IF END IF IF MacOSX THEN 'dylib support 'check for .dylib (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + "." + libver$ + ".dylib" END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + ".dylib") THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + ".dylib" inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + ".dylib" END IF END IF END IF 'check for .so (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + ".so." + libver$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + libpath$ + "lib" + x$ + ".so") THEN libname$ = "/usr/lib/" + libpath$ + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib/" + libpath_inline$ + "lib" + x$ + ".so" END IF END IF '--------------------------(without path)------------------------------ IF MacOSX THEN 'dylib support 'check for .dylib (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = "lib" + x$ + "." + libver$ + ".dylib" libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".dylib") THEN libname$ = "lib" + x$ + ".dylib" inlinelibname$ = "lib" + x$ + ".dylib" libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF END IF 'check for .so (direct) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".so." + libver$) THEN libname$ = "lib" + x$ + ".so." + libver$ inlinelibname$ = "lib" + x$ + ".so." + libver$ libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("lib" + x$ + ".so") THEN libname$ = "lib" + x$ + ".so" inlinelibname$ = "lib" + x$ + ".so" libname$ = "./" + libname$: inlinelibname$ = "./" + inlinelibname$ END IF END IF 'check for .so (usr/lib64) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib64/" + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib64/" + "lib" + x$ + ".so." + libver$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib64/" + "lib" + x$ + ".so") THEN libname$ = "/usr/lib64/" + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib64/" + "lib" + x$ + ".so" END IF END IF IF MacOSX THEN 'dylib support 'check for .dylib (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + "." + libver$ + ".dylib") THEN libname$ = "/usr/lib/" + "lib" + x$ + "." + libver$ + ".dylib" inlinelibname$ = "/usr/lib/" + "lib" + x$ + "." + libver$ + ".dylib" END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + ".dylib") THEN libname$ = "/usr/lib/" + "lib" + x$ + ".dylib" inlinelibname$ = "/usr/lib/" + "lib" + x$ + ".dylib" END IF END IF END IF 'check for .so (usr/lib) IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + ".so." + libver$) THEN libname$ = "/usr/lib/" + "lib" + x$ + ".so." + libver$ inlinelibname$ = "/usr/lib/" + "lib" + x$ + ".so." + libver$ END IF END IF IF LEN(libname$) = 0 THEN IF _FILEEXISTS("/usr/lib/" + "lib" + x$ + ".so") THEN libname$ = "/usr/lib/" + "lib" + x$ + ".so" inlinelibname$ = "/usr/lib/" + "lib" + x$ + ".so" END IF END IF END IF 'Linux END IF 'Dynamic 'library found? IF dynamiclibrary <> 0 AND LEN(libname$) = 0 THEN a$ = "DYNAMIC LIBRARY not found": GOTO errmes IF LEN(libname$) = 0 AND LEN(headername$) = 0 THEN a$ = "LIBRARY not found": GOTO errmes '***actual method should cull redundant header and library entries*** IF dynamiclibrary = 0 THEN 'static IF LEN(libname$) THEN IF os$ = "WIN" THEN IF MID$(libname$, 2, 1) = ":" OR LEFT$(libname$, 1) = "\" THEN mylib$ = mylib$ + " " + libname$ + " " ELSE mylib$ = mylib$ + " ..\..\" + libname$ + " " END IF END IF IF os$ = "LNX" THEN IF LEFT$(libname$, 1) = "/" THEN mylib$ = mylib$ + " " + libname$ + " " ELSE mylib$ = mylib$ + " ../../" + libname$ + " " END IF END IF END IF ELSE 'dynamic IF LEN(headername$) = 0 THEN 'no header IF subfuncn THEN f = OpenBuffer%("A", tmpdir$ + "maindata.txt") ELSE f = DataTxtBuf END IF 'make name a C-appropriate variable name 'by converting everything except numbers and 'letters to underscores x2$ = x$ FOR x2 = 1 TO LEN(x2$) IF ASC(x2$, x2) < 48 THEN ASC(x2$, x2) = 95 IF ASC(x2$, x2) > 57 AND ASC(x2$, x2) < 65 THEN ASC(x2$, x2) = 95 IF ASC(x2$, x2) > 90 AND ASC(x2$, x2) < 97 THEN ASC(x2$, x2) = 95 IF ASC(x2$, x2) > 122 THEN ASC(x2$, x2) = 95 NEXT DLLname$ = x2$ IF sfdeclare THEN IF os$ = "WIN" THEN WriteBufLine RegTxtBuf, "HINSTANCE DLL_" + x2$ + "=NULL;" WriteBufLine f, "if (!DLL_" + x2$ + "){" WriteBufLine f, "DLL_" + x2$ + "=LoadLibrary(" + CHR$(34) + inlinelibname$ + CHR$(34) + ");" WriteBufLine f, "if (!DLL_" + x2$ + ") error(259);" WriteBufLine f, "}" END IF IF os$ = "LNX" THEN WriteBufLine RegTxtBuf, "void *DLL_" + x2$ + "=NULL;" WriteBufLine f, "if (!DLL_" + x2$ + "){" WriteBufLine f, "DLL_" + x2$ + "=dlopen(" + CHR$(34) + inlinelibname$ + CHR$(34) + ",RTLD_LAZY);" WriteBufLine f, "if (!DLL_" + x2$ + ") error(259);" WriteBufLine f, "}" END IF END IF END IF 'no header END IF 'dynamiclibrary IF LEN(headername$) THEN IF (os$ = "WIN" AND (MID$(headername$, 2, 1) = ":" OR LEFT$(headername$, 1) = "\")) _ OR (os$ = "LNX" AND (LEFT$(headername$, 1) = "/")) THEN WriteBufLine RegTxtBuf, "#include " + CHR$(34) + headername$ + CHR$(34) ELSE WriteBufLine RegTxtBuf, "#include " + CHR$(34) + "../../" + headername$ + CHR$(34) END IF END IF END IF l$ = l$ + sp + CHR$(34) + autoformat_x$ + CHR$(34) IF n > x THEN IF dynamiclibrary THEN a$ = "Cannot specify multiple DYNAMIC LIBRARY names in a single DECLARE statement": GOTO errmes x = x + 1: x2$ = getelement$(a$, x): IF x2$ <> "," THEN a$ = "Expected ,": GOTO errmes l$ = l$ + sp2 + "," x = x + 1: IF x > n THEN a$ = "Expected , ...": GOTO errmes GOTO addlibrary END IF END IF 'n>=x layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$ GOTO finishednonexec END IF GOTO finishednonexec 'note: no layout required END IF END IF 'begin SUB/FUNCTION IF n >= 1 THEN dynamiclibrary = 0 declaresubfunc2: sf = 0 IF firstelement$ = "FUNCTION" THEN sf = 1 IF firstelement$ = "SUB" THEN sf = 2 IF sf THEN IF declaringlibrary = 0 THEN IF LEN(subfunc) THEN a$ = "Expected END SUB/FUNCTION before " + firstelement$: GOTO errmes END IF IF n = 1 THEN a$ = "Expected name after SUB/FUNCTION": GOTO errmes e$ = getelement$(ca$, 2) symbol$ = removesymbol$(e$) '$,%,etc. IF Error_Happened THEN GOTO errmes IF sf = 2 AND symbol$ <> "" THEN a$ = "Type symbols after a SUB name are invalid": GOTO errmes try = findid(e$) IF Error_Happened THEN GOTO errmes DO WHILE try IF id.subfunc = sf THEN GOTO createsf IF try = 2 THEN findanotherid = 1: try = findid(e$) ELSE try = 0 IF Error_Happened THEN GOTO errmes LOOP a$ = "Unregistered SUB/FUNCTION encountered": GOTO errmes createsf: IF UCASE$(e$) = "_GL" THEN e$ = "_GL" IF firstelement$ = "SUB" THEN l$ = SCase$("Sub") + sp + e$ + symbol$ ELSE l$ = SCase$("Function") + sp + e$ + symbol$ END IF id2 = id targetid = currentid 'check for ALIAS aliasname$ = RTRIM$(id.cn) IF n > 2 THEN ee$ = getelement$(a$, 3) IF ee$ = "ALIAS" THEN IF declaringlibrary = 0 THEN a$ = "ALIAS can only be used with DECLARE LIBRARY": GOTO errmes IF n = 3 THEN a$ = "Expected ALIAS name-in-library": GOTO errmes ee$ = getelement$(ca$, 4) 'strip string content (optional) IF LEFT$(ee$, 1) = CHR$(34) THEN ee$ = RIGHT$(ee$, LEN(ee$) - 1) x = INSTR(ee$, CHR$(34)): IF x = 0 THEN a$ = "Expected " + CHR$(34): GOTO errmes ee$ = LEFT$(ee$, x - 1) l$ = l$ + sp + SCase$("Alias") + sp + CHR_QUOTE + ee$ + CHR_QUOTE ELSE l$ = l$ + sp + SCase$("Alias") + sp + ee$ END IF 'strip fix046$ (created by unquoted periods) DO WHILE INSTR(ee$, fix046$) x = INSTR(ee$, fix046$): ee$ = LEFT$(ee$, x - 1) + "." + RIGHT$(ee$, LEN(ee$) - x + 1 - LEN(fix046$)) LOOP aliasname$ = ee$ 'remove ALIAS section from line IF n <= 4 THEN a$ = getelements(a$, 1, 2) IF n >= 5 THEN a$ = getelements(a$, 1, 2) + sp + getelements(a$, 5, n) IF n <= 4 THEN ca$ = getelements(ca$, 1, 2) IF n >= 5 THEN ca$ = getelements(ca$, 1, 2) + sp + getelements(ca$, 5, n) n = n - 2 END IF END IF IF declaringlibrary THEN GOTO declibjmp1 IF closedmain = 0 THEN closemain 'check for open controls (copy #2) IF controllevel <> 0 AND controltype(controllevel) <> 6 THEN 'It's OK for subs to be inside $IF blocks a$ = "Unidentified open control block" SELECT CASE controltype(controllevel) CASE 1: a$ = "IF without END IF" CASE 2: a$ = "FOR without NEXT" CASE 3, 4: a$ = "DO without LOOP" CASE 5: a$ = "WHILE without WEND" CASE 10 TO 19: a$ = "SELECT CASE without END SELECT" END SELECT linenumber = controlref(controllevel) GOTO errmes END IF IF ideindentsubs THEN controllevel = controllevel + 1 controltype(controllevel) = 32 controlref(controllevel) = linenumber END IF subfunc = RTRIM$(id.callname) 'SUB_..." IF id.subfunc = 1 THEN subfuncoriginalname$ = "FUNCTION " ELSE subfuncoriginalname$ = "SUB " subfuncoriginalname$ = subfuncoriginalname$ + RTRIM$(id.cn) subfuncn = subfuncn + 1 closedsubfunc = 0 subfuncid = targetid subfuncret$ = "" DataTxtBuf = OpenBuffer%("O", tmpdir$ + "data" + str2$(subfuncn) + ".txt") FreeTxtBuf = OpenBuffer%("O", tmpdir$ + "free" + str2$(subfuncn) + ".txt") RetTxtBuf = OpenBuffer%("O", tmpdir$ + "ret" + str2$(subfuncn) + ".txt") defdatahandle = DataTxtBuf WriteBufLine RetTxtBuf, "if (next_return_point){" WriteBufLine RetTxtBuf, "next_return_point--;" WriteBufLine RetTxtBuf, "switch(return_point[next_return_point]){" WriteBufLine RetTxtBuf, "case 0:" WriteBufLine RetTxtBuf, "error(3);" 'return without gosub! WriteBufLine RetTxtBuf, "break;" declibjmp1: IF declaringlibrary THEN IF sfdeclare = 0 AND indirectlibrary = 0 THEN RegTxtBuf = OpenBuffer%("O", tmpdir$ + "regsf_ignore.txt") END IF IF sfdeclare = 1 AND customtypelibrary = 0 AND dynamiclibrary = 0 AND indirectlibrary = 0 THEN WriteBufLine RegTxtBuf, "#include " + CHR$(34) + "externtype" + str2(ResolveStaticFunctions + 1) + ".txt" + CHR$(34) fh = FREEFILE: OPEN tmpdir$ + "externtype" + str2(ResolveStaticFunctions + 1) + ".txt" FOR OUTPUT AS #fh: CLOSE #fh END IF END IF IF sf = 1 THEN rettyp = id.ret t$ = typ2ctyp$(id.ret, "") IF Error_Happened THEN GOTO errmes IF t$ = "qbs" THEN t$ = "qbs*" IF declaringlibrary THEN IF rettyp AND ISSTRING THEN t$ = "char*" END IF END IF IF declaringlibrary <> 0 AND dynamiclibrary <> 0 THEN IF os$ = "WIN" THEN WriteBufRawData RegTxtBuf, "typedef " + t$ + " (CALLBACK* DLLCALL_" + removecast$(RTRIM$(id.callname)) + ")(" END IF IF os$ = "LNX" THEN WriteBufRawData RegTxtBuf, "typedef " + t$ + " (*DLLCALL_" + removecast$(RTRIM$(id.callname)) + ")(" END IF ELSEIF declaringlibrary <> 0 AND customtypelibrary <> 0 THEN WriteBufRawData RegTxtBuf, "typedef " + t$ + " CUSTOMCALL_" + removecast$(RTRIM$(id.callname)) + "(" ELSE WriteBufRawData RegTxtBuf, t$ + " " + removecast$(RTRIM$(id.callname)) + "(" END IF IF declaringlibrary THEN GOTO declibjmp2 WriteBufRawData MainTxtBuf, t$ + " " + removecast$(RTRIM$(id.callname)) + "(" 'create variable to return result 'if type wasn't specified, define it IF symbol$ = "" THEN a = ASC(UCASE$(e$)): IF a = 95 THEN a = 91 a = a - 64 'so A=1, Z=27 and _=28 symbol$ = defineextaz(a) END IF |