Trailing-Edge
-
PDP-10 Archives
-
BB-AE97C-BM
-
sources/chmchkcc.bli
There are 11 other files named chmchkcc.bli in the archive. Click here to see a list.
%TITLE 'CHMCHKCC - check for control C'
MODULE CHMCHKCC ( ! Check for control C
IDENT = '3-005' ! File: CHMCHKCC.BLI Edit: CJG3005
) =
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:
!
! This module checks to see if a CTRL/C has been typed.
!
! ENVIRONMENT: Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: Unknown
!
! MODIFIED BY:
!
! 1-001 - Original. DJS 04-Feb-1981. This module was created by
! extracting routine EDT$$CHK_CC from module CHANGE.BLI.
! 1-002 - Regularize headers and remove control C checking, since we intend to
! re-do it to support journaling. JBS 27-Feb-1981
! 1-003 - Fix module name. JBS 02-Mar-1981
! 1-004 - Revise journaling to support control C. JBS 22-Jun-1981
! 1-005 - Add logic for recovering during control C. JBS 18-Dec-1981
! 1-006 - Debug control C journaling. JBS 24-Dec-1981
! 1-007 - Change names of control C data. JBS 29-Dec-1981
! 1-008 - Use two words for control C counters. JBS 30-Dec-1981
! 1-009 - Print the 'working' message from this routine. JBS 13-Jan-1982
! 1-010 - Use symbols instead of magic numbers for control C journaling. JBS 24-May-1982
! 1-011 - Change the format of the working message. SMB 28-Jun-1982
! 1-012 - Figure out whether the journal buffer should be flushed. STS 28-Sep-1982
! 1-013 - Don't destroy the cursor position, it is now being maintained accurately. JBS 07-Oct-1982
! 1-014 - Clear EDT$$G_SECOND after printing or erasing the working message, so
! we do not spend all our time printing the working message on slow terminals. JBS 07-Oct-1982
! 3-001 - Add updates from V3 sources. GB 26-Apr-1983
! 3-002 - Fix working message for TOPS-20 operation. CJG 15-Jun-1983
! 3-003 - Modify Control-C code slightly. CJG 17-Jun-1983
! 3-004 - Simplify the timer again. CJG 24-Nov-1983
! 3-005 - Modify ASSERT macro to include error code. CJG 30-Jan-1984
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$CHK_CC; ! Check to see if a CTRL/C has been typed
!
! INCLUDE FILES:
!
REQUIRE 'SYS:JSYS';
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
LITERAL
JOU_MAX = 20,
WORK_COL = 26;
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$CHK_CC - check for control C'
GLOBAL ROUTINE EDT$$CHK_CC ! Check for control C
=
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine checks to see if a CTRL/C has been typed.
! It is called frequently enough that the response to typing a control C
! is reasonably fast. It keeps track of how often it has been called
! since the last journal record was written so it can do the same during
! recovery.
!
! This routine is also responsible for printing the 'working' message.
! The flag SECOND is set once a second by an AST. If it is set
! this routine clears it and either prints or erases the 'working' message.
!
! FORMAL PARAMETERS:
!
! NONE
!
!IMPLICIT INPUTS:
!
! FMT_WRRUT
! MESSAGE_LINE
! RCOV_MOD
! CC
! CC_CNT1
! CC_CNT2
! CC_FLAG
! SECOND
! WORKCOUNT
!
! IMPLICIT OUTPUTS:
!
! CC_CNT1
! CC_CNT2
! CC_FLAG
! SECOND
! WORKCOUNT
!
! ROUTINE VALUE:
!
! 0 no control C typed
! 1 control C was typed
!
! SIDE EFFECTS:
!
! May print or erase the 'working' message.
!
!--
BEGIN
EXTERNAL
PUT_JOU, ! Flag to put journal buffer
TIN_OBUFPOS, !
FMT_WRRUT, ! Address of output formatter
MESSAGE_LINE, ! Working on this line + 1
CC : VOLATILE, ! 1 = a control C has been typed
CC_CNT1, ! Counts number of "no control C's" returned.
CC_CNT2, ! Loaded with value from control C record
CC_FLAG, ! 1 = a control C record was read or written
RCOV_MOD, ! 1 = /RECOVER
SECOND : VOLATILE, ! Set once a second
WORKCOUNT; ! Counter to support the 'working' message
EXTERNAL ROUTINE
EDT$$TI_WRSTR, ! String format for working
EDT$$OUT_FMTBUF, ! Output format buffer to terminal
EDT$$SC_ERATOEOL, ! Erase to end of current line
EDT$$SC_POSCSIF, ! Absolute cursor positioning
EDT$$SC_REVID : NOVALUE, ! Set screen to reverse video
EDT$$MSG_TOSTR, ! Write out the working message
EDT$$TI_FLUSHJOUFI : NOVALUE; ! Write a record on the journal file
LOCAL
FORMAT_ROUTINE; ! Save the format routine entered with
MESSAGES ((WORKING));
!+
! If a second has passed since we were last here, print or erase the
! 'working' message.
!-
IF ((.WORKCOUNT GEQ 0) AND (.SECOND NEQ 0))
THEN
BEGIN
WORKCOUNT = .WORKCOUNT + 1;
FORMAT_ROUTINE = .FMT_WRRUT;
FMT_WRRUT = EDT$$TI_WRSTR;
EDT$$SC_POSCSIF (.MESSAGE_LINE + 1, WORK_COL);
EDT$$SC_REVID ();
IF .WORKCOUNT THEN EDT$$MSG_TOSTR (EDT$_WORKING) ELSE EDT$$SC_ERATOEOL ();
EDT$$OUT_FMTBUF ();
FMT_WRRUT = .FORMAT_ROUTINE;
SECOND = 0;
END;
!+
! If we are in recovery mode, use the counters to
! simulate typing a control C at the right point.
!-
IF .RCOV_MOD
THEN
BEGIN
!+
! If CC_FLAG is zero, there has been no control C record.
!-
IF (.CC_FLAG EQL 0) THEN RETURN (0);
!+
! If the counters match, it is time to return a control C.
!-
IF (.CC_CNT1 EQL .CC_CNT2)
THEN
BEGIN
PUT_JOU = 1;
RETURN (1);
END;
!+
! Otherwise, we are one count closer to a control C.
!-
CC_CNT1 = .CC_CNT1 + 1;
ASSERT (4, .CC_CNT1 LEQ CC_CTR_MAX);
RETURN (0);
END
ELSE
BEGIN
!+
! We are not recovering.
!-
IF (.CC NEQ 0)
THEN
BEGIN
!+
! A control C was typed. Write out a control C record in case
! we must recover to this point, unless we have already written it.
!-
PUT_JOU = 1;
IF (.CC_FLAG EQL 0)
THEN
BEGIN
EDT$$TI_FLUSHJOUFI (%C'C');
CC_FLAG = 1;
END;
RETURN (1);
END;
!+
! Keep track of the number of times we are called but no control C has
! been typed; that is, count the number of times we return 0. This
! number will be written to the journal file later, when and if we see a
! control C, so that we can read it into the second counter on recovery,
! and thus return 1 at the same point in EDT's execution.
!-
CC_CNT1 = .CC_CNT1 + 1;
ASSERT (4, .CC_CNT1 LEQ CC_CTR_MAX);
!+
! check to see if the journal buffer should be written out and
! the control-c counter restarted
!-
IF (.TIN_OBUFPOS GEQ JOU_MAX) THEN PUT_JOU = 1;
RETURN (0);
END;
END;
END
ELUDOM