Google
 

Trailing-Edge - PDP-10 Archives - BB-L014Z-BM_1990 - cblsrc/gendcl.mac
There are 22 other files named gendcl.mac in the archive. Click here to see a list.
	UNIVERSAL GENDCL	FOR COBOL 11(460)

	SEARCH COPYRT
	SALL

;                     Copyright (C) 1974, 1984 by
;             Digital Equipment Corporation, Maynard, Mass.

; *******************************************************************
; NOTE!!! This module is shared by the COBOL and DBMS products. Any
; modification by either group should be immediately reflected in the
; copy of the other group.
; *******************************************************************

	SUBTTL	LINKAGE MACROS

	DEFINE SEGSYM<
	;;;	EXISTS SO THAT PASS 2 RE-INITS WILL OCCUR
	  OFFS.==0
	  LMREG.==0
	  LGREG.==16
	;;;	ALLOW GROUP OF MODULES TO HAVE SOME COMMON REGS (MU=MOD UNIV)
	  IFDEF MUREG.,<MREG.=MUREG.>
	  IFNDEF MUREG.,<MREG.==TREG.>
	  HMREG.==MREG.
	  HIGH==1
	>
	DEFINE SEGMEN<
	  IFDEF  HIORG,<TWOSEG  HIORG>	;[1106]
	  IFNDEF HIORG,<TWOSEG>		;[1106]
	  RELOC	0
	  GDATA.==0			;;FOR GDATA'S IFDEF TEST
	  SEGSYM
	>

	DEFINE SAVE (A)<
	IRP A,<	PUSH	P,A>>

	DEFINE RESTOR (A)<
	IRP A,<	POP	P,A>>

	DEFINE BLTSAV(LO.,HI.)<
	  HRRZ	R0,P
	  ADD	R0,[LO.,,1]		;;THE 1 GETS YOU TO 1ST UNUSED WORD ON STACK
	  BLT	R0,HI.(P)
	  T1.==HI.-LO.+1
	  ADD	P,[T1.,,T1.]		;;THE PUSH SIMULATION
	>
	DEFINE BLTPOP(LO.,HI.)<
	  T1.==HI.-LO.+1
	  SUB	P,[T1.,,T1.]
	  HRLZ	AP,P
	  ADD	AP,[1,,LO.]
	  BLT	AP,HI.
	>

	DEFINE SAVTMPS<SAVE<R2,R3,R4,R5>>
	DEFINE POPTMPS<RESTOR<R5,R4,R3,R2>>

	DEFINE	SAVALL <
	  IFN HMREG.-MREG.,<		;;ONLY DO SELF, IF CAN'T DO IN COM
	    T1.==TREG.
	    REPEAT <MREG.-TREG.>,<
	      T1.==T1.+1
	      SAVE	T1.
	    >
	    IFDEF UNWIND,<MOVEM P,UNWIND>
	    IFDEF MY.INI,<JSP R1,MY.INI>
	  >
	  IFE HMREG.-MREG.,<JSP	R1,SAV$A>
	>

	DEFINE POPALL <
	T1.==MREG.
	REPEAT <MREG.-TREG.>,<
	  RESTOR	T1.
	  T1.=T1.-1
	>
	>

	DEFINE LEAVE<POP$A+HMREG.-MREG.>
	DEFINE RETURN<
	  IFN MREG.-TREG.,<JRST	LEAVE>
	  IFE MREG.-TREG.,<POPJ	P,>
	>

	DEFINE $HISEG<			;[1106]
	IFG HIGH,<			;[1106]
	  IFDEF  HIORG,<RELOC  HIORG>	;[1106]
	  IFNDEF HIORG,<RELOC 400000>	;[1106]
	  HIGH==0>			;[1106]
	>

	DEFINE $FUNCT(NAME,ARGLST)<
	IFGE HIGH,<			;[1106]
	IFG HIGH,<
	  IFDEF  HIORG,<RELOC  HIORG>	;[1106]
	  IFNDEF HIORG,<RELOC 400000>	;[1106]
	>; END IFG HIGH			;[1106]
	  HIGH==-1
	  IFG MREG.-TREG.,<
SAV$A:
	  T1.==TREG.
	  REPEAT <MREG.-TREG.>,<
	    T1.==T1.+1
	    SAVE	T1.
	  >
	  IFDEF UNWIND,<
	    MOVEM P,UNWIND
	    IFDEF UNWEXIT,<
	      IFDEF MY.EXIT,<COPI UNWEXIT,MY.EXIT>
	      IFNDEF MY.EXIT,<COPI UNWEXIT,POP$A-1>
	    >
	  >
	  IFDEF MY.INI,<JRST MY.INI>	;;MUST RETURN WITH JRST 0(R1)
	  IFNDEF MY.INI,<JRST	0(R1)>
	  >
	  IFDEF UNWEXIT,<IFNDEF MY.EXIT,<MOVE P,UNWIND>>
POP$A:
	  POPALL
	  POPJ	P,
	>

NAME:
	ENTRY NAME
	IFN LMREG.,<MREG.==LMREG.
			LMREG.==0>
	AOFF.==0
	IFNB <ARGLST>,<
	  IRP ARGLST,<
	  ARGLST==AOFF.
	  AOFF.==AOFF.+1
	  >
	>
	IFN MREG.-TREG.,<SAVALL>	;;KEYED BY MREG.
	IFE MREG.-TREG.,<
	  IFDEF UNWIND,<MOVEM P,UNWIND>
	  IFDEF MY.INI,<JSP R1,MY.INI>
	>
	>; END IFGE HIGH		;[1106]

	DEFINE $UTIL(NAME,ARGLST)<
NAME:
	IFE LMREG.,<LMREG.==MREG.>
	MREG.=TREG.			;;UTIL'S DON'T AFFECT MOD REGS
	AOFF.==0
	IFNB <ARGLST>,<
	  IRP ARGLST,<
	  ARGLST==AOFF.
	  AOFF.==AOFF.+1
	  >
	>
	>
	DEFINE $GUTIL(NAME,ARGLST)<
NAME:
	ENTRY NAME
	IFE LMREG.,<LMREG.==MREG.>
	MREG.=TREG.			;;UTIL'S DON'T AFFECT MOD REGS
	AOFF.==0
	IFNB <ARGLST>,<
	  IRP ARGLST,<
	  ARGLST==AOFF.
	  AOFF.==AOFF.+1
	  >
	>
	>

	DEFINE $GLOYO(NAME,ARGLST)<
	IFGE HIGH,<			;[1106]
	IFG HIGH,<
	  IFDEF  HIORG,<RELOC  HIORG>	;[1106]
	  IFNDEF HIORG,<RELOC 400000>	;[1106]
	>; END IFG HIGH			;[1106]
	  HIGH==-1
	  MREG.==TREG.			;;IF A GLOYO FIRST GLOBAL ENTRY, THERE CAN BE NO FUNCTS
	  HMREG.==MREG.			;;...AND THEREFORE NO MODULE REGS
POP$A:
	  POPJ	P,
	>
NAME:
	ENTRY NAME
	IFE LMREG.,<LMREG.==MREG.>
	MREG.=TREG.			;;YOYO'S DON'T AFFECT MOD REGS
	>; END IFGE HIGH		;[1106]

	DEFINE $YOYO(NAME,ARGLST)<
NAME:
	IFE LMREG.,<LMREG.==MREG.>
	MREG.=TREG.			;;YOYO'S DON'T AFFECT MOD REGS
	>


	DEFINE GLOYO(PROG,ARGLST)<
	IF2, <IFNDEF PROG,<EXTERNAL PROG>>
	PUSHJ	P,PROG			;;ARGLST JUST FOR DOC
	>

	DEFINE YOYO(PROG,ARGLST)<
	PUSHJ	P,PROG			;;ARGLST JUST FOR DOC
	>

	;;;	SAME EXCEPT MUST PRESERVE SUBSYS (IE. SAVE R2-R5)
	SYN	$FUNCT,$LINK
	SYN	FUNCT,LINK


	DEFINE FUNCT(PROG,ARGLST)<
	SALL
	ARGS.=0
	IF2, <IFNDEF PROG,<EXTERNAL PROG>>
	  IFB <ARGLST>,<	PUSHJ P,PROG>
	  IFNB <ARGLST>,<
	  IRP ARGLST,<ARGS.=ARGS.+1>
	  MOVEI	AP,[-ARGS.,,0
	  IRP ARGLST,<ARGLST>
	  ]+1
	  PUSHJ	P,PROG
	  >
	>


	DEFINE UTIL(PROG,ARGLST)<
	SALL
	ARGS.=0
	  IFB <ARGLST>,<	PUSHJ P,PROG>
	  IFNB <ARGLST>,<
	  IRP ARGLST,<ARGS.=ARGS.+1>
	  MOVEI	AP,[-ARGS.,,0
	  IRP ARGLST,<ARGLST>
	  ]+1
	  PUSHJ	P,PROG
	  >
	>
	DEFINE GUTIL(PROG,ARGLST)<
	SALL
	IF2, <IFNDEF PROG,<EXTERNAL PROG>>
	ARGS.=0
	  IFB <ARGLST>,<	PUSHJ P,PROG>
	  IFNB <ARGLST>,<
	  IRP ARGLST,<ARGS.=ARGS.+1>
	  MOVEI	AP,[-ARGS.,,0
	  IRP ARGLST,<ARGLST>
	  ]+1
	  PUSHJ	P,PROG
	  >
	>

	SYN $UTIL,$ULINK
	SYN UTIL,ULINK
	SUBTTL	DECLARATIVE MACROS FOR USER VARIABLES

	DEFINE GDATA(NAME,LEN)<
	  IFNDEF GDATA.,<EXTERN NAME>
	  IFDEF GDATA.,<
	    IFB<LEN>,<NAME:: BLOCK 1>
	    IFNB<LEN>,<NAME:: BLOCK LEN>
	  >
	>

	DEFINE DATA(NAME,LEN)<
	IFB<LEN>,<	NAME: BLOCK 1>
	IFNB<LEN>,<	NAME: BLOCK LEN>
	>

	DEFINE GREG(NAME,VALUE)<	;;GLOBAL REG
	  IFB <VALUE>,<GREG.==GREG.-1>
	  IFNB <VALUE>,<GREG.==VALUE>
	  IFL GREG.-LGREG.,<LGREG.=GREG.>
	  NAME=GREG.
	  IFDEF .'NAME,<
	    IFN .'NAME+GREG.,<
	      PRINTX			;"NAME" ALTER-EGO ALREADY IN USE
	    >
	  >
	  IFNDEF .'NAME,<  .'NAME==-GREG.>
	>

	DEFINE MREG(NAME,VALUE)<	;;MODULE REG
	  IFN LMREG.,<MREG.==LMREG.
			LMREG.==0>
	  IFB <VALUE>,<MREG.==MREG.+1>
	  IFNB <VALUE>,<MREG.==VALUE>
	  IFB <NAME>,<MREG.=TREG.>
	  IFG MREG.-HMREG.,<HMREG.=MREG.>
	 IFNB <NAME>,<
	  NAME=MREG.
	  IFDEF .'NAME,<
	    IFN .'NAME+MREG.,<
	      PRINTX			;"NAME" ALTER-EGO ALREADY IN USE
	    >
	  >
	  IFNDEF .'NAME,<  .'NAME==-MREG.>
	 >
	>

	DEFINE REG(NAME,VALUE)<
	  NAME=VALUE
	  IFDEF .'NAME,<
	    IFN .'NAME+VALUE,<
	      PRINTX			;"NAME" ALTER-EGO ALREADY IN USE
	    >
	  >
	  IFNDEF .'NAME,<  .'NAME==-VALUE>
	>


	DEFINE ASP(NAM.,SIZ.,INIT.)<
	GETLEN	<INIT.>
NAM.:	POINT 7,.+2
	XWD	SIZ.,LEN.
	ASCII\INIT.\
	T1.==<LEN.+4>/5
	T1.==T1.*5
	T1.==SIZ.-T1.
	BLOCK	<<T1.+4>/5>
	>

	DEFINE BP(STRUC.,FIELD.,BASE.)<
	  POINT STRUC.'$'FIELD.,STRUC.'.'FIELD.'BASE.,STRUC.'%'FIELD.
	>
	DEFINE DUMMY(STRUC.,FIELDS,PFX.)<
	ONEBYT(STRUC.,FIELDS,PFX.)
	>
	DEFINE ONEBYT(STRUC.,FIELD.,SIZE.,PFX.)<
	  IFNB <PFX.>,<PFX.'.'FIELD.=OFFS.-STRUC.'.'PFX.>
	  STRUC.'.'FIELD.==OFFS.
	  STRUC.'$'FIELD.==SIZE.
	  POS.==POS.+SIZE.
	  STRUC.'%'FIELD.==POS.
	>
	DEFINE BYTES(STRUC.,FIELDS)<
	  POS.==-1
	  IRP FIELDS,<DUMMY(STRUC.,FIELDS)>
	  OFFS.==OFFS.+1
	>
	DEFINE BYTPFX(STRUC.,PFX.,FIELDS)<
	  POS.==-1
	  IRP FIELDS,<DUMMY(STRUC.,FIELDS,PFX.)>
	  OFFS.==OFFS.+1
	>
	DEFINE WORD(STRUC.,FIELDS)<
	  BYTES(STRUC.,<FIELDS>)
	  OFFS.==0
	>

	DEFINE FIELD(FIELD.,SIZE.)<
	  T1.=1
	  IFNB <SIZE.>,<
	    T1.==SIZE.
	    IFN 100000*T1.-100000*SIZE.,<T1.==T1.+1>
	  >
	  FIELD.==OFFS.
	  OFFS.==OFFS.+T1.
	>
	DEFINE PREFIX(STRUC.,PFX.,FIELD.,SIZE.)<
	  PFX.'.'FIELD.==OFFS.-STRUC.'.'PFX.
	  FIELD	(STRUC.'.'FIELD.,SIZE.)
	>

	DEFINE ARRAY(FIELD.,SIZE.)<
	  T1.==1
	  IFNB <SIZE.>,<
	    T1.==SIZE.
	    IFN 100000*T1.-100000*SIZE.,<T1.==T1.+1>
	  >
	  FIELD.==OFFS. - 1
	  OFFS.==OFFS.+T1.
	>

	DEFINE BLKSIZ(SIZID.)<
	  SIZID.==OFFS.
	  OFFS.==0
	>

	;;;	BORROWED FROM MACTEN...
	;MACRO TO COMPUTE THE WIDTH OF A MASK
	;	"WID" RETURNS THE LENGTH OF THE LEFTMOST STRING OF
	;	CONSECUTIVE ONES IN THE WORD.
	DEFINE	WID(MASK),<<^L<-<<MASK>_<^L<MASK>>>-1>>>

	;MACRO TO COMPUTE THE POSITION OF A MASK
	DEFINE	POS(MASK),<<^L<MASK>+^L<-<<MASK>_<^L<MASK>>>-1>-1>>

	;MACRO TO BUILD A POINTER TO A MASKED QUANTITY
	;	POINTR	LOCATION,MASK
	DEFINE	POINTR(LOC,MASK),<<POINT	WID(MASK),LOC,POS(MASK)>>

	;MACRO TO BUILD A MASK "WID" BITS WIDE, WITH ITS RIGHTMOST BIT
	;	IN THE BIT POSITION "POS".   (I.E. A MASK FOR THE BYTE
	;	POINTED TO BY THE BYTE POINTER "POINT  WID,LOC,POS")
	DEFINE	MASK.(WID,POS),<<<<1_<WID>>-1>B<POS>>>

	;MACRO TO DEFINE A SYMBOL IF NOT ALREADY DEFINED
	;	ND  SYMBOL,VALUE
	DEFINE	ND(SYMBOL,VALUE),<
	  IFNDEF	SYMBOL,<SYMBOL==VALUE>
	>
	SUBTTL DECLARATIVE MACROS FOR CONSTANT DATA

	DEFINE PATTRN(NAM.,STR.)<
	  STR.ST=.
	  BYTE (12)STR.
	  LEN.==0
	  IRP STR.,<LEN.==LEN.+1>
NAM.:	  POINT	^D12,STR.ST
	  XWD	0,LEN.
	>

	DEFINE MESSAG(NAM,ELEM)<
	EXP	[
	  IRP ELEM,<
	  ACT..=0
	    IRPC ELEM,<IFIDN <-><ELEM>,<ACT..=1>
				  STOPI>
	    IFN ACT..,<
	    ELEM
	    >
	    IFE ACT..,<
		GETLEN <ELEM>
		ADDR.==[EXP LEN.
			ASCIZ\ELEM\]
		EXP <ADDR.+1>
	    >
	  >
			0	]
	NAM:: MSG..
	MSG..=MSG..+2
	>

	DEFINE GETLEN(STRING)<
	  LEN.=0
	  IRPC STRING,<LEN.=LEN.+1>
	>

	DEFINE SETADDR(STRING)<
	 GETLEN	STRING
	  ADDR.=1B12 + [	LEN.
			 ASCII/STRING/]+1
	>

	DEFINE VARY(NAM)<1B12+NAM>
	DEFINE INT(WORD)<2B12+WORD>
	DEFINE ASZ(NAM.)<17B12+NAM.>

	DEFINE ZERO<[0]>
	DEFINE ONE<[1]>
	DEFINE TWO<[2]>
	DEFINE THREE<[3]>
	DEFINE FOUR<[4]>
	DEFINE FIVE<[5]>
	DEFINE SIX<[6]>

	DEFINE MLIT(STRIN)<
	17B12+[ASCIZ\STRIN\]
	>

	DEFINE STRIVRY(NAM,STRING)<
	GETLEN (<STRING>)
	EXP LEN.
NAM:	ASCII/STRING/
	>

	DEFINE STRIPT(STRING)<
	GETLEN (<STRING>)
	POINT	7,[ASCII\STRING\]
	EXP	LEN.
	>
	SUBTTL	PROCEDURAL MACROS

	DEFINE WHATYP(SYM)<
	SYM..==0
	  IRPC SYM,<
	  IFIDN <SYM><@>,<SYM..=1
			  STOPI>
	  IFIDN <SYM><(>,<SYM..=2
			  STOPI>
	  IFIDN <SYM><[>,<SYM..=3
			  STOPI>
	  IFIDN <SYM><+>,<SYM..=4
			  STOPI>
	  IFIDN <SYM><->,<SYM..=4
			  STOPI>
	  >
	  IFE SYM..,<
	    IFDEF .'SYM,<SYM..=-1>
	  >
	>

	DEFINE	CASE(REG,VECTOR)<
	  JRST	@[EXP .+1,VECTOR](REG)
	>

	DEFINE DBP(BP,BCNT)<		;;ASCII ONLY
	REPEAT 5-BCNT,<IBP	BP>
	SOS	BP
	>

	DEFINE TURNON(REG.,VAL.)<TXO	REG.,VAL.>
	DEFINE TURNOFF(REG.,VAL.)<TXZ REG.,VAL.>
	DEFINE TX(DESIG.,REG.,BIT.)<
	IFE BIT.&777777,<TL'DESIG.	REG.,(BIT.)>
	IFN BIT.&777777,<TR'DESIG.	REG.,BIT.>
	>
	DEFINE TXNE(A,B)<TX(NE,A,B)>
	DEFINE TXNN(A,B)<TX(NN,A,B)>
	DEFINE TXOA(A,B)<TX(OA,A,B)>
	DEFINE TXOE(A,B)<TX(OE,A,B)>
	DEFINE TXON(A,B)<TX(ON,A,B)>
	DEFINE TXO(A,B)<TX(O,A,B)>
	DEFINE TXZA(A,B)<TX(ZA,A,B)>
	DEFINE TXZE(A,B)<TX(ZE,A,B)>
	DEFINE TXZN(A,B)<TX(ZN,A,B)>
	DEFINE TXZ (A,B)<TX(Z,A,B)>
	DEFINE TXC (A,B)<TX(C,A,B)>

	DEFINE COPY(DEST,SORCE)<
	WHATYP	<DEST>
	IFE SYM..+1,<
	MOVE	DEST,SORCE>
	IFN SYM..+1,<
	  WHATYP <SORCE>
	  IFN SYM..+1,<
	  MOVE	0,SORCE
	  MOVEM	0,DEST>
	  IFE SYM..+1,<
	  MOVEM	SORCE,DEST>
	>
>

	DEFINE COPI(DEST,SORCE)<
	WHATYP	<DEST>
	IFE SYM..+1,<
	MOVEI	DEST,SORCE>
	IFN SYM..+1,<
	MOVEI	0,SORCE
	MOVEM	0,DEST>
>


	DEFINE DCOPY(DEST,SORCE)<
	WHATYP	<DEST>
	IFE SYM..+1,<
	MOVE	DEST,SORCE
	MOVE	DEST+1,1+SORCE
	>
	IFN SYM..+1,<
	  WHATYP	<SORCE>
	  IFN SYM..+1,<
	  MOVE	0,SORCE
	  MOVEM	0,DEST
	  MOVE	0,1+SORCE
	  MOVEM	0,1+DEST
	  >
	  IFE SYM..+1,<
	  MOVEM	SORCE,DEST
	  MOVEM	SORCE+1,1+DEST
	  >
	>
	>
	DEFINE	COPY7(DEST.,SORCE.,SIZ.)<
	SAVE	<R2,R3,R4>
	MOVEI	0,SORCE.
	MOVEI	1,DEST.
	MOVEI	4,SIZ.
	HRR	2,0
	HRLI	2,(POINT 7,)
	HRR	3,1
	HRLI	3,(POINT 7,)
	ILDB	0,2
	IDPB	0,3
	SOJG	R4,.-2
	RESTOR	<R4,R3,R2>
	>
	DEFINE	CMPR7(SRCE1.,SRCE2.,SIZ.)<
	SAVE	<R2,R3,R4>
	MOVEI	0,SRCE1.
	MOVEI	1,SRCE2.
	MOVEI	4,SIZ.
	HRR	2,0
	HRLI	2,(POINT 7,)
	HRR	3,1
	HRLI	3,(POINT 7,)
	ILDB	0,2
	ILDB	1,3
	CAME	0,1
	JRST	.+3
	SOJG	4,.-4
	SETZM	1
	RESTOR	<R4,R3,R2>
	>

	DEFINE LD(REG.,STRUC.,FIELD.,BASE.)<
	  IFNDEF STRUC.'$'FIELD.,<T1.==^D36>
	  IFDEF STRUC.'$'FIELD.,<T1.==STRUC.'$'FIELD.>
	  IFE T1.-^D36,<MOVE REG.,STRUC.'.'FIELD.'BASE.>
	  IFN T1.-^D36,<
	    IFN T1.-^D18,<LDB REG.,[BP (STRUC.,FIELD.,BASE.)]>
	    IFE T1.-^D18,<
	      T1.==STRUC.'%'FIELD.
	      IFE T1.-^D17,<HLRZ REG.,STRUC.'.'FIELD.'BASE.>
	      IFE T1.-^D35,<HRRZ REG.,STRUC.'.'FIELD.'BASE.>
	    >
	  >
	>
	DEFINE LDEX(REG.,STRUC.,FIELD.,BASE.)< ;;SIGNED-NESS IS A PROP OF A FIELD SO...
	  IFNDEF STRUC.'$'FIELD.,<T1.==^D36>
	  IFDEF STRUC.'$'FIELD.,<T1.==STRUC.'$'FIELD.>
	  IFE T1.-^D36,<MOVE REG.,STRUC.'.'FIELD.'BASE.>
	  IFN T1.-^D36,<
	    IFN T1.-^D18,<LDB REG.,[BP (STRUC.,FIELD.,BASE.)]>
	    IFE T1.-^D18,<
	      T1.==STRUC.'%'FIELD.
	      IFE T1.-^D17,<HLRE REG.,STRUC.'.'FIELD.'BASE.>
	      IFE T1.-^D35,<HRRE REG.,STRUC.'.'FIELD.'BASE.>
	    >
	  >
	>

	DEFINE ST(REG.,STRUC.,FIELD.,BASE.)<
	  IFNDEF STRUC.'$'FIELD.,<T1.==^D36>
	  IFDEF STRUC.'$'FIELD.,<T1.==STRUC.'$'FIELD.>
	  IFE T1.-^D36,<MOVEM REG.,STRUC.'.'FIELD.'BASE.>
	  IFN T1.-^D36,<
	    IFN T1.-^D18,<DPB REG.,[BP (STRUC.,FIELD.,BASE.)]>
	    IFE T1.-^D18,<
	      T1.==STRUC.'%'FIELD.
	      IFE T1.-^D17,<HRLM REG.,STRUC.'.'FIELD.'BASE.>
	      IFE T1.-^D35,<HRRM REG.,STRUC.'.'FIELD.'BASE.>
	    >
	  >
	>

	DEFINE STFIX(REG.,STRUC.,FIELD.,BASE.)< ;;PROVIDE SPECIAL CASE SUPPORT FOR THIS COMMON CASE
	  T1.==STRUC.'%'FIELD.
	  IFE T1.-^D17,<MOVSM REG.,STRUC.'.'FIELD.'BASE.>
	  IFE T1.-^D35,<IFN REG.-BASE.,<MOVEM REG.,STRUC.'.'FIELD.'BASE.>>
	>
	SUBTTL	EXCEPTION HANDLING MACROS

	DEFINE SETABORT(ADDR.)<
	  MOVEM	P,FRAMCON
	  COPI	PARSCON,ADDR.
	>

	DEFINE ERRS(ARGS.,REENT.)<
	JRST	[FUNCT	TYPOUT,<ARGS.>
		 JRST	REENT.]
	>

	SYN ERRS,WARNS
	SYN ERRS,SYSERS
	SYN ERRS,USRERS
	SYN ERRS,SYNERS
	SYN ERRS,FILERS

	DEFINE ERR(ARGS.,REENT.)<
	FUNCT	TYPOUT,<ARGS.>
	IFNB <REENT.>,<JRST	REENT.>
	>

	SYN ERR,WARNJ			;;FOR THE .+1 CASE
	SYN ERR,SYSERR
	SYN ERR,USRERR
	SYN ERR,SYNERR
	SYN ERR,FILERR

	DEFINE WARN(ARGS.)<
	FUNCT	TYPOUT,<ARGS.>
	>

	;;;	GENMSG INTERFACE MACROS
	DEFINE	CASLAB(NUM.)<CAS'NUM.::>
	DEFINE	SETCAS(NAM.)<
	  CA.'NAM.==CA.USR
	  CASLAB(\CA.USR)
	  CA.USR==CA.USR+1
	>

	DEFINE OTHCAS<
	  REPEAT <CA.UMAX-CA.USR+1>,<
	    CASLAB(\CA.USR)
	    CA.USR==CA.USR+1
	  >
	>
	SUBTTL	NEEDED SYMBOLS, REGISTERS, ETC.

	REG(R0,0)
	REG(R1,1)
	REG(R2,2)
	REG(R3,3)
	REG(R4,4)
	REG(R5,5)
	REG(AP,16)
	REG(TAP,AP)			;GIVE DIF NAME FOR USE AS TEMP
	REG(P,17)

	;;;	GENMSG DEFINED MESSAGE CASES
	CA.VAR==1			; Text that is varing
	CA.ASZ==2			; Text that is word aligned
	CA.PAD==3			; Number padded to 8 columns
	CA.PT==4			; Text using a byte pointer
	CA.SIX==5			; SIXBIT Text (max of 1 word)
	CA.CRLF==6			; CRLF
	CA.NUM==7			; Unpadded Number
	CA.NOCR==10			; Don't do a CRLF when we are done
	CA.FF==11			; Formfeed
	CA.DBK==12			; Data Base Key
	CA.COL==13			; Limited control of next column
	CA.FILL==14			; Pad with specified number of columns
	CA.OCT==15			; Unpadded Octal Number
	CA.DTM==16			; Date and time
	;;;	UNDEFINED AND LIMIT CASES
	CA.UNU==17			; not used
	CA.SMAX==17			; sys max (ie max defined in gendcl)
	CA.UMAX==40			; user max - smax is whats left to user

	;;;	GENIO MODES
	GENIN==1
	GENOUT==2
	GENAPP==3
	GENIO==4
	; ***	SWITCH COMPON
	GENASZ==0
	GENBIN==1B32			;IE. 10
	; ***	CONSTANT CHANNEL DEFS
	DEFINE CHAN(CHAN.,VAL.)<
	  CHAN.'CHAN==VAL.
	  $$$'CHAN.==1B<^D35-VAL.>
	  INI.CH==INI.CH ! $$$'CHAN.
	>

	;;;	SCAN BLK OFFSETS
	OFFS.==0			;0 EXPLIC SINCE HERE
	FIELD	(F.DEV)			;DEVICE NAME
	FIELD	(F.NAME)		;FILE NAME
	FIELD	(F.NAMM)		;MASK
	FIELD	(F.EXT)			;EXT/MASK
	FIELD	(F.MOD)			;VARIOUS JUNK
	FIELD	(F.MODM)
	FIELD	(F.DIR)			;DIRECTORY WORD
	FIELD	(F.DIRM)
	FIELD	(F.SFD,^D12)
	BLKSIZ	(F.SLEN)
	F.LEN==F.SLEN

	;;;	ENQ/DEQ RESOURCE BLK
	; ***	THE HEADER PORTION
	BYTES	(RS,<<NUM,^D18>,<SIZ,^D18>>) ;NUM OF LOCKS/SIZ OF BLK
	BYTES	(RS,<<RUPT,^D18>,<RQID,^D18>>) ;INTERRUPT CHAN/REQ ID
	BLKSIZ	(HDR.RS)
	; ***	PER-LOCK BLK
	BYTES	(RS,<<SHAR,1>,<IGLN,1>,<UNU,7>,<LEV,^D9>,<CHAN,^D18>>)
					;SHARED?,IGNOR LEV?,LEV#,JFN/CHAN OF RES
	FIELD	(RS.LOCK)		;5B2+NUM OR BYTE PTR
	BYTES	(RS,<<POOL,^D18>,<GROUP,^D18>>) ;POOL SIZE/SHAR GROUP
	BLKSIZ	(SIZ.RS)

	;;;	IPCF ARG BLKS
	; ***	PACKET DESCRIPTOR
	BYTES	(PD,<<FLAG,^D24>,<ERR,6>,<SSC,3>,<NANS,3>>)
					;1 BIT FLAGS, REF DIRECTLY
					;IPCF RETURNED ERROR CODE
					;SYS SENDER CODE, FOR COMMUN WIHT INFO
					;WAS AN UNANSWERED MSG RETURNED
	FIELD	(PD.SEND)
	FIELD	(PD.CEIV)
	BYTES	(PD,<<MLEN,^D18>,<MADD,^D18>>)
	FIELD	(PD.DIR)
	FIELD	(PD.CAPAB)
	BLKSIZ	(SIZ.PD)
	; ***	[SYS]INFO DATA PACKET
	BYTES	(INP,<<CODE,^D18>,<FUNC,^D18>>)
	FIELD	(INP.CPID)		;COPY PID
	FIELD	(INP.ARG)		;BEGIN OF VAR LEN ARG
	BLKSIZ	(SIZ.INP)

	;;;	MGRMEM ARG BLK
	FIELD	(MM.CUR)		;-LEFT,,START -- SORT OF PSEUDO AOBJ
					; PTR FOR STORBLK
	FIELD	(MM.SIZ)		;AMOUNT USER WANTS
	FIELD	(MM.ALC)		;AMOUNT TO GRAB IF RUN OUT
	BLKSIZ	(SIZ.MM)

	;;;	VARIOUS STANDARD WAYS OF BREAKING UP A WORD INTO SUB-FIELDS
	WORD	(UUO,<<OPC,^D9>,<CHAN,4>,<EA,^D23>>)
	WORD	(BP,<<POS,6>,<SIZ,6>,<UNU,1>,<EA,^D23>>)
	WORD	(INS,<<OPC,^D9>,<AC,4>,<IND,1>,<IDX,4>,<MEM,^D18>>)
	WORD	(ARG,<<UNU,^D9>,<TYP,4>,<EA,^D23>>)

	;;;	THE PMAP SYMBOLS
	PM%CNT=1B0			;PAGE COUNT FOLLOWS
	PM%RD=1B2			;PERMIT READ ACCESS
	PM%WR=1B3			;PERMIT WRITE ACCESS
	PM%EX=1B4			;PERMIT EXECUTE ACCESS
	PM%PLD=1B5			;PRE-LOAD PAGE
	PM%CPY=1B9			;COPY ON WRITE

	;;;	MISCELLANEOUS SYMBOLS
	TREG.==5			;MORE OR LESS IN ACCORD WITH DPSS
	CPW==5				;ASCII--CHARS PER WORD
	DEFINE CFOPF<^D36B5+OF%NWT+OF%PLN> ;THIS WAY SINCE OTHERWISE O/S DEP
					   ; (COMMON FLAGS FOR OPENF)

	END