Google
 

Trailing-Edge - PDP-10 Archives - BB-H138F-BM_1988 - 7-sources/ticlraud.bli
There are 10 other files named ticlraud.bli in the archive. Click here to see a list.
 %TITLE 'TICLRAUD - flush journal file'
MODULE TICLRAUD (				! Flush journal file
		IDENT = '3-002'			! File: TICLRAUD.BLI Edit: CJG3002
		) =
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:
!
!	Flush journal file.
!
! 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_FLUSHJOUFI  from module TINPUT.
! 1-002	- Regularize headers.  JBS 11-Mar-1981
! 1-003	- Add parameter to routine and flag to record.  JBS 18-Jun-1981
! 1-004	- Make record flag compatible with EDT V2.  JBS 07-Jul-1981
! 1-005	- Fix a bug in control C processing.  JBS 17-Dec-1981
! 1-006	- Continue to debug control C processing.  JBS 24-Dec-1981
! 1-007	- Revise control C data names.  JBS 29-Dec-1981
! 1-008	- Use two words for control C counters.  JBS 30-Dec-1981
! 1-009	- Decrease stack usage.  JBS 27-Jan-1982
! 1-010	- We must write 0-length journal records.  JBS 01-Apr-1982
! 1-011	- We must not write a record unless it has been marked valid.  JBS 09-Apr-1982
! 1-012	- Use symbols instead of magic numbers in control C journaling.  JBS 24-May-1982
! 3-001 - Fix journal file for TOPS-20 operation. CJG 15-Jun-1983
! 3-002 - Modify ASSERT macro to include error code. CJG 30-Jan-1984
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$TI_FLUSHJOUFI : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

REQUIRE 'SYS:JSYS';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$TI_FLUSHJOUFI  - flush journal file'

GLOBAL ROUTINE EDT$$TI_FLUSHJOUFI (		! Flush journal file
    RECORD_TYPE					! text or control C
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine writes either a text record or a control C record.
!	A text record is taken from the journal buffer.  A control C record
!	consists of the count of the number of times we tested for control C
!	and didn't find it.  Upon writing either record the control c counter
!	is cleared; thus it records the number of tests since the last journal
!	record.
!
! FORMAL PARAMETERS:
!
!	RECORD_TYPE	ASCII 'T' for a text record, ASCII 'C' for a control C record.
!
! IMPLICIT INPUTS:
!
!	TIN_OBUF
!	TIN_OBUFPOS
!	CC_CNT1
!	JOU_VALID
!
! IMPLICIT OUTPUTS:
!
!	TIN_OBUFPOS
!	JOU_VALID
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$JOU_PUTREC;

    EXTERNAL
	TIN_OBUF : VECTOR [CH$ALLOCATION (256, BYTE_SIZE)],
					! The journal buffer
	TIN_OBUFPOS,			! Position in journal output buffer
	CC_CNT1,			! Number of control C tests
	JOU_VALID;			! 1 = journal record is valid

    LOCAL
	PTR,
	JOURNAL_RECORD : VECTOR [CH$ALLOCATION (CC_REC_SIZE, BYTE_SIZE)];
					! For building the control C record

!+
! Make sure the control C counter is reasonable.
!-
    ASSERT (4, .CC_CNT1 LEQ CC_CTR_MAX);

    SELECTONE .RECORD_TYPE OF
	SET

	[%C'T'] : 				! Output a text record
	    BEGIN
	    ASSERT (25, .TIN_OBUFPOS LEQ 256);
	    ASSERT (25, .TIN_OBUFPOS GEQ 0);

	    IF (.TIN_OBUFPOS GTR 0) THEN ASSERT (13, .JOU_VALID);

	    IF .JOU_VALID
	    THEN
		BEGIN
		EDT$$JOU_PUTREC (TIN_OBUF [0], .TIN_OBUFPOS);
		TIN_OBUFPOS = 0;
		JOU_VALID = 0;
		END;

	    END;

	[%C'C'] : 				! Output a control C record
	    BEGIN
!+
! A control-C record consists of a journal file escape character, a flag to
! indicate that this is a control-C record, and the CC_CNT1 value stored as
! 12 octal ascii bytes.
!-

	    PTR = CH$PTR (JOURNAL_RECORD,, BYTE_SIZE);
	    CH$WCHAR_A (JOU_REC_ESC, PTR);	 ! Flag as non-text record
	    CH$WCHAR_A (CC_REC_FLAG, PTR);	 ! Control-C record
	    _NOUT (.PTR, .CC_CNT1,
		NO_MAG + NO_LFL + NO_ZRO + FLD (12, NO_COL) + 10);
	    EDT$$JOU_PUTREC (JOURNAL_RECORD, CC_REC_SIZE);
	    END;

	[OTHERWISE] :
	    ASSERT (13, 0);
	TES;

    END;					! of routine EDT$$TI_FLUSHJOUFI


END
ELUDOM