Google
 

Trailing-Edge - PDP-10 Archives - BB-R775E-BM - sources/edt/prmaccal.bli
There are 10 other files named prmaccal.bli in the archive. Click here to see a list.
 %TITLE 'PRMACCAL - test for macro token'
MODULE PRMACCAL (				! Test for macro token
		IDENT = '3-001'			! File: PRMACCAL.BLI Edit: CJG3001
		) =
BEGIN
!
!			  COPYRIGHT (c) 1981, 1985 BY
!	      DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
!		ALL RIGHTS RESERVED.
!
! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
! ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE
! INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER
! COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
! OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
! TRANSFERRED.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE
! AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT
! CORPORATION.
!
! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
!

!++
! FACILITY:	EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
!	Test for macro token.
!
! ENVIRONMENT:	TOPS 20 only
!
! AUTHOR: Bob Kushlis, CREATION DATE: December 12, 1978
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 25-Feb-1981.  This module was created by
!	extracting routine MACRO_CALL from module PARSER.
! 1-002	- Regularize headers.  JBS 12-Mar-1981
! 1-003 - Implement new TBCB with macro pointers inside. Remove
!	  references to the MAC_BLOCK.  TMV 6-Aug-81
! 3-001 - Rewrite parts of the module for TOPS20 operation. CJG 11-Mar-83
!--

%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$PA_TSTMACCAL;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

REQUIRE 'EDTSRC:PARLITS';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$PA_TSTMACCAL  - test for macro token'

GLOBAL ROUTINE EDT$$PA_TSTMACCAL 		! Test for macro token
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine checks to see if the current token is the name of a macro,
!	and returns 1 it is, 0 if not.  A list of macro description records is
!	scanned and the current token is compared against each of them.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	ATOM_BUFFER
!	BUF_LST
!	PA_CURCMD
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	1 = current token is a macro
!	0 = current token is not a macro, or the parse stack overflowed
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$PA_NEW_NOD;			! Create a new parse node

    EXTERNAL
	BUF_LST,				! Header for all buffers
	PA_SP,					! Parse stack pointer
	PA_CURCMD : REF NODE_BLOCK,
	PA_CURTOK,				! start of the current token
	PA_CURTOKLEN;				! length of current token

    LOCAL
	C,
	BUF : REF TBCB_BLOCK;

    C = CH$RCHAR (.PA_CURTOK);
    IF ((.C GEQ %C'A') AND (.C LEQ %C'Z')) THEN

	BEGIN
	BUF = .BUF_LST;

	WHILE (.BUF NEQ 0) DO
	    BEGIN

	    IF (CH$EQL (.PA_CURTOKLEN, .PA_CURTOK, .BUF [TBCB_NAME_LEN],
		    CH$PTR (BUF [TBCB_NAME],, BYTE_SIZE)))
		AND (.BUF [TBCB_IS_MAC] EQL 1)
	    THEN
		BEGIN
!+
! We have found a macro corresponding to this token.
!-

		IF (.PA_CURCMD NEQ 0) THEN PA_CURCMD [NEXT_COM] = .PA_SP;
		IF ((PA_CURCMD = EDT$$PA_NEW_NOD (COM_NODE, COM_MAC_CALL))
			EQL 0) THEN RETURN (0);

		PA_CURCMD [RANGE1] = .BUF;
		RETURN (1);
		END;

!+
! Update the pointer to the next buffer which is defined as a macro.
!-
	    BUF = .BUF [TBCB_NEXT_BUF];
	    END;

	END;

    RETURN (0);
    END;


END
ELUDOM