Google
 

Trailing-Edge - PDP-10 Archives - BB-R775E-BM - sources/edt/chmgsustr.bli
There are 11 other files named chmgsustr.bli in the archive. Click here to see a list.
 %TITLE 'CHMGSUSTR - isolate the search and replace strings'
MODULE CHMGSUSTR (				! Isolate the search and replace strings
		IDENT = '3-002'			! File: CHMGSUSTR.BLI Edit: CJG3002
		) =
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 isolates the search and replace strings for the
!	SUBSTITUTE command.
!
! 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_SUBSTR  from module CHANGE.BLI.
! 1-002	- Regularize header.  JBS 02-Mar-1981
! 3-001 - Fix up for TPS-20. CJG 7-Oct-1983
! 3-002 - Add code to cope with delimiters of the form '^char'. GB 14-Oct-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FND_SUBSTR : NOVALUE;		! Isolate the search and replace strings for the SUBSTITUTE command

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FND_SUBSTR  - isolate the search and replace strings'

GLOBAL ROUTINE EDT$$FND_SUBSTR 			! Isolate the search and replace strings
    : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine isolates the search and replace strings for the SUBSTITUTE
!	command.
!
!	The length and address of the search and replace strings respectively
!	are placed in the global variables: SEA_LEN ,
!	SEA_PTR , RPL_LEN  and RPL_STR .
!
!	The command line pointer CMD_PTR is left pointing 1 character beyond the
!	command.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	CMD_END
!	CMD_PTR
!
! IMPLICIT OUTPUTS:
!
!	CMD_PTR
!	RPL_STR
!	RPL_LEN
!	SEA_PTR
!	SEA_LEN
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL
	CMD_PTR,					! Pointer into MD_BUF
	CMD_END,				! End of command pointer
	RPL_STR,				! Address of replace string.
	RPL_LEN,				! Length of replace string.
	SEA_PTR,				! Address of search string.
	SEA_LEN;				! Length of search string.

    LOCAL
	C,
	QUOTE,
	R_ADDR,
	R_LEN;

    QUOTE = CH$RCHAR_A (CMD_PTR);
    IF (.QUOTE EQL %C'^') THEN QUOTE = CH$RCHAR_A (CMD_PTR) - %O'100';
    SEA_PTR = .CMD_PTR;
    SEA_LEN = 0;

    WHILE (CH$PTR_GTR (.CMD_END, .CMD_PTR)) DO
	BEGIN
	C = CH$RCHAR_A (CMD_PTR);
	IF (.C EQL %C'^') THEN C = CH$RCHAR_A (CMD_PTR) - %O'100';
	IF (.C EQL .QUOTE) THEN EXITLOOP;
	SEA_LEN = .SEA_LEN + 1;
	END;

    RPL_STR = .CMD_PTR;
    RPL_LEN = 0;

    WHILE (CH$PTR_GTR (.CMD_END, .CMD_PTR)) DO
	BEGIN
	C = CH$RCHAR_A (CMD_PTR);
	IF (.C EQL %C'^') THEN C = CH$RCHAR_A (CMD_PTR) - %O'100';
	IF (.C EQL .QUOTE) THEN EXITLOOP;
	RPL_LEN = .RPL_LEN + 1;
	END;

    END;


END
ELUDOM