Swifty wrote
> This is why I started with the line:
> REM /*
> ... which means that REXX ignores the rest of the BAT code.
> It's lucky that Windows implements REM as a valid command.
Before REXX became part of VM/CMS, users who wanted to write REXX execs
had to install the REXX processor into their execution environment (typically
done in "PROFILE EXEC"). I suspect that what this did was to create a nucleus
extension called "EXEC", so that when the operating system looked for a
program called "EXEC" to interpret a user exec file (in response to the user
typing the name of his exec file on the command line), the OS found the
nucleus extension instead of the real EXEC1 processor.
In the nucleus extension, REXX had a non standard fix-up that caused it to
treat the first line as a comment if the line began with:
*/*
What did this do? Well, it allowed bilingual execs to be written. In the
EXEC1 language, lines beginning with a "*" character were treated as comment
lines, and ignored. If a tool writer wanted a tool written in REXX to be
usable by people who had NOT installed REXX into their execution environment,
the tool writer would put something like the following at the start of the
exec:
*/*
REXX INSTALL
EXEC &0 &1 &2 &3 &4 &5 &6 &7 &8 &9
&exit &retcode
*/
...the actual REXX code for the tool goes here...
exit rc
If invoked in an environment without REXX installed, the EXEC1 interpreter
would get invoked. EXEC1 would see the first line as a comment, and would
execute lines 2-4. Line 2 installs REXX into the environment, line 3 then
re-invokes the exec (but this time REXX will get invoked instead of EXEC1),
and line 4 exits with the return code.
If invoked with REXX already installed, REXX special-cases the first line and
treats it as the start of a comment, which is not ended until line 5. Result:
the EXEC1 lines are ignored by REXX, and REXX sees only the subsequent REXX
lines.
To get a similar effect on Windows, you need a BAT statement that does not
produce any output on the screen, and which is capable of being subverted
(i.e. is valid REXX). Although lines beginning with the "@" character do not
produce any output, they are not valid REXX. Hence, the only way to enable
bilingual BAT files is to include a non-standard fix-up into the ooRexx
interpreter, for example by treating:
REM /*
as the start of a REXX comment if found on the first line of a BAT file. Would
the ooRexx maintainers be amenable to such a change? Ask them!
-- from CyberSimian in the UK