Google
 

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

!
!
!
!	THIS IS TRY.BEG   --   USED WITH TRY.RTN AND RESHUF.RTN
!
!

    MACRO SUCCESS=RETURN 1$,
	  FAIL=RETURN 0$;

    BIND
	 GENESIS=0,	! FIRST LON/FON
	 ETERNITY=(-1)^(-1);	! LAST LON/FON

    MACRO NOTEBOUND(TN,LST) = (TN[BNDLSTHDR]_LST) $,
	  MARKTN(TN,TYPE) = (TN[BNDTYP]_TYPE) $;

!	THE FOLLOWING MACRO, FORALLTN, ALLOWS ALL TN'S REPRESENTED
!	ON A (TN-REP) LIST TO BE EASILY PROCESSED IN A UNIFORM
!	MANNER. THE ACTION TO BE PERFORMED ON EACH TN IS DEFINED
!	BY THE 'ACTION' PARAMETER OF THE MACRO.
!
!

    MACRO FORALLTN(Z,ZLST,ACTION)=
	BEGIN
	LOCAL TNREPR ID(Z)R;
	BIND TNLSTHDR ZHEAD=ZLST;
	ID(Z)R_.ZHEAD[RLINK];
	UNTIL .ID(Z)R[RLINK] EQL .ZHEAD[RLINK] DO
	    (Z_.ID(Z)R[TNPTR]; ACTION; ID(Z)R_.ID(Z)R[RLINK])
	END$;

	! NOTE THE FOLLOWING CONVENTIONS FOR CALLING FORALLTN:
	!	Z - IS A VARIABLE MAPPED GTVEC
	!	ZLST - IS AN EXPRESSION WHICH EVALUATES TO THE ADDRESS
	!		OF A LIST HEADER (.ZLST<0,18> IS RLINK)
	!	ACTION - IS AN EXPRESSION TO BE EVALUATED FOR EACH TN
	!		IN THE LIST ZLST.  THE TN MAY BE REFERED TO BY
	!		THE NAME Z.  THE TNREP POINTING TO Z IS ZR.

    MACRO NULLLST(A) = (A)<RIGHTPART>_(A)<LEFTPART>_(A)<0,0> $,
	  ISOPEN(LST) = NOT(EMPTY(LST)) $,
	  OPENREG(Z) = OPENLIST(REGS[(Z)]) $;

    STRUCTURE PLSTSTK[I,J,K,L]=
	CASE .I OF
	  SET
	  (@.PLSTSTK + .J - 1)<0,36>;
	  (@.PLSTSTK+2+@@.PLSTSTK)<.K,.L>;
	  .(.(@.PLSTSTK+2+@@.PLSTSTK)<0,18>)<.K,.L>;
	  .(.(@.PLSTSTK+2+@@.PLSTSTK)<18,18>)<.K,.L>;
	  (@.PLSTSTK+2+.J)<.K,.L>
	  TES;

    EXTERNAL PLSTSTK LOOPSTK:STEMPS:DTEMPS;

    EXTERNAL LON,FON,TNREP,REGS;
    MACRO TOS=1,1,0,36$,
	  BOS=2,1,0,36$,
	  CURD=0,1,0,36$,
	  MAXD=0,2,0,36$,
	  LSELEM(Z)=4,(Z),0,36$;

    STRUCTURE TNLSTHDR[I,J,K,L]=.TNLSTHDR<.K,.L>;

    EXTERNAL TNLSTHDR TNCHAIN:PREFLST:SRLST:ARLST:SLLST;


    MACRO REPFLD(FLD)=2,FLD$;

    MACRO PUSHSTK(STK)=
	BEGIN MAP PLSTSTK STK;
	IF (STK[CURD]_.STK[CURD]+1) GTR .STK[MAXD] THEN STK[MAXD]_.STK[CURD];
	NULLLST(STK[TOS])
	END$;

    MACRO POPSTK(STK)=
	BEGIN MAP PLSTSTK STK;
	RELTNREPLST(STK[TOS]);
	STK[CURD]_.STK[CURD]-1
	END$;


MACRO
	INITREGS = DECR I FROM 5 TO 0 DO
		     (NULLLST(REGS[.I]); OPENREG(.I))$,

	INITSTEMPS = (INITSTK(STEMPS))$,

	INITDYTEMPS = INITSTK(DTEMPS)$;