Google
 

Trailing-Edge - PDP-10 Archives - tops20-v7-ft-dist1-clock - 7-sources/chminschr.bli
There are 11 other files named chminschr.bli in the archive. Click here to see a list.
 %TITLE 'CHMINSCHR - insert a string of characters'
MODULE CHMINSCHR (				! Insert a string of characters
		IDENT = '3-002'			! File: CHMINSCHR.BLI Edit: GB3002
		) =
BEGIN
!COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1981, 1988.  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 THAT IS NOT SUPPLIED BY DIGITAL.
!
!
!++
! FACILITY:	EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
!	This module does a (change mode) insertion of a string of
!	characters at the current position in the text.
!
! 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 INSERT_CHARS from the module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 02-Mar-1981
! 1-003	- Change SPLIT_LINE to EDT$$SPLT_LNINS .  JBS 30-Mar-1981
! 1-004	- Fix up some comments.  JBS 02-Jun-1981
! 1-005	- Use new message codes.  JBS 04-Aug-1981
! 1-006	- New screen update logic.  JBS 13-Sep-1982
! 1-007 - Replace call to edt$$tst_eob. STS 22-Sep-1982
! 1-008 - Add a parameter to the split line routine.  SMB 16-Nov-1982
! 1-009 - Change the parameter to split line routine.  SMB 17-Nov-1982
! 1-010	- Change the call to EDT$$MRK_LNCHG.  JBS 27-Dec-1982
! 3-001 - Change CPY_MEM to CPY_STR.  GB 1-Mar-1983
! 3-002 - Add updates from V3 source kit.  GB 27-Apr-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$INS_STR;				! Insert a string of characters at the current position

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$INS_STR  - insert a string of characters'

GLOBAL ROUTINE EDT$$INS_STR (			! Insert a string of characters
	S, 					! Address of string to insert
	L					! Length of string to insert
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Insert a string of characters at the current position in the text.
!
! FORMAL PARAMETERS:
!
!  S 			a pointer to the string
!  L 			the length of the string
!
! IMPLICIT INPUTS:
!
!	SEL_POS
!	LN_END
!	LN_LEN
!	LN_PTR
!	LN_BUF
!
! IMPLICIT OUTPUTS:
!
!	SEL_POS
!	LN_PTR
!
! ROUTINE VALUE:
!
!	1 = success, 0 = error (line overflow)
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$MSG_BELL : NOVALUE,		! Output a message to the terminal with a warning bell
	EDT$$MRK_LNCHG : NOVALUE,		! Track line update
	EDT$$CS_UP,				! Move up a line
	EDT$$UPD_LNLEN : NOVALUE,		! Update the length of the current line
	EDT$$SEL_RNGPOS,			! Compare the select line with the current line
	EDT$$SPLT_LNINS : NOVALUE;		! Split a line of text at the current cursor position
    EXTERNAL
	SEL_POS,				! select position.
	LN_END,				! End of current line pointer
	LN_LEN,				! Length of current line
	WK_LN : REF LIN_BLOCK,
	EOB_LN,
	LN_PTR,				! Current character pointer
	LN_BUF;				! Line buffer

    MESSAGES ((LINEXC255));
!+
! First make sure the line will not overflow.
!-

    IF (.LN_LEN + .L GTRU 255)
    THEN
	BEGIN
	EDT$$MSG_BELL (EDT$_LINEXC255);
	RETURN (0);
	END
    ELSE
	BEGIN

	LOCAL
	    OLD_LPOINT;

!+
! Check for the old EOB.
!-

	IF (.WK_LN EQLA EOB_LN)
	THEN
	    BEGIN
	    EDT$$SPLT_LNINS (0);	!Dont use optimizer
	    EDT$$CS_UP ();
	    END;

!+
! Compute the new cursor position.
!-
	OLD_LPOINT = .LN_PTR;
	LN_PTR = CH$PLUS (.LN_PTR, .L);
!+
! Open up a hole for the new characters.
!-
	EDT$$CPY_STR (CH$DIFF (.LN_END, .OLD_LPOINT), .OLD_LPOINT, .LN_PTR);
!+
! And move the new one(s) in.
!-
	EDT$$CPY_STR (.L, .S, .OLD_LPOINT);
!+
! Update the length of the line.
!-
	EDT$$UPD_LNLEN (.L);
!+
! Record the insertion for the screen updater.
!-
	EDT$$MRK_LNCHG (SCR_EDIT_MODIFY, CH$DIFF (.OLD_LPOINT,
					 	CH$PTR (LN_BUF,, BYTE_SIZE)));
!+
! Update select ranges if necessary.
!-

	IF (EDT$$SEL_RNGPOS () EQL 0)
	THEN
!+
! The current line is the select line.
!-

	    IF CH$PTR_LSS (.OLD_LPOINT, .SEL_POS) THEN SEL_POS = CH$PLUS (.SEL_POS, .L);

	RETURN (1);
	END;

    END;


END
ELUDOM