Google
 

Trailing-Edge - PDP-10 Archives - BB-R775E-BM - sources/edt/chmmrkchg.bli
There are 11 other files named chmmrkchg.bli in the archive. Click here to see a list.
 %TITLE 'CHMMRKCHG - track changes in current line'
MODULE CHMMRKCHG (				! Track changes in current line
		IDENT = '3-001'			! File: CHMMRKCHG.BLI Edit: CJG3001
		) =
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 keeps track of the bounds between which the
!	current line must be updated.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: Unknown
!
! MODIFIED BY:
!
! 2-001	- Recode to interface to the new screen updater.  JBS 13-Sep-1982
! 2-002	- Version 2-001 was just a stub.  This version is little better:
!	   it always marks the line for reapinting.  JBS 17-Sep-1982
! 2-003	- Add logic for deleting lines and for skipping over deleted lines.
!	   JBS 20-Sep-1982
! 2-004	- Worry about the target line having a deleted neighbor.  JBS 20-Sep-1982
! 2-005	- Call EDT$$SC_FNDREC, which contains the table searching code.  JBS 24-Sep-1982
! 2-006	- Record the actual edits to a line, instead of just marking it for repaint.  JBS 28-Sep-1982
! 2-007 - Change the parameters to SC_FNDREC.  SMB 28-Sep-1982
! 2-008 - Put in temporary zeroing of screen buffer pointer.  SMB 30-Sep-1982
! 2-009 - Remove yesterday's temporary change.  SMB 01-Oct-1982
! 2-010 - Change the way SC_FNDREC is used.  SMB 08-Oct-1982
! 2-011	- Don't run off the end of the edit buffer, and maintain SCR_EDIT_POS.  JBS 18-Oct-1982
! 2-012	- Turn insert followed by delete into a null operation.  JBS 24-Oct-1982
! 2-013	- Fix problems involving marking deleted characters.  JBS 24-Oct-1982
! 2-014	- If we free the first screen pointer, update EDT$$A_FST_SCRPTR.
! 2-015	- Maintain SCR_EDIT_MINPOS.  JBS 28-Oct-1982
! 2-016	- Use EDT$$SC_LNDEL to free line blocks.  JBS 29-Oct-1982
! 2-017 - Fix a bad LOCAL declaration.  SMB 31-Oct-1982
! 2-018	- Maintain MINPOS, even if we must repaint, to avoid extra repainting
!	   if we overflow the edit buffer, which is likely on the PDP-11.  JBS 01-Dec-1982
! 2-019	- Maintain MINPOS even if the previous edit is a repaint.  JBS 04-Dec-1982
! 2-020	- If we are editing the first character of a continuation line, mark the
!	   previous line as needing repainting at its end, in case we are inserting
!	   a character before a wide character that should really be painted at the
!	   end of the previous line.  JBS 20-Dec-1982
! 2-021	- Remove the edit buffer.  JBS 27-Dec-1982
! 2-022	- If we delete an inserted continuation or continued line,
!	   rebuild the screen data structure.  JBS 05-Jan-1983
! 2-023	- If we are going to rebuild the screen data structure,
!	   don't update anything.  JBS 17-Feb-1983
! 3-001 - Modify ASSERT macro to include error code. CJG 30-Jan-1984
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$MRK_LNCHG : NOVALUE;			! Mark changes in the current line

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$MRK_LNCHG  - mark changes in the current line'

GLOBAL ROUTINE EDT$$MRK_LNCHG (			! Mark changes in the current line
    CODE, 					! Change code
    POSITION					! Position in the record
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Keep track of edits done to lines on the screen, so the screen
!	updater can repaint them.
!
! FORMAL PARAMETERS:
!
!  CODE			The type of edit: delete line or modify
!  POSITION		The position in the record at which the operation takes place
!
! IMPLICIT INPUTS:
!
!	SCR_BUF
!	CUR_BUF
!	SCR_REBUILD
!
! IMPLICIT OUTPUTS:
!
!	LN_CHGD
!	SCR_REBUILD
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$SC_FNDREC,				! Find a record in the screen data base
	EDT$$SC_LNDEL : NOVALUE;		! Free a record from the screen data base

    EXTERNAL
	SCR_BUF,
	CUR_BUF : REF TBCB_BLOCK,	! Pointer to the current text buffer control block
	LN_CHGD,				! The current record has been changed
	SCR_REBUILD;			! 1 = the screen data base has to be rebuilt

    LOCAL
	DISP,					! Displacement from cursor screen pointer
	SCRPTR : REF SCREEN_LINE,		! Pointer to our screen line
	RECORD_NO : LN_BLOCK,			! Record number of our screen line
	EDIT_CODE,				! Do this to this record
	REL_POS,				! Position in this line
	MIN_RELPOS;				! Minimum edit position on this line

!+
! Make sure the work file system knows that the current record has been
! changed, so it will write the record back to the work file system.
!-
    LN_CHGD = 1;
!+
! If we are going to rebuild the screen data base anyway, don't bother to update it.
!-
    IF .SCR_REBUILD THEN RETURN;

!+
! Point to the current line in the screen data base.
!-
    ASSERT (7, .POSITION LEQ 255);
    SCRPTR = EDT$$SC_FNDREC (.POSITION, DISP);
!+
! If the line is not in the screen data base, just return.
!-

    IF (.SCRPTR EQLA 0) THEN RETURN;

!+
! Check for delete of an inserted line.  It is very special.
!-
    EDIT_CODE = .CODE;

    IF ((.EDIT_CODE EQL SCR_EDIT_DELLN) AND ((.SCRPTR [SCR_EDIT_FLAGS] AND SCR_EDIT_INSLN) NEQ 0))
    THEN
	BEGIN
!+
! We are deleting an inserted line.  Back out the insert so that
! the screen updater will see nothing.
!-

	LOCAL
	    NEXT_SCRPTR : REF SCREEN_LINE;

!+
! If this is a continued or continuation line, rebuild the screen data base.
!-

	IF (.SCRPTR [SCR_LINE_IDX] NEQ 0)
	THEN
	    BEGIN
	    SCR_REBUILD = 1;
	    RETURN;
	    END;

	NEXT_SCRPTR = .SCRPTR [SCR_NXT_LINE];

	IF (.NEXT_SCRPTR NEQA 0)
	THEN
	    BEGIN

	    IF (.NEXT_SCRPTR [SCR_LINE_IDX] NEQ 0)
	    THEN
		BEGIN
		SCR_REBUILD = 1;
		RETURN;
		END;

	    END;

	EDT$$SC_LNDEL (.SCRPTR);
	RETURN;
	END;

!+
! Maintain the record of the minimum edit position.
!-
    REL_POS = .POSITION - .SCRPTR [SCR_CHR_FROM];
    MIN_RELPOS = MINU (.REL_POS, .SCRPTR [SCR_EDIT_MINPOS]);
    SCRPTR [SCR_EDIT_MINPOS] = .MIN_RELPOS;
    SCRPTR [SCR_EDIT_MAXPOS] = 255;
!+
! If we are editing at the front of a continuation line, mark the previous line as needing
! an edit at its end.  This is in case we are inserting a narrow character in front of a
! wide character; the narrow character may want to be displayed at the end of the previous line.
!-

    IF ((.REL_POS EQL 0) AND (.SCRPTR [SCR_CHR_FROM] NEQ 0))	!
    THEN
	EDT$$MRK_LNCHG (SCR_EDIT_MODIFY, .POSITION - 1);

!+
! Mark the edit for this line.
!-
    SCRPTR [SCR_EDIT_FLAGS] = .SCRPTR [SCR_EDIT_FLAGS] OR .EDIT_CODE;
!+
! After any edit to a line, mark all subsequent lines for the
! same record for repainting.  This means that in NOTRUNCATE mode,
! if you edit a line all later lines for that record are repainted.
! This is important even for replaces, since the width of a character
! may change.  Note that deleting a line causes the subsequent
! records to be marked as deleted.
!-

    WHILE ((.SCRPTR [SCR_CHR_TO] NEQ 255) AND (.SCRPTR [SCR_NXT_LINE] NEQA 0)) DO
	BEGIN
	SCRPTR = .SCRPTR [SCR_NXT_LINE];
	SCRPTR [SCR_EDIT_MINPOS] = 0;
	SCRPTR [SCR_EDIT_MAXPOS] = 255;
	SCRPTR [SCR_EDIT_FLAGS] = .SCRPTR [SCR_EDIT_FLAGS] OR .EDIT_CODE;
	END;					! Repaint later lines for this record

    END;					! of routine EDT$$MRK_LNCNG

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

ELUDOM