Re: SETDOS /X-4-6



Steve Fabian пише:
Control characters are not valid in variable names. That's what makes storing special variables, e.g. GOSUB formal parameters, in the environment possible. The parser has to keep track of the current context; the 0x01 as the first character in GOSUB variable names signals that it is a "very local" variable; the next character in the name (4NT V8 et seq.) is the context.

As I already wrote, GOSUB and FOR variables in 4DOS are not stored in the environment but temporary stored in memory, and their lifetime is only during the command. Nor they are preceded by control characters, with the exception of the single-character FOR variables (COMMAND.COM limitation, as the comment in the source code explains).

In most other command processor languages the value of a variable does not become a part of the command, it is treated as data. This makes it possible for the variable to contain characters that are special characters for the parser.

In BASH, "export t='$!"<>'; echo $t" outputs $!"<>. The same effect can be obtained in 4DOS using "SETDOS /X-4-6": after it, set t=`%@'<>"` and echo %t outputs %@'<>". The only issue here is, if you want to redirect the output of a command, containing an environment variable, containing redirection characters: if so, you can't disable redirection with /X-6. But such coincidence is only theoretical so SETDOS /X-4-6 does the job.

|| An auxiliary issue: when DO or FOR is used to read the lines of a
|| file, e.g., FOR %X IN (@XYZ.BTM) ... the same rules should apply, at
|| least optionally. Likewise, the results of some functions, esp.
|| @ALIAS[] and @FUNCTION[] often need the "pure" text accessible.
|
Do you mean a new SETDOS /X option, so that when it is in effect, all DATA (values of functions and dynamic variables of FOR and DO commands) is treated as DATA, without being interpreted?

This can be done. But FOR and DO are so complex that I get lost even in the description of these commands, let alone their "C" implementations!

Regards,
Lucho
.



Relevant Pages

  • Re: Text environment
    ... | standard environment - but the problem is not this but distinguishing ... Control characters are not valid in variable names. ... The parser has to keep track of the current context; ... In most other command processor languages the value of a variable does not ...
    (comp.os.msdos.4dos)
  • Re: SETDOS /X-4-6
    ... the 0x01 as the first character in GOSUB variable names ... | the environment but temporary stored in memory, ... | only during the command. ... Nor they are preceded by control characters, ...
    (comp.os.msdos.4dos)
  • Re: Environment limit on NT
    ... the 'system' command seems to be exitting abruptly. ... common observation is around 6000 characters) and when another ... when I run a perl script containing just the following: ... Is there a limit on the length of an environment ...
    (perl.beginners)
  • Re: Environment limit on NT
    ... the 'system' command seems to be exitting abruptly. ... common observation is around 6000 characters) and when another ... when I run a perl script containing just the following: ... Is there a limit on the length of an environment ...
    (perl.beginners)
  • Re: Set App Priority
    ... string and then terminates" ... gives then parameters to use to modify the START command ... below) /F:OFF Disable file and directory name completion characters ... no special characters between the two quote characters, ...
    (microsoft.public.windowsxp.customize)