From:	CSBVAX::MRGATE!MCGEE@NUACC.ACNS.NWU.Edu@SMTP 29-FEB-1988 14:34
To:	ARISIA::EVERHART
Subj:	RE: Parsing CLD modules in Pascal.


Received: from EECS.NWU.EDU by KL.SRI.COM with TCP; Fri 26 Feb 88 15:16:58-PST
Received: from accuvax.nwu.edu by Gamma.EECS.NWU.Edu id aa23447;
          26 Feb 88 11:37 CST
Received: from [192.26.85.12] by accuvax.NWU.Edu id aa27341; 26 Feb 88 11:33 CST
Date: Fri, 26 Feb 88 11:22 CST
From: Randy McGee <MCGEE@NUACC.ACNS.NWU.Edu>
Subject: RE: Parsing CLD modules in Pascal.
To: info-vax@kl.sri.com, chris%calstate.bitnet@EECS.NWU.EDU
X-VMS-To: IN%"info-vax@kl.sri.com",IN%"chris@calstate.bitnet"
Message-ID:  <8802261133.aa27341@accuvax.NWU.Edu>

> I can't seem to figgure out how to define an external CLD module in terms
> that Pascal will accept.  I keep getting compilation errors whenever I
> attempt to pass the module name in CLI$DCL_PARSE.  The one time I got it
> to compile (by declairing the module as an [UNSAFE] PROCEDURE), it crashed
> at run time, claiming an invalidly formatted CLD table.

Below are the definitions that we use.  They seem to offer the most 
flexibility.  There are probably some updates that need to be made.  Note 
that both PACKED ARRAY OF CHAR and VARYING OF CHAR strings may be used as 
input and output.  In the case of output, pass variable.BODY as the returned 
string parameter and variable.LENGTH as the returned string length parameter.

For the command table, declare it as:

	TABLE : [EXTERNAL] $UBYTE;

$UBYTE is defined below.

Note that the definition for the two routine arguments to CLI$DCL_PARSE will 
cause an informational message to be generated, but this is not a problem.

Randy McGee
------------------------------------cut-here------------------------------------
{++
{   VMS data types
{--
}

TYPE
   $UWORD = [UNSAFE,WORD] 0..65535;
   $UBYTE = [UNSAFE,BYTE] 0..255;

{++
{   CLI Return constants
{--
}

CONST
	CLI$_ABVERB	= %X00038008;
	CLI$_ABKEYW	= %X00038010;
	CLI$_BUFOVF	= %X00038018;
	CLI$_COMPLX	= %X00038020;
	CLI$_DEFOVF	= %X00038028;
	CLI$_DIRECT	= %X00038030;
	CLI$_EXPSYN	= %X00038038;
	CLI$_IMCHNG	= %X00038040;
	CLI$_INSFPRM	= %X00038048;
	CLI$_IVCHAR	= %X00038050;
	CLI$_SPARE	= %X00038058;
	CLI$_IVKEYW	= %X00038060;
	CLI$_IVOPER	= %X00038068;
	CLI$_IVPROT	= %X00038070;
	CLI$_IVQLOC	= %X00038078;
	CLI$_IVSYMB	= %X00038080;
	CLI$_IVVALU	= %X00038088;
	CLI$_IVVERB	= %X00038090;
	CLI$_MAXPARM	= %X00038098;
	CLI$_NOATFIL	= %X000380A0;
	CLI$_NOCCAT	= %X000380A8;
	CLI$_NOCOMD	= %X000380B0;
	CLI$_NOKEYW	= %X000380B8;
	CLI$_NOLIST	= %X000380C0;
	CLI$_NOQUAL	= %X000380C8;
	CLI$_NOVALU	= %X000380D0;
	CLI$_NOTNEG	= %X000380D8;
	CLI$_NULFIL	= %X000380E0;
	CLI$_NUMBER	= %X000380E8;
	CLI$_ONCOMD	= %X000380F0;
	CLI$_ONERR	= %X000380F8;
	CLI$_ONLEVL	= %X00038100;
	CLI$_ONOVF	= %X00038108;
	CLI$_PARMDEL	= %X00038110;
	CLI$_RSLOVF	= %X00038118;
	CLI$_SKPDAT	= %X00038120;
	CLI$_STKOVF	= %X00038128;
	CLI$_SYMDEL	= %X00038130;
	CLI$_SYMOVF	= %X00038138;
	CLI$_UNDSYM	= %X00038140;
	CLI$_USGOTO	= %X00038148;
	CLI$_VALREQ	= %X00038150;
	CLI$_ONEVAL	= %X00038158;
	CLI$_OVRFLW	= %X00038160;
	CLI$_UNPROQUAL	= %X00038168;
	CLI$_UNPROPARM	= %X00038170;
	CLI$_INVKEY	= %X00038178;
	CLI$_INVRSP	= %X00038180;
	CLI$_UNDFIL	= %X00038188;
	CLI$_FILOPN	= %X00038190;
	CLI$_BADRET	= %X00038198;
	CLI$_ABSYMD	= %X000381A0;
	CLI$_INVUIC	= %X000381A8;
	CLI$_BADTEXT	= %X000381B0;
	CLI$_ABFNAM	= %X000381B8;
	CLI$_IVFNAM	= %X000381C0;
	CLI$_BLKOVRFLOW	= %X000381C8;
	CLI$_BLKUNDFLOW	= %X000381D0;
	CLI$_BADBLK	= %X000381D8;
	CLI$_NOLBLS	= %X000381E0;
	CLI$_NOCHANGE	= %X000381E8;
	CLI$_ABSENT	= %X000381F0;
	CLI$_NEGATED	= %X000381F8;
	CLI$_INVFILSPE	= %X00038200;
	CLI$_INVLOGFIL	= %X00038208;
	CLI$_NOTHEN	= %X00038210;
	CLI$_SYMTOOLNG	= %X00038218;
	CLI$_ASTDCL	= %X00038220;
	CLI$_INVRANGE	= %X00038228;
	CLI$_LOCNEG	= %X00038230;
	CLI$_CMDNOTFND	= %X00038238;
	CLI$_IVQUAL	= %X00038240;
	CLI$_CMDSEG	= %X00038248;
	CLI$_NOTIFY	= %X00038250;
	CLI$_CONFLICT	= %X00038258;
	CLI$_UNDKEY	= %X00038260;
	CLI$_ARGREQ	= %X00038268;
	CLI$_SYMLNG	= %X00038270;
	CLI$_SYMABR	= %X00038278;
	CLI$_IVKEYNAM	= %X00038280;
	CLI$_NOPAREN	= %X00038288;
	CLI$_IVATIME	= %X00038290;
	CLI$_IVDTIME	= %X00038298;
	CLI$_TKNOVF	= %X000382A0;
	CLI$_CMDFILERR	= %X000382A8;
	CLI$_INVOUTSPE	= %X000382B0;
	CLI$_CONFQUAL	= %X00038802;
	CLI$_INVQUAL	= %X0003880A;
	CLI$_REQPRMABS	= %X00038812;
	CLI$_INVQUALNUM	= %X0003881A;
	CLI$_INVREQTYP	= %X00038822;
	CLI$_NOVALUE	= %X0003882A;
	CLI$_VALCNVERR	= %X00038832;
	CLI$_ILLVAL	= %X0003883A;
	CLI$_NOOPTPRS	= %X00038842;
	CLI$_CREQUEJOB	= %X0003884A;
	CLI$_SUBMITERR	= %X00038852;
	CLI$_DEVALSPL	= %X0003885A;
	CLI$_DEVNOTSPL	= %X00038862;
	CLI$_IVDEVTYPE	= %X0003886A;
	CLI$_IMGFNF	= %X00038872;
	CLI$_DEVNOTFOR	= %X0003887A;
	CLI$_PWDNOTVAL	= %X00038882;
	CLI$_PWDNOTVER	= %X0003888A;
	CLI$_PWDLOCKED	= %X00038892;
	CLI$_NOTFR	= %X0003889A;
	CLI$_PWDSYNTAX	= %X000388A2;
	CLI$_IMGNAME	= %X000388AA;
	CLI$_IMAGEFNF	= %X000388B2;
	CLI$_BADSTRLVL	= %X000388BA;
	CLI$_REFUSED	= %X000388C2;
	CLI$_BADCTLMSK	= %X000388CA;
	CLI$_INVRFM	= %X000388D2;
	CLI$_NOCLINT	= %X000388DA;
	CLI$_NOSPAWN	= %X000388E2;
	CLI$_SPWNIO	= %X000388EA;
	CLI$_TRMMBX	= %X000388F2;
	CLI$_STRTOOLNG	= %X000388FA;
	CLI$_CMDGONE	= %X00038902;
	CLI$_NOCMDPROC	= %X0003890A;
	CLI$_INVROUT	= %X00038912;
	CLI$_OLDTAB	= %X0003891A;
	CLI$_INVTAB	= %X00038922;
	CLI$_NOTDISCON	= %X0003892A;
	CLI$_ENTNF	= %X00038932;
	CLI$_ATTRMBX	= %X0003893A;
	CLI$_DEFKEY	= %X0003DDC3;
	CLI$_DELKEY	= %X0003DDCB;
	CLI$_SETKEY	= %X0003DDD3;
	CLI$_SPARE1	= %X0003DDDB;
	CLI$_ALLOC	= %X0003DDE3;
	CLI$_SUPERSEDE	= %X0003DDEB;
	CLI$_INSPRIV	= %X0003DDF3;
	CLI$_NODIRCHG	= %X0003DDFB;
	CLI$_IGNQUAL	= %X0003DE03;
	CLI$_TABEXIST	= %X0003DE0B;
	CLI$_TABSUPER	= %X0003DE13;
	CLI$_TABNOTFND	= %X0003DE1B;
	CLI$_DELSYM	= %X0003DE23;
	CLI$_SYMTRUNC	= %X0003DE2B;
	CLI$_KEYCNV	= %X0003DE33;
	CLI$_SPAWNED	= %X0003FD01;
	CLI$_ATTACHED	= %X0003FD09;
	CLI$_RETURNED	= %X0003FD11;
	CLI$_PRESENT	= %X0003FD19;
	CLI$_DEFAULTED	= %X0003FD21;
	CLI$_CONCAT	= %X0003FD29;
	CLI$_LOCPRES	= %X0003FD31;
	CLI$_COMMA	= %X0003FD39;
	CLI$_OKTAB	= %X0003FD41;
	CLI$_UPGTAB	= %X0003FD49;
	CLI$_PROC_ID	= %X0003FFF1;
	CLI$_QUEJOBCRE	= %X0003FFF9;
	CLI$_NORMAL	= %X00030001;

{++
{   CLI$GET_VALUE
{--
}

[ASYNCHRONOUS, UNBOUND]
FUNCTION CLI$GET_VALUE
   ( NAME: [READONLY, CLASS_S] PACKED ARRAY [L1..U1:INTEGER] OF CHAR
   ; VAR RETBUF: [CLASS_S] PACKED ARRAY [L2..U2:INTEGER] OF CHAR
   ; VAR RETLEN: [TRUNCATE] $UWORD := %IMMED 0
   ): [UNSAFE] UNSIGNED;
EXTERNAL;

{++
{   CLI$PRESENT
{--
}

[ ASYNCHRONOUS, UNBOUND ]
FUNCTION CLI$PRESENT
   ( NAME: [CLASS_S, READONLY] PACKED ARRAY [L1..U1:INTEGER] OF CHAR
   ): [UNSAFE] UNSIGNED;
EXTERNAL;

{++
{   CLI$DCL_PARSE - Parse DCL command string
{--
}

[ ASYNCHRONOUS, UNBOUND ]
FUNCTION CLI$DCL_PARSE
   ( COMMAND_STRING: [CLASS_S, READONLY] PACKED ARRAY [L1..U1:INTEGER] OF CHAR
   ; TABLE: $UBYTE
   ; %IMMED [TRUNCATE, ASYNCHRONOUS, UNBOUND] FUNCTION PARAM_ROUTINE:
        [UNSAFE] UNSIGNED := %IMMED 0 
   ; %IMMED [TRUNCATE, ASYNCHRONOUS, UNBOUND] FUNCTION PROMPT_ROUTINE:
        [UNSAFE] UNSIGNED := %IMMED 0
   ; PROMPT_STRING: [TRUNCATE] PACKED ARRAY [L5..U5:INTEGER] OF CHAR := %IMMED 0
   ): [UNSAFE] UNSIGNED;
EXTERNAL;

{++
{   CLI$DISPATCH
{--
}

[ ASYNCHRONOUS, UNBOUND ]
FUNCTION CLI$DISPATCH
    : [UNSAFE] UNSIGNED;
EXTERNAL;
