Google
 

Trailing-Edge - PDP-10 Archives - bb-h138f-bm - 7-sources/chmcmblin.bli
There are 11 other files named chmcmblin.bli in the archive. Click here to see a list.
 %TITLE 'CHMCMBLIN - combine lines'
MODULE CHMCMBLIN (				! Combine lines
		IDENT = '3-002'			! File: CHMCMBLIN.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 combines the current line with the one
!	immediately above it.
!
! 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$$COMB_LN  from module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 25-Feb-1981
! 1-003	- Fix module name.  JBS 02-Mar-1981
! 1-004	- Use the ASSERT macro.  JBS 01-Jun-1981
! 1-005	- EDT$$SEL_RNGPOS  can have values -1, 0 and 1.  JBS 02-Jun-1981
! 1-006	- Use new message codes.  JBS 04-Aug-1981
! 1-007 - Fix bug where you cannot combine lines because length >255.
!	  STS 23-Oct-1981
! 1-008	- New screen update logic.  JBS 13-Sep-1982
! 1-009 - Make call to edt$$tst_eob in line. STS 22-Sep-1982
! 1-010	- Remove EDT$$G_LN_NO for new screen update logic.  JBS 29-Sep-1982
! 1-011	- Move call to EDT$$MRK_LNCHG.  JBS 27-Oct-1982
! 1-012	- Change order of operations to improve screen updating.  JBS 01-Dec-1982
! 1-013	- Change call to EDT$$MRK_LNCHG.  JBS 27-Dec-1982
! 1-014	- Add special cases for empty lines, to improve screen updating.  JBS 28-Dec-1982
! 1-015	- Add parameter to suppress special cases.  JBS 28-Dec-1982
! 1-016	- Don't delete the current line if it is of zero length.  JBS 29-Dec-1982
! 3-001 - Replace CPY_MEM with CPY_STR and allow big bytes.  GB 3-Mar-1983
! 3-002 - Add updates from V3 sources.  GB 04-May-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$COMB_LN : NOVALUE;		! Combine the current line with the one immediately above it

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$COMB_LN  - combine lines'

GLOBAL ROUTINE EDT$$COMB_LN (			! Combine lines
    LEN_OPT) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine combines the current line with the one immediately
!	above it.
!
! FORMAL PARAMETERS:
!
!  LEN_OPT			1 = do optimizations based on line lengths
!
! IMPLICIT INPUTS:
!
!	LNO0
!	LN_BUF
!	LN_END
!	LN_LEN
!	WK_LN
!
! IMPLICIT OUTPUTS:
!
!	LN_PTR
!	SEL_POS
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$MSG_BELL : NOVALUE,		! Output a message to the terminal with a warning bell
	EDT$$MRK_LNCHG : NOVALUE,		! Record line updates
	EDT$$UPD_LNLEN : NOVALUE,		! Update the length of the current line
	EDT$$DEL_CURLN,				! Delete a line from buffer
	EDT$$RD_PRVLN,				! Move backward a line
	EDT$$RD_NXTLN,				! Move forward a line
	EDT$$RPL_CHGDLN : NOVALUE;		! Replace a changed line

    EXTERNAL
	LN_BUF,				! Current line buffer
	LN_PTR,				! Current character pointer
	LN_END,				! End of current line pointer
	LN_LEN,				! Length of current line
	EOB_LN,
	WK_LN : REF LIN_BLOCK;		! Current line pointer

!+
! Declare the message codes to be used.
!-
    MESSAGES ((LINEXC255));

    LOCAL
	EOB,
	LEN;

!+
! Remember if we are at the end of the buffer.
!-
    EOB = (.WK_LN EQLA EOB_LN);

!+
! Move back a line, give up if it fails.
!-

    IF ( NOT EDT$$RD_PRVLN ()) THEN RETURN;

!+
! Get length of add on line.
!-
    LEN = .WK_LN [LIN_LENGTH];
!+
! Make sure the two do not exceed 255 characters.
!-

    IF ((.LN_LEN + .LEN) GTR 255)
    THEN
	BEGIN
	EDT$$MSG_BELL (EDT$_LINEXC255);
	EDT$$RD_NXTLN ();
	RETURN;
	END;

!+
! If the add-on line is empty, just delete it.
!-

    IF ((.LEN EQL 0) AND .LEN_OPT)
    THEN
	BEGIN
	EDT$$DEL_CURLN ();
	RETURN;
	END;

!+
! The add-on line is not empty, or length optimization is not permitted.  Move the current line over.
!-
    LN_PTR = CH$PTR (LN_BUF, .LEN, BYTE_SIZE);
    EDT$$CPY_STR (.LN_LEN, CH$PTR (LN_BUF, 0, BYTE_SIZE), .LN_PTR);
!+
!+
! Move in the text from the previous line.
!-
    EDT$$CPY_STR (.LEN, CH$PTR (WK_LN [LIN_TEXT], 0, BYTE_SIZE), CH$PTR (LN_BUF, 0, BYTE_SIZE));
    EDT$$MRK_LNCHG (SCR_EDIT_MODIFY, .LEN);
!+
! Update the length field.
!-
    EDT$$UPD_LNLEN (.LEN);
    EDT$$RPL_CHGDLN ();
!+
! Delete the first line unless it is just before EOB.
!-

    IF (( NOT .EOB) OR (.LN_LEN EQL 0))
    THEN
	BEGIN

	IF ( NOT .EOB) THEN EDT$$RD_NXTLN ();

	EDT$$DEL_CURLN ();

	IF ( NOT .EOB) THEN EDT$$RD_PRVLN ();

	END;

    END;					! of routine EDT$$COMB_LN

!<BLF/PAGE>
END						! of module EDT$CHMCMBLIN

ELUDOM