Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50325/once.bli
There are no other files named once.bli in the archive.
! File:   ONCE.BLI
!
!    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.

MODULE ONCE(TIMER=EXTERNAL(SIX12))=
BEGIN
REQUIRE COMMON.BEG;
REQUIRE ST.BEG;
REQUIRE GTX.BEG;
REQUIRE LDSF.BEG;
REQUIRE LDSFT.BEG;
REQUIRE TABONC.BEG;
REQUIRE ONCDEB.BEG;
BEGIN
!-----------------------------------------------------------------------
!THIS COMPLETE MODULE CONSISTS OF AN INITIALIZATION PORTION FOR THE
!BLISS COMPILER. ALL THESE THINGS ARE DONE ONE TIME ONLY, AT THE
!VERY INITIALIZATION OF COMPILATION.
!
!	BASICALLY, THIS MODULE HAS A ROUTINE "ONCEONLY", FOR
!	INITIALIZATIONS, AND THREE (3) OTHER USEFUL ROUTINES
!	TO HELP DO THESE INITIALIZATIONS.
!-----------------------------------------------------------------------




MACHOP BLT=#251, CALLI=#47, TTCALL=#51;


    MACRO IDT(VALUE,ADDINF)=DT[VALUE]_ADDINF$;



    ROUTINE CONVT(FRM)=

	!I. GENERAL:
	!
	!	1. THIS ROUTINE LOADS "ACCUM[0]" AND
	!	   "ACCUM[1]" WITH A NAME FROM LOCATION
	!	   ".FRM".
	!
	!II. SPECIFIC:
	!
	!	1. *
	!
	!		A. INITIALIZE "ACCUM[0]" AND "ACCUM[1]" TO
	!		   INITIAL VALUES OF -2;
	!
	!		B. MAKE UP 2 POINTERS, ONE TO WHERE THE
	!		   NAME MAY BE FOUND, AND THE OTHER TO WHERE
	!		   WE WANT TO PUT IT ("ACCUM").
	!
	!		C. FINALLY, SCAN UNTIL WE FIND A NULL CHARACTER
	!		   LOADING CHARACTERS ALL THE WHILE INTO "ACCUM".

	BEGIN
	LOCAL PTR,PTR2;
	ACCUM[1]_ACCUM[0]_-2;
	PTR_(.FRM-1)<1,7>;
	PTR2_(ACCUM-1)<1,7>;
	WHILE SCANI(PTR) NEQ 0 DO COPYNI(PTR,PTR2);
	END;



    GLOBAL ROUTINE ISTG(NAME1,NAME2,TYP,ADDINF)=

	!I. GENERAL:
	!
	!	1. THIS ROUTINE CONSTRUCTS A SYMBOL TABLE ENTRY
	!	   FOR "<NAME1><NAME2>" WITH A TYPE FIELD OF
	!	   ".TYP", AND AN ADDITIONAL INFORMATION FIELD
	!	   OF ".ADDINF".

	BEGIN
	REGISTER LOC;
	CONVT(NAME1);
	STE_STINSERT(LOC_NTINSERT(),.TYP,.ADDINF);
	.LOC
	END;



    GLOBAL ROUTINE IST(NAME1,NAME2,LEXEME,DTIND)=

	!I. GENERAL:
	!
	!	1. THIS ROUTINE CONSTRUCTS A DELIMITER SYMBOL TABLE
	!	   ENTRY FOR "<NAME1><NAME2>" WITH AN ADDITIONAL
	!	   INFORMATION FIELD OF ".DTIND".
        !       2. IT THEN ENTERS THE LEXEME CORRESPONDING TO THE
        !          INDEX IN THE DELIMITER TABLE (DT).

	!	3. IT ALSO CONSTRUCTS THE INVERSE TABLE, DTPF, FOR
	!	   DEBUGGING PURPOSES. (SEE DEBUG)
	BEGIN
	CONVT(NAME1);
	DTPF[.DTIND]_STINSERT(NTINSERT(),DELMT,.DTIND);
        DT[.DTIND]_.LEXEME
	END;



    EXTERNAL ONCEF2;
    EXTERNAL ONCEF;



    GLOBAL ROUTINE ONCEONLY=

	!I.GENERAL:
	!
	!	1. THIS ROUTINE HANDLES THE MAIN INITIALIZATION
	!	   SEQUENCE OF THE COMPILER.
	!
	!	2. IT FIRST INITIALIZES THE SYMBOL TABLE,
	!	   LITERAL TABLE, AND GRAPH TABLE DOPE VECTORS.
	!
	!	3. THEN IT INITIALIZES ALL OTHER IMPORTANT THINGS.
	!	   THESE ARE EXPLAINED BELOW, JUST PRIOR TO THEIR
	!	   ACTUAL INITIALIZATIONS.

	BEGIN
	REGISTER R1;
	BIND DEVCHR=4;
	MACRO TTYBIT=21,1$;	! FOR DEVCHR
	EXTERNAL JOBSA,JOBREL,JOBVER;
	EXTERNAL GARBCNT;
	EXTERNAL CALLEXECFORSPACE;
	EXTERNAL TTYDIR;

	CALLI (0,0);

	CLEARCORE(SFDB,EFDB-SFDB+1);

	R1_ SIXBIT 'TTY' ;
	CALLI(R1,DEVCHR);
	IF .R1<TTYBIT> THEN TTYDIR_1 ELSE TTYDIR_-1;

	R1_.JOBREL<RIGHTPART>+PAGSIZE*2;
!	(@ST)[ENDOFSPACE]_PAGSIZE;
!	(@ST)[TOPOFTABLE]_NOGBGCOL+1;
	CALLI(R1,#11);		! GET MORE CORE
	R1_0;			! ERROR RETURN
	ENDOFSPACE_.JOBREL<RIGHTPART>;
	TOPOFTABLE_.JOBSA<LEFTPART>;
	GARBCNT_5;

! B. NOW WE INITIALIZE THE NAME FOR PRINTING NODES.

BEGIN
BIND OPPLIT=PLIT(
	'+',
	'*SWAB',
	'/',
	'.',
	'-',
	'*MOD',
	'*',
	'-',
	'*LOAD',
	'^',
	'*BIT',
	'*GTR',
	'*LEQ',
	'*LSS',
	'*GEQ',
	'*EQL',
	'*NEQ',
	'*NOT',
	'*EQV',
	'*AND',
	'*OR',
	'*XOR',
	'*FADR',
	'*FDVR',
	'*FIX',
	'*FLT',
	'*FMPR',
	'*FNEG',
	'*FSBR',
	'*GTRU',
	'*LEQU',
	'*LSSU',
	'*GEQU',
	'*EQLU',
	'*NEQU',
	'*ROT',
	'*MAX',
	'*MIN',
	'*CARY',
	'*OVFL',
	'_',
	0,
	'*CASE',
	'*FPAR',
	'*FSTO',
	'*WHDO',
	'*UNDO',
	'*ROUT',
	'*COMP',
	'*INCR',
	'*DECR',
	'*IF',
	'*DOWH',
	'*DOUN',
	'*CREA',
	'*EXCH',
	'*SELE',
	'*ESC',
	'*LABL',
	'*MODU',
	'*PLIT',
	'*CALL',
	'*PTR',
	'*STRU',
	'*LEAV',
	'*RTRN',
	'*NULL',
	'*INLI',
	'*ENAB',
	'*SIGN',
	'*MOVP'		);


MOVECORE(OPPLIT,OPPRNT,MAXOPERATOR+1);
MOVECORE(OPPLIT[MAXOPERATOR+1],
	 OBPRNT[MAXOPERATOR+1],
	 MAXDELIMITER-MAXOPERATOR);
END;




    ! D. INITIALIZE DEFAULT LINKAGE AND STRUCTURE, AND DEFINE LINKAGE NAMES


    BEGIN
    MAP STVEC STE;
    LOCAL STVEC L;
    EXTERNAL SPEC1LNKG,SPEC2LNKG,EXCHJLNKG;
    ROUTINE DEFLNKG(N1,N2,T,DESC) = (
        ISTG(.N1,.N2,LNKGNMT,0);
        STE[LNKGTF] _ .T;
        STE[LNKGDESCF] _ .DESC  );
    L_GETSPACE(ST,1);
    L[LNKGSIZEF]_0;
    DEFLNKG('BLISS',0,BLISLNKGT,.L);
    DFLTLNKGLX _ LEXOUT(BNDVAR,.STE);
    DEFLNKG('FORTR','AN',FRTRNLNKGT,.L);
    DEFLNKG('EMT',0,EMTLNKGT,.L);
    DEFLNKG('TRAP',0,TRAPLNKGT,.L);
    TRAPLNKGLX_LEXOUT(BNDVAR,.STE);
    DEFLNKG('INTER','RUPT',INTRRPTLNKGT,.L);
    DEFLNKG('IOT',0,IOTLNKGT,.L);
    DEFLNKG('HYDRA',0,HBLISLNKGT,.L);
    DEFLNKG('IHYDR','A',IHBLISLNKGT,.L);
    DEFLNKG('.SPEC','1',SPECLNKGT,.L);
    SPEC1LNKG_.STE;		! LINKAGE FOR RESET, WAIT, NOP

    L_GETSPACE(ST,2);
    L[LNKGSIZEF]_1;
    L[PARMTYPE(1)]_REGPARM; L[PARMLOC(1)]_VR;
    DEFLNKG('.SPEC','2',SPECLNKGT,.L);
    SPEC2LNKG_.STE;		! LINKAGE FOR HALT

    L_GETSPACE(ST,3);
    L[LNKGSIZEF]_2;
    L[PARMTYPE(1)]_STACKPARM;
    L[PARMTYPE(2)]_REGPARM; L[PARMLOC(2)]_VR;
    DEFLNKG('.SPEC','3',SPECLNKGT,.L);
	! EXCHJ ACTUALLY SHOULD HAVE THE BLISS LINKAGE TYPE, BUT
	! BY GIVING IT THE SPECIAL LINKAGE TYPE WE FORCE SYNTAX
	! TO CHECK FOR THE NUMBER OF PARAMETERS BEING MORE THAN 2.
    EXCHJLNKG_.STE;
    INCR R FROM 1 TO 5 DO
	BEGIN
	BIND BR=PLIT(0,'REG1','REG2','REG3','REG4','REG5');
	L_GETSPACE(ST,.R+1);
	L[LNKGSIZEF]_.R;
	INCR I FROM 1 TO .R DO
	    (L[PARMTYPE(.I)]_REGPARM; L[PARMLOC(.I)]_.I);
	DEFLNKG('BLISS',.BR[.R],BLISLNKGT,.L);
	DEFLNKG('HYDRA',.BR[.R],HBLISLNKGT,.L);
	DEFLNKG('IHYDR','A'+(.BR[.R]^(-7)),IHBLISLNKGT,.L);
	END;
    END;



! H. NOW INITIALIZE RESERVED WORD DELIMITER SYMBOL
!	TABLE ENTRIES (PART 1).

	ONCEF2();
	ONCEF();

! SAVE THE HASH TABLE FOR REINIT

	SAVHASH_GETSPACE(ST,HTSIZE);
	MOVECORE(HT,.SAVHASH,HTSIZE);

!  SAVE THE TOP OF THE SYMBOL TABLE FOR REINIT

	SAVTOP_.TOPOFTABLE;

! INITIALIZE SOURCE LISTING LEFT MARGIN

	LEFTMARGIN_";" ;
	LMARG[2]_' ?I';

END;
END
END