Google
 

Trailing-Edge - PDP-10 Archives - BB-R775C-BM - sources/scrinsert.bli
There are 10 other files named scrinsert.bli in the archive. Click here to see a list.
 %TITLE 'SCRINSERT - insert a line on the screen'
MODULE SCRINSERT (				! Insert a line on the screen
		IDENT = '3-001'			! File: SCRINSERT.BLI Edit: GB3001
		) =
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 updates the screen information vector to
!	reflect the insertion of a line.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: September 8, 1979
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 12-Feb-1981.  This module was created by
!	extracting the routine EDT$$SC_INSLN  from module SCREEN.
! 1-002	- Regularize headers.  JBS 13-Mar-1981
! 1-003	- Repaint when a line is inserted above the top of the screen,
!	   but not when a line is inserted at the top of the screen.
!	   JBS 24-Sep-1981
! 1-004	- Check a new flag for scrolling regions.  JBS 31-Aug-1982
! 1-005 - Modify for the new screen updater.  SMB 17-Sep-1982
! 1-006 - Modify to use new 48 bit macros. STS 01-Oct-1982
! 1-007 - Take out references to L_CUR_SCRLN.  SMB 04-Oct-1982
! 1-008 - Reduce parameters to SC_LNINS.  SMB 06-Oct-1982
! 1-009 - Change the way SC_FNDREC is used.  SMB 08-Oct-1982
! 1-010	- Change EDT$$G_SCR_CHGD to EDT$$G_SCR_REBUILD.  JBS 09-Oct-1982
! 1-011 - Set the current screen pointer when a line is inserted.  SMB 10-Oct-1982
! 1-012	- Add support for NOTRUNCATE mode.  JBS 11-Oct-1982
! 1-013 - Update L_CUR_SCRLN on insert.  SMB 13-Oct-1982
! 1-014	- Don't rebuild the screen after deleting a line.  JBS 23-Oct-1982
! 1-015	- Don't increment the record number if our record was replaced
!	   rather than inserted before.  JBS 25-Oct-1982
! 1-016	- Check for replacing a multi-line record.  JBS 26-Oct-1982
! 1-017 - Fix notruncate bug on searching for deleted lines.  SMB 02-Dec-1982
! 1-018	- Remove the edit buffer.  JBS 27-Dec-1982
! 1-019	- Remove the unused reference to EDT$$G_CS_CHNO.  JBS 27-Dec-1982
! 3-001 - Add updates from V3 sources.  GB 03-May-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$SC_INSLN : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$SC_INSLN  - mark a line for insert'

GLOBAL ROUTINE EDT$$SC_INSLN (			! Mark a work file line for insert
    REC_ADDR, 					! Address of new line
    REC_LEN					! Length of new line
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	A line has been inserted.  Mark the line for insert in the screen
!	information structure.
!
! FORMAL PARAMETERS:
!
!  REC_ADDR 		the address of the new line
!
!  REC_LEN 		the length of the new line
!
! IMPLICIT INPUTS:
!
!	LN_PTR
!	LN_BUF
!	SCR_BUF
!	CUR_BUF
!
! IMPLICIT OUTPUTS:
!
!	CUR_SCRLN
!	CSR_SCRPTR
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$SC_LNINS,				! Insert a line into sceen structure
	EDT$$CMP_LNO,				! Compare line numbers
	EDT$$SC_FNDREC;				! Find a record in the data structure

    EXTERNAL
	LNO0,
	LN_PTR,
	CUR_SCRLN : LN_BLOCK,		! Current screen line
	LN_BUF,				! Workfile line buffer
	CSR_SCRPTR : REF SCREEN_LINE,	! Pointer to current line screen info
	SCR_BUF : REF TBCB_BLOCK,	! Current screen block
	CUR_BUF : REF TBCB_BLOCK;	! Current text buffer control block

    LOCAL
	NEW_SCRPTR : REF SCREEN_LINE,		! Temporary screen line
	CURSOR_LINE,				! Relative cursor line
	CURSOR_POS,				! Cursor position on the line
	SCRPTR : REF SCREEN_LINE,		! Current line screen info
	CURSOR_DELETED,				! 1 = the cursor line had been deleted
	DISP;					! Displacement from cursor line

!+
! Only perform this routine if we are in the current screen data structure and a data structure exists.
!-

    IF (.SCR_BUF NEQA .CUR_BUF) THEN RETURN;

!+
! Get the pointer which corresponds to the current record.  The insert will be just
! before that record.
!-
    SCRPTR = EDT$$SC_FNDREC (CH$DIFF (.LN_PTR, CH$PTR (LN_BUF)), DISP);
!+
! We will do the insert above the current screen information block.
! If there is a deleted line before the current screen information block
! we will replace it.  If that line is the cursor line, don't increment
! the record number of the cursor line.
!-

    IF (.SCRPTR NEQA 0)
    THEN
	BEGIN
!+
! See if the first line of the cursor record has already been deleted.
!-
	NEW_SCRPTR = .CSR_SCRPTR;

	WHILE (.NEW_SCRPTR [SCR_LINE_IDX] NEQ 0) DO
	    NEW_SCRPTR = .NEW_SCRPTR [SCR_PRV_LINE];

	IF ((.NEW_SCRPTR [SCR_EDIT_FLAGS] AND SCR_EDIT_DELLN) NEQ 0)
	THEN
	    CURSOR_DELETED = 1
	ELSE
	    CURSOR_DELETED = 0;

!+
! Now insert just before the current line.
!-
	EDT$$SC_LNINS (.SCRPTR, .REC_ADDR, .REC_LEN);
!+
! If we just replaced the current screen line, don't increment it's record number.
! (The call to EDT$$SC_LNINS may change the screen data block pointed to by NEW_SCRPTR, but
! BLISS doesn't know this unless we tell it.)
!-
	NEW_SCRPTR = .NEW_SCRPTR;

	IF ( NOT (.CURSOR_DELETED AND ((.NEW_SCRPTR [SCR_EDIT_FLAGS] AND SCR_EDIT_DELLN) EQL 0)))
	THEN
	    BEGIN

	    IF (EDT$$CMP_LNO (CUR_BUF [TBCB_CUR_LIN], CUR_SCRLN) LEQ 0)	!
	    THEN
		ADDLINE (LNO0, CUR_SCRLN, CUR_SCRLN);

	    END;

	END;

    END;					! of routine EDT$$SC_INSLN

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

ELUDOM