Trailing-Edge
-
PDP-10 Archives
-
BB-AE97C-BM
-
sources/tiline.bli
There are 10 other files named tiline.bli in the archive. Click here to see a list.
%TITLE 'TILINE - read a command line'
MODULE TILINE ( ! Read a command line
IDENT = '3-004' ! File: TILINE.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:
!
! Read a command line.
!
! ENVIRONMENT: Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: June 9, 1979
!
! MODIFIED BY:
!
! 1-001 - Original. DJS 18-FEB-1981. This module was created by
! extracting routine EDT$$TI_RDCMDLN from module TINPUT.
! 1-002 - Regularize headers. JBS 11-Mar-1981
! 1-003 - Add return value for end of journal file. JBS 02-Oct-1981
! 1-004 - Add an alternate terminator. STS 21-Oct-1981
! 1-005 - Fix parameter pass to/from char. translator. SMB 27-Oct-1981
! 1-006 - Set a flag if control C actually aborted something. JBS 24-May-1982
! 1-007 - Remove a reference to TI_STARTECHO. SMB 22-Jun-1982
! 1-008 - Allow for 8-bit keyboards. JBS 17-Aug-1982
! 1-009 - Add SS3 for 8-bit terminals. JBS 20-Aug-1982
! 1-010 - Add a special test for "Delete" as a terminator. SMB 23-Aug-1982
! 1-011 - Don't write into a formal parameter. JBS 24-Aug-1982
! 1-012 - Fix a bug in edit 1-011. JBS 25-Aug-1982
! 1-013 - Don't modify EDT$$G_PRV_COL; it is being maintained. JBS 05-Oct-1982
! 1-014 - Add a conditional for VT220 support. JBS 11-Feb-1983
! 3-001 - Fix various string pointers that were not string pointers. GB 23-Mar-1983
! 3-003 - Fix a problem handling excess deletes in a command. CJG 8-Jul-1983
! 3-004 - Remove VT220 conditionals. CJG 25-Nov-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$TI_RDCMDLN;
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$TI_RDCMDLN - read a command line'
GLOBAL ROUTINE EDT$$TI_RDCMDLN ( ! read a command line
C, ! First character (already read)
COM_BUF, ! Command buffer
END_COM, ! Receives address of end of line
TERM, ! Character to terminate on
RES_TERM ! resultant terminator
) =
!++
! FUNCTIONAL DESCRIPTION:
!
! Read characters up to a terminator into the command buffer. The
! characters are echoed as they are read. Delete is handled and
! CTRL/U aborts the operation.
!
! FORMAL PARAMETERS:
!
! C The first character to be handled (it was read previously)
!
! COM_BUF Pointer into the command buffer where the characters should
! be placed.
!
! END_COM A character pointer to receive the pointer after the characters
! have been read.
!
! TERM A special terminator. (escape is always a terminator)
!
! RES_TERM The actual terminator.
!
! IMPLICIT INPUTS:
!
! CMD_BUF
! TIN_ECHOPOS
!
! IMPLICIT OUTPUTS:
!
! TIN_ECHOFLG
! CC_DONE
!
! ROUTINE VALUE:
!
! 1 = the string was read,
! 0 = aborted by CTRL/U or CTRL/C
! 2 = end of journal file
!
! SIDE EFFECTS:
!
! NONE
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$ERA_MSGLN,
EDT$$CHK_CC,
EDT$$TRN_KPADK,
EDT$$TI_INPCH,
EDT$$TI_DELK : NOVALUE,
EDT$$TI_ECHOCH : NOVALUE;
EXTERNAL
CMD_BUF, ! Command line buffer
TIN_ECHOFLG, ! Flag indicating character have been echoed
TIN_ECHOPOS, ! Position on the echo line
CC_DONE; ! Set to 1 if control C actually aborts something
LOCAL
COM_POINT,
KEY,
CH;
COM_POINT = .COM_BUF;
!+
! Use C as the first character.
!-
CH = .C;
!+
! If the terminator can be any character, then return immediately
! upon seeing the delete character.
!-
IF (.TERM EQL ASC_K_DEL) THEN RETURN (1);
WHILE 1 DO
BEGIN
SELECTONE .CH OF
SET
[ASC_K_DEL] :
!+
! Delete character, delete the previous character if there is one.
!-
IF CH$PTR_NEQ (.COM_POINT, .COM_BUF)
THEN
BEGIN
COM_POINT = CH$PLUS (.COM_POINT, -1);
EDT$$TI_DELK (CH$RCHAR (.COM_POINT));
END;
[ASC_K_ESC, ASC_K_CSI, ASC_K_SS3] :
!+
! Escape, CSI or SS3, terminate the read and gobble up the rest of the escape
! or control sequence.
!-
BEGIN
IF (EDT$$TRN_KPADK (KEY) EQL 0) THEN RETURN (2);
.RES_TERM = .KEY;
EXITLOOP;
END;
[.TERM] :
!+
! The special terminator, end the read.
!-
BEGIN
.RES_TERM = .TERM;
EXITLOOP;
END;
[ASC_K_CTRL_U] :
!+
! Abort the read operation, erasing the echo line.
!-
BEGIN
TIN_ECHOFLG = 1;
.END_COM = .COM_BUF;
EDT$$ERA_MSGLN ();
RETURN (0);
END;
[OTHERWISE] :
!+
! Place the character in the buffer.
!-
IF CH$PTR_NEQ (.COM_POINT, CH$PLUS (.COM_BUF, 256))
THEN
BEGIN
CH$WCHAR_A (.CH, COM_POINT);
EDT$$TI_ECHOCH (.CH);
END;
TES;
!+
! Check for a control C as abort the read.
!-
IF EDT$$CHK_CC ()
THEN
BEGIN
.END_COM = .COM_BUF;
CC_DONE = 1;
RETURN (0);
END;
IF (EDT$$TI_INPCH (CH) EQL 0) THEN RETURN (2);
END;
!+
! Return a pointer one character beyond the last one read.
!-
.END_COM = .COM_POINT;
RETURN (1);
END; ! of routine EDT$$TI_RDCMDLN
END
ELUDOM