Google
 

Trailing-Edge - PDP-10 Archives - BB-H138F-BM_1988 - 7-sources/scrfcurs.bli
There are 10 other files named scrfcurs.bli in the archive. Click here to see a list.
 %TITLE 'SCRFCURS - absolute cursor position'
MODULE SCRFCURS (				! Absolute cursor position
		IDENT = '3-002'			! File: SCRFCURS.BLI Edit: CJG3002
		) =
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 forces an absolute cursor position sequence to a specified
!	line and position to be placed in the formatted output buffer.
!
! 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_POSABS  from module SCREEN.
! 1-002	- Regularize headers.  JBS 13-Mar-1981
! 1-004	- Output a CR before positioning to the last column, to defeat
!	   autowrap.  JBS 16-Apr-1982
! 1-005	- Remove edit 1-004, since it doesn't help on a VT100, and use
!	   a shorter sequence to position to home.  JBS 07-Oct-1982
! 1-006	- Don't allow negative cursor locations.  JBS 10-Oct-1982
! 1-007	- Preserve FMT_LNPOS, it may be modified by EDT$$FMT_DCML.  JBS 28-Oct-1982
! 3-002 - Modify ASSERT macro to include error code. CJG 30-Jan-1984
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$SC_POSABS : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$SC_POSABS  - absolute cursor position'

GLOBAL ROUTINE EDT$$SC_POSABS (			! Absolute cursor position
    LINE, 					! Desired line
    POS						! Desired column
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine forces a cursor position sequence to the specified line
!	and position to be placed in the formatted output buffer.
!
!	The new line and position are saved in PRV_LN  and
!	PRV_COL for use by future positions.
!
! FORMAL PARAMETERS:
!
!  LINE			Desired line number
!
!  POS			Desired column number
!
! IMPLICIT INPUTS:
!
!	TI_TYP
!
! IMPLICIT OUTPUTS:
!
!	PRV_LN
!	PRV_COL
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$STORE_FMTCH : NOVALUE,	! Store a character in the format buffer
	EDT$$FMT_DCML : NOVALUE;	! Expand a number in decimal into the format buffer

    EXTERNAL
	PRV_LN,				! Previous line number.
	PRV_COL,			! Previous column number.
	TI_TYP,				! Terminal type.
	FMT_LNPOS;			! Column number for formatting purposes

    LOCAL
	SAVE_FMTLNPOS;

!+
! The line and position parameters must not be negative.
!-
    ASSERT (21, .LINE GEQ 0);
    ASSERT (21, .POS GEQ 0);
!+
! Preserve FMT_LNPOS, since the call to EDT$$FMT_DCML will modify it,
! but those characters do not really increment the column.
!-
    SAVE_FMTLNPOS = .FMT_LNPOS;
!+
! Always start with an escape.
!-
    EDT$$STORE_FMTCH (ASC_K_ESC);
!+
! If this is a VT100, the escape is always followed by a [, to make a CSI.
!-

    IF (.TI_TYP EQL TERM_VT100) THEN EDT$$STORE_FMTCH (%C'[');

!+
! If we are positioning to home, use the shorter sequence.
!-

    IF ((.LINE EQL 0) AND (.POS EQL 0))
    THEN
	BEGIN
	EDT$$STORE_FMTCH (%C'H');
	PRV_LN = .LINE;
	PRV_COL = .POS;
	FMT_LNPOS = .SAVE_FMTLNPOS;
	RETURN;
	END;

!+
! We are not positioning to home, use the longer sequence.
!-

    IF (.TI_TYP EQL TERM_VT52)
    THEN
	BEGIN
	EDT$$STORE_FMTCH (%C'Y');
	EDT$$STORE_FMTCH (.LINE + 32);
	EDT$$STORE_FMTCH (.POS + 32);
	PRV_LN = .LINE;
	PRV_COL = .POS;
	FMT_LNPOS = .SAVE_FMTLNPOS;
	RETURN;
	END;

    ASSERT (5, .TI_TYP EQL TERM_VT100);

    IF (.LINE NEQ 0) THEN EDT$$FMT_DCML (.LINE + 1);

    IF (.POS NEQ 0)
    THEN
	BEGIN
	EDT$$STORE_FMTCH (%C';');
	EDT$$FMT_DCML (.POS + 1);
	END;

    EDT$$STORE_FMTCH (%C'H');
    PRV_LN = .LINE;
    PRV_COL = .POS;
    FMT_LNPOS = .SAVE_FMTLNPOS;
    END;					! of routine EDT$$SC_POSABS

!<BLF/PAGE>
END						! of module SCRFCRUS

ELUDOM