Google
 

Trailing-Edge - PDP-10 Archives - AP-D471B-SB_1978 - print.bli
There are no other files named print.bli in the archive.
!***COPYRIGHT (C) 1974, 1975, 1976, 1977 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.***
%%
%
	THIS MODULE IMPLEMENTS THE PRINT COMMAND.
	LAST MODIFIED ON 13 AUG 74 BY JG.
%
%%

MODULE PRINTX (MLIST,FSAVE,TIMER=EXTERNAL(SIX12)) =
BEGIN
REQUIRE COMMON.BLI;
REQUIRE ENTRY.BLI;
COMMENT(PRINT);

! SUBROUTINE PRINT
! ========== =====

! THIS ROUTINE IMPLEMENTS THE PRINT COMMAND.

GLOBAL ROUTINE PRINT =
BEGIN

	MACRO SETFLAG(FLAG) =
		IF .CURREP[ALLSEL]			! OPTION IS REDUNDANT IF ALL HAS BEEN SPECIFIED
			THEN MSG(30)
			ELSE CURREP[FLAG] _ SOMETHING _ TRUE$;

	MACRO	NOTHING = NOT .SOMETHING$,
		NOTALL  = NOT .CURREP[ALLSEL]$;
	BIND	CNAME = PLIT ASCIZ 'PRINT';
	LABEL	LOOP,BRK;
	LOCAL	ATOM,SOMETHING,IOB,BOTH,INDEX;
	MAP	VARYINGCHAR	ATOM,
		REPBLK		CURREP;

	FUNCTION MSG(CODE) =				! SIMPLIFIES PRINTING ERROR MSGS, MUST BE FUNCTION
	BEGIN
		ERTEXT(24);
		TTYOVR(.ATOM);
		ERTEXT(.CODE);
		SOMETHING _ TRUE			! BUT WE DID SEE AN OPTION
	END;
	IF GETREP(OLD) IS FALSE THEN RETURN FALSE;	! NO ROOM?
	SOMETHING _ BOTH _ IOB _ FALSE;
	CURREP[IOBSEL] _ XBOTH;				! GIVE THE GUY AT LEAST ONE DEFAULT

	REPEAT LOOP:BEGIN				! INFINITE LOOP IF WE CAN'T GET A ;
		ATOM _ TTYINT();
		IF .ATOM[LANGTH] LSS 0			! BREAK OR SUPER ATOM
		THEN BRK: BEGIN
			IF .ATOM[LANGTH] IS -40		! SUPER ATOM - NO GOOD
			THEN BEGIN
				MSG(25);
				WHILE .ATOM[LANGTH] IS -40	! SCAN TO ITS END
					DO ATOM _ TTYINT();
				SOMETHING _ TRUE;	! WE SAW SOMETHING
				IF .ATOM[LANGTH] GTR 0 THEN LEAVE BRK	
			END;
			SELECT .ATOM[STRING] OF		! LAZY WAY TO DO THINGS
			NSET

			';':	IF NOTHING
				THEN BEGIN
					ERTEXT(8); TTYOTS(0,CNAME); ERTEXT(9);
					RETURN FALSE
				END
				ELSE RETURN TRUE;
	
			',':	LEAVE LOOP;		! SIMPLY IGNORE COMMAS
	
			OTHERWISE: BEGIN		! INVALID BREAK CHAR
					ERTEXT(27); TTYOTS(0,CNAME); ERTEXT(28);
					LEAVE LOOP
				END;
			TESN;
		END;

		KEYCHK(.ATOM,INDEX);			! IS IT A KEYWORD?
		CASE .INDEX+1 OF			
		SET
		%AMBIGUOUS%	BEGIN
					TTYOVR(.ATOM);
					ERTEXT(39);
					SOMETHING _ TRUE
				END;
		%NO MATCH%	BEGIN
					MSG(25);
					SOMETHING _ TRUE
				END;
		%BY%		MSG(25);
		%GO%		MSG(25);
		%ALL%		IF NOTHING
				THEN BEGIN
					CURREP[ALLSEL] _ TRUE;
					CURREP[MPPSEL] _ CURREP[CODSEL] _ CURREP[DATSEL] _ TRUE;
						CURREP[TXTSEL] _ CURREP[TIMSEL] _ CURREP[CLSSEL] _ TRUE;
						CURREP[SORSEL] _ CURREP[SEQSEL] _ CURREP[DSTSEL] _ TRUE;
					SOMETHING _ TRUE
				END
				ELSE MSG(29);
		%AND%		MSG(25);
		%BOTH%		IF NOTHING OR .CURREP[ALLSEL]
				THEN BEGIN
					IF .IOB AND .CURREP[IOBSEL] ISNOT XBOTH
					THEN ERTEXT(31);
					CURREP[IOBSEL] _ XBOTH;
					SOMETHING _ IOB _ BOTH _ TRUE
				END
				ELSE MSG(29);
		%EXIT%		MSG(25);
		%MPPS%		SETFLAG(MPPSEL);
		%SORT%		MSG(25);
		%AFTER%		MSG(25);
		%CODES%		SETFLAG(CODSEL);
		%DATES%		SETFLAG(DATSEL);
		%INPUT%		IF NOTALL AND .SOMETHING AND NOT .IOB
				THEN MSG(29)
				ELSE BEGIN
					IF .CURREP[IOBSEL] IS XOUTPUT OR .BOTH
					THEN BEGIN
						ERTEXT(31);
						CURREP[IOBSEL] _ XBOTH
					END
					ELSE CURREP[IOBSEL] _ XINPUT;
					SOMETHING _ IOB _ TRUE
				END;
		%PRINT%		MSG(25);
		%TALLY%		MSG(25);
		%TEXTS%		SETFLAG(TXTSEL);
		%TIMES%		SETFLAG(TIMSEL);
		%BEFORE%	MSG(25);
		%OUTPUT%	IF NOTALL AND .SOMETHING AND NOT .IOB
				THEN MSG(29)
				ELSE BEGIN
					IF .CURREP[IOBSEL] IS XINPUT OR .BOTH
					THEN BEGIN
						ERTEXT(31);
						CURREP[IOBSEL] _ XBOTH;
					END
					ELSE CURREP[IOBSEL] _ XOUTPUT;
					SOMETHING _ IOB _ TRUE
				END;
		%REPORT%	MSG(25);
		%BETWEEN%	MSG(25);	
		%CLASSES%	SETFLAG(CLSSEL);
		%SOURCES%	SETFLAG(SORSEL);
		%SEQUENCES%	SETFLAG(SEQSEL);
		%DESTINATIONS%	SETFLAG(DSTSEL);
		TES;
	END;
END;

END ELUDOM; ! END OF PRINT COMMAND MODULE ...