Google
 

Trailing-Edge - PDP-10 Archives - bb-r775c-bm_tops20_ks_upd_3 - sources/chmendwrd.bli
There are 11 other files named chmendwrd.bli in the archive. Click here to see a list.
 %TITLE 'CHMENDWRD - find the end of a word'
MODULE CHMENDWRD (				! Find the end of a word
		IDENT = '1-004'			! File: CHMENDWRD.BLI Edit: STS1004
		) =
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 end of the word entity.
!
! 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_EWD  from module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 27-Feb-1981
! 1-003	- Fix module name.  JBS 02-Mar-1981
! 1-004 - Add handling for new type of word. STS 23-Oct-1981
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FND_EWD;				! Find the end of a word

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FND_EWD  - find the end of a word'

GLOBAL ROUTINE EDT$$FND_EWD 			! Find the end of a word
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Find the end of a word.
!
!	The number of characters between the cursor and the end of the word
!	is returned.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	US_ENT
!	LN_BUF
!	WRDTYP
!	LN_PTR
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE
!
!	The number of characters between the cursor and the end of the word.
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

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

    EXTERNAL
	US_ENT : VECTOR,		! Pointers to user defined entities
	LN_BUF,				! Current line buffer
	WRDTYP,				! indicates whether delimiters are words
	LN_PTR;				! Current character pointer

    LOCAL
	SIZE;

    SIZE = 0;
!+
! Scan up to a delimiter.
!-

    WHILE ( NOT EDT$$TST_ENTDELIM (.US_ENT [0])) DO
	BEGIN

	IF NOT EDT$$CS_RIGHT () THEN EXITLOOP;

	SIZE = .SIZE + 1;
	END;

!+
! If the delimiter was a space, or there were no characters before the
! delimiter, then scan past all trailing spaces (but do not cross a line).
!-

    IF (.WRDTYP EQL DELIMITED ) THEN
	BEGIN
	IF ((.SIZE EQL 0) OR (CH$RCHAR (.LN_PTR) EQL %C' '))
	THEN

	    DO
		BEGIN
		EDT$$CS_RIGHT ();
		SIZE = .SIZE + 1;
		END
	    UNTIL (CH$PTR_EQL (.LN_PTR, CH$PTR (LN_BUF,, BYTE_SIZE)) OR
		(CH$RCHAR (.LN_PTR) NEQ %C' '));
	END
    ELSE
!
! delimiters are not considered words so pass over any delimiters
!
	BEGIN
	IF (.SIZE EQL 0) OR (EDT$$TST_ENTDELIM(.US_ENT[0]))
	THEN

	DO
	    BEGIN
	    IF NOT EDT$$CS_RIGHT () THEN EXITLOOP;
	    SIZE = .SIZE + 1;
	    END
	UNTIL (NOT EDT$$TST_ENTDELIM(.US_ENT[0]));
    END;

    RETURN (.SIZE);
    END;


END
ELUDOM