Google
 

Trailing-Edge - PDP-10 Archives - AP-4172F-BM - 3a-sources/ma1n.bli
There are 18 other files named ma1n.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,1973,1974,1977,1978 DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. 01754
!FILENAME:	H1MACR.BLI
!DATE:		22 JUNE 73	MGM/FLD

! REVISION HISTORY::
!  1-17-78 ROUTINE BODY IS MODIFIED SO THAT '.' IS CARRIED INSIDE
!	    MACRO BODY AS IT IS IF '?' NAME TYPE.IE.
!	    MACRO XX=?X.Y $; 
!
!  12-21-77 ROUTINE BODY IS MODIFIED TO ALLOW SPECIAL NAMES WITH 
!	    ? MARK IN FRONT AS NAMES IN MACRO BODY. THESE NAMES CAN HAVE
!	    $,.,% ARE PART OF NAMES. EX: MACRO X=?A$$B%%Y $;
!
!  9-19-77  ROUTINE BODY IS MODIFIED TO FIX BUGS#38,NEW FEATURES
!           ADDED TO 7C(223).
!
%3.2%	GLOBAL BIND H1MAV=2;	!MODULE VERSION NUMBER





%               MACRO SOURCE FILE FOR BLISS-10/11
               -------------------------------------


  THIS IMPLEMENTS THE SIMPLE MACROS AS SPECIFIED IN THE BLISS-10
  AND BLISS-11 DESCRIPTIONS.

  GLOBAL VARIABLES INTRODUCED BY THIS MODULE ARE:

     MCBUFF(3) - TOP OF PUSHDOWN OF MACRO EXPANSIONS (3 WORDS)
     STEMC     - SYMBOL TABLE INDEX OF CURRENT MACRO
     FBLKMC    - POINTER TO FORMAL BLOCK FOR CURRENT MACRO
     BODYMC    - POINTER TO CURRENT POSITION IN BODY OF CURRENT MACRO
     POSIT     - COUNTER IN CURRENT CELL OF CURRENT MACRO BODY
     FORGET    - POINTER TO STENTRY FOR MACRO INUSEBIT CLEARING

%

  BIND EOL=#15;

    FORWARD SSMACRO, GETFORMALS, BODY, ISFORMAL;
GLOBAL ROUTINE SMACRO =

%WINDOW IN:  ( XXX , "MACRO" , <NAME> , XXX )
 WINDOW OUT: ( XXX , ";" , XXX , XXX )
%
BEGIN
%5.200.37%	EXTERNAL EOLCONTEXT;LOCAL OLDCONTEXT;
%5.200.37%	OLDCONTEXT_.EOLCONTEXT;EOLCONTEXT_"M";
   DO SSMACRO() WHILE .FUTDEL<LEFTF> EQL HCOMMA;
   IF .FUTDEL<LEFTF> NEQ HSEMCOL THEN
      ERROR(.NFUTDEL,#100);
%5.200.37%	EOLCONTEXT_.OLDCONTEXT;
%5.200.20%   HRUND()		! WAS WRUND(1)
END;

% SSMACRO PROCESSES EACH MACRO IN THE LIST.
  THE MACRO NAME, IF LEGAL, IS DECLARED AT THE CURRENT BLOCKLEVEL.
  THEN THE LEVEL IS BUMPED AND THE FORMALS COLLECTED.
  NEXT THE BODY IS COLLECTED AS A CHARACTER STRING WITH THE
  FORMAL PARAMETERS REPLACED BY A SPECIAL CHARACTER PAIR (#176
  SAYS A FORMAL FOLLOWS, AND THE NEXT GIVES THE FORMAL NUMBER).
  AT MOST 31 FORMAL PARAMETERS ARE ALLOWED.

 WINDOW IN:  ( XXX , "MACRO" , <NAME> , XXX )
     OR      ( XXX , XXX , XXX , "," )
 WINDOW OUT: ( XXX , XXX , XXX , "," OR ";" )
%

ROUTINE SSMACRO =

BEGIN
   LOCAL T;
%2.15%   IF .MCBUFF NEQ 0 THEN
%2.15%		BEGIN
%2.15%		  WARNEM(.NDEL,#174);
%2.15%		  UNTIL .CHAR EQL "$" DO SKAN(#10);
%2.15%		  WRUND(1);
%2.15%		  RETURN
%2.15%		END;
   IF .FUTDEL<LEFTF> EQL HCOMMA THEN WRUND(1);
   IF NOT DECSYN(STEMC,MACROT) THEN RETURN;
   BLOCKLEVEL_.BLOCKLEVEL+1;
   GETFORMALS();
   ST[.STEMC,1]<NEXTF> _ .FBLKMC;
   BODYMC<0,18>_ST[.FBLKMC,0]; !INITIALIZE TO COLLECT BODY
   POSITC_TOOBIG;  !READY TO OVERFLOW
   BODY();

   BLOCKLEVEL_.BLOCKLEVEL-1;
   BLOCKPURGE(.BLOCKLEVEL)

END;
%     GETFORMALS---

  COLLECT THE FORMAL PARAMETERS AND SET UP THE FORMAL
  BLOCK FOR THIS MACRO. THIS BLOCK CONSISTS OF:
     WORD 0:   LEFT - NUMBER OF FORMALS: N
               RIGHT - INDEX OF BODY STRING
     WORD 1 THRU WORD N:
               SYMBOL TABLE INDEX FOR RESPECTIVE FORMAL ID

  (THE FORMAL BLOCK WILL BE USED DIFFERENTLY AT MACRO EXPANSION TIME.)

 WINDOW IN:  ( XXX , XXX , XXX , "(" OR "=" )
 WINDOW OUT: ( XXX , XXX , XXX , "=" )
%

ROUTINE GETFORMALS =

BEGIN
   LOCAL SAVE[32],T,S;

   T_0;
   IF .FUTDEL<LEFTF> EQL HPAROPEN THEN
      (DO(WRUND(1);
         IF (.FUTDEL<LEFTF> EQL HCOMMA OR .FUTDEL<LEFTF> EQL HROCLO) AND .REALFS NEQ 0
             AND .T LSS 31 THEN
           (T_.T+1;
            SAVE[.T]_.REALFS
           )
         ELSE
           (ERROR(.NFUTSYM,#173); RETURN )
        )
      WHILE .FUTDEL<LEFTF> EQL HCOMMA;
      IF .T GTR 31 THEN WARNEM(.NFUTDEL,#172);
      IF .FUTDEL<LEFTF> NEQ HROCLO THEN ERROR(.NFUTDEL,#76);
      WRUND(0)
     );
   BEGIN
     BIND VECTOR THEACTS=ST[FBLKMC_GETSPACE(1+.T^(-1)),0];;
     THEACTS[0]<LEFTF>_.T;
     INCR I FROM 1 TO .T DO THEACTS[.I]_.SAVE[.I];
   END;

END;
%   BODY---

  COLLECT THE BODY OF THE ROUTINE.
  THE INPUT CHAR STREAM IS COPIED UNTIL AN INITIAL LETTER
  IS DETECTED. AN ATOM IS COLLECTED AND COMPARED WITH
  THE FORMALS. IF A FORMAL, THEN THE CHAR PAIR (#176,#NUMBER)
  GOES INTO THE BODY. ELSE THE IDENTIFIER ITSELF GOES INTO THE
  BODY. THE FIRST DOLLAR SIGN TERMINATES THE DEFINITION.

 WINDOW IN:  ( XXX , XXX , XXX , "=" )
 WINDOW OUT: ( XXX , XXX , XXX , "," OR ";" )
%

ROUTINE BODY =

BEGIN
	LOCAL ESCAPE;		%1-17-78%
   LOCAL T; MACHOP ILDB=#134;
	%5.200.6% GLOBAL QUOTESEEN;		! M205.1
   REGISTER R;
	%5.200.6% QUOTESEEN_0;		!WE BEGIN OUTSIDE A QUOTED STRING
   IF .FUTDEL<LEFTF> NEQ HEQL  THEN
      (ERRO