Google
 

Trailing-Edge - PDP-10 Archives - bb-r775c-bm_tops20_ks_upd_3 - sources/chmsendel.bli
There are 11 other files named chmsendel.bli in the archive. Click here to see a list.
 %TITLE 'CHMSENDEL - find a sentence delimiter'
MODULE CHMSENDEL (				! Find a sentence delimiter
		IDENT = '1-002'			! File: CHMSENDEL.BLI Edit: JBS1002
		) =
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 looks for a sentence delimiter.
!
! 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_SENDLIM  from CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 03-Mar-1981
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FND_SENDLIM;				! Look for a sentence delimiter

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FND_SENDLIM  - find a sentence delimiter'

GLOBAL ROUTINE EDT$$FND_SENDLIM (		! Find a sentence delimiter
	INC					! Include the delimiter in the found string
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Look for a sentence delimiter.  If one is found, move to the right
!	over it.  A sentence delimiter must be a character in the set of
!	delimiters followed by a space or a <CR>.
!
! FORMAL PARAMETERS:
!
!  INC 			indicates whether or not the delimiter should
! 			be included.
!
! IMPLICIT INPUTS:
!
!	US_ENT
!	LN_END
!	LN_PTR
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	A value of 1 is returned if a delimiter is found, 0 otherwise.
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$TST_ENTDELIM,			! Determine if the current character is an entity delimiter
	EDT$$CS_LEFT,				! Move left a character
	EDT$$CS_RIGHT;				! Move right a character

    EXTERNAL
	US_ENT : VECTOR,			! Pointers to user defined entities
	LN_END,				! End of current line pointer
	LN_PTR;				! Current character pointer

!+
! Look for a sentence delimiter.
!-

    IF EDT$$TST_ENTDELIM (.US_ENT [1])
    THEN
	BEGIN
!+
! Move to next character.
!-
	EDT$$CS_RIGHT ();
!+
! If we are at the end of a line, accept the sentence and
! position either in front of or after the delimiter.
!-

	IF CH$PTR_EQL (.LN_PTR, .LN_END)
	THEN
	    BEGIN

	    IF .INC THEN EDT$$CS_RIGHT () ELSE EDT$$CS_LEFT ();

	    RETURN (1);
	    END;

!+
! If the character is a blank, then accept the delimiter.
! If we are to include the delimiter, include all trailing spaces.
!-

	IF (CH$RCHAR (.LN_PTR) EQL %C' ')
	THEN
	    BEGIN

	    IF .INC
	    THEN

		WHILE CH$RCHAR (.LN_PTR) EQL %C' ' DO
		    EDT$$CS_RIGHT ()

	    ELSE
		EDT$$CS_LEFT ();

	    RETURN (1);
	    END;

	EDT$$CS_LEFT ();
	END;

!+
! We are not at a sentence delimiter, return 0;
!-
    RETURN (0);
    END;


END
ELUDOM