Trailing-Edge
-
PDP-10 Archives
-
decuslib10-11
-
43,50544/format.t20
There is 1 other file named format.t20 in the archive.  Click here to see a list.
MODULE format (
		MAIN = fmain,
%IF %BLISS (BLISS32)
%THEN
		ADDRESSING_MODE (EXTERNAL = LONG_RELATIVE,
		NONEXTERNAL = LONG_RELATIVE) ,
%FI
		IDENT = '8.3'
		) =
BEGIN
!++
! Facility: BLISS Language Formatter
!
! Abstract:
!
!	This module contains the main program for the
!	BLISS Language Formatter.
!
! Environment: Transportable, with XPORT
!		Called from BLF$MAIN in BLFxxx.BLI
!
!
! REVISION HISTORY
!
!	19-Oct-81	TT	Went from V6.3 to V7.0
!				Pretty V7.0 has various bug fixes and handles
!				all new syntax for Bliss V2.1 and V3.0
!
!	 9-Nov-81	TT	Was using BLISS36 as check for whether or not
!				to include timing info. Removed this and let
!				the %var = 10 do the job. We were getting the
!				timing stuff for TOPS-20 and it doesn't work
!				there.
!
!	13-Nov-81	TT	Had to bump version to 8 as TOPS-10 was already
!				running 7.0
!
!	20-Jan-82	TT	Version number to 8.1
!
!	25-Feb-82	TT	Bop version to 8.2 for shipment with Bliss V3.
!
!	25-Feb-82	TT	Moved the message giving the version number
!				into Module BLFT20.BLI. That way we can verify
!				the it gets written only once. Also makes this
!				version look more like it's brother for TOPS-10
!				and VAX; leading toward a unified module in the
!				future.
!
!	26-Feb-82	TT	If new flag Errors_detected is set and /LOG not
!				present, inform the user that errors occurred
!				during parsing.
!
! END OF REVISION HISTORY
!--
!
! Table of contents:
!--
FORWARD ROUTINE
    fmain : NOVALUE;
!
! Include files:
!--
REQUIRE 'BLFCSW';
REQUIRE 'BLFMAC';			! Defines macros 'lex', 'msg', etc.
REQUIRE 'BLFIOB';			! Declares external iobs used by Xport
!
! Macros:
!--
!
! Equated symbols:
!--
!
! Own storage:
!--
LITERAL
    true = 1 EQL 1,
    false = 1 NEQ 1;
%IF false
%THEN
    OWN
	line : VECTOR [CH$ALLOCATION (23)];	! For TOPS-10 timing report
%FI
GLOBAL
    errors_detected;
GLOBAL LITERAL
    input_unit = 0,
    output_unit = 1,
    require_unit = 2,
    listing_unit = 3;
!
! External references:
!--
EXTERNAL ROUTINE
    cli$open,					! Command Language Interface ( BLFCLI)
    ctl$init : NOVALUE,				! Initialize control variables (CONTRL)
    ctl$switch,
    lex$init : NOVALUE,				! Initialize Lexical processor
    lst$init : NOVALUE,				! Initialize listing routines
    out$nit : NOVALUE,				! Initialize output (OUTPUT)
    prs$main : NOVALUE,				! Begin formatting (PARSE1)
    scn$init : NOVALUE,				! Initialize scan (SCANNR)
    utl$init : NOVALUE;				! Initialize error messages (UTILIT)
EXTERNAL
    in_okay,
    list_okay,
    out_okay;
GLOBAL ROUTINE fmain : NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
!	Main routine of the BLISS Language Formatter (BLF)
!	1. Initializes all subordinate modules
!	2. Invokes parser/formatter
!	3. Closes major files
!
! Formal parameters:
!
!	None
!
! Implicit inputs:
!
!	None
!
! Implicit outputs:
!
!	None
!
! Routine value:
!
!	None
!
! Side effects:
!
!	None
!
!--
    BEGIN
    LOCAL
	ctrl_z;					! Flag for end-of-file
    $xpo_iob_init (
	file_spec = $xpo_output,
	iob = tty_iob);
    $xpo_open (
	options = output,
	iob = tty_iob);
    utl$init ();				! In case of errors in the command line
    UNTIL ctrl_z = cli$open () DO		! Process continues until ctrl-z
						!. or ctrl-c is typed.
	BEGIN
%IF false
%THEN
	    tim$set_clocks ();			! Begin timing
%FI
	errors_detected = false;
	ctl$init ();
	scn$init ();
	lst$init ();
	out$nit ();
	lex$init ();
	utl$init ();
	prs$main ();
%IF false
%THEN
	    cli$rename ();			! Rename .bli ->.blf, .tmp->.bli
%FI
	IF .errors_detected AND NOT ctl$switch (sw_log)
	THEN
	    msg ('% Errors detected parsing input file.');
	IF .in_okay
	THEN
	    $xpo_close (iob = in_iob);
	IF .list_okay
	THEN
	    $xpo_close (iob = list_iob);
	IF .out_okay
	THEN
	    $xpo_close (iob = out_iob);
%IF false
%THEN
	    CH$MOVE (15, CH$PTR (UPLIT('CPU time =     ')), CH$PTR (line));
	    tim$format (tim$_read_cpu (), CH$PTR (line, 15));
	    WRITE (unit = -1, lth = 23, ptr = CH$PTR (line));
	    CH$MOVE (15, CH$PTR (UPLIT('Elapsed time = ')), CH$PTR (line));
	    tim$format (tim$read_wall (), CH$PTR (line, 15));
	    WRITE (unit = -1, lth = 23, ptr = CH$PTR (line));
%FI
	END;
    END;						! End of routine 'fmain'
%TITLE 'Last page of FORMAT.T20'
END							! End of FORMAT
ELUDOM