(Nearly) solved: FuNction which tests if a variable is set
Posted: Tue Apr 18, 2017 10:48 am
Is there a S(uper)BASIC-function which tests if a variable is set?
e.g.:
In SBASIC (SMSQ/E on QPC2) you can use:
IF NOT a_%:END_CMD
But this does unfortunately not (even) work on Minerva :-( It is also not what I want, cause if a_% is 0 the command file will always stop. But perhaps the command file should continue and use the value 0.
EDIT:
Found a function from Turbo Toolkit: BASIC_INDEX%(name$) does it. Returns a value <0 if no such name exists.
A note in the Keyword Reference Page says there is a fix (TurboFix_bin), which allows using BASIC_INDEX%() even with MultiBASICs. Where can I obtain Turbofix_bin? Without BASIC_INDEX%() always references the name table of the initial S(uper)BASIC interpreter (Job-ID 0).
e.g.:
Code: Select all
REMark Turbo Toolkit required for END_CMD
IF NOT variableSet(a_%):END_CMD
REMark Alternative: IF NOT variableSet("a_%"):END_CMD
REMark Continue with command file only if a_% is set
REMark ... (your commands)
END_CMD
IF NOT a_%:END_CMD
But this does unfortunately not (even) work on Minerva :-( It is also not what I want, cause if a_% is 0 the command file will always stop. But perhaps the command file should continue and use the value 0.
EDIT:
Found a function from Turbo Toolkit: BASIC_INDEX%(name$) does it. Returns a value <0 if no such name exists.
A note in the Keyword Reference Page says there is a fix (TurboFix_bin), which allows using BASIC_INDEX%() even with MultiBASICs. Where can I obtain Turbofix_bin? Without BASIC_INDEX%() always references the name table of the initial S(uper)BASIC interpreter (Job-ID 0).