Google
 

Trailing-Edge - PDP-10 Archives - BB-AE97C-BM - sources/lxcom.bli
There are 10 other files named lxcom.bli in the archive. Click here to see a list.
 %TITLE 'LXCOM - execute a line-mode command'
MODULE LXCOM (				! Execute a line-mode command
		IDENT = '3-008'			! File: LXCOM.BLI Edit: CJG3008
		) =
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:
!
!	Execute a line-mode command.  Most of the work is done by external routines.
!
! ENVIRONMENT: User mode
!
! AUTHOR: Bob Kushlis, CREATION DATE: February 3, 1978
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 10-MAR-81.  This module was created by
!	extracting the routine EDT$$LNM_CMD  from EXEC.BLI.
! 1-002	- Fix module name.  JBS 23-Mar-1981
! 1-003	- Make sure the routine names start with EDT$$.  JBS 31-Mar-1981
! 1-004	- Use the ASSERT macro.  JBS 01-Jun-1981
! 1-005	- Use the new message codes.  JBS 04-Aug-1981
! 1-006	- Add a synonym for the entry point name, so the overlay analyzer
!	   can be told to ignore it, and make sure the EXTEND module
!	   is in memory before returning.  JBS 12-Mar-1982
! 1-007	- Revise the overlay structure, since the method outlined above
!	   can cause an undefined symbol.  JBS 15-Mar-1982
! 1-008	- Remove the reference to EDT$$LOAD_EXTEND.  JBS 18-Mar-1982
! 1-009 - Set stay flag if command is a write. STS 10-May-1982
! 1-010	- Bypass EDT$$LNM_HLP by calling EDT$$OUT_HLP directly.  JBS 03-Jun-1982
! 1-011 - Set TXT_ONSCR for commands that don't.  SMB 11-Jun-1982
! 1-012 - Set stay flag if command is a print. STS 10-May-1982
! 1-013 - Modify the setting of message flags.  SMB 23-Jun-1982
! 1-014	- Use EDT$$FMT_CRLF instead of EDT$$OUT_FMTBUF.  This means we don't have
!	   to set MSGFLG or TXT_ONSCR in most cases.  JBS 05-Jul-1982
! 1-015	- Move setting of SCR_CHGD to the routines called.  JBS 07-Jul-1982
! 1-016	- Set SCR_CHG in FIND only if it succeeds.  JBS 07-Jul-1982
! 1-017	- Remove EDT$$G_SCR_CHGD, the new screen logic does not need it.  JBS 09-Oct-1982
! 1-018 - Put code for edt$$rng_posfrst in line. STS 11-Oct-1982
! 1-019 - Remove forced setting of G_TXT_ONSCR for insert and replace.  SMB 14-Dec-1982
! 3-001 - Modify for use with the TOPS-20 parser. CJG 14-Mar-1983
! 3-002 - Don't need overlay code. CJG 17-Apr-1983
! 3-003 - Add updates from V3 sources.  GB 03-May-1983
! 3-004 - Add PUSH command and make rest more readable. CJG 20-Sep-1983
! 3-005 - Fix line-mode help used in change-mode to get good display. CJG 25-Sep-1983
! 3-006 - Add TRACE and XDDT commands. CJG 10-Oct-1983
! 3-007 - Modify the coding of the XDDT command. CJG 9-Dec-1983
! 3-008 - Modify ASSERT macro to include error code. CJG 30-Jan-1984
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$LNM_CMD : NOVALUE;			! Execute the last parsed command

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routines
%SBTTL 'EDT$$LNM_CMD  - execute a line-mode command'

GLOBAL ROUTINE EDT$$LNM_CMD (			! Execute a line-mode command
    COM_START					! Command to execute
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine executes the command which was last parsed.
!	It is assumed that the command is described in the first
!	node on the parsing stack.
!
! FORMAL PARAMETERS:
!
!  COM_START		Node block containing the command to execute
!
! IMPLICIT INPUTS:
!
!	RCOV_MOD
!	PA_STK 		The semantic stack containing the command to be executed
!
! IMPLICIT OUTPUTS:
!
!	EDIT_MOD
!	EXE_CURCMD
!	EXE_SBLK
!	EXE_SBITS
!	EXE_QRYQUIT
!	EXITD
!	TXT_ONSCR
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	MANY
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$SC_NONREVID,			! Turn off reverse video
	EDT$$STOP_WKINGMSG,			! Turn off timer AST
	EDT$$CLR_CMD : NOVALUE,			! Process the CLEAR command
	EDT$$DEFK_CMD : NOVALUE,		! Process the DEFINE KEY command
	EDT$$DEFM_CMD : NOVALUE,		! Process the DEFINE MACRO command
	EDT$$DEL_CMD : NOVALUE,			! Process the DELETE command
	EDT$$MAC_CALL,				! Invoke a macro
	EDT$$EXI_CMD : NOVALUE,			! Process the EXIT command
	EDT$$FILL_CMD : NOVALUE,		! Process the FILL command
	EDT$$FMT_CRLF,				! Terminate a line
	EDT$$FMT_MSG,				! Put the text of a message in the format buffer
	EDT$$OUT_FMTBUF : NOVALUE,		! Output the buffer
	EDT$$OUT_HLP,				! Get help
	EDT$$INCL_CMD : NOVALUE,		! Process the INCLUDE command
	EDT$$INS_CMD : NOVALUE,			! Process the INSERT command
	EDT$$DEL_LNS,				! Delete a range of lines
	EDT$$INS_TXT : NOVALUE,			! Insert text
	EDT$$MOVCPY_CMD : NOVALUE,		! Process the MOVE and COPY commands
	EDT$$NULL_CMD : NOVALUE,		! Process the null command
	EDT$$PUSH_CMD : NOVALUE,		! Process the PUSH command
	EDT$$XDDT_CMD : NOVALUE,		! Process the XDDT command
	EDT$$PRNT_CMD : NOVALUE,		! Process the PRINT command
	EDT$$RNG_REPOS,
	EDT$$RSEQ_CMD : NOVALUE,		! Process the RESEQUENCE command
	EDT$$SET_CMD : NOVALUE,			! Process the SET command
	EDT$$SHW_CMD : NOVALUE,			! Process the SHOW command
	EDT$$LN_SUBCMD : NOVALUE,		! Process the SUBSTITUTE command
	EDT$$SUB_NXTCMD : NOVALUE,		! Process the SUBSTITUTE NEXT command
	EDT$$TSADJ_CMD : NOVALUE,		! Process the TABS ADJUST command
	EDT$$TY_CMD : NOVALUE,			! Process the TYPE command
	EDT$$WR_CMD : NOVALUE,			! Process the WRITE command
	$TRACE;					! Process the TRACE command

    EXTERNAL
	EDIT_MOD,
	RCOV_MOD,
	TXT_ONSCR,			! Use "Press return to continue" after this command is done
	EXITD,
	EXE_CURCMD : REF NODE_BLOCK,	! Pointer to the current command.
	EXE_QRYQUIT,			! Quit flag  for /EDT$$PROC_QRYQAL  operations.
 	RNG_FRSTLN,
    	CUR_BUF : REF TBCB_BLOCK,
    	RNG_ORIGPOS : POS_BLOCK,
	EXE_SBITS,			! The options switches.
	EXE_SBLK : REF NODE_BLOCK;	! The option switch value block.

    MESSAGES ((NODDTAVL));

    EXE_CURCMD = .COM_START;

!+
! The top level had better be a command code. Ignore it if first word is -1.
!-

    IF (.EXE_CURCMD [COM_NUM] EQL %O'777777') THEN RETURN;
    ASSERT (17, .EXE_CURCMD [NODE_TYPE] EQL COM_NODE);
    EXE_SBLK = .EXE_CURCMD [SWITS];

    IF (.EXE_SBLK NEQ 0)
    THEN
	EXE_SBITS = .EXE_SBLK [SW_BITS]
    ELSE
	EXE_SBITS = 0;

    EXE_QRYQUIT = 0;

    CASE .EXE_CURCMD [COM_NUM] FROM COM_NULL TO LAST_COM OF
	SET

	[COM_CHANGE] :
	    BEGIN
!+
! Position to the first line of the specified range
! and set the current mode to change mode.
!-

    	    RNG_FRSTLN = 1;
    	    EDT$$CPY_MEM(POS_SIZE, .CUR_BUF, RNG_ORIGPOS);
	    IF EDT$$RNG_REPOS (.EXE_CURCMD [RANGE1]) THEN EDIT_MOD = CHANGE_MODE;

	    END;

	[COM_CLEAR] :
	    BEGIN
	    EDT$$CLR_CMD ();
	    END;

	[COM_COPY] :
	    BEGIN
	    EDT$$MOVCPY_CMD (0);
	    END;

	[COM_DEFINE] :
	    BEGIN
	    EDT$$DEFK_CMD ();
	    END;

	[COM_DEF_MAC] :
	    BEGIN
	    EDT$$DEFM_CMD ();
	    END;

	[COM_DELETE] :
	    BEGIN
	    EDT$$DEL_CMD ();
	    END;

	[COM_EXIT] :
	    BEGIN
	    EDT$$EXI_CMD ();
	    END;

	[COM_FILL] :
	    BEGIN
	    EDT$$FILL_CMD ();
	    END;

	[COM_FIND] :
	    BEGIN
    	    RNG_FRSTLN = 1;
    	    EDT$$CPY_MEM(POS_SIZE, .CUR_BUF, RNG_ORIGPOS);
	    EDT$$RNG_REPOS (.EXE_CURCMD [RANGE1]);
	    END;

	[COM_HELP] :
	    BEGIN
	    EDT$$SC_NONREVID ();
	    EDT$$OUT_FMTBUF ();
	    EDT$$OUT_HLP (.EXE_CURCMD [FILSPEC], .EXE_CURCMD [FSPCLEN], 1);
	    TXT_ONSCR = 1;
	    END;

	[COM_INCLUDE] :
	    BEGIN
	    EDT$$INCL_CMD ();
	    END;

	[COM_INSERT] :
	    BEGIN
	    EDT$$INS_CMD ();
	    END;

	[COM_MAC_CALL] :
	    BEGIN
	    EDT$$MAC_CALL (.EXE_CURCMD [RANGE1]);
	    END;

	[COM_MOVE] :
	    BEGIN
	    EDT$$MOVCPY_CMD (1);
	    END;

	[COM_NULL] :
	    BEGIN
	    EDT$$STOP_WKINGMSG ();
	    EDT$$NULL_CMD ();
	    END;

	[COM_PRINT] :
	    BEGIN
	    EXE_SBITS<OPB_STAY> = 1;	! print never changes the position
	    EDT$$PRNT_CMD ();
	    END;

	[COM_PUSH] :
	    BEGIN
	    EDT$$STOP_WKINGMSG ();
	    EDT$$SC_NONREVID ();
	    EDT$$OUT_FMTBUF ();		! Force screen cleanup
	    EDT$$PUSH_CMD ();
	    END;

	[COM_QUIT] :
	    BEGIN
	    EXITD = 1;
	    EDT$$FMT_CRLF ();
	    END;

	[COM_REPLACE] :
	    BEGIN
	    IF EDT$$DEL_LNS () THEN EDT$$INS_TXT ();
	    END;

	[COM_RESEQ] :
	    BEGIN
	    EDT$$RSEQ_CMD ();
	    END;

	[COM_SET] :
	    BEGIN
	    EDT$$SET_CMD ();
	    END;

	[COM_SHOW] :
	    BEGIN
	    EDT$$SHW_CMD ();
	    END;

	[COM_SUBS] :
	    BEGIN
	    EDT$$LN_SUBCMD ();
	    END;

	[COM_SUBS_NEXT] :
	    BEGIN
	    EDT$$SUB_NXTCMD ();
	    END;

	[COM_TADJ] :
	    BEGIN
	    EDT$$TSADJ_CMD ();
	    END;

	[COM_TRACE] :
	    BEGIN
	    BIND
		SWITCH = .EXE_CURCMD [SWITS] : NODE_BLOCK;

	    IF (.EXE_CURCMD [AS_STR] NEQ 0)
	    THEN
		CH$WCHAR (0, CH$PLUS (.EXE_CURCMD [AS_STR], .EXE_CURCMD [AS_LEN]));

	    IF (.SWITCH NEQ 0)
	    THEN
		BEGIN
		IF (.SWITCH [AS_STR] NEQ 0)
		THEN
		    CH$WCHAR (0, CH$PLUS (.SWITCH [AS_STR], .SWITCH [AS_LEN]));
		$TRACE (.EXE_CURCMD [SET_TYPE], .EXE_CURCMD [AS_STR],
			.SWITCH [SW_VAL2], .SWITCH [AS_STR]);
		END
	    ELSE
		$TRACE (.EXE_CURCMD [SET_TYPE], .EXE_CURCMD [AS_STR], 0, 0);

	    END;

	[COM_TYPE] :
	    BEGIN
	    EDT$$STOP_WKINGMSG ();
	    EDT$$SC_NONREVID ();
	    EDT$$TY_CMD ();
	    END;

	[COM_XDDT] :
	    BEGIN
	    EDT$$SC_NONREVID ();
	    EDT$$XDDT_CMD ();
	    END;
		
	[COM_WRITE] :
	    BEGIN
	    EXE_SBITS<OPB_STAY> = 1;	! write never changes the position
	    EDT$$WR_CMD ();
	    END;

	[OUTRANGE] :
	    BEGIN
	    ASSERT (17, 0);
	    END;
	TES;

    IF .EXITD
    THEN

	IF .EXE_SBITS<OPB_SAVE> THEN EXITD = 3;

    IF .RCOV_MOD THEN EXITD = 0;

    END;					! of routine EDT$$LNM_CMD


END
ELUDOM