Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50325/common.beg
There are no other files named common.beg in the archive.
! File:   COMMON.BEG
!
!    This work was supported by the Advanced Research
!    Projects Agency of the Office of the Secretary of
!    Defense (F44620-73-C-0074) and is monitored by the
!    Air Force Office of Scientific Research.

!	THIS IS THE COMMON BEGIN FILE, IT SHOULD BE USED ALMOST EVERYWHERE
!-------------------------------------------------------------------------
!
!0. COMMON STRUCTURE DEFINITIONS
!
STRUCTURE FASTTABLE[I,J,K,L]=[I] (.I+.J)<.K,.L>;	! I=CELL ADDR, J=WORD IN CELL, K=POSITION, L=SIZE
EXTERNAL FASTTABLE ST;
BIND FASTTABLE GT=ST:NT=ST;
!      THIS STRUCTURE IS USED FOR ACCESSING SYMBOL TABLE ENTRY
!      FIELDS BY ACCESSING THESE FIELDS RELATIVE TO THE BASE OF A
!      GIVEN ENTRY. THUS, IF WE SAY, "ENTRY[FIELD]", THEN
!      "ENTRY" MUST CONTAIN THE INDEX OF THE ENTRY TO BE ACCESSED.
STRUCTURE STVEC[I,J,K]=ST[@.STVEC,.I,.J,.K];
STRUCTURE NTVEC[I,J,K]=NT[@.NTVEC,.I,.J,.K];
STRUCTURE HASHVEC[I,J,K]=[I]((.HASHVEC+.I)<.J,.K>);
STRUCTURE FLAGWORD[I,J]=(.FLAGWORD)<.I,.J>;
STRUCTURE LEXEME[I,J]=.LEXEME<.I,.J>;
STRUCTURE WINDOW[I,J]=.WINDOW<.I,.J>;


!-----------------------------------------------------------------------
!1. COMMON INFORMATION BETWEEN SYMBOL TABLE ENTRIES AND
!   GRAPH TABLE ENTRIES.
!   A. ADDRESSING MODES:

    BIND
	DEFERRED=1,

	GENREG=0,
	AUTOINCR=2,
	AUTODECR=4,
	INDEXED=6,

	IMMEDIATE=2,
	ABSOLUTE=3,
	RELATIVE=6;

!   B. REGISTER DEFINITIONS:

    BIND
	VR=0,
	SP=6,
	PC=7;

!-----------------------------------------------------------------------
!2. THIS PORTION DEALS WITH ROUTINES DECLARED EXTERNAL TO 
!   INDIVIDUAL MODULES. THEY APPEAR HERE IN ALPHABETICAL ORDER.
!   NEXT TO THEM IS THE MODULE IN WHICH THEY APPEAR, FOR EXAMPLE,
!   IF A ROUTINE CALLED BBLAP APPEARS IN MODULE XXX THEN ITS ENTRY WILL
!   BE:
!
!	BBLAP,				!XXX
!

EXTERNAL
	BLOCKPURGE,			!LEXAN
	CCLINIT,			!CCL
	DELINK,				!LSTPKG
!	DOMODULE,			!DECLAR
	EMPTY,				!LSTPKG
	ENLST,				!LSTPKG
	ESTRU,				!LEXAN
	FORCE,				!LOIO
	FSYMPROTECT,			!LEXAN
	GARBAGECOLLECT,			!TABLES
	GENIT,				!DRIVER
	GETCELL,			!FINLST
	GETLABEL,			!SYNTAX
	GETSPACE,			!TABLES
!	INITIO,				!NEWIO2 (HIIO)
	LINK,				!LSTPKG
	MAKHDR,				!LSTPKG
	MAKINTLST,			!LSTPKG
	MAKITEM,			!LSTPKG
	MARKSTK,			!SYNTAX
	NEWBOT,				!FIN2LS,FINAL
	NTINSERT,			!TABLES
!	ONCEONLY,			!ONCE
	OUTDEL,				!LEXAN
	OUTSTR,				!LEXAN
	OUTSYM,				!LEXAN
	OUT11STRING,			!LEXAN,LISTC
	PAGE,				!LOIO
	PULSELIST,			!LSTPKG
	PUNT,				!LOIO
	PUSH,				!SYNTAX
	PUSHBOT,			!FINLST
	RELEASESPACE,			!TABLES
	RELFLOW,			!TABLES
	RELITEM,			!LSTPKG
	RELLST,				!LSTPKG
	RHOPULSE,			!LSTPKG
	RSTRTHREAD,			!TABLES
	RSTRTREE,			!TABLES
	RUND,				!LEXAN
	RUNDE,				!SYNTAX
	SEARCH,				!TABLES
	SORTFINT,			!LSTPKG
!	STATOUT,			!CCL
	STINSERT,			!TABLES
	STRMRELEASE,			!LEXAN
	TTYLIST;			!LOIO



!-----------------------------------------------------------------------
!3. EXTERNAL NAMES:
!
!   THESE ARE EXTERNAL VARIABLES WHICH HAVE GENERAL USES. ALL NAMES
!   ARE DECLARED EXTERNAL AT THIS LOCATION. FOLLOWING THEM IS A VERY
!   BRIEF AND CRYPTIC DESCRIPTION OF THEIR USES.

EXTERNAL
	ANYENAB,		! ENABLE ANYWHERE INSIDE CURRENT BLOCK
	ACCUM, %VECTOR%		! HOLDS NAME CHARACTERS FOR SEARCH()
	ALDON,			! TRUE IF .TITLE AND .IDENT HAVE BEEN OUTPUT
	BLOCKLEVEL,		! NUMBER OF BLOCKS OUTSIDE CURRENT BLOCK
	BUFF, %VECTOR%		! HOLDS CHARACTER STRING GOTTEN BY READTEXT
	BUFFL,			! MAX NO. OF CHARS PER INPUT LINE
	B11LO,			! BLIS11 COMPILER LOSEG SIZE
	CCLCTL,			! CCL CONTROL WORD; 0-NO CCL ENTRY,
				!   1-CCL ENTRY, 3-CCL FILE READ
	CODESIZE,		! NO. OF PDP-11 WORDS OF CODE PRODUCED
	CSNAME,			! CURRENT CSECT NAME
	CSFLAG,			! TELLS WHO OUTPUT LAST '.CSECT'
	CURROUT,		! NAME OF CURRENT ROUTINE, IF ANY
	DATASIZE,		! NO. OF PDP-11 WORDS OF STORAGE RESERVED
	DDT,			! DYNAMIC DEBUGGING
	DOPAGE,			! TRUE IFF NEED TO PRINT FF BEFORE OUTPUTTING BUFF
	DTPF,			! INVERSE OF DELIMITER TABLE(DT)
	EFDB,
	FOUNDATION,		! BASE OF SAVED GT HASH TABLE
	GARBCNT,		! IS IT TIME TO COLLECT?
	LABELNO,		! NEXT LABEL NUMBER(COMPILER GENERATED).
	LASTPUR,		! SAVED LIST OF PURGED SYMBOL TABLE ENTRIES
	LINCNT,			! SOURCE LINE COUNT
	LOOPDEPTH,		! CURRENT LOOP DEPTH DURING LEXSYNFLO, TNBIND
	MAINDECL,		! TRUE IFF COMPILING MAIN MODULE
	MAXLOCALS,		! MAX # LOCALS IN A ROUTINE
	MAXPARMS,		! MAX # PUSHED PARAMETERS IN ANY RTN CALL
	MODDONE,		! TRUE IFF FINISHED PARSING OUTER MODULE CODE
	MODNAME,		! MODULE NAME (2 WORDS)
	MODMAIN,		! NAME OF MAIN MODULE (STARTING ADDRESS)
	NEXTGLOBAL,		! NUMBER OF LAST GLOBAL ASSIGNED
				! (OFFSET INTO GLOBAL REGION).
	NEXTLOCAL,		! NUMBER OF LAST LOCAL ASSIGNED
				! (OFFSET INTO LOCAL REGION -- STACK).
	NEXTOWN,		! NUMBER OF LAST OWN ASSIGNED
				! (OFFSET INTO OWN REGION).
	NINLINES,		! NUMBER OF "INLINES" IN CURRENT MODULE
	NLINES,			! NUMBER OF LINES ON CURRENT OUTPUT PAGE.
	NOTREE,			! STACK OF BITS; BIT ON TOP TURNS OFF GENGT.
	PACCUM,			! BYTE POINTER TO ACCUM.
	PBUFF,			! BYTE POINTER TO BUFF.
	PURGED,			! POINTS TO LINKED LIST OF PURGED ST ENTRIES 
FLAGWORD RESERVED,		! BIT MASK OF RESERVED REGISTERS
	RBLOCKLEVEL,		! BLOCK LEVEL AT ROUTINE BODY LEVEL
	RUTIME,			! RUNTIME (IN SECONDS) TO COMPILE MODULE
	SFDB,
	SIZE,			! SIZE OF SYMBOL OR SYMBOLS BEING DECLARED 
	SSTKLEN,		! NO. OF WORDS IN RUNTIME STACK
	STACK, %VECTOR%		! BLISS-10 RUNTIME STACK
STVEC	STE,			! SYMBOL TABLE ENTRY JUST DECLARED
	STRUCLEVEL,		! BLOCK LEVEL AT STRUCTURE DECLARATION LEVEL
	TNCHAIN,		! CHAIN OF  TEMP NAME CELLS
	VALIDBUF;		! TRUE IF CURRENT INPUT LINE HAS NOT BEEN OUTPUT YET.


!-----------------------------------------------------------------------
!4. SPECIAL SPACE PARAMETER DEFINITIONS:

!   A. THESE ARE DEFINITIONS OF THE SIZE OF A PAGE IN CELLS, AND
!      THE SIZE OF A CELL IN WORDS, AND OTHER LITTLE GOODIES.


    BIND
	WRDSZ=16,	!BITS/WORD FOR COMPILED CODE
	BYTSZ=8,	!BITS/BYTE FOR COMPILED CODE
	PAGED=0,	!TRUE IFF COMPILER TABLES ARE PAGED
	PAGSIZE=#2000,	! NUMBER OF WORDS/PAGE; MUST BE POWER OF 2!!
	LOGPAGSIZE=10,
	WORDSIZE=1,	! NUMBER OF ADDRESS UNITS PER WORD
	DVSIZE=100;	!DOPE VECTOR SIZE FOR TABLES.


!-----------------------------------------------------------------------
!5. GENERAL LEXEME INFORMATION.



!   A. THE FOLLOWING IS A LIST OF ALL LEXEME TYPES AND
!      THEIR MEANINGS.

    BIND
	LITTYP=1,		! LITERAL LEXEME

	BNDVAR=2,		! BOUND VARIABLE
				!  (POINTS TO A SYMBOL TABLE ENTRY).
	GTTYP=3,		! GRAPH TABLE LEXEME.

	ERRTYP=4,		! ERROR LEXEME.

	LSLEXTYP=5,		! LONG STRING LEXEME

	SSLEXTYP=6,		! SHORT STRING LEXEME

	CLSTRUF=7,		! STRUCTURE ACTUAL (IN STREAMS ONLY)

	UNBNDVAR=8,		! UNBOUND VARIABLE
				!  (POINTS TO A NAME TABLE ENTRY).
	CLSFCONV=9,		! SPECIAL FUNCTIONS (CONVERSION)

	CLMACR=10,		! MACRO NAME
				! (POINTS TO A SYMBOL TABLE ENTRY).

	CLSFEXPND=11,		! SPECIAL FUNCTIONS (EXPANSION)

	CLMACRF=12,		! MACRO ACTUAL (IN STREAMS ONLY)

	SELTYP=13,		! OTHERWISE OR ALWAYS IN SELECT

	TNTYP=14,		! TEMP NAME LEXEME

	CLWANTSYM=15,		! SYMBOL DECLARED DURING STRUCTURE
				! EXPANSION (IN STREAMS ONLY)
	ALPHAT=31,
	RHOT=30,
	CHIT=29,
	OMEGAT=28,
	LOWFLOLSTTYPE=28;	!IF A FLOLSTTYPE IS ADDED, CHANGE!!!


!   B. SPECIAL LEXEMES FOR ALWAYS AND OTHERWISE

	BIND LEXALWAYS=SELTYP^18+1,
	     LEXOTHERWISE=SELTYP^18;

!   C. ASSOCIATED EXTERNALS:
!
!      THESE EXTERNAL NAMES ARE MAPPED TO THE ABOVE STRUCTURE.


    EXTERNAL LEXEME SYM:DEL:DFLTLNKGLX:TRAPLNKGLX;



!   E. FIELD DEFINITIONS FOR OPERAND LEXEMES.


    MACRO
	LEXPART	=0,23$,
	LEXABCF	=23,12$,
	ADDRF	=0,18$,		! ADDRESS PORTION OF LEXEME
	LTYPF	=18,5$,		! LEXEME TYPE FIELD
	LEXW	=0,36$,		! LEXEME WORD
	DELIND	=23,8$,		! DELIM TABLE INDEX WITH WINDOW STRUCTURE
	DLRESWD	=7,1$,		! TRUE IF DELIMITER WAS A RESERVED WORD
	DLINDX	=0,7$,		! ACTUAL INDEX
	SYMPART(X)=(X AND NOT #377^23)$,
	FORMWINDOW(S,D)=(SYMPART(S) OR D^23)$;



!   F. LEXEME BUILDING MACROS.

!       1. THESE MACROS SERVE TO MAKE UP A LEXEME WITH
!	   A SPECIFIED ADDRESS AND TYPE FIELD.


    MACRO LEXTYPE(TYPE)=((TYPE)^18)$,
      LEXOUT(TYPE,ADDRESS)=(((ADDRESS) AND #777777)+LEXTYPE(TYPE))$,
      FASTLEXOUT(T,A)=(A OR LEXTYPE(T))$,
      LITLEXEME(X)=LEXOUT(LITTYP,X)$;


!   G. SPECIAL LEXEMES:

!      1. FIRST WE HAVE SPECIAL BASE LEXEMES FOR OPERANDS.


    BIND
	LITLEX=LEXOUT(LITTYP,0),	!LITERAL LEXEME BASE.
	GTLEX=LEXOUT(GTTYP,0);		!GRAPH TABLE LEXEME BASE.

!	2. NOW VARIOUS OTHER USEFUL LEXEMES.

    MACRO
	MINONE=LITLEXEME(-1)$,
	LZERO=LTINSERT(0)$,
	ZERO=LITLEXEME(0)$,
	FULLWORD=LITLEXEME(WRDSZ)$,
	ONE=LITLEXEME(1)$;

!   H. MISC. STUFF FOR LITERAL LEXEMES

  MACRO
	LITVALUE(Q)=((Q) AND #177777)$,
	LTINSERT(X)=(X)$;





!-----------------------------------------------------------------------
!6. BUFFER SIZE DECLARATIONS

    BIND
	BUFFSIZ=26,		!NO. OF WORDS IN INPUT LINE BUFFER;
				!RECOMPILE GLODEC IF YOU CHANGE THIS.
	DEFAULTSSTK=#400,	! DEFAULT NO. OF WORDS IN RUNTIME STACK
	HTSIZE=125,		! LENGTH OF HASH TABLE;
				! RECOMPILE GLODEC IF YOU CHANGE THIS.
	MAXSTRING=135;		! MAXIMUM STRING SIZE

!------------------------------------------------------------------------
!7. DEFINITIONS FOR HANDLING LEFT MARGIN OF SOURCE LISTING

EXTERNAL LMARG;

BIND	LEFTMARGIN = (LMARG)<1,7>,
	SEQNUM = (LMARG+1)<0,36>,
	SCANTYPE = (LMARG+2)<29,7>;



!-------------------------------------------------------------------------
!8. FLAGS:
!
!   A. THE FOLLOWING ARE MACRO DEFINITIONS OF FLAGS FOR COMPILATION.


    EXTERNAL FLAGS;

    MACRO
	EMFLG=FLAGS<19,1>$,	!LIST MACRO EXPANSIONS
	NPTFLG=FLAGS<20,1>$,	!NO OPTIMIZATION ACROSS ;'S
	SFLG=FLAGS<21,1>$,	!PRINT COMPILER STATISTICS
	BINFLG=FLAGS<22,1>$,	!PRODUCE BINARY OUTPUT (NOT IMPL. YET).
	LSTFLG=FLAGS<23,1>$,	!PRODUCE LISTING
	MLFLG=FLAGS<24,1>$,	!LIST MACHINE CODE
	PICSW=FLAGS<25,1>$,	!PRODUCE POSITION INDEPENDENT CODE
	XREFLG=FLAGS<26,1>$,	!PRODUCE CROSS REFERENCE (NOT IMPL. YET).
	ERRBIT=FLAGS<27,1>$,	!REPORT ERRORS TO USER'S TERMINAL
	HYDRASW=FLAGS<28,1>$,	!DO SPECIAL THINGS FOR HYDRA
	FINALSW=FLAGS<29,1>$,	!ON FOR 'SUPER' OPTIMIZE IN FINAL
	UNAMESW=FLAGS<30,1>$,	!PRINT UNIQUE NAMES
	MRKFLG=FLAGS<31,1>$,	!MARK DOT NODES FOR .X_
	DEBFLG=FLAGS<32,1>$,	!PRODUCE TABLES, ETC., FOR SIX12
	ZIPSW=FLAGS<33,1>$,	!OPTIMIZE FOR SPEED INSTEAD OF SIZE
	SEGSW=FLAGS<34,1>$,	!INSURE SEPARATION OF INSTRUCTIONS AND DATA
	QUIKSW=FLAGS<35,1>$,	!SPEED UP COMPILATION

	FINFLG=FLAGS<7,1>$,	!END OF FILE FLAG
	TTYLST=FLAGS<10,1>$;	!TELETYPE LISTING FLAG.

    EXTERNAL SECTFLAGS;

    MACRO
	CSFLG=SECTFLAGS<0,2>$,
	CSCFLG=SECTFLAGS<2,2>$,	! CODE
	CSGFLG=SECTFLAGS<4,2>$,	! GLOBALS
	CSOFLG=SECTFLAGS<6,2>$,	! OWNS
	CSPFLG=SECTFLAGS<8,2>$,	! PLITS
	CSDFLG=SECTFLAGS<10,2>$;	! DEBUG STUFF



	EXTERNAL FLAGWORD OFLAGS;


!-----------------------------------------------------------------------
!9. LINKAGE TYPES

BIND
	SPECLNKGT=0,		!ANY SPECIAL FUNCTIONS (HALT,WAIT, ETC.)
	BLISLNKGT=1,		!BLISS
	EMTLNKGT=2,		!EMT
	FRTRNLNKGT=3,		!FORTRAN
	INTRRPTLNKGT=4,		!INTERRUPT
	TRAPLNKGT=5,		!TRAP
	IOTLNKGT=6;		!IOT LINKAGE

BIND
	HBLISLNKGT=7,
	IHBLISLNKGT=8;

BIND
	STACKPARM=0,		! STACK TYPE PARM
	REGPARM=1,		! REGISTER PARM
	LITPARM=2,		! LITERAL MEMORY PARM
	NMEMPARM=3;		! NAMED MEMORY PARM

MACRO
	LNKGSIZEF=0,0,18$,
	PARMTYPE(N)=N,18,18$,
	PARMLOC(N)=N,0,18$;



!------------------------------------------------------------------
!10. DECLARATIONS FOR OVERLAY VERSION

BIND
    NULLSEG=0,
    ONCESEG=1,
    LEXSYNSEG=2,
    IOSEG=3,
	DELAYSEG=4,
	TNBINDSEG=5,
	CODESEG=6,
	FINALSEG=7,
	INITSYNSEG=8,
	SYMPURSEG=9;

%<
MACRO
    ONCEONLY(X)=SEGCALL(X,ONCESEG)$,
    EXPRESSION(X)=SEGCALL(X,LEXSYNSEG)$;
>%

!--------------------------------------------------------------------
!11. FAST COMPILATION SWITCHES

BIND
	ALWAYSFAST=0,		! SET TO FORCE IGNORING OF /-K
	NEVERFAST=0;		! SET TO FORCE IGNORING OF /K

MACRO
	FAST= (IF ALWAYSFAST
		 THEN 1
		 ELSE IF NEVERFAST
			THEN 0
			ELSE .QUIKSW)$,
	SLOW= (IF ALWAYSFAST
		 THEN 0
		 ELSE IF NEVERFAST
			THEN 1
			ELSE (NOT .QUIKSW))$;

	! NOTE THAT IF "ALWAYSFAST" IS SET, "NEVERFAST" IS IGNORED.

!--------------------------------------------------------------------
!12. MISCELLANEOUS

BIND
	TRUE=1,
	FALSE=0;

MACRO
	MOVECORE(SRC,DST,LENTH)=
	  BEGIN
	  MACHOP BLT=#251;
	  REGISTER RQQQ,SQQQ;
	  RQQQ<LEFTPART>_(SRC);
	  RQQQ<RIGHTPART>_(DST);
	  SQQQ_(DST)+(LENTH);
	  BLT(RQQQ,-1,SQQQ);
	  END$,

	SETCORE(BASE,LENTH,CONST)=
	  BEGIN
	  MACHOP BLT=#251;
	  REGISTER RQQQ,SQQQ;
	  SQQQ_(BASE);
	  (.SQQQ)<0,36>_(CONST);
	  IF (LENTH) EQL 1 THEN EXITBLOCK;
	  RQQQ<LEFTPART>_.SQQQ<0,18>;
	  RQQQ<RIGHTPART>_.SQQQ<0,18>;
	  RQQQ_.RQQQ+1;
	  SQQQ_.SQQQ+(LENTH);
	  BLT(RQQQ,-1,SQQQ);
	  END$,

	CLEARCORE(BASE,LENTH)=SETCORE(BASE,LENTH,0)$;

MACRO
	COMMENT=SWITCHES LIST;$,
	EXTEND(X)=(((X)^20)/(1^20))$,
	CONTINUOUSLY=WHILE 1$,
	LEFTPART=18,18$,
	RIGHTPART=0,18$,
	NOVALUE=.VREG$,
	ID(X)=X$,
	SWAP(A,B)=(REGISTER R999999;
		   MACHOP EXCH=#250;
		   R999999_.(A);
		   EXCH(R999999,(B));
		   (A)_.R999999)$,
	BMSKX(P,S)=((1^(S)-1)^(36-(P)-(S)))$,
	BMSK(A)=(1^(35-(A)))$,
	BIT2(A,B)=(BMSK(A) OR BMSK(B))$,
	BIT3(A,B,C)=(BMSK(A) OR BIT2(B,C))$,
	BIT4(A,B,C,D)=(BIT2(A,B) OR BIT2(C,D))$,
	BIT5(A,B,C,D,E)=(BIT3(A,B,C) OR BIT2(D,E))$,
	BIT6(A,B,C,D,E,F)=(BIT3(A,B,C) OR BIT3(D,E,F))$,
	ONEOF(NUM,BITMASK)=((BITMASK)^(NUM) LSS 0)$;