AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
=>     R0 =     pointer to syntax string
     R1 =     pointer to input string
     R2 =     pointer to output buffer
     R3 =     size of output buffer

<=     R3 =     bytes left in output buffer

This command scans the input string, and places values in output buffer according to the syntax string.

See PRM 1, page 465.
Syntax string
string          = element{, element}
element          = [identifier [=alias] ] {/qualifier}
qualifier     =
A     :     Keyword must always be given value
K     :     Identifier must be used
S     :     Switch
E     :     Do OS_EvaluateExpression on value
G     :     Do OS_GSTrans on value

Note: An element doesn't have to have a name. "," is a perfectly legal syntax string.
Input-string
example:
Syntax
"number=times/e,file/k/a,expand/s"

These input-strings will match:
"-n 10 -file myfile"
"-times 1+7 -file myfile -expand"
"-file myfile -e"

These will not:
"myfile -number 4"
"-number 20 -times 4 -file myfile"
Output buffer
For the Nth identifier (named or not), word N in output buffer contains :

Switch     (/S)     :     non zero value if switch used
GSTransed     (/G)     :     pointer to block (0 if unused) containing a two-byte length and then string itself (not terminated)
Evaluated     (/E)     :     pointer to block (0 if unused) containing a one-byte type then four bytes of value (integer if type=0)
else                :     pointer to NULL terminated string

The results blocks pointed to are appended after the array of N words, therefore the output buffer must be at least N words long plus space to hold values/strings themselves.

[sh-index] Back to list of manuals