Google
 

Trailing-Edge - PDP-10 Archives - tops20-v7-ft-dist1-clock - 7-sources/fcolinc.bli
There are 10 other files named fcolinc.bli in the archive. Click here to see a list.
 %TITLE 'FCOLINC - compute formatted character width'
MODULE FCOLINC (				! Compute formatted character width
		IDENT = '3-003'			! File: FCOLINC.BLI Edit: GB3003
		) =
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:
!
!	Compute formatted character width.
!
! 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_CHWID  from module FORMAT.
! 1-002	- Regularize headers.  JBS 05-Mar-1981
! 1-003 - Change length of form feed string. STS 08-Oct-1981
! 1-004	- Add support for DEC STD 169.  JBS 11-Aug-1982
! 1-005	- Remove ".L32".  JBS 12-Aug-1982
! 1-006	- Add conditional for VT220 support.  JBS 10-Feb-1983
! 1-007	- Deduce the width of unusual characters from their representation table.  JBS 04-Mar-1983
! 1-008	- Correct the computation for characters on an 8-bit terminal.  JBS 07-Mar-1983
! 3-001 - Use string ptr to access US_TXT.  GB 3-Feb-1983
! 3-002 - Add updates from V3 source kit. GB 27-Apr-1983
! 3-003 - Remove VT220 conditionals. CJG 25-Nov-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FMT_CHWID;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

LIBRARY 'EDTSRC:TRANSLATE';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FMT_CHWID  - compute formatted character width'

GLOBAL ROUTINE EDT$$FMT_CHWID (			! Compute formatted character width
	CHAR, 					! Character whose width to compute
	COLUMN					! Current column (for tabs)
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine computes the number of character positions a character would
!	take to display at a specified column.
!
! FORMAL PARAMETERS:
!
!  CHAR			The character to be displayed.
!
!  COLUMN		The starting column.  (0 is the first column on a line)
!
! IMPLICIT INPUTS:
!
!	US_TXT
!	EIGHT_BIT
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	The number of chraracter positions the character would occupy.
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL
	EIGHT_BIT,			! 1 = this is an eight-bit terminal
	CHAR_INFO : BLOCKVECTOR [256, 1],	! Table of information about characters
	CHAR_NAMES,			! Names of some characters
	CHAR_NAMES_LEN,			! Length of the names table
	US_TXT : VECTOR;

    LOCAL
	C;

    C = .CHAR AND %X'7F';

    SELECTONE .C OF
	SET

	[ASC_K_TAB] :
	    RETURN (8 - (.COLUMN MOD 8));

	[ASC_K_FF] :
	    BEGIN
	    LOCAL
		LEN;
	    LEN = ..US_TXT[1];
	    RETURN (.LEN);
	    END;

	[OTHERWISE] :
	    BEGIN

	    LOCAL
		LEN;

	    CASE .CHAR_INFO [.C, CI_DSP] FROM 0 TO 3 OF
		SET

		[0] :
		    RETURN (1);			! Normal character

		[1] :
		    RETURN (2);			! ^C

		[2] :
		    BEGIN			! <name>

		    IF (.EIGHT_BIT AND (.C GEQ %X'A0'))
		    THEN
			RETURN (1)
		    ELSE
			BEGIN
			LEN = 2 + .CHAR_INFO [.C, CI_LEN];
			RETURN (.LEN);
			END;

		    END;

		[3] :
		    RETURN (5);			! <Xnn>
		TES;

	    END;
	TES;

    END;					! of routine EDT$$FMT_CHWID

!<BLF/PAGE>
END						! of module EDT$FCOLINC

ELUDOM