Google
 

Trailing-Edge - PDP-10 Archives - bb-h138e-bm_tops20_v6_1_distr - 6-1-sources/keycom.bli
There are 10 other files named keycom.bli in the archive. Click here to see a list.
 %TITLE 'KEYCOM - get a keypad command'
MODULE KEYCOM (				! Get a keypad command
		IDENT = '3-002'			! File: KEYCOM.BLI Edit: CJG3002
		) =
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:
!
!	Get a keypad command.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: April 7, 1979
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 24-Feb-1981.  This module was created by
!	extracting routine EDT$$GET_KPADCMD  from module KEYTRAN.
! 1-002	- Regularize headers.  JBS 09-Mar-1981
! 1-003	- Add return values.  JBS 02-Oct-1981
! 1-004 - Check one more return value, and add a variable to call to
!	   EDT$$KPAD_INP. STS 21-Oct-1981
! 1-005	- Set a flag if control C actually aborts something.  JBS 25-May-1982
! 1-006	- In NOKEYPAD mode copy control characters into the buffer.  JBS 07-Jun-1982
! 1-007 - Pass flag to EDT$$NXT_CMDCH so that it will accept repeat counts. STS 16-Jun-1982
! 1-008 - Add reverse video to nokeypad command input.  SMB 24-Jun-1982
! 1-009	- New implementation of defined keys.  JBS 12-Aug-1982
! 1-010 - Add another control C check since a control C can occur
!	   in edt$$trn_kstr. STS 24-Nov-1982
! 1-011	- Don't call EDT$$ERA_MSGLN unnecessarily.  JBS 20-Jan-1983
! 3-001 - Add updates from V3 sources.  GB 29-Apr-1983
! 3-002 - Call EDT$$TI_RDCMDLN directly. CJG 3-Jan-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$GET_KPADCMD;				! Get a keypad command

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

LIBRARY 'EDTSRC:KEYPADDEF';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$GET_KPADCMD  - get a keypad command'

GLOBAL ROUTINE EDT$$GET_KPADCMD 		! Get a keypad command
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Get a keypad command.  Characters are read and translated until a complete
!	command is seen.  The characters are handled as follows:
!
!		Keypad and control characters are translated, and if they end in a '.' then the
!		command is complete
!
!		Other characters are treated as insertions and always complete.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	CMD_BUF
!	CMD_PTR
!	TIN_ECHOFLG
!	MSGFLG
!	KPAD
!
! IMPLICIT OUTPUTS:
!
!	CMD_END
!	CC_DONE
!
! ROUTINE VALUE:
!
!	1 = ok, 0 = control C, 2 = end of journal file
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$SC_REVID,			! Turn on reverse video for nokeypad commands
	EDT$$CHK_CC,			! Check for control C
	EDT$$ERA_MSGLN : NOVALUE,	! Erase the message line
	EDT$$NXT_CMDCH,			! Get the next command character
	EDT$$TRN_KSTR,			! Build the command buffer
	EDT$$PUT_CMDCH : NOVALUE,	! Put a character in the command buffer
	EDT$$TI_RDCMDLN,
	EDT$$SC_NONREVID : NOVALUE;	! Make sure we are not in reverse video

    EXTERNAL
	CMD_BUF,			! Command buffer
	CMD_PTR,			! Pointer to next char in command buffer
	CMD_END,			! Pointer to end of info in command buffer
	KPAD,				! Keypad mode flag
	CC_DONE,			! Set to 1 if control C actually aborts something
	TIN_ECHOFLG,
	MSGFLG;

    LOCAL
	C,
	RES_TERM,
	SUCCEED,
	KEYS_SEEN;

    KEYS_SEEN = 0;
!+
! Loop until command is complete.
!-

    WHILE 1 DO
	BEGIN
!+
! Get the next command character. If the command was aborted, return.
!-
	SUCCEED = EDT$$NXT_CMDCH (C, 1);

	IF (.SUCCEED NEQ 1) THEN RETURN (.SUCCEED);

!+
! Check for control C and abort the command.
!-

	IF EDT$$CHK_CC ()
	THEN
	    BEGIN
	    CMD_END = CH$PTR (CMD_BUF,, BYTE_SIZE);

	    IF .KEYS_SEEN THEN CC_DONE = 1;

	    RETURN (0);
	    END;

	KEYS_SEEN = 1;
!+
! Erase the message line and make sure we are in reverse video mode
! if this is a nokeypad command
!-

	IF ((.MSGFLG NEQ 0) OR .TIN_ECHOFLG) THEN EDT$$ERA_MSGLN ();

	IF ( NOT .KPAD) THEN EDT$$SC_REVID ();

	SELECTONE .C OF
	    SET

	    [0 TO 31] :
!+
! Control character: if in keypad mode, translate it.
!-
		IF .KPAD
		THEN
		    BEGIN

		    IF EDT$$TRN_KSTR (.C, 1, 0) THEN RETURN (1);

		    END
		ELSE
		    BEGIN
!+
! In nokeypad mode, copy characters into the buffer.
!-

		    IF (EDT$$TI_RDCMDLN (.C, .CMD_PTR, CMD_PTR, ASC_K_CR, RES_TERM) EQL 2)
			THEN RETURN (2);

		    CMD_END = .CMD_PTR;
		    RETURN (1);
		    END;

	    [ASC_K_DEL, K_KPAD_BASE TO K_KEY_MAX] :
!+
! DEL, keypad or function key: always translate.
!-

		IF EDT$$TRN_KSTR (.C, 1, 0) THEN RETURN (1);

	    [OTHERWISE] :
!+
! Insertion character: make the command Ic^Z.
!-

		IF .KPAD
		THEN
		    BEGIN
		    EDT$$PUT_CMDCH (%C'I', 0);
		    EDT$$PUT_CMDCH (.C, 0);
		    EDT$$PUT_CMDCH (ASC_K_CTRL_Z, 0);
		    CMD_END = .CMD_PTR;
		    RETURN (1);
		    END
		ELSE
		    BEGIN
!+
! In nokeypad mode, copy characters into the buffer.
!-

		    IF (EDT$$TI_RDCMDLN (.C, .CMD_PTR, CMD_PTR, ASC_K_CR, RES_TERM) EQL 2)
			THEN RETURN (2);

		    CMD_END = .CMD_PTR;
		    RETURN (1);
		    END;

	    TES;

!+
! Check for control C and abort the command.
!-

	IF EDT$$CHK_CC ()
	THEN
	    BEGIN
	    CMD_END = CH$PTR (CMD_BUF,, BYTE_SIZE);

	    IF .KEYS_SEEN THEN CC_DONE = 1;

	    RETURN (0);
	    END;

	END;

    RETURN (1);
    END;					! of routine EDT$$GET_KPADCMD


END
ELUDOM