Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/debugging-tools/dts/parunv.mac
There is 1 other file named parunv.mac in the archive. Click here to see a list.
	UNIVERSAL PARUNV - MACRO AND SYMBOL DEFINITION FILE FOR PARSE ROUTINE
	SUBTTL PARUNV - ASSEMBLY ENVIRONMENT DEFINITION

	SEARCH MONSYM

	SALL
	.DIRECTIVE .NOBIN	;NO NEED FOR A REL FILE

	EXTERN PARSE
	EXTERN ..INIT
	EXTERN ..TAKE
	EXTERN ..CFM
	EXTERN ..MSG
	EXTERN ..STR



	PAGE
	SUBTTL PDB - PARSER DESCRIPTOR BLOCK DEFINITION

;+
;.RIGHT MARGIN 70
;.TITLE PARSER MACRO AND SYMBOL DEFINITIONS
;.SUBTITLE PARSER DESCRIPTOR BLOCK
;.AUTOPARAGRAPH
;
; THE PARSER DESCRIPTOR BLOCK (PDB) IS THE BASIC DATA STRUCTURE USED TO 
;CONTROL THE ACTION OF THE PARSER ROUTINE. THE PDB CONSISTS OF THE STANDARD 
;FUNCTION DESCRIPTOR BLOCK (FDB) AS USED BY THE COMND JSYS, PLUS FOUR 
;ADDITIONAL WORDS USED BY THE PARSER ROUTINE TO CONTROL THE PARSE. THE PDBDEF
;MACRO IS USED TO BUILD A PDB AND ALLOWS THE PROGRAMMER TO SPECIFY ALL OF
;THE FIELD PARAMETERS. IN ADDITION, THERE ARE A NUMBER OF MNEMONIC MACROS
;WHICH ALLOW THE USER TO BUILD FUNCTION SPECIFIC PDBS' AND PROVIDE A COMMON
;SUBSET OF THE PARAMETER FIELDS. THE PDBS' ARE LINKED THROUGH A NEXT PDB 
;CHAIN FIELD, AND AN ALTERNATE PDB CHAIN FIELD TO FORM A TREE LIKE STRUCTURE
;WHICH DEFINES THE COMMAND SYNTAX. THE PARSE ROUTINE, WHEN PASSED THE ADDRESS
;OF THE ROOT OF THE TREE, THEN PARSES ONE COMPLETE COMMAND AND RETURNS CONTROL
;TO THE CALLER. THERE IS A PROVISION FOR THE USER TO SPECIFY EXIT ROUTINES
;WITHIN EACH PDB WHICH WILL BE CALLED AT CRITICAL POINTS AS THE PARSE
;PROGRESSES.
;
;.SKIP 3
;
; THE FORMAT OF THE PARSER DESCRIPTOR BLOCK IS SHOWN BELOW:
;
;
;.SKIP 3
;.LITERAL
;
;
;	!=======================================================!
;	!  FUNCTION   !  FUNCTION   ! ADDRESS OF NEXT FUNCTION  !
;	!    CODE     !    FLAGS    !     DESCRIPTOR BLOCK      !
;	!-------------------------------------------------------!
;	!              DATA FOR SPECIFIC FUNCTION               !
;	!-------------------------------------------------------!
;	!            POINTER TO HELP TEXT FOR FIELD             !
;	!-------------------------------------------------------!
;	!          POINTER TO DEFAULT STRING FOR FIELD          !
;	+-------------------------------------------------------+
;	!          SPECIAL ACTION ROUTINE FOR THIS PDB          !
;	!-------------------------------------------------------!
;	!              PDB DEFAULT FILLING ROUTINE              !
;	!-------------------------------------------------------!
;	!                     ERROR ROUTINE                     !
;	!-------------------------------------------------------!
;	!             CHAIN POINTER TO LINKED PDB'S             !
;	!=======================================================!
;
;
;.END LITERAL
;-



	PAGE
	SUBTTL PDBDEF - PDBDEF MACRO DEFINITION



;+
;
;.PAGE
;
; THE FORM OF THE PDBDEF MACRO CALL IS:
;
;.NO FILL
;.BLANK 3
;.LEFT 10
;
;PDBDEF (TYP,FLGS,DATA,HLPM,DEFM,LST,NXT,ERRTN,RTN,DEFR)
;
;.BLANK 3
;
; ARGUMENTS TO THE PDBDEF MACRO ARE:
;
;.BLANK 3
;.LITERAL
;
;	TYP	TYPE OF FDB, IE. .CMKEY
;	FLGS	FUNCTION SPECIFIC FLAGS
;	DATA	FUNCTION SPECIFIC DATA
;	HLPM	BYTE POINTER FOR HELP TEXT
;	DEFM	POINTER TO DEFAULT
;	LST	POINTER TO ALTERNATE FDB
;	NXT	PTR TO NEXT FDB (OPTIONAL FOR TYPE .CMKEY OR .CMSWI)
;	ERRTN	ROUTINE IF AN ERROR IS GOTTEN POINTING TO THIS PDB
;	RTN	SPECIAL ACTION ROUTINE FOR THIS PDB
;	DEFR	SPECIAL ROUTINE TO FILL IN DEFAULTS FOR THIS PDB
;
;.END LITERAL
;
;-




DEFINE PDBDEF(TYP,FLGS,DATA,HLPM,DEFM,LST,NXT,ERRTN,RTN,DEFR),<

	..XX==<FLD(TYP,CM%FNC)>+FLGS+<Z LST> ;;DEFINE .CMFNP WORD OF COMND FDB

   IFNB <HLPM>,<..XX=..XX!CM%HPP> ;;IF HELP TEXT, INCLUDE FLAG BIT
   IFNB <DEFM>,<..XX=..XX!CM%DPP> ;;IF DEFAULT TEXT, INCLUDE FLAG BIT

	EXP ..XX		;;ASSEMBLE THE .CMFNP WORD

   IFNB <DATA>,<EXP DATA>
   IFB <DATA>,<EXP 0>

   IFNB <HLPM>,<POINT 7,[ASCIZ \HLPM\]>
   IFB <HLPM>,<0>

   IFNB <DEFM>,<POINT 7,[ASCIZ \DEFM\]>
   IFB <DEFM>,<0>

;;THE REST OF THE DEFINITION IS NOT USED BY THE JSYS BUT ONLY BY THE PARSER

   IFB <RTN>,<0>
   IFNB <RTN>,<EXP RTN>

   IFB <DEFR>,<0>
   IFNB <DEFR>,<EXP DEFR>

   IFB <ERRTN>,<0>
   IFNB <ERRTN>,<EXP ERRTN>

   IFB <NXT>,<0>
   IFNB <NXT>,<EXP NXT>

>;END OF DEFINITION OF PDBDEF MACRO


	PAGE
SUBTTL	PDB  --  PARSER DESCRIPTOR BLOCK

;THIS BLOCK IS DEFINED BY THE PDBDEF MACRO
;THE SYMBOLS HERE ARE FOR REFERENCING IT

	PHASE	0

PDB.FD:!	BLOCK	.CMDEF+1 ;ALLOCATE SPACE FOR AN FDB
PDB.RT:!	BLOCK	1	;SPECIAL ACTION ROUTINE ADDRESS
PDB.DF:!	BLOCK	1	;DEFAULT FILLING ROUTINE ADDRESS
PDB.ER:!	BLOCK	1	;ERROR MESSAGE ROUTINE ADDRESS
PDB.NX:!	BLOCK	1	;ADDRESS OF PDB TO USE NEXT
PDB.SZ:!			;SIZE OF A PDB

	DEPHASE

	PAGE
	SUBTTL COMMAND FUNCTION MACROS

;+
;.PAGE
;
;
; THE FOLLOWING FUNCTION SPECIFIC MACROS ARE PROVIDED FOR THE PURPOSE OF
;DEFINING THE PDB COMMAND TREE. THE MACROS AND THEIR SYNTAX IS SHOWN BELOW:
;
;.BLANK 2
; Where upper case identifies keywords which must be coded as shown
;and lower case identifies variable information which must be provided
;by the programmer, e.g., a symbol which represents the address of a
;block.
;.BLANK 2
; The variable parameters are as follows -
;.BLANK 2
; "next__pdb__address" is the address of the next parser data block to use
;in the parse
;.BLANK 1
; "table__address" is the address of keyword table in TBLUK format
;.BLANK 1
; "radix" is the radix in which the number will be input, in octal
;.BLANK 1
; "help__text" is a string to be output on a ?
;.BLANK 1
; "noise__text" is string representing the noise phrase
;.BLANK 1
; "keyword__list" is an optional list of keywords representing additional
;functions
;.BLANK 1
; where the general form of a keyword parameter is
;.BLANK 1
; 	KEYWORD (argument)
;.BLANK 1
; the entire list of keywords must be enclosed by angle brackets "<", ">"
;and the keyword elements are separated blanks or a comma
;.BLANK 2
;	the valid keywords are
;
;.BLANK 2
;.LITERAL
;
;	$DEFAULT (default_string)
;
;	$ALTERNATE (alternate_pdb)
;
;	$NEXT (next_pdb_address)
;
;	$ERROR (error_routine)
;
;	$ACTION (special_action_routine)
;
;	$PREFILL (default_filling_routine)
;
;.END LITERAL
;.BLANK 3
; example:
;
;	$KEY (NOIPDB,KYTBL1,<$ACTION(CHKIT)>)
;
;.BLANK 3
;.LITERAL
;
;	$KEY (next_pdb_address,table_address,keyword_list)
;
;	$KEYDSP (table_address,keyword_list)
;
;	$NUMBER (next_pdb_address,radix,help_text,keyword_list)
;
;	$DIGIT (next_pdb_address,radix,help_text,keyword_list)
;
;	$NOISE (next_pdb_address,noise_text,keyword_list)
;
;	$SWITCH (next_pdb_address,table_address,keyword_list)
;
;	$IFILE (next_pdb_address,help_text,keyword_list)
;
;	$OFILE (next_pdb_address,help_text,keyword_list)
;
;	$FILE (next_pdb_address,help_text,keyword_list)
;
;	$FIELD (next_pdb_address,help_text,keyword_list)
;
;	$CRLF (keyword_list)
;
;	$DIR (next_pdb_address,keyword_list)
;
;	$USER (next_pdb_address,keyword_list)
;
;	$COMMA (next_pdb_address,keyword_list)
;
;	$INIT (next_pdb_address,keyword_list)
;
;	$FLOAT (next_pdb_address,help_text,keyword_list)
;
;	$DEV (next_pdb_address,keyword_list)
;
;	$TEXT (next_pdb_address,help_text,keyword_list)
;
;	$DATE (next_pdb_address,keyword_list)
;
;	$TIME (next_pdb_address,keyword_list)
;
;	$TAD (next_pdb_address,keyword_list)
;
;	$QUOTE (next_pdb_address,help_text,keyword_list)
;
;	$UNQUOTE (next_pdb_address,break_table_address,help_text,keyword_list)
;
;	$TOKEN (next_pdb_address,token_character,keyword_list)
;
;	$ACCOUNT (next_pdb_address,help_text,keyword_list)
;
;	$NODE (next_pdb_address,keyword_list)
;
;.END LITERAL
;-
	PAGE
;+
;
;
;
; THE FOLLOWING SUPPORT MACROS ARE DEFINED TO ALLOW THE USER TO DEFINE THE
;KEYWORD AND SWITCH TABLES USED BY THE KEYWORD AND SWITCH PDB'S:
;
;.LITERAL
;
;	DSPTAB (next_pdb_address,user_code,keyword_entry,flags)
;
;	KEYTAB (user_code,keyword_entry,flags)
;
;	$STAB
;
;	$ETAB
;
;.END LITERAL
;.FILL
;-


	PAGE
	SUBTTL MACRO DEFINITIONS


DEFINE $TYPE (ARG),<DEFINE .$TYP <ARG>>

DEFINE $FLAGS (ARG),<DEFINE .$FLGS <ARG>>

DEFINE $DATA (ARG),<DEFINE .$DATA <ARG>>

DEFINE $HELP (ARG),<DEFINE .$HLPM <POINT 7,[ASCIZ\ARG\]>>

DEFINE $DEFAULT (ARG),<DEFINE .$DEFM <POINT 7,[ASCIZ\ARG\]>>

DEFINE $ALTERNATE (ARG),<DEFINE .$LST <ARG>>

DEFINE $NEXT (ARG),<DEFINE .$NXT <ARG>>

DEFINE $ERROR (ARG),<DEFINE .$ERTN <ARG>>

DEFINE $ACTION (ARG),<DEFINE .$RTN <ARG>>

DEFINE $PREFILL (ARG),<DEFINE .$DEFR <ARG>>

;DEFINE $PDB (ARG),<..'ARG>


;
;INITIALIZE ALL THE INNER MACROS
;

	$TYPE (0)
	$FLAGS (0)
	$DATA (0)
	$HELP (FOO)
	$DEFAULT (FOO)
	$ALTERNATE (0)
	$NEXT (0)
	$ERROR (0)
	$ACTION (0)
	$PREFILL (0)

DEFINE .$RESET <
	DEFINE .$TYP <0>
	DEFINE .$FLGS <0>
	DEFINE .$DATA <0>
	DEFINE .$HLPM <0>
	DEFINE .$DEFM <0>
	DEFINE .$LST <0>
	DEFINE .$NXT <0>
	DEFINE .$ERTN <0>
	DEFINE .$RTN <0>
	DEFINE .$DEFR <0>>

DEFINE .$BUILD (%XX),<			;;BUILD A PDB

	%XX==<FLD(.$TYP,CM%FNC)>!.$FLGS!<.$LST> ;;DEFINE .CMFNP WORD OF FDB

	IFN <.$HLPM>,<%XX==%XX!CM%HPP> ;;IF HELP TEXT, INCLUDE FLAG BIT
	IFN <.$DEFM>,<%XX==%XX!CM%DPP> ;;IF DEFAULT, INCLUDE FLAG BIT

	EXP %XX			;;ASSEMBLE WORD .CMFNP OF FDB

	EXP .$DATA			;;ASSEMBLE WORD .CMDAT OF FDB

	EXP .$HLPM			;;ASSEMBLE WORD .CMHLP OF FDB

	EXP .$DEFM			;;ASSEMBLE WORD .CMDEF OF FDB

	EXP .$RTN			;;ASSEMBLE WORD PDB.RT OF PDB

	EXP .$DEFR			;;ASSEMBLE WORD PDB.DF OF PDB

	EXP .$ERTN			;;ASSEMBLE WORD PDB.ER OF PDB

	EXP .$NXT>			;;ASSEMBLE WORD PDB.NX OF PDB

DEFINE $KEYDSP (TABLE,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMKEY)
	$DATA (TABLE)
	$NEXT (0)
	.$BUILD>


DEFINE $KEY (NXT,TABLE,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMKEY)
	$DATA (TABLE)
	$NEXT (NXT)
	.$BUILD>



DEFINE $NUMBER (NXT,RADIX,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMNUM)
	$DATA (RADIX)
	$NEXT (NXT)
	IFB <HELP>,<.$BUILD>
	IFNB <HELP>,<
		$HELP (HELP)
		$FLAGS (CM%SDH)
		.$BUILD>>



DEFINE $DIGIT (NXT,RADIX,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMNUX)
	$DATA (RADIX)
	$NEXT (NXT)
	IFB <HELP>,<.$BUILD>
	IFNB <HELP>,<$HELP (HELP)
		$FLAGS (CM%SDH)
		.$BUILD>>


DEFINE $NOISE (NXT,TEXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMNOI)
	$DATA (<POINT 7,[ASCIZ\TEXT\]>)
	$NEXT (NXT)
	.$BUILD>


DEFINE $SWITCH (NXT,TABLE,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMSWI)
	$DATA (TABLE)
	$NEXT (NXT)
	.$BUILD>


DEFINE $IFILE (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMIFI)
	$NEXT (NXT)
	$PREFILL (0)
IFB <HELP>,<.$BUILD>
IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $OFILE (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMOFI)
	$NEXT (NXT)
	$PREFILL (0)
IFB <HELP>,<.$BUILD>
IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $FILE (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMFIL)
	$NEXT (NXT)
IFB <HELP>,<.$BUILD>
IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $FIELD (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMFLD)
	$NEXT (NXT)
IFB <HELP>,<
	.$BUILD>

IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $CRLF (ARGLST),<
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMCFM)
	.$BUILD>


DEFINE $DIR (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMDIR)
	$NEXT (NXT)
	.$BUILD>


DEFINE $USER (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMUSR)
	$NEXT (NXT)
	.$BUILD>


DEFINE $COMMA (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMCMA)
	$NEXT (NXT)
	.$BUILD>



DEFINE $INIT (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$NEXT (NXT)
	$TYPE (.CMINI)
	.$BUILD>

DEFINE $FLOAT (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMFLT)
	$NEXT (NXT)
IFB <HELP>,<
	.$BUILD>

IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

	PAGE


DEFINE $DEV (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMDEV)
	$NEXT (NXT)
	.$BUILD>


DEFINE $TEXT (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMTXT)
	$NEXT (NXT)
IFB <HELP>,<
	.$BUILD>

IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $DATE (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMTAD)
	$DATA (CM%IDA)
	$NEXT (NXT)
	.$BUILD>


DEFINE $TIME (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMTAD)
	$DATA (CM%ITM)
	$NEXT (NXT)
	.$BUILD>


DEFINE $TAD (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMTAD)
	$DATA (<CM%IDA!CM%ITM>)
	$NEXT (NXT)
	.$BUILD>


DEFINE $QUOTE (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMQST)
	$NEXT (NXT)
IFB <HELP>,<
	.$BUILD>

IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $UNQUOTE (NXT,BRKTBL,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMUQS)
	$DATA (BRKTBL)
	$NEXT (NXT)
IFB <HELP>,<
	.$BUILD>
IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $TOKEN (NXT,CHAR,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMTOK)
	$DATA (<POINT 7,[ASCIZ\CHAR\]>)
	$NEXT (NXT)
	.$BUILD>

DEFINE $ACCOUNT (NXT,HELP,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$TYPE (.CMACT)
	$NEXT (NXT)
IFB <HELP>,<
	.$BUILD>

IFNB <HELP>,<
	$HELP (HELP)
	$FLAGS (CM%SDH)
	.$BUILD>>

DEFINE $NODE (NXT,ARGLST) <
	.$RESET
	IRP ARGLST,<ARGLST>
	$NEXT (NXT)
	$TYPE (.CMNOD)
	.$BUILD>




DEFINE DSPTAB (NXT,CODE,KEY,FLG) <
	XWD [IFNB <FLG>,<EXP CM%FW!FLG>
		ASCIZ\KEY\],[XWD CODE,NXT]>

DEFINE KEYTAB (CODE,KEY,FLG) <
	XWD [IFNB <FLG>,<EXP CM%FW!FLG>
		ASCIZ\KEY\],CODE>



;DEFINE DSPTAB (NXT,CODE,KEY,FLG<CM%FW>) <
;	XWD [EXP CM%FW!FLG
;		ASCIZ\KEY\],[XWD CODE,NXT]>

;DEFINE KEYTAB (CODE,KEY,FLG<CM%FW>) <
;	XWD [EXP CM%FW!FLG
;		ASCIZ\KEY\],CODE>


DEFINE $STAB (%X,%Y) <
	%X==.
	XWD %Y-1,%Y-1
	DEFINE $ETAB <
	%Y==.-%X>>

;DEFINE $STAB (%X,%Y) <
;	%X==.
;	XWD %Y-1,%Y-1
;	DEFINE $ETAB <
;		%Y==.-%X>>

	PAGE
	SUBTTL MACROS FOR INTERNAL TAKE COMMAND


;$START MACRO, USED TO DEFINE SPECIAL INITIAL PDB FOR USE WITH TAKE


DEFINE $START (NEXT),<$INIT (NEXT,<$PREFILL(..INIT)>)>


;$FINISH MACRO, USED TO DEFINE SPECIAL CRLF PDB FOR USE WITH TAKE


DEFINE $FINISH <$CRLF (<$ACTION(..CFM)>)>


DEFINE $WRITE (TEXT),<
	IFNB <TEXT>,<HRROI 1,[ASCIZ'TEXT]>
	CALL ..MSG>


	END