Google
 

Trailing-Edge - PDP-10 Archives - AP-D471B-SB_1978 - mgngen.bli
There are no other files named mgngen.bli in the archive.
!***COPYRIGHT (C) 1974, 1975, 1976, 1977 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.***
MODULE MCSGEN(SREG = #17, FREG = #16,  VREG = #15, MLIST,
TIMER=EXTERNAL(SIX12), FSAVE)=
BEGIN

GLOBAL BIND GEN = 1;

REQUIRE	MGNMAC.BLI;
REQ (MGNEXT);
REQ (MGNMC2);

EXTERNAL
	PUTBLK,
	GETBLK,
	MOVE,
	ZAPMISC,
	GETWORD,
	FIN,
	WCORMISC,
	RCORMISC,
	?.JBFF,
	?.JBREL,
	MISCDEFFLAG;

REQ (MGNPRG);
REQ (MGNREL);

GLOBAL ROUTINE MCSGEN =
BEGIN

MAP	ROOTFORMAT	ROOT;

! COMMAND DEFINATIONS:

BIND	COMMANDS=PLIT(
	%MAKE VERB%
		'MAKE',		MAKE,
	%DISPLAY VERB%
		'DISPL',	DISPLAY,
	%MODIFY VERB%
		'MODIF',	MODIFY,
	%DELETE VERB%
		'DELET',	DELETE,
	%PRINT VERB%
		'PRINT',	PRINT,
	%WRITE VERB%
		'WRITE',	WRITE,
	%READ COMMANDS%
		'READ',		READ,
	%SET VERB%
		'SET',		XSET,
	%EXCHANGE VERB%
		'EXCHA',	EXCHANGE,
	%WHAT VERB%
		'WHAT',		WHAT,
	%HELP VERB%
		'HELP',		HELP,
		'??',		HELP,
	%EXIT VERB%
		'EXIT',		STOP,
	%NULL VERB%
		0,		XNULL
	%END OF COMMAND TABLE%);

! ROUTINE GETRTN
! ======= ======
! GATHERS A COMMAND VERB FROM THE COMMAND BUFFER
! RETURNS VREG = TRUE IF GOOD COMMAND ELSE FALSE
! EXECUTE SET TO APPROPRIATE ROUTINE ADDRESS IF GOOD COMMAND ELSE
!    IF UNKNOWN COMMAND THEN 0 ELSE -1 FOR NON-UNIQUE

ROUTINE GETRTN=
    BEGIN
	REGISTER SIZE,SWITCH;
	IF .CCHAR EQL "/" THEN (ADV(CMDBUFF,CMDBPTR,CMDCOUNT,CCHAR); SWITCH _ FALSE)
	    ELSE SWITCH _ TRUE;
	SWITCH _ NOT .SLASHSEEN OR .SWITCH;
	IF (SIZE _ GATHER(CMDLINE,CCHAR,ACCUM,5)) GTR 5 THEN SIZE _ 5;
	IF .SIZE EQL 0 THEN			! IF NOTHING GATHERED THEN ILLEGAL CHARACTER
	    BEGIN
		ERROR( 7 );
		EXECUTE _ XNULL;
		RETURN TRUE
	    END;
	IF SEARCHTABLE(COMMANDS,ACCUM,.SIZE,1,EXECUTE) THEN
	    BEGIN
		IF .SWITCH THEN TRUE
		    ELSE IF .EXECUTE NEQ HELP THEN FALSE
			ELSE TRUE
	    END
	    ELSE
	    BEGIN
		FALSE
	    END
    END;

LABEL	BLOOP;

! MAIN LINE

	CALLI( 0, 0 );				! RESET THE WORLD!

! OUTPUT TITLE AND VERSION

	OUTS('MCSGEN	');
	OUTO(.VER<VMAJOR>);
	IF .VER<VMINOR> NEQ 0 THEN OUTC(.VER<VMINOR>+"A"-1);
	OUTC("("); OUTO(.VER<VEDIT>); OUTC(")");
	IF .VER<VGROUP> NEQ 0 THEN (OUTC("-"); OUTO(.VER<VGROUP>));
	CRLF;CRLF;

! INITIALIZE THE TABLES

	SA _ ( .?.JBFF + #200 ) AND NOT #177;
	IF .SA GTR .?.JBREL THEN			!GET MORE CORE IF REQ'D
	    BEGIN
		REGISTER	FF;
		FF _ .SA;
		IFSKIP CORE(FF) THEN
		    ELSE
		    BEGIN
			ERROR( 63 );
			XIT
		    END
	    END;
	?.JBFF _ .SA;				! START AT THE COMPUTED START ADDRESS (SA)

	PORTTAB _ 0;
	MPPTAB _ 0;
	TERMTAB _ 0;
	SHOW _ TRUE;
	ZAPMISC();
	ZERO( ROOT, ROOT + N0SIZE - 1 );
	ROOT[ N0LEVEL ] _ - 1;				! SINCE PRIM LEVEL IS 0 ROOT'S LEVEL IS -1

! MAIN LOOP !

	IF .CCL THEN RELOAD();				! IF CCL ENTRY RELOAD CORE

	REPEAT						! WHILE THE USER WANTS TO TALK TO US DO
	    BEGIN
		IF NOT .CCL THEN			! IF CCL THEN DON'T READ THE FIRST LINE TO EXECUTE FROM THE TTY
		    BEGIN
			ERRORFLG _ FALSE;			! RESET THE ERROR FLAG
			PROMPT;					! TELL THE USER WE WANT HIM TO TALK TO US
			CCHAR _ INPUT(CMDLINE,CMDLINELENGTH);	! ACCEPT HIS RESPONSE AND GET THE FIRST CHARACTER
			FIRST _ TRUE;
		    END
		    ELSE CCL _ FALSE;
BLOOP:		REPEAT
		    BEGIN
			DCHANNEL _ TTYCHANNEL;		! MAKE SURE WE TALK TO THE CONTROLLING TTY
			IF NEWCMD(CCHAR) AND NOT .FIRST THEN ADV(CMDBUFF,CMDBPTR,CMDCOUNT,CCHAR);
			IF EOL(CCHAR) OR COMMNT(CCHAR) THEN LEAVE BLOOP;	! ALL DONE
		        IF GETRTN() THEN (.EXECUTE)()	! DECODE COMMAND AND EXECUTE IF GOOD
			    ELSE
			    BEGIN
				ERROR(IF .EXECUTE EQL 0 THEN 5 ELSE 10);	! OTHERWISE COMPLAIN
				LEAVE BLOOP
			    END;
			IF.ERRORFLG THEN LEAVE BLOOP;	! IF ERROR IGNORE THE REST OF THE LINE
			FIRST _ FALSE
		    END
	    END
END;
END;


! END OF MGNGEN.BLI