Google
 

Trailing-Edge - PDP-10 Archives - BB-4157D-BM - sources/sta2.bli
There are 26 other files named sta2.bli in the archive. Click here to see a list.


!THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
!  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.

!COPYRIGHT (C) 1972,1977 BY DIGITAL EQUIPMENT CORPORATION
!AUTHOR: F.J. INFANTE, D. B. TOLMAN/DCE/SJW
MODULE STA2(RESERVE(0,1,2,3),SREG=#17,FREG=#16,VREG=#15,DREGS=4,GLOROUTINES)=
BEGIN

!	REQUIRES FTTENX.REQ, LEXNAM, FIRST, TABLES, META72, ASHELP

REQUIRE  FTTENX.REQ;
SWITCHES NOLIST;
REQUIRE LEXNAM.BLI;
REQUIRE FIRST.BLI;
REQUIRE TABLES.BLI;
REQUIRE META72.BLI;
REQUIRE ASHELP.BLI;
SWITCHES LIST;

GLOBAL BIND STA2V = 5^24 + 1^18 + 45;	!VERSION DATE: 7-MAR-77

%(
REVISION HISTORY

36	-----	-----	ADD THE INCLUDE STATEMENT SEMANTICS ROUTINE

37	-----	-----	ALLOW LITSTRINGS IN THE PARAMETER STATEMENT

38	-----	-----	FIX REAL*8 X*4  SO IT WORKS

			ALLOW SIGNED CONSTANTS IN THE PARAMETER STATEMENT
39	-----	-----	THE "CLEVER" WAY OF DEALING WITH THE LOOKUP
			SKIP RETURN WAS OPTIMIZED AWAY BY 5(122)
			SO WE MUST NOT BE SO CLEVER THIS TIME

40	-----	-----	FIX UP INCLUDE A LITTLE
41	320	16787	CATCH COMMON STATEMENTS LIKE /X/A(5)B(5) AS ERRORS
42	402	18917	RESTORE FLAGS CORRECTLY AFTER INCLUDE FILE
43	467	VER5	REQUIRE FTTENX.REQ
44	533	21796	FIX OUTPUT BUFFER PTR FOR INCLUDE FILE TO BE 0.
45	540	22096	ICE CAUSED BY BAD COMMON DECLARATION
)%

GLOBAL	ACTLDATYPE;	!SET TO THE CODE OF THE SPECIFIC DATA TYPE IDENTIFIER
			!IN ORDER TO DIFFERENTIATE BETWEEN REAL*8 AND
			!DOUBLEPRECISION  WHEN DOING THE SIZE MODIFIER
			!OVERRIDE
			!USED IN ASTER  AND SET IN TYPDECLARE

!THE NUMBER IN COMMENT'S IS THE STATEMENTS LOCATION
!IN THE HASH TABLE .
FORWARD
% 16%	SUBRSTA,	!SUBROUTINE 
% 19%	INTESTA,	!INTEGER 
% 29%	LOGISTA,	!LOGICAL - P.30
% 51%	DIMESTA,	!DIMENSION 
% 56%	DOUBSTA,	!DOUBLEPRECISION - P.31
% 64%	ENTRSTA,	!ENTRY 
% 75%	BLOCSTA,	!BLOCKDATA - P.38
% 81%	FUNCSTA,	!FUNCTION 
% 86%	REALSTA,	!REAL - P.29
% 93%	COMMSTA,	!COMMON 
% 96%	COMPSTA,	!COMPLEX - P.32
%121%	PROGSTA,	!PROGRAM 
	PARASTA;	!PARAMETER STATEMENT
	GLOBAL ROUTINE
INCLSTA   =
BEGIN	% INCLUDE STATEMENT%

	GLOBAL SVFLG2;
	EXTERNAL EOPSVPOOL,POOL,EOPRESTORE;
	EXTERNAL LEXICAL,GSTCSCAN,GSTSSCAN,LOOK4CHAR,LEXEMEGEN,GSTEOP;
	BIND EOF = #200;
	MACHOP  LOOKUP = #076, OPEN = #050, JFCL = #255;
	OWN TMP;
	MACRO  DEFAULT =  TMP<LEFT>$,
		NOLST =  TMP<RIGHT>$;
	EXTERNAL SAVFLG;
	MACRO	PROJNUM = DIRECTORY(ICL)<LEFT>$,
		PROGNUM = DIRECTORY(ICL)<RIGHT>$,
		ERRORR(X) = RETURN FATLEX(X<0,0>)$;

	FORWARD
		PPN,PPNUM,SCANFIL,FILSP,SWITCH;

ROUTINE  FILSP  =
BEGIN IF NOT FTTENEX THEN BEGIN
	REGISTER R;

	%GET DEVICE OR FILE NAME%
	WHILE 1 DO
	BEGIN
		EXTERNAL  E122;

		IF (R_SCANFIL())  EQL  0  THEN RETURN 0;
		LOOK4CHAR _ ":";
		IF LEXICAL(.GSTCSCAN)  EQL  0
		THEN
		BEGIN	%FILE NAME%
			EXITLOOP
		END
		ELSE
		BEGIN	%DEVICE NAME%
			IF .DEVICE(ICL)  NEQ  0
			THEN	RETURN  FATLEX( SIXBIT'DEVICE', E122<0,0>);
			DEVICE(ICL)  _ .R
		END
	END	%LOOP%  ;

	%STORE FILE NAME%
	IF .FILENAME(ICL)  NEQ  0
	THEN	RETURN  FATLEX( SIXBIT'FILE', E122<0,0>);
	FILENAME(ICL) _ .R;

	LOOK4CHAR _ ".";
	IF LEXICAL(.GSTCSCAN)  EQL  0
	THEN
	BEGIN
		%DEFAULT%
		DEFAULT _ 1;
		(FILENAME(ICL)+1)  _ SIXBIT'FOR';
	END
	ELSE
	BEGIN
		DEFAULT _ 0;
		(FILENAME(ICL)+1)  _ SCANFIL()
	END;
	RETURN 1
END END;


ROUTINE  PPN  =
BEGIN IF NOT FTTENEX THEN BEGIN	%PICK UP THE PPN%

	LOOK4CHAR _ "[";
	IF LEXICAL (.GSTCSCAN) EQL  0
	THEN	( DIRECTORY(ICL) _ 0;
		  RETURN  0	!NONE
		);

	IF (PROJNUM _ PPNUM() )  EQL 0
	THEN  RETURN -1;	!ERROR
	LOOK4CHAR _ ",";
	IF LEXICAL(.GSTCSCAN)  EQL  0
	THEN	RETURN -1;	!ERROR
	IF ( PROGNUM _ PPNUM() )  EQL  0
	THEN RETURN -1;	!ERROR
	LOOK4CHAR _ "]";
	IF LEXICAL(.GSTCSCAN) EQL  0
	THEN RETURN -1;	!ERROR

	RETURN 1	!GOT ONE
END END;

ROUTINE  PPNUM  =
BEGIN IF NOT FTTENEX THEN BEGIN	%GET PPN%
	REGISTER NUM,C;
	NUM _ 0;
	LOOK4CHAR _ "?D";
	UNTIL  ( C _ LEXICAL(.GSTCSCAN) ) EQL  0
	DO	NUM _ .NUM*8 + .C -"0";
	RETURN .NUM
END END;

ROUTINE  SCANFIL  =
BEGIN IF NOT FTTENEX THEN BEGIN
	%GET FILE NAME%
	REGISTER SIX,C;

	DECR SHIFT FROM  30 TO 0 BY 6
	DO
	BEGIN
		MACHOP  ADDI=#271;
		SIX _ .SIX^6;
		LOOK4CHAR _ "?L";
		IF ( C _ LEXICAL(.GSTCSCAN) )  EQL 0
		THEN
		BEGIN
			LOOK4CHAR _ "?D";
			IF ( C_ LEXICAL(.GSTCSCAN))  EQL  0
			THEN	RETURN  SIX_.SIX^.SHIFT;
		END;
		ADDI(SIX,-" ",C)
	END;
	WHILE 1 DO
	BEGIN	%SKIP ANY MORE CHARACTERS%
		LOOK4CHAR _ "?L";
		IF LEXICAL(.GSTCSCAN)  EQL  0
		THEN
		BEGIN
			LOOK4CHAR _ "?D";
			IF LEXICAL(.GSTCSCAN) EQL 0
			THEN  RETURN .SIX
		END
	END
END END;


ROUTINE   SWITCH =
BEGIN IF NOT FTTENEX THEN BEGIN
	% GET /NOLIST %
	LOOK4CHAR _ "/";
	IF  LEXICAL(.GSTCSCAN) EQL 0
	THEN RETURN 0;	!NONE
	LOOK4CHAR _ PLIT'NOLIST'<36,7>;
	IF LEXICAL(.GSTSSCAN)  EQL  0
	THEN  RETURN -1;	!ERROR
	NOLST _ 1;
	RETURN  1
END END;



	%LETS DO IT%

	IF .FLGREG<ININCLUD>  THEN  RETURN FATLEX(E120<0,0>);

	IF NOT FTTENEX THEN
	BEGIN


	FILENAME(ICL)  _ 0;
	TMP _ 0;
	DIRECTORY(ICL) _ 0;
	DEVICE(ICL) _ 0;

	%GET THE INITIAL ' %
	LOOK4CHAR  _ "'";
	IF LEXICAL(.GSTCSCAN)  EQL  0
	THEN
	BEGIN
		EXTERNAL LEXNAME;
		LEXEMEGEN();
		RETURN FATLEX(PLIT'''',.LEXNAME[.VREG<LEFT>],E0<0,0>);
	END;

	BEGIN
		LABEL  SPEC,LOOP,LOK,CHK;

		SPEC:BEGIN
			WHILE 1 DO
			BEGIN	%GET THE SPEC%
				LOOP:BEGIN
					IF  .FILENAME(ICL) EQL  0 OR .DEVICE(ICL) EQL 0
					THEN	IF  FILSP()  EQL  1
						THEN  LEAVE LOOP	!FOUND ONE
						ELSE	IF .VREG LSS 0 
							THEN RETURN .VREG;
					IF .DIRECTORY(ICL)  EQL  0
					THEN	IF  PPN() EQL  1
						THEN	LEAVE LOOP
						ELSE	IF .VREG  LSS 0
							THEN	ERRORR(E117);

					IF SWITCH()  LSS 0
					THEN ERRORR(E116)
					ELSE	IF .VREG  EQL  1
						THEN LEAVE LOOP;

					LEAVE SPEC	!NOTHING ELSE RECOGNIZABLE
				END %LOOP%
			END %WHILE 1%
		END ;	%SPEC%

		%GET THE FINAL ' %
		LOOK4CHAR  _ "'";
		IF LEXICAL(.GSTCSCAN)  EQL  0
		THEN
		BEGIN
			EXTERNAL LEXNAME;
			LEXEMEGEN();
			RETURN FATLEX(PLIT'''',.LEXNAME[.VREG<LEFT>],E0<0,0>);
		END;
			
		IF LEXEMEGEN()  NEQ  EOSLEX^18
		THEN RETURN  NOEOSERRV;

		%NOW LETS TRY AND OPEN THE FILE%
		IF .DEVICE(ICL)  EQL  0
		  THEN DEVICE(ICL) _ SIXBIT'DSK';
		BEGIN	%MAKE SURE THAT THE DEVICE IS A DISK%
			MACHOP  DEVCHR = #047;
			EXTERNAL  E124;
			VREG _ .DEVICE(ICL);
			DEVCHR ( VREG,4);
			IF NOT .VREG<34,1>  %DISK DEVICE%
			THEN	RETURN  FATLERR(.ISN,E124<0,0>)
		END;

		IF .FILENAME(ICL)  EQL  0
		THEN	ERRORR(E118);	!NO FILE NAME

		STATUS(ICL) _ 0;	!ASCII
!**;[533], INCLST @3684, DCE, 24-JAN-77
!**;[533], BE SURE THAT THE OUTPUT PTR IS ZERO, NOT 4400 AS IT WAS
%[533]%		BUFFERS(ICL) _ BUFHDR(ICL)<0,0>;

		OPEN  (ICL, STATUS(ICL));
		JFCL(0,0);

		LOK:BEGIN
		WHILE 1 DO
		BEGIN
	
			VREG _ -1;
			LOOKUP(ICL,FILENAME(ICL));
			VREG _ 0;	!FILE NOT FOUND
			IF .VREG  NEQ 0 THEN LEAVE LOK;	!OK FOUND THE FILE

			%TRY WITHOUT .FOR %
			IF .DEFAULT  NEQ 0
			THEN
			BEGIN
				EXTENSION(ICL) _ 0;
				DEFAULT _ 0
			END
			ELSE	ERRORR(E119)
		END	%WHILE 1%
		END	%LOK%
	END;

	END
	ELSE
	BEGIN	%FTTENEX%

		EXTERNAL OPNICL,E138;
		GLOBAL  ICLPTR;		!FILESPEC POINTER
		LOCAL BASE LIT;
		EXTERNAL LITPOINTER;
		LOCAL	LITPNTSAV,VAL;

		LITPNTSAV _ .LITPOINTER;	!SAVE SO LITERAL CAN BE DELETED

		%PICK UP THE LITSTRING SPEC%
		LIT _ LEXICAL(.GSTLEXEME);
		IF .LIT<LEFT>  NEQ  LITSTRING
		THEN	FATLEX(.LEXNAM[LITSTRING],.LEXNAM[.LIT<LEFT>],E0<0,0>);

		%CHECK FOR EOS%
		IF LEXICAL(.GSTLEXEME ) NEQ  EOSLEX^18
		THEN	RETURN  NOEOSERRV;

		ICLPTR _ ( LIT[LIT1] )<36,7>;		!SPEC POINTER
		VAL _ OPNICL();	!OPEN THE FILE

		IF .VAL  NEQ 0	!WAS THERE AN ERROR
		THEN	RETURN  FATLERR(.VAL,.ISN,E138<0,0>);	
				%MESSAGE POINTER GIVEN IN VREG%

		%OK GOT IT NOW LOOK FOR  /NOLIST%
		IF ..ICLPTR  EQL  "/"
		THEN
		BEGIN
			%SEE WHAT THE SWITCH IS%
			LOCAL PNT;
			PNT_ (PLIT'NOLIST')<36,7>;
			UNTIL  (VREG _ SCANI(PNT))  EQL  0
			DO 
			BEGIN
				IF .VREG  NEQ  SCANI(ICLPTR)
				THEN	(  EXTERNAL CLOICL;
					   FATLEX(E116<0,0>);
					   CLOICL();
					   RETURN
					)
			END;
			NOLST _ -1
		END
		ELSE
			NOLST _ 0;

		%FREE UP THE LITERAL%
		SAVSPACE( .LIT[LITSIZ]+2 , @LIT );
		LITPOINTER _ .LITPNTSAV;
		IF .LITPOINTER<RIGHT> NEQ 0 THEN (@LITPOINTER)<RIGHT> _ 0;

	END;	%FTTENEX%



	%OK WE GOT THE FILE%
	%SAVE THE CURRENT BUFFERS%
	LEXICAL (.GSTEOP);	!TERMINATE CURRENT STATEMENT
	EOPSVPOOL();

	%SAVE THE INFO%
	BEGIN
		GLOBAL  SVINCL[8];
		EXTERNAL LINENO;
		EXTERNAL  EOPSAVE,CURPOOLEND,CURPTR,STLPTR,STPTR,LINEPTR,SEQLAST,LINELINE,CHARPOS;

		SVINCL[0] _ .EOPSAVE;
		SVINCL[1] _ .CURPOOLEND;
		SVINCL[2] _ .CURPTR;
		SVINCL[3] _ .STLPTR;
		SVINCL[4] _ .STPTR;
		SVINCL[5] _ .LINEPTR;
		IF .SEQLAST  NEQ  0
		THEN	SVINCL[6] _ .LINELINE	!LINESEQUENCE NUMBER
		ELSE	SVINCL[6] _ 0;
		SVINCL[7] _ .CHARPOS;
		IF .CHARPOS  NEQ 72
		THEN	LINELINE _ .LINELINE+1;	!MULTIPLE STATEMENTS ON LINE
		SAVFLG _ .FLGREG<0,36>;
		FLGREG<ININCLUD> _ 1;
		FLGREG<EOCS> _ 1;
		IF .NOLST THEN  FLGREG<LISTING> _ 0;
		SVFLG2 _ .FLAGS2;
		FLAGS2<TTYINPUT> _ 0;

		%SET LINENO[1] SO THAT AN * WILL APPEAR NEXT TO THE
			INCLUDED CODES LINE NUMBER %
		LINENO[1] _ '*	';

		CURPOOLEND _ POOL<0,0>;
		IF EOPRESTORE()  EQL  EOF
		THEN
		BEGIN
			EXTERNAL  POSTINCL;
			POSTINCL();	!RESTORE
		END
	END
END;


	GLOBAL ROUTINE
POSTINCL   =
BEGIN
	%RESTORE THE WORLD AFTER AN INCLUDED FILE %
	EXTERNAL  SVINCL[8];
	EXTERNAL  EOPSAVE,CURPOOLEND,CURPTR,STLPTR,STPTR,LINEPTR,SEQLAST,LINELINE;
	EXTERNAL  EOPRESTORE,SVFLG2;

	EXTERNAL LINENO;
	EXTERNAL SAVFLG,GSTEOP,LEXICAL,CHARPOS;
	MACHOP  CLOSE = #070;

	% CLEAN UP LAST LINE%
	LEXICAL(.GSTEOP);

	IF NOT FTTENEX 
	THEN
		CLOSE (ICL,0)	!CLOSE THE FILE
	ELSE
		( EXTERNAL CLOICL;
		  CLOICL();
		);


	EOPSAVE _ .SVINCL[0];
	CURPOOLEND  _ .SVINCL[1];
	CURPTR _ .SVINCL[2];
	STLPTR _ .SVINCL[3];
	STPTR _ .SVINCL[4];
	LINEPTR _ .SVINCL[5];
	IF .SVINCL[6] NEQ  0
	THEN	LINELINE _ .SVINCL[6];	!LINESEQUENCE NUMBER
	CHARPOS _ .SVINCL[7];

	SEQLAST  _ 1;	!SO NO ONE WILL MESS WITH THE LINELINE
	LINENO[1] _ '	';	!RESET LINENO TO TAB

	!**;[402], POSTINCL @3850, DCE, 13-MAY-76
	!**;[402], KEEP VALUES OF SOME FLAGS WHICH MAY HAVE CHANGED
	!**;[402], DURING PROCESSING OF THE INCLUDE FILE, AND WHOSE NEW
	!**;[402], VALUES WE REALLY WANT TO KEEP!

	SAVFLG<BTTMSTFL> _ .FLGREG<BTTMSTFL>; ![402] IF 16 CLOBBERED
	SAVFLG<WARNGERR> _ .FLGREG<WARNGERR>; ![402] WARNINGS GIVEN
	SAVFLG<FATALERR> _ .FLGREG<FATALERR>; ![402] FATAL ERRORS GIVEN
	SAVFLG<LABLDUM> _ .FLGREG<LABLDUM>; ![402] LABELS PASSED AS ARGS
	FLGREG<0,36> _ .SAVFLG;
	FLAGS2 _ .SVFLG2;
	EOPRESTORE();	!RESTORE THE BUFFERS

END;


	GLOBAL ROUTINE
ASTER (TYPE)   =
BEGIN
	% THIS ROUTINE WILL SCAN FOR THE *DIGIT CONSTRUCT FOLLOWING THE
	  DATA TYPE NAME IN TYPE OR IMPLICIT OR FUNCTION STATEMENTS.

	  THE PARAMETER TYPE IS BASED UPON THE DATA TYPE NAME.
	  THIS ROUTINE WILL RETURN AS ITS VALUE:
		1. THE AMMENDED TYPE IF A VALID * CONSTRUCT WAS FOUND
		2. TYPE IF NO * CONSTRUCT WAS FOUND
		3. -1 IF THERE WAS SOME ERROR IN THE * CONSTRUCT

	%

	EXTERNAL LSAVE,LEXL;
	MACRO  ERR50(X)  =  FATLEX( .TYPDIG, X<0,0>, E50<0,0> ) $,
		ERR24(X) =  WARNLEX ( X<0,0>, .TYPDIG, E24<0,0> )  $;
	REG