next up previous contents index
Next: The messaging facility Up: SIC Programming Manual - Previous: The Help File   Contents   Index


Retrieving Arguments

To properly interface your program, you must know how to retrieve an argument from the command buffer processed by SICIn standard SIC offers for each command up to 98 options, and for each option (or command) up to 98 arguments, the total number of arguments and options in a command line being limited to 99.

Arguments in SIC command lines are positional. The position of argument number IARG of option number IOPT of the current command is kept in SIC by means of internal pointers, By convention, argument number 0 refers to the option (or command) itself, and option number 0 to the command itself. Four standard routines are provided to decode the following type of arguments. All these routines do not modify the value of the argument if it is missing in the command buffer. They may return an error condition and output an error message if requested in this case.

          Argument Type   Routine Name
          Integer*4         SIC_I4
          Real*4            SIC_R4
          Real*8            SIC_R8
          Logical*4         SIC_L4
          Character         SIC_CH
          Character         SIC_KE           (Upcase converted keyword)
The first four routines routines have the following calling list
          CALL SIC_name (LINE,IOPT,IARG,Arg,PRESENT,ERROR)
in which
          LINE        The command buffer
          IOPT        The option number (0=command)
          IARG        The argument number (0=command or option)
          Arg         The argument to be retrieved
          PRESENT     A flag indicating whether an error must occur if
                      the argument is not present in the command line
          ERROR       An error flag set in case of decoding errors,
                      or for missing argument when PRESENT is set.
SIC_CH and SIC_KE are slightly different, because they also return the length of the character string:
          CALL SIC_CH (LINE,IOPT,IARG,Arg,Larg,PRESENT,ERROR)
          CALL SIC_KE (LINE,IOPT,IARG,Arg,Larg,PRESENT,ERROR)
where
          Larg        Integer, true length of Arg
While SIC_CH returns any character string, with implicit formatting if necessary, but no case conversion, SIC_KE returns upcase keywords.

Two additional routines provide a way of testing the presence of an argument SIC_PRESENT(IOPT,IARG) returns the logical value .TRUE. if the required argument is present, and SIC_LEN(IOPT,IARG) returns the actual length of the argument (0 means the argument is missing). A last routine, SIC_NARG(IOPT) indicates how many arguments are actually present for option IOPT.

Note that due to the structure of SIC vocabulary, IOPT is always the sequential number of the option as defined by the ordering in the DATA statement. Hence IOPT is not dependent on the order in which the options appear in the command buffer currently analysed.

SIC also includes some general character string manipulation routines which may be of interest in many other problems. All these routines are described more completely in section [*].


next up previous contents index
Next: The messaging facility Up: SIC Programming Manual - Previous: The Help File   Contents   Index
Gildas manager 2014-07-01