Google
 

Trailing-Edge - PDP-10 Archives - tops20-v7-ft-dist1-clock - 7-sources/fcrlf.bli
There are 10 other files named fcrlf.bli in the archive. Click here to see a list.
 %TITLE 'FCRLF - put a crlf in the format buffer'
MODULE FCRLF (				! Put a crlf in the format buffer
		IDENT = '3-003'			! File: FCRLF.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:
!
!	Put a crlf in the format buffer.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: March 18, 1979
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 19-FEB-1981.  This module was created by
!	extracting routine EDT$$FMT_CRLF  from module FORMAT.
! 1-002	- Regularize headers.  JBS 05-Mar-1981
! 1-003	- Use the new formatting flags to control display at the bottom
!	   of the screen.  JBS 05-Jul-1982
! 1-004	- Stop the working message before printing the line.  JBS 07-Jul-1982
! 1-005	- Maintain the cursor position variables.  JBS 05-Oct-1982
! 1-006	- Be a little moe honest when maintaining the cursor position variables.  JBS 29-Oct-1982
! 3-001 - Use string pointers to manipulate CUR_BUF.  GB 14-Feb-1983
! 3-002 - Change method of moving FMT_BUF to prevent overlap problems. CJG 25-Mar-1983
! 3-003 - Add FMT_FREE to improve speed of format routines. CJG 11-Jan-1984
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FMT_CRLF;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FMT_CRLF  - put a crlf in the format buffer'

GLOBAL ROUTINE EDT$$FMT_CRLF 			! Put a crlf in the format buffer
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Terminate the current output line.  If we are in line mode, we can
!	just call EDT$$OUT_FMTBUF.  Otherwise there are two cases: normal
!	and displaying text at the bottom of the screen.  If things are
!	normal put a CR and LF into the format buffer.  Otherwise (we are in EXT)
!	just call EDT$$OUT_FMTBUF for the first line, but preceed subsequent lines
!	with CRLF.  If there is more than one line, flag that we need
!	"press return to continue" and a screen refresh when the operation
!	is complete.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	FMT_WRRUT
!	FMT_BOT
!	FMT_LCNT
!	FMT_CUR
!	FMT_FREE
!	SCR_LNS
!
! IMPLICIT OUTPUTS:
!
!	FMT_LNPOS
!	FMT_LCNT
!	MSGFLG
!	TXT_ONSCR
!	FMT_FREE
!	FMT_CUR
!	PRV_LN
!	PRV_COL
!
! ROUTINE VALUE:
!
!	Same as EDT$$OUT_FMTBUF, or 1.
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$OUT_FMTBUF,		! Output the format buffer to the screen
	EDT$$STORE_FMTCH : NOVALUE,	! Store a character into the format buffer
	EDT$$TI_WRSTR,			! String output routine
	EDT$$STOP_WKINGMSG : NOVALUE;	! Stop the "working" message

    EXTERNAL
	FMT_LNPOS,			! The current column number
	FMT_WRRUT,			! Routine to call to write the buffer
	FMT_BOT,			! 1 = we are printing at the bottom of the screen
	FMT_LCNT,			! Number of lines printed at the bottom of the screen
	FMT_BUF : VECTOR [FMT_BUFLEN],	! Format buffer
	FMT_CUR,			! Current location in the format buffer
	FMT_FREE,			! Space left in format buffer
	MSGFLG,				! 1 = erase the message line on the next keystroke
	TXT_ONSCR,			! Text on screen: use "Press return to continue"
	PRV_COL,			! Cursor column
	PRV_LN,				! Cursor line
	SCR_LNS;			! Number of lines in the scrolling area

    LOCAL
	PTR,
	STATUS;

    EDT$$STOP_WKINGMSG ();

    IF (.FMT_WRRUT NEQA EDT$$TI_WRSTR)
    THEN
	BEGIN
!+
! Since we are effectively outputting a CR and LF, the column is set to
! zero and the line increases by one, but not below the bottom of the screen.
!-
	PRV_COL = 0;

	IF (.PRV_LN LSS .SCR_LNS)	!
	THEN
	    PRV_LN = MIN (.SCR_LNS - 1, .PRV_LN + 1)
	ELSE
	    PRV_LN = .PRV_LN + 1;

	STATUS = EDT$$OUT_FMTBUF ();
	END
    ELSE
	BEGIN

	IF .FMT_BOT
	THEN
	    BEGIN

	    IF (.FMT_LCNT EQL 0)
	    THEN
		BEGIN
!+
! This is the first line printed in the message area at the bottom
! of the screen.
!-
		STATUS = EDT$$OUT_FMTBUF ();
		FMT_LCNT = 1;
		MSGFLG = 1;
		END
	    ELSE
		BEGIN
		PTR = CH$PTR (FMT_BUF,, BYTE_SIZE);
!+
! This is the second line to go into the message area.  Preceed the text with a CRLF,
! and adjust the column and line counters, assuming that there are no cursor
! positioning sequences or control characters in the format buffer.
!-

		IF (.PRV_LN LSS .SCR_LNS)	!
		THEN
		    PRV_LN = MIN (.SCR_LNS - 1, .PRV_LN + 1)
		ELSE
		    PRV_LN = .PRV_LN + 1;

		PRV_COL = FMT_BUFLEN - .FMT_FREE;
		EDT$$CPY_STR (FMT_BUFLEN - 2, .PTR, CH$PTR (FMT_BUF, 2, BYTE_SIZE));
		CH$WCHAR_A (ASC_K_CR, PTR);
		CH$WCHAR_A (ASC_K_LF, PTR);
		FMT_CUR = CH$PLUS (.FMT_CUR, 2);
		FMT_FREE = .FMT_FREE - 2;
		STATUS = EDT$$OUT_FMTBUF ();
		FMT_LCNT = .FMT_LCNT + 1;
		TXT_ONSCR = 1;
		END;

	    END
	ELSE
	    BEGIN
!+
! This line is not being placed at the bottom of the buffer.
!-
	    PRV_COL = 0;

	    IF (.PRV_LN LSS .SCR_LNS)	!
	    THEN
		PRV_LN = MIN (.SCR_LNS - 1, .PRV_LN + 1)
	    ELSE
		PRV_LN = .PRV_LN + 1;

	    EDT$$STORE_FMTCH (ASC_K_CR);
	    EDT$$STORE_FMTCH (ASC_K_LF);
	    STATUS = 1;
	    END;

	FMT_LNPOS = 0;
	END;

    RETURN (.STATUS);
    END;					! of routine EDT$$FMT_CRLF


END
ELUDOM