Google
 

Trailing-Edge - PDP-10 Archives - bb-r775e-bm_tops20_ks_upd_5 - sources/edt/chmfinent.bli
There are 11 other files named chmfinent.bli in the archive. Click here to see a list.
 %TITLE 'CHMFINENT - find page and paragraph entities'
MODULE CHMFINENT (				! Find page and paragraph entities
		IDENT = '1-004'			! File: CHMFINENT.BLI Edit: GB1004
		) =
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:
!
!	This module finds the page and paragraph entities.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: Unknown
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 04-Feb-1981.  This module was created by
!	extracting the routine EDT$$FND_ENT  from module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 02-Mar-1981
! 1-003	- Correct description of routine value.  JBS 01-Oct-1981
! 1-004 - Change handling of entities these are now count followed by ptr.  GB 24-Mar-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FND_ENT;				! Search for a page or paragraph entity

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FND_ENT  - find page and paragraph entities'

GLOBAL ROUTINE EDT$$FND_ENT (			! Find page and paragraph entities
	ENT, 					! The entity to search for
	DIR, 					! The direction to search
	INC_DELIM				! Include delimiter in the found string
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine is used to isolate the page and paragraph entities, which
!	are based upon a search string which must be found.
!
! FORMAL PARAMETERS:
!
!  ENT			The entity to search for
!
!  DIR			The direction to search
!
!  INC_DELIM		Include delimiter in the found string
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	1 = found, 0 = not found, 2 = terminated by control C
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$STR_SEACMD,			! Search for a specific string
	EDT$$CS_BOTBUF,				! Move to bottom of buffer
	EDT$$CS_LEFT,				! Move left a character
	EDT$$CS_RIGHT,				! Move right a character
	EDT$$CS_TOP;				! Move to top of buffer

    EXTERNAL
	SEA_BEG;				! Leave search at begining if on

    LOCAL
	ENT_LEN,
	SAVE_BEGIN,
	SUCCEED;

!+
! Temporarily put us in BEGIN mode, so we position to the beginning
! of the entity delimiter.
!-
    SAVE_BEGIN = .SEA_BEG;
    SEA_BEG = 1;
!+
! If searching backward, move back the length of the delimiter before
! starting.
!-

    ENT_LEN = ..ENT;
    IF (.DIR EQL DIR_BACKWARD)
    THEN

	INCR I FROM 0 TO .ENT_LEN DO
	    EDT$$CS_LEFT ();

!+
! Do the search.
!-
    SUCCEED = EDT$$STR_SEACMD (.ENT + 1, .ENT_LEN, 0, .DIR);
!+
! Restore the BEGIN/END parameter.
!-
    SEA_BEG = .SAVE_BEGIN;
!+
! Check to see whether or not it was found.  If not then move
! to the top or bottom depending on the direction.  In this case
! we want to fail if we are already at top or bottom.
!-

    IF (.SUCCEED EQL 0)
    THEN
	BEGIN

	IF (.DIR EQL DIR_BACKWARD)
	THEN
	    BEGIN
	    SUCCEED = EDT$$CS_LEFT ();
	    EDT$$CS_TOP ();
	    END
	ELSE
	    BEGIN
	    SUCCEED = EDT$$CS_RIGHT ();
	    EDT$$CS_BOTBUF ();
	    END;

	END
    ELSE

	IF (.SUCCEED EQL 1)
	THEN

	    IF (.INC_DELIM NEQ 0)
	    THEN 				! include the delimiter.

		INCR I FROM 1 TO .ENT_LEN DO
		    EDT$$CS_RIGHT ();

    RETURN (.SUCCEED);
    END;


END
ELUDOM