Every option is given a name. For example, perhaps the interpreter has an option whereby LINEOUT() truncates (ie, discards) any data that may have been after the point at which you wrote a line to the file. The name of this option may be EXT_LINEOUTTRUNC.
To turn on a feature, simply list its name after the OPTIONS keyword. Make sure that you enclose the name in quotes so that REXX doesn't mistake it for a variable name. Here, we turn on the EXT_LINEOUTTRUNC feature:
OPTIONS 'EXT_LINEOUTTRUNC'Of course, you could use a variable if desired:
MyOptions = 'EXT_LINEOUTTRUNC' OPTIONS MyOptionsTo turn off a feature, preface its name with 'NO'. Here, we turn off the EXT_LINEOUTTRUNC feature:
OPTIONS 'NOEXT_LINEOUTTRUNC'You can turn on and off numerous options with one OPTION statement. Simply separate each desired option with one or more spaces. For example, here we turn off the EXT_LINEOUTTRUNC option and turn on the LABELCHECK option:
OPTIONS 'NOEXT_LINEOUTTRUNC LABELCHECK'Different interpreters may have different optional features with different names. You'll have to consult the documentation with your interpreter. But, all interpreters use the OPTIONS keyword to turn features on or off from within a script. Note though, that if the user runs the script with a different interpreter than you use, the optional features may not be the same. In this case, the interpreter will ignore any attempt to enable an option it doesn't support (and your script will run without that option turned on. Unfortunately, there is no way to know whether your attempt to turn on an option succeeds or fails).
Note: If your script requires some option to be turned on (ie, will not run properly, or at all, without that option turned on), then you should use PARSE VERSION to get the interpreter name, and if it's not one of the interpreters that you're sure supports that option, display a message telling the user that the interpreter may not support a feature you require.
Reginald OPTIONS
Reginald offers the following options:
C_CALL
If you do not use the return value from a function, that return is not sent to the OS shell. It is thrown away. But, you can otherwise issue commands to the OS shell. For example, here we toss away the return from the TRACE() function call, but then issue a DIR command to the OS shell:OPTIONS 'C_CALL' TRACE('O') 'DIR C\:MyDir'
CASELESS
Turns various string functions such as POS, LASTPOS, WORDPOS, COUNTSTR, CHANGESTR, ABBREV, etc from case-sensitive to case-insensitive.
FAST_LINES_BIF_DEFAULT
The LINES() function returns 1 if there are any more lines in a stream. This is faster than counting how many more lines are still in the stream. This is on by default unless you turn it off.
MEMPOINT
Marks a subroutine as being a spot where any memory you allocate via CONVERTDATA(), is automatically freed when that subroutine ends.
LINEOUTTRUNC
LINEOUT() truncates a stream at the current position after writing out a line. This is on by default unless you turn it off.
OS
Gives more specific information about the operating system name when your script does a "PARSE SOURCE". For example, when this flag is not set, all Windows versions of Reginald report the OS name as "WIN32". When this flag is set, the OS name may be reported as "WIN32S" (32-bit API running upon Windows 3.1), "WIN95", "WIN98", "WINME", "WINNT", "WIN2K", "WINXP", or "WIN32" for all others.
TRACE_FUNCS
Whenever you call some add-on Function in a DLL, and it assigns a value to some variable in your script, the debugger displays the name of that variable and its new value (in the RESULTS box). So too, if the add-on Function queries the value of some variable in your script, the debugger will display that variable's name and value.
TRACE_OPTS
Allows multiple TRACE options to be set simultaneously (instead of only one option at a time).
MSGBOX
Instead of displaying error messages to a console window, Reginald displays the message in a pop-up message box with a Help button that opens up a help page for a specific error. This is on by default unless you turn it off.
SAYBOX
When you follow a SAY instruction with a lone PULL instruction, then Reginald displays the SAY text in a pop-up message box instead of the console window.OPTIONS 'SAYBOX' SAY 'This is my message.' PULL
SOURCE
When this option is turned off, Reginald throws away the source of a script after parsing. This can reduce memory usage while the script is running, and improve speed. But a script may not use the SOURCELINE() function, nor the TRACE instruction, to reference a line where the SOURCE option is turned off. Previous lines can be referenced.
WINFUNC
When this option is turned on, FUNCDEF() automatically appends an "A" to the name of any Windows operating system function that has both a UNICODE and ANSI version.
LABELCHECK
Causes a SYNTAX error if there is a duplicate label in the script (ie, two labels with the same name).
Allows everything after a semi-colon, up to the end of line, to be considered a comment.Even if you specify the SEMICOMMENT option, you still cannot use a semi-colon as a comment until after the next instruction (in your source listing) that immediately follows the OPTIONS 'SEMICOMMENT' statement.
OPTIONS 'SEMICOMMENT' /* Don't use a semi-colon as a comment yet */ i = 5 ; Now that there is at least one instruction ; after we enabled the SEMICOMMENT OPTION, ;we can use a semi-colon as a comment now p = 3;Another comment