Showing changes from revision #2 to #3:
Added | Removed | Changed
Entry | |
---|---|
R0 | Pointer to argument list, and flag in top bit |
R1 | Pointer to buffer for resulting string |
R2 | Length of buffer |
R3 | Pointer to template string |
R4 | Length of template string |
Exit | |
---|---|
R0 | Preserved |
R1 | Preserved |
R2 | Length of result string (including terminator) |
R3 | Preserved |
R4 | Preserved |
This SWI is deprecated, because the use of flag bits in address values makes it unsafe to use on systems with 32bit logical memory maps. Please use OS_SubstituteArgs32 instead.
The purpose of this call is to substitute command line arguments
This call performs the hard work involved in substituting a list of arguments into a ‘template’ string. Its main use is in the processing of command Alias$...
variables by the system. It’s also useful in other situations; it has been made available to users. For example, FileSwitch uses it in the processing of Alias$LoadType_TTT
variables.
The argument list is a string consisting of space separated items which will be substituted into the template string. Spaces within double quotation marks are not counted as argument seperators. Typically, the argument string will just be the tail of a *Command. Its control character terminated. The result of substituting the arguments into the template string is placed in the buffer. The length of the buffer is given so that the call can check for buffer overflow. The template string is copied into the result buffer char for char. However, when a ‘%’ appears in the template string (even within quotation marks), it marks where an argument should be placed into the output buffer. The ‘%’ is followed by a single digit from 0 – 9. 0 stands for the first argument in the argument list and so on. % means a single . Anything else following the ’’ is not treated specially, i.e. both the % and the character are copied over. The template string doesn’t have a terminator; instead its length is given. At the end of substitution, any arguments after the highest one mentioned in the template string are appended to the result string. To prevent this set the top bit of R0 on entry. If a non-existing argument is specified in the template string, then a null string is substituted, no error is given.
Note this SWI fails when given addresses with bit 31 set – OS_SubstituteArgs32 should be used in preference.