Trailing-Edge
-
PDP-10 Archives
-
bb-r775e-bm_tops20_ks_upd_5
-
sources/edt/chmbegwrd.bli
There are 11 other files named chmbegwrd.bli in the archive. Click here to see a list.
%TITLE 'CHMBEGWRD - search for beginning of word'
MODULE CHMBEGWRD ( ! Search for beginning of word
IDENT = '1-005' ! File: CHMBEGWRD.BLI Edit: STS1005
) =
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 moves backward to the beginning of a word.
!
! 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_BWD 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 of new word type. STS 23-Oct-1981
! 1-005 - Return if we're at the beginning of the buffer. STS 21-Jun-1982
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$FND_BWD; ! Move backwards to the beginning of a word
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
!OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$FND_BWD - search for the beginning of a word'
GLOBAL ROUTINE EDT$$FND_BWD ( ! Search for the beginning of a word
L_FLAG ! 1 = stop at start of line
) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Move backwards to the beginning of a word.
!
! FORMAL PARAMETERS:
!
! L_FLAG 1 = do not go beyond the beginning of a line
!
! IMPLICIT INPUTS:
!
! US_ENT
! LN_BUF
! WRDTYP
! LN_PTR
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! The length of the word
!
! 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_BUF, ! Current line buffer
WRDTYP, ! indicate whether or not to include delimiters
LN_PTR; ! Current character pointer
LOCAL
SIZE;
SIZE = 0;
!+
! Go past all spaces to the left first. If nodelimiters set, also go past
! all delimiters.
!-
IF .WRDTYP EQL NOT_DELIMITED
THEN
WHILE (EDT$$TST_ENTDELIM(.US_ENT[0]))DO
IF EDT$$CS_LEFT() THEN SIZE = .SIZE + 1 ELSE RETURN (.SIZE)
ELSE
WHILE (CH$RCHAR (.LN_PTR) EQL %C' ') DO
IF EDT$$CS_LEFT () THEN SIZE = .SIZE + 1 ELSE RETURN (.SIZE);
!+
! Keep moving left until we hit a terminator or beginning of file.
!-
WHILE ( NOT EDT$$TST_ENTDELIM (.US_ENT [0])) DO
BEGIN
!+
! If L_FLAG is 1, do not go beyond the beginning of line.
!-
IF ((.L_FLAG EQL 1) AND CH$PTR_EQL (.LN_PTR, CH$PTR (LN_BUF,, BYTE_SIZE)))
THEN EXITLOOP;
!+
! Do not go beyond the beginning of file.
!-
IF ( NOT EDT$$CS_LEFT ()) THEN EXITLOOP;
!+
! Continue search.
!-
SIZE = .SIZE + 1;
END;
!+
! If we moved across any characters before finding a delimiter, then do
! not include the delimiter in the word, otherwise, the word is the delimiter
! character.
!-
IF ((.SIZE GTR 0) AND EDT$$TST_ENTDELIM (.US_ENT [0]))
THEN
BEGIN
SIZE = .SIZE - 1;
EDT$$CS_RIGHT ();
END;
RETURN (.SIZE);
END;
END
ELUDOM