[comp.lang.pascal] Using CLI Routines from VAX Pascal

geigel@soleil.UUCP (jogle) (02/03/90)

 Hello all,

    I am trying to use the VAX Command Line Interface Runtime Routines
 (CLI) from within a VAX Pascal program.  The problem I am having is that
 I can't seem to find the system file to include that contains all the
 return codes for these routines.  (e.g. CLI$_NORMAL, CLI$_PRESENT, etc).
 Are these codes defined in starlet.pas or is there another file that
 my system seems to be missing?

    Any help would be greatly appriciated.  Please E-mail replies.


                                           Thanks in advance,

                                            -- jogle
                                               !rutgers!soleil!geigel

nboogaar@ruunsa.fys.ruu.nl (Martin v.d. Boogaard) (02/04/90)

Sorry to post this solution instead of mailing it. I've already wasted
enough time trying to reach people without decent Internet or BITnet
addresses. Below is my solution to the question of communication between
VAX Pascal and CLI. CLI is the only decent way to get VAX Pascal to detect
command line parameters. We finally found the values of CLI$_PRESENT etc.
in a C include file (see comments below). Don't ask me why DEC didn't include
info like this in its documentation on CLI and CDU.

Good luck,


Martin J. van den Boogaard          
                                        
Dept. of Atomic & Interface Physics, Rijksuniversiteit, Utrecht

                                       P.O. Box 80.000
decnet:   ruunsc::boogaard             NL-3508 TA  Utrecht
bitnet:   boogaard@hutruu51.bitnet     the Netherlands
internet: nboogaar@fys.ruu.nl          +31 30 532904

-----------------------------------cut here------------------------------------

 module Pl_sys_decl;

 { Library of Pascal routines for use under VAX VMS.
   Martin J. van den Boogaard
   Dept. of Atomic and Interface Physics, R.U. Utrecht

   Declarations for Pl_sys routines. }

 {############################################################################}

 type     Byte_uns      =  [byte] 0..255;
          Word_uns      =  [word] 0..32767;
          Longword_uns  =  [long] unsigned;

 {############################################################################}

 const    Pl_sys_line_length   =  80;

         {The following constants define so-called condition values, as they
          are returned by system routines. This enables the programmer to
          adhere to the notational conventions used in the DEC manuals. Off
          course, these constants may be changed in a new VMS release! On node
          RUUNSC (HUTRUU51) the information below was found in the following
          text libraries on directory SYS$LIBRARY:

            FORSYSDEF.TLB, module $SSDEF ;
            VAXCDEF.TLB,   module CLIMSGDEF.

          Our VMS release is 5.1-1. Check your local files or system manager
          to see if the constants in this module are up-to-date.}

          SS$_NORMAL           =  %X'00001';
          CLI$_COMMA           =  %X'3FD39';
          CLI$_CONCAT          =  %X'3FD29';
          CLI$_ABSENT          =  %X'381F0';
          CLI$_PRESENT         =  %X'3FD19';
          CLI$_NEGATED         =  %X'381F8';
          CLI$_LOCPRES         =  %X'3FD31';
          CLI$_LOCNEG          =  %X'38230';
          CLI$_DEFAULTED       =  %X'3FD21';

 {############################################################################}

 type     Pl_sys_line   =  varying [Pl_sys_line_length] of char;

 {############################################################################}

 [ external, asynchronous ] function CLI$GET_VALUE

   ( %stdescr Entity_desc:
                         packed array [ F1..L1: integer ] of char := %immed 0 ;
     %stdescr Retdesc:   packed array [ F2..L2: integer ] of char := %immed 0 ;
     %ref     Retlength: Word_uns := %immed 0 ):

     Longword_uns; external;

 {############################################################################}

 [ external, asynchronous ] function CLI$PRESENT

   ( %stdescr  Entity_desc:
                        packed array [ F1..L1: integer ] of char := %immed 0 ):

     Longword_uns; external;

 {############################################################################}

 end.

 {############################################################################}

-----------------------------------cut here------------------------------------

[inherit('pl_sys_decl.pen')]

module Pl_sys_cli (input, output);

{ Library of Pascal routines for use under VAX VMS.
  Martin J. van den Boogaard
  Dept. of Atomic and Interface Physics, R.U. Utrecht }

{############################################################################}

[global]
function Pl_sys_cli$get_value
           ( Entity_desc:     packed array [ Ef..El: integer ] of char;
             var Retdesc:     varying [ Rl ] of char ):
         integer;

{ Returns, in Retdesc, CLI entity described by Entity_desc. }

var Ret:         packed array [ 1..Pl_sys_line_length ] of char;
    Retlength:   Word_uns;

begin
  Pl_sys_cli$get_value :=
                         int (CLI$GET_VALUE ( Entity_desc, Ret, Retlength ) );
  Retdesc := substr ( Ret, 1, Retlength );
end;

{############################################################################}

[global]
function Pl_sys_cli$present
           ( Entity_desc:     packed array [ Ef..El: integer ] of char ):
         integer;

{ Determines the presence of the CLI entity described by Entity_desc. }

begin
  Pl_sys_cli$present := int ( CLI$PRESENT ( Entity_desc ) );
end;

{############################################################################}

end.

{############################################################################}

vanavermaet@player.dec.com (02/07/90)

[ inherit('STANDARD_DISCLAIMER') ]

In article <932@soleil.UUCP>, geigel@soleil.UUCP (jogle) writes...
[...]
> I can't seem to find the system file to include that contains all the
> return codes for these routines.  (e.g. CLI$_NORMAL, CLI$_PRESENT, etc).

You could simply declare them as follows:

var
    CLI$_PRESENT : [ external, value ] unsigned;

In general, in Vax/VMS, most such symbols can be resolved by two means:

1. during the compilation - for Pascal, that often means  
   [ inherit('SYS$LIBRARY:STARLET') ]

2. during the link - as shown above

For some groups of symbols, only one method is available.

Regards,
Peter Van Avermaet
Digital Equipment, E.I.S. Europe, Application Development Group (Brussel site)
InterNet:	vanavermaet@player.dec.com or vanavermaet%player.dec.com@decwrl.dec.com
UUCP:		node-1!node-2!...!decwrl!player.dec.com!vanavermaet or vanavermaet@player.dec.com
Phone:		+32 2 244 7959
Snailmail:	Luchtschipstraat 1
		1140 Brussel
		Belgium