Google
 

Trailing-Edge - PDP-10 Archives - bb-r775c-bm_tops20_ks_upd_3 - sources/extend.bli
There are 10 other files named extend.bli in the archive. Click here to see a list.
 %TITLE 'EXTEND - EXTEND change-mode command'MODULE EXTEND (				! EXTEND change-mode command
		IDENT = '3-004'			! File: EXTEND.BLI Edit: CJG3004
		) =
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:
!
!	Do the EXTEND change-mode command, which allows a line-mode
!	command to be executed from change mode.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: 6-AUG-1979
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 18-FEB-1981.  This module was created by
!	extracting routine EDT$$EXT_CMD  from module EDTCTR.
! 1-002	- Regularize headers.  JBS 04-Mar-1981
! 1-003	- Do prompting from a global and remove LLINE and LCHANGE.  JBS 23-Oct-1981
! 1-004 - Replace L_LINE and L_CHANGE 7-Dec-81
! 1-005	- Add EDT$$LOAD_EXTEND, so that EDT$LNM_CMD can reload this routine into
!	   memory prior to returning to it.  Also, use a different symbol
!	   for EDT$$LNM_CMD, so the overlay analyzer can be told to ignore it.
!	   JBS 12-Mar-1982
! 1-006	- Do the same for EDT$$PA_CMD.  JBS 16-Mar-1982
! 1-007	- Remove L_LINE and L_CHANGE.  JBS 03-Jun-1982
! 1-008 - Allow any key to terminate the "Continue" message.  SMB 10-Jun-1982
! 1-009 - Fix bug in /RECOVER associated with above change.  SMB 16-Jun-1982
! 1-010 - Position the cursor better when waiting for a command to execute.
!	  SMB 28-Jun-1982
! 1-011 - We can't use TI_WRSTR unless this is a VT100/52.  SMB 02-Jul-1982
! 1-012	- Use new formatting flags to control output at the bottom
!	   of the screen.  JBS 05-Jul-1982
! 1-013	- Fix up response to PRTC when reading the journal file.  JBS 06-Jul-1982
! 1-014 - Check for control C. STS 15-Jul-1982
! 1-015	- Write out the journal buffer before asking for input.  JBS 03-Aug-1982
! 1-016 - Force a cursor positioning sequence and reverse video.  SMB 30-Aug-1982
! 1-017 - Output the format buffer after turning off reverse video.  SMB 01-Sept-1982
! 1-018	- Don't destory EDT$$G_PRV_COL, it is now being maintained accurately.  JBS 05-Oct-1982
! 1-019 - Force a write to the journal file after return is pressed. STS 07-Oct-1982
! 1-020	- Don't clear EDT$$G_SCR_CHGD.  JBS 09-Oct-1982
! 1-021 - Check for hardcopy terminal. STS 02-Dec-198_
! 1-022 - Also check for terminal type unknown. STS 03-Dec-1982
! 1-023	- Don't permit a long response to destroy the stack.  JBS 13-Dec-1982
! 3-001 - Don't need overlay code. CJG 17-Apr-1983
! 3-002 - Add updates from V3 sources.  GB 27-Apr-1983
! 3-003 - Add some checking for PUSH command. CJG 22-Nov-1983
! 3-004 - Clear TIN_ECHOFLG is TXT_ONSCR is set so that <GOLD>repeat will
!	  always display the count on the message line. CJG 4-Jan-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$EXT_CMD : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

REQUIRE 'SYS:JSYS';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine

%SBTTL 'EDT$$EXT_CMD  - EXTEND change-mode command'

GLOBAL ROUTINE EDT$$EXT_CMD 			! EXTEND change-mode command
    : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Do the EXTEND change-mode command.  This allows a line-mode
!	command to be executed from change mode.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	MESSAGE_LINE
!	EXI
!	CMD_BUF
!	CMD_PTR
!	CMD_END
!	EXITD
!	RCOV_MOD
!	PA_STK
!
! IMPLICIT OUTPUTS:
!
!	SCR_CHGD
!	TXT_ONSCR
!	FMT_LNPOS
!	LASTMSG
!	TIN_ECHOFLG
!	TIN_ECHOPOS
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	MANY
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$SC_REVID,
	EDT$$SC_NONREVID,
	EDT$$SC_POSCSIF,
	EDT$$FMT_CRLF,
	EDT$$STOP_WKINGMSG,
	EDT$$RD_JOUTXT,
	EDT$$TI_WRSTR,
	EDT$$TI_RDCMDLN,
	EDT$$TI_INPCH,
	EDT$$CHK_CC,
	EDT$$MSG_TOSTR,
	EDT$$OUT_FMTBUF,		! Output the format buffer
	EDT$$PA_CMD,			! Parse a command
	EDT$$LNM_CMD,			! Execute a line mode command
	EDT$$TI_FLUSHJOUFI : NOVALUE,	! Write out the journal file's buffer
	EDT$$FMT_MSG : NOVALUE,		! Output a message
	EDT$$ALO_HEAP,			! Allocate heap storage
	EDT$$DEA_HEAP : NOVALUE;	! Deallocate heap storage

    EXTERNAL
	PUT_JOU,			! force a write to journal file
	MESSAGE_LINE,			! Message lines are this + 1
	EXI,				! Change mode has been exited
	FMT_WRRUT,			! Output format routine
	TEMP_BUFFER,			! Temporary storage
	CMD_BUF,			! Command line buffer
	CMD_PTR,			! Pointer into command line buffer
	CMD_END,			! End of current command
	EXITD,				! Did we exit with the last command?
	EDIT_MOD,			! Current editing mode
	RCOV_MOD,			! Are we in recovery mode?
	SCR_CHGD,			! screen changed
	PUSH_FLAG,			! Last command was PUSH
	TI_TYP,				! kind of terminal
	FMT_LNPOS,			! Position on the output line
	TXT_ONSCR,			! Text was written to screen
	TIN_ECHOFLG,			! Echo status
	TIN_ECHOPOS,			! Echo position
	PA_STK,				! Parser semantic stack
	PA_MORE,			! More data on command line
	FMT_BOT,			! 1 = messages at bottom of screen
	FMT_LCNT,
	CC_DONE,			! Control-c flag
	LASTMSG;			! The last message printed. 1 = None

    MESSAGES ((PRERETCON, INSMEM));

    LOCAL
	CONT_RESP : REF BLOCK [CH$ALLOCATION (256)],
	C,
	TERM,
	LEN;

    TXT_ONSCR = 0;
    EDIT_MOD = LINE_MODE;
!+
! Position the cursor to the message line.
!-

    IF ((.TI_TYP NEQ TERM_HCPY) AND (.TI_TYP NEQ TERM_UNKNOWN))
    THEN
	BEGIN
	EDT$$SC_POSCSIF (.MESSAGE_LINE + 1, 0);
	FMT_LNPOS = 0;
	FMT_BOT = 1;
	FMT_LCNT = 0;
	EDT$$SC_REVID ();
	END;

!+
! Copy the remainder of the command and append <CR><LF><NUL>
! Then place the command in the rescan buffer and make it available.
!-
    C = CH$MOVE (CH$DIFF (.CMD_END, .CMD_PTR), .CMD_PTR, CH$PTR (TEMP_BUFFER));
    CH$MOVE (3, CH$PTR (UPLIT (%STRING (%CHAR (ASC_K_CR), %CHAR (ASC_K_LF),
	%CHAR (0)))), .C);
    CMD_PTR = .CMD_END;
    _RSCAN (CH$PTR (TEMP_BUFFER));		! Put command in rescan buffer
    _RSCAN ($RSINI);


    DO
	BEGIN

	IF EDT$$PA_CMD (0,0) THEN EDT$$LNM_CMD (PA_STK) ELSE TXT_ONSCR = 1;

	END
    UNTIL ((.PA_MORE EQL 0) OR (.EDIT_MOD EQL CHANGE_MODE) OR (EDT$$CHK_CC ()));

!+
! See if the reason we are exiting is because of a control C seen.
!-

    IF ( NOT (.PA_MORE EQL 0) OR (.EDIT_MOD EQL CHANGE_MODE))
    THEN
	CC_DONE = 1;

!+
! Text on the screen means we have more than 2 lines of messages and that
! we need to issue the Press return to continue message.
!-

    IF ((.TXT_ONSCR NEQ 0) AND (.FMT_WRRUT EQL EDT$$TI_WRSTR))
    THEN
	BEGIN

!+
! Allocate heap storage for the response, even though we use so much space only in /RECOVER mode,
! so that if we run out of storage during /RECOVER we will also run out in the original session.
!-

	IF ( NOT EDT$$ALO_HEAP (%REF (256), CONT_RESP))
	THEN
	    BEGIN
	    EDT$$FMT_MSG (EDT$_INSMEM);
	    END
	ELSE
	    BEGIN

	    IF (.RCOV_MOD EQL 0)
	    THEN
		BEGIN
		EDT$$STOP_WKINGMSG ();

!+
! Output the "Press return to continue" message and wait for ANY key
! to be pressed before refreshing the screen and returning to change mode.
!-

		EDT$$FMT_CRLF ();

!+
! Don't call FMT_MSG because we don't want the bell to ring.
!-

		EDT$$SC_REVID ();
		EDT$$MSG_TOSTR (EDT$_PRERETCON);
		EDT$$OUT_FMTBUF ();

!+
! Make sure the journal buffer has been written to the journal file,
! since we are about to wait for terminal input.
!-

		EDT$$TI_FLUSHJOUFI (%C'T');

!+
! Get the next character of input, including any characters generated by
! striking a keypad key.
!-

		EDT$$TI_INPCH (C);
		EDT$$TI_RDCMDLN (.C, .CMD_PTR, CMD_PTR, .C, TERM);

!+
! Make sure that the echo flag and position are clear
!-

		TIN_ECHOFLG = 0;
		TIN_ECHOPOS = 0;
		END
	    ELSE
		EDT$$RD_JOUTXT (.CONT_RESP, LEN);

	    EDT$$DEA_HEAP (%REF (256), CONT_RESP);
	    END;

	LASTMSG = 1;
	IF (.PUSH_FLAG EQL 0) THEN SCR_CHGD = 1;
	END;

    IF (.EXITD NEQ 0) THEN EXI = 1;

    PUT_JOU = 1;				! make sure the response gets written out alone
    EDT$$SC_NONREVID ();
    EDT$$OUT_FMTBUF ();
    PUSH_FLAG = 0;				! No last command now
    FMT_BOT = 0;
    EDIT_MOD = CHANGE_MODE;
    END;					! of routine EDT$$EXT_CMD


END
ELUDOM