Google
 

Trailing-Edge - PDP-10 Archives - bb-r775d-bm_tops20_ks_upd_4 - sources/screscr.bli
There are 10 other files named screscr.bli in the archive. Click here to see a list.
 %TITLE 'SCRESCR - erase screen'
MODULE SCRESCR (				! Erase screen
		IDENT = '3-001'			! File: SCRESCR.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 outputs an erase screen sequence.
!
! 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_ERAALL  from module SCREEN.
! 1-002	- Regularize headers.  JBS 13-Mar-1981
! 1-003 - Set message flag to zero when the screen is erased.  SMB 30-Aug-1982
! 1-004 - Add code to erase line by line if message flag set.  SMB 24-Sep-1982
! 1-005	- Revise the handling of MSGFLG.  JBS 06-Oct-1982
! 1-006	- Use the fancy screen clearing features of the VT100 to speed up screen
!	   clearing when the message line must be preserved.  JBS 06-Oct-1982
! 1-007	- Don't clear SCR_CHGD unless we are clearing the whole screen.  JBS 07-Oct-1982
! 1-008	- Fix clearing one line too many when clearing the text area.  JBS 09-Oct-1982
! 1-009	- Remove the call to EDT$$OUT_FMTBUF.  JBS 09-Oct-1982
! 1-010	- Set the cursor position before erasing.  JBS 23-Oct-1982
! 1-011	- If the cursor line is -1 (initial value) use 0.  JBS 11-Jan-1983
! 1-012	- Allow for new value of SCR_CHGD.  JBS 02-Mar-1983
! 3-001 - Add updates from V3 sources.  GB 03-May-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$SC_ERAALL : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!

BIND
    ERS_S_52 = UPLIT (%STRING (%CHAR (ASC_K_ESC), 'J')),
    ERS_S_100 = UPLIT (%STRING (%CHAR (ASC_K_ESC), '[J')),
    ERS_S_100A = UPLIT (%STRING (%CHAR (ASC_K_ESC), '[1J'));

LITERAL
    ERS_S_52_LEN = 2,
    ERS_S_100_LEN = 3,
    ERS_S_100A_LEN = 4;

!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCESD
!
!	In the routine
%SBTTL 'EDT$$SC_ERAALL  - erase screen'

GLOBAL ROUTINE EDT$$SC_ERAALL 			! Erase screen
    : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine erases the screen from the current location to
!	the end of the screen, or to just before the message line
!	if there is useful text in the message line.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	CS_LNO
!	SCR_LNS
!	MSGFLG
!	TI_TYP
!	SCR_CHGD
!	TI_WID
!
! IMPLICIT OUTPUTS:
!
!	MSGFLG
!	SCR_CHGD
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$SC_ERATOEOL : NOVALUE,		! Erase to end of line
	EDT$$SC_POSCSIF : NOVALUE,		! Position the cursor
	EDT$$FMT_LIT : NOVALUE;			! Output a string without expansion

    EXTERNAL
	CS_LNO,				! current cursor line
	SCR_LNS,				! number of screen lines
	MSGFLG,				! 1 = there is a message on the message line
	TI_TYP,				! Terminal type
	SCR_CHGD,			! non-zero = the screen must be erased completely
	TI_WID;				! The width of the screen

    LOCAL
	LINE_NO;

    LINE_NO = .CS_LNO;

    IF (.LINE_NO LSS 0) THEN LINE_NO = 0;

!+
! If the screen has been mangled then there can be nothing useful on the message line.
!-

    IF (.SCR_CHGD NEQ 0) THEN MSGFLG = 0;

!+
! Use different algorithms depending on whether or not we must protect the message line.
!-

    IF (.MSGFLG EQL 0)
    THEN
!+
! Erase to the end of the screen.
!-
	BEGIN
	EDT$$SC_POSCSIF (.LINE_NO, 0);

	IF (.TI_TYP EQL TERM_VT52)
	THEN
	    EDT$$FMT_LIT (CH$PTR (ERS_S_52), ERS_S_52_LEN)
	ELSE
	    IF (.TI_TYP EQL TERM_VT100)
	    THEN
		EDT$$FMT_LIT (CH$PTR (ERS_S_100), ERS_S_100_LEN);

!+
! If we are erasing the whole screen then the screen is no longer mangled.
!-

	IF (.LINE_NO EQL 0) THEN SCR_CHGD = 0;

	END
    ELSE
!+
! We must preserve the message line.  If we have a VT100 and are at the home position
! we can use a "clear from beginnning of screen to here" command.
!-
	BEGIN

	IF ((.TI_TYP EQL TERM_VT100) AND (.LINE_NO EQL 0))
	THEN
	    BEGIN
	    EDT$$SC_POSCSIF (.SCR_LNS - 1, .TI_WID - 1);
	    EDT$$FMT_LIT (CH$PTR (ERS_S_100A), ERS_S_100A_LEN);
	    END
	ELSE
!+
! Erase each line separately up to the message line.
!-

	    INCR I FROM .LINE_NO TO .SCR_LNS - 1 DO
		BEGIN
		EDT$$SC_POSCSIF (.I, 0);
		EDT$$SC_ERATOEOL ();
		END;

	END;

    END;					! of routine EDT$$SC_ERAALL

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

ELUDOM