Trailing-Edge
-
PDP-10 Archives
-
BB-H138F-BM_1988
-
7-sources/tichar.bli
There are 10 other files named tichar.bli in the archive. Click here to see a list.
%TITLE 'TICHAR - input a character'
MODULE TICHAR ( ! Input a character
IDENT = '3-003' ! File: TICHAR.BLI Edit: CJG3003
) =
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:
!
! Input a character.
!
! 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_INPCH from module TINPUT.
! 1-002 - Regularize headers. JBS 10-Mar-1981
! 1-003 - Revise journaling. JBS 22-Jun-1981
! 1-004 - Fix reading journal file. JBS 08-Jul-1981
! 1-005 - Don't flush the journal record in the middle of an escape sequence.
! JBS 08-Jul-1981
! 1-006 - Return 0 if the journal file ends. JBS 01-Oct-1981
! 1-007 - Use the global prompt string, if specified. JBS 21-Oct-1981
! 1-008 - Remove length of prompt string. JBS 23-Oct-1981
! 1-009 - Revise autorepeat logic, putting it in a subroutine. JBS 30-Jan-1982
! 1-010 - Flush the terminal buffer after turning off Autorepeat.
! JBS 31-Jan-1982
! 1-011 - Add JOU_VALID. JBS 09-Apr-1982
! 1-012 - Allow for 8-bit keyboards. JBS 17-Aug-1982
! 1-013 - Add SS3 for 8-bit keyboards. JBS 20-Aug-1982
! 1-014 - Revise read-ahead logic. JBS 02-Sep-1982
! 1-015 - Don't write out to the journal file here. 07-Oct-1982
! 1-016 - Add VT220 support conditional. JBS 11-Feb-1983
! 3-001 - Make argument to FLUSHJOUFI %C. GB 08-Mar-1983
! 3-002 - Remove VT220 conditional to speed up code. CJG 25-Nov-1983
! 3-003 - Check for VT52 and clear parity bit if it is a VT52. CJG 26-Jan-84
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$TI_INPCH;
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
LIBRARY 'EDTSRC:TRANSLATE';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$TI_INPCH - input a character'
GLOBAL ROUTINE EDT$$TI_INPCH ( ! Input a character
BUF ! Where to store character
) =
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine gets the next character from input. If recovery mode is on
! then the character is read from the journal file. If not, then we check
! to see if the character was read previously, and take it from the type-
! ahead character; otherwise, we read a chraracter from the terminal. If the
! character is not coming from the journal file, it is written to it.
!
! FORMAL PARAMETERS:
!
! BUF the address of a fullword in which the character is returned.
!
! IMPLICIT INPUTS:
!
! RCOV_MOD
! K_AUTRPT
! TIN_IRECEND
! RDAHEDBF
! RDAHED
! TIN_INREC
! TIN_IBUFPTR
! PMT_KPD
! PMT_NOKPD
! KPAD
!
! IMPLICIT OUTPUTS:
!
! TIN_IRECLEN
! RDAHED
! TIN_IBUFPTR
! JOU_VALID
!
! ROUTINE VALUE:
!
! 1 = got a character, 0 = end of journal file
!
! SIDE EFFECTS:
!
! May turn off auto-repeat.
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$RD_JOUTXT, ! Read a text record from the journal file
EDT$$OUT_FMTBUF,
EDT$$FMT_LIT,
EDT$$TI_GETCH,
EDT$$TI_BUFCH : NOVALUE,
EDT$$TI_ENBLAUTREP : NOVALUE; ! Enable and disable autorepeat
EXTERNAL
RCOV_MOD, ! Recovery mode flag
K_AUTRPT, ! Auto repeat flag
RDAHED, ! Type ahead counter
RDAHEDBF, ! Type ahead buffer
TIN_IBUFPTR : REF VECTOR, ! Pointer into journal input buffer
TIN_IRECLEN, ! Length of journal input record
TIN_INREC, ! Journal input record buffer
TIN_IRECEND, ! Pointer to end of journal input buffer
PMT_KPD : VECTOR, ! Counted ASCII string for keypad mode prompt
PMT_NOKPD : VECTOR, ! Counted ASCII string for nokeypad mode prompt
KPAD, ! 1 = keypad change mode, 0 = nokeypad change mode
TI_TYPE, ! Terminal type
JOU_VALID, ! 1 = journal record is valid
CHAR_INFO : BLOCKVECTOR [256, 1]; ! Information about characters
!+
! Check for recovery mode.
!-
IF .RCOV_MOD
THEN
BEGIN
!+
! Make sure we have a character in the buffer.
!-
WHILE (CH$PTR_EQL (.TIN_IBUFPTR, .TIN_IRECEND) OR (.TIN_IBUFPTR EQL 0)) DO
BEGIN
!+
! No characters left, try to read a new record from the journal
! file.
!+
IF EDT$$RD_JOUTXT (TIN_INREC, TIN_IRECLEN)
THEN
BEGIN
TIN_IRECEND = CH$PTR (TIN_INREC, .TIN_IRECLEN, BYTE_SIZE);
TIN_IBUFPTR = CH$PTR (TIN_INREC, 0, BYTE_SIZE);
END
ELSE
!+
! No more records in the journal file, arrange to return to the root.
!-
RETURN (0);
END;
!+
! Return next character from the journal buffer.
!-
.BUF = CH$RCHAR_A (TIN_IBUFPTR);
END
ELSE
!+
! Not in recovery mode, check for type ahead.
!-
BEGIN
!+
! If there are any characters in the type-ahead buffer, use the first.
! Otherwise block waiting for the user to type something.
!-
IF (.RDAHED GTR 0)
THEN
BEGIN
!+
! Return the oldest typed ahead character, and shuffle the buffer.
!-
RDAHED = .RDAHED - 1;
.BUF = CH$RCHAR (CH$PTR (RDAHEDBF,, BYTE_SIZE));
IF (.RDAHED GTR 0) !
THEN
CH$MOVE (.RDAHED, CH$PTR (RDAHEDBF, 1, BYTE_SIZE),
CH$PTR (RDAHEDBF, 0, BYTE_SIZE));
END
ELSE
BEGIN
!+
! Read the character from the terminal. Prompt first if requested.
!-
LOCAL
PROMPT_ADDR : REF VECTOR [8];
PROMPT_ADDR = (IF .KPAD THEN PMT_KPD ELSE PMT_NOKPD);
IF (.PROMPT_ADDR [0] GTR 0)
THEN
BEGIN
EDT$$FMT_LIT (CH$PTR (PROMPT_ADDR [1],, BYTE_SIZE), .PROMPT_ADDR [0]);
EDT$$OUT_FMTBUF ();
END;
EDT$$TI_GETCH (.BUF);
END;
!+
! Make sure the character is journaled.
!-
IF (.TI_TYPE EQL TERM_VT52) THEN .BUF = ..BUF AND %O'177';
EDT$$TI_BUFCH (..BUF);
JOU_VALID = 1;
!+
! If the character was an escape, CSI or SS3, turn auto-repeat off.
! This also disables dumping the journal buffer, so that a
! journal record can contain an entire escape or control sequence.
!-
IF .CHAR_INFO [..BUF, CI_ESC]
THEN
BEGIN
EDT$$TI_ENBLAUTREP (0);
EDT$$OUT_FMTBUF ();
END;
END;
RETURN (1);
END; ! of routine EDT$$TI_INPCH
END
ELUDOM