Next: PAUSE
Up: SIC Language Internal Help
Previous: ON ERROR
Contents
Index
PARSE
[SIC\]PARSE [/OptionName1] ... [/OptionNameN]
Parse the array PRO%ARG in order to mimic the options mechanism provided
by a standard command.
When a procedure is executed, the array PRO%ARG is filled with the argu-
ments passed to the procedure. If you invoke the command PARSE with some
option names, it will parse the arguments to gather them by options and
option arguments into the structure PRO%PARSE%.
For example, if you invoke your procedure like this:
SIC> @ myprocedure 123 /MYOPTION "ABC"
the PRO%ARG array will contain
SIC_3> EXA PRO%ARG
PRO%ARG is a character*256 Array of dimensions 3
123
/MYOPTION
ABC
Invoking the command PARSE in your procedure e.g.
SIC_3> PARSE /MYOPTION /OTHEROPTION
will gather the command and the 2 option arguments like this:
SIC_3> EXA PRO%PARSE%
PRO%PARSE% ! Structure GLOBAL
PRO%PARSE%COMMAND ! Structure GLOBAL
PRO%PARSE%COMMAND%NARG = 1 ! Integer GLOBAL RO
PRO%PARSE%COMMAND%ARG is a character*256 Array of dimensions 1
PRO%PARSE%MYOPTION ! Structure GLOBAL
PRO%PARSE%MYOPTION%NARG = 1 ! Integer GLOBAL RO
PRO%PARSE%MYOPTION%ARG is a character*256 Array of dimensions 1
PRO%PARSE%OTHEROPTION ! Structure GLOBAL
PRO%PARSE%OTHEROPTION%NARG = -1 ! Integer GLOBAL RO
Namely: the command was passed 1 argument (available in the associated
ARG array), the option MYOPTION was passed 1 argument, and the option
OTHEROPTION was absent (NARG=-1). An option is present if NARG>=0.
Gildas manager
2014-07-01