Re: SETDOS /X-4-6
- From: Luchezar Georgiev <lucho@xxxxxxxxx>
- Date: Wed, 13 Aug 2008 10:51:51 +0300
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
.
- Follow-Ups:
- Re: SETDOS /X-4-6
- From: Steve Fabian
- Re: SETDOS /X-4-6
- References:
- Trigonometric and transcendental functions with @EVAL
- From: lcaverly
- Re: Trigonometric and transcendental functions with @EVAL
- From: Luchezar Georgiev
- Re: Trigonometric and transcendental functions with @EVAL
- From: Klaus Meinhard
- Re: Trigonometric and transcendental functions with @EVAL
- From: Luchezar Georgiev
- Re: Trigonometric and transcendental functions with @EVAL
- From: Steve Fabian
- Re: Trigonometric and transcendental functions with @EVAL
- From: Luchezar Georgiev
- Re: Trigonometric and transcendental functions with @EVAL
- From: Klaus Meinhard
- Re: Text-only (non-expandable) variables
- From: Luchezar Georgiev
- Re: Text-only (non-expandable) variables
- From: Steve Fabian
- Re: Text-only (non-expandable) variables
- From: Steve Fabian
- Reading binary data from a file: @FILEREADB function
- From: Luchezar Georgiev
- Re: Reading binary data from a file: @FILEREADB function
- From: Steve Fabian
- Re: @FILEREADB
- From: Luchezar Georgiev
- Re: @FILEREADB
- From: jayterry@xxxxxxxxxxxxx
- Re: @FILEREADB, _READSTR
- From: Luchezar Georgiev
- Re: @FILEREADB, _READSTR
- From: Klaus Meinhard
- Re: _READSTR (or whatever other name we prefer)
- From: Luchezar Georgiev
- Re: _READSTR (or whatever other name we prefer)
- From: Steve Fabian
- Re: Text environment
- From: Luchezar Georgiev
- Re: Text environment
- From: Steve Fabian
- Trigonometric and transcendental functions with @EVAL
- Prev by Date: Re: Non-expandable environment variables
- Next by Date: Re: User-assignable internal variables
- Previous by thread: Re: Text environment
- Next by thread: Re: SETDOS /X-4-6
- Index(es):
Relevant Pages
|