[comp.lang.ada] Is there a good place to post this?

JEP1142@VENUS.TAMU.EDU (John Pittman) (05/18/89)

-- The VAX/VMS Command Language Interface (CLI) is accessed through a set 
-- of routines which (optionally input and) PARSE a command line, DISPATCH 
-- the CPU to a routine as specified in the command line, test for the 
-- PRESENSE_OF a symbolic parameter or option, and GET_(the_)VALUE of a 
-- symbolic parameter or option.  These routines are documented in the 
-- VAX/VMS Utility Routines Reference Manual.
 
-- J E Pittman May 4, 1989.
 
package CLI is
 
   -- Most programs using this package will only require the PRESENSE_OF 
   -- function and the GET_VALUE procedure.  The usage is very similar 
   -- to CLI$PRESENT and CLI$GET_VALUE except that GET_VALUE expects to 
   -- be called only immediately after a PRESENSE_OF test or prior 
   -- GET_VALUE call (in the case of a list of values).  This protocol 
   -- is enforced by passing ENTITY to GET_VALUE through PRESENSE_OF.
 
   -- The values from PRESENSE_OF are ABSENT, DEFAULTED, LOCALLY_NEGATED, 
   -- LOCALLY_PRESENT, NEGATED, and PRESENT.
 
   -- The possible returned CONDITION values from GET_VALUE are ABSENT, 
   -- COMMA_TERMINATED, CONCATENATED, and NORMAL.  The given CONDITION 
   -- value must be COMMA_TERMINATED, CONCATENATED, DEFAULTED, 
   -- LOCALLY_PRESENT, or PRESENT; other values will cause a PROGRAM_ERROR.
 
   -- If the value returned does not fit in the given string, GET_VALUE 
   -- will quietly truncate it.
 
   -- It is implicit in the definition that the CLI requires exclusivity.
 
   -- PRESENSE_OF and GET_VALUE can raise a SYNTAX_ERROR, this usually 
   -- implies an error with the Command Language Definition file or absence 
   -- thereof.
 
   type CONDITION_VALUE is
         (ABSENT, COMMA_TERMINATED, CONCATENATED, DEFAULTED, 
         COMMAND_EOF, LOCALLY_NEGATED, LOCALLY_PRESENT, NEGATED, 
         NULL_COMMAND, NORMAL, PRESENT, ERRONEOUS_CONDITION);
 
   SYNTAX_ERROR: exception;
 
   function PRESENSE_OF
         (ENTITY: STRING)
         return CONDITION_VALUE;
 
   procedure GET_VALUE
         (CONDITION: out CONDITION_VALUE;
         VALUE: out STRING;
         LENGTH: out INTEGER);
 
   -- The possible returned CONDITION values from PARSE are NORMAL, 
   -- NULL_COMMAND, or COMMAND_EOF.  If a user error occurs, PARSE will
   -- display the error message and try again.  Note that a traceback
   -- will also be displayed unless /notraceback is specified on the
   -- link command.
 
   -- DISPATCH must be called after PARSE and the value returned by PARSE 
   -- must be NORMAL.  Other values will cause a PROGRAM_ERROR as will the 
   -- CLI$_INVROUT condition value which can be returned as a result of an 
   -- error in the command table.
 
   -- CLD_TABLEs must be declared using a normal object declaration plus a
   -- pragma IMPORT_OBJECT (name); statement.
 
   type CLD_TABLE is limited private;
 
   procedure PARSE
         (COMMAND: in STRING;
         CONDITION: out CONDITION_VALUE;
         TABLE: in CLD_TABLE;
         PROMPT: in STRING:= "COMMAND> ");
   
   procedure PARSE
         (CONDITION: out CONDITION_VALUE;
         TABLE: in CLD_TABLE;
         PROMPT: in STRING:= "COMMAND> ");
   
   procedure DISPATCH;
         
   private
   
      type CLD_TABLE is array(1..4) of CHARACTER;
 
      pragma INLINE (PARSE, DISPATCH);  -- probably only used once.
 
   end CLI;