Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-07 - decus/20-0172/utilit.bli
There is 1 other file named utilit.bli in the archive. Click here to see a list.
!<BLF/lowercase_user>
!<BLF/uppercase_key>
!<BLF/synonym iob = x>
!<BLF/synonym data = x>
!<BLF/synonym characters = x>
MODULE utilit (
	! Error handling for BLISS Language Formatter.

%IF %BLISS (BLISS32)
%THEN
		ADDRESSING_MODE (EXTERNAL = LONG_RELATIVE, 		!
		NONEXTERNAL = LONG_RELATIVE) ,
%FI

		IDENT = '8.2'
		) =
BEGIN

!++
! FACILITY:
!	Part of BLISS Language Formatter,
!	Usable on all systems supporting Common BLISS.
!
! Abstract:
!	This module handles all error conditions detected during
!	execution of the BLISS Lnanguage Formatter. These errors may be
!	of the following general types:
!	1) Syntax. The BLISS input text is locally unrecognizable
!		(spelling errors, etc.)
!	2) Internal logic. Attempts to read beyond eof in the input
!		stream, etc.
!	3) Character errors. E.g., name beginning with '@'.
!	4) Warnings. Failure to close a quoted string, e.g.
!
! Environment: Transportable, with Xport
!
!
! REVISION HISTORY
!
!	12-Feb-82	TT	Don't say anything to terminal unless
!				(new) switch sw_log is on.
!
!	26-Feb-82	TT	Turn on new flag errors_found if we've
!				detected a parsing error.
!
! END OF REVISION HISTORY
!
!--

!<BLF/page>
!
! Table of contents:
!

FORWARD ROUTINE
    utl$error : NOVALUE,			! Error handler.
    utl$init : NOVALUE;				! Table initializer.

!
! Include files:
!

REQUIRE 'BLFMAC';

REQUIRE 'BLFCSW';		! Defines control switches, i.e. 'sw_...'

REQUIRE 'BLFIOB';		! Defines in_iob, etc.

REQUIRE 'UTLCOD';		! Defines error codes, i.e. 'er_...'

!
! Macros:
!

MACRO
    error (name, sev, mess) =
	er_length [name] = %CHARCOUNT (mess);	!
	er_table [name] = UPLIT (mess); 	!
	er_severity [name] = sev  %;

!
! Equated symbols:
!

LITERAL
    true = 1,
    false = 0;

!
! Own storage:
!

OWN
    line : VECTOR [CH$ALLOCATION (120)],				! Space to build error messages.
    er_length : VECTOR [maxerr],					! Lengths of error messages
    er_table : VECTOR [maxerr],						! PLITS to messages
    er_severity : VECTOR [maxerr];					! error severity codes

!
! External references:
!

EXTERNAL ROUTINE
    ctl$switch,								! Contrl
    lst$line : NOVALUE,							! LSTING
    lst$on,								! LSTING
    out$break : NOVALUE,						! Output
    out$on,								! Output
    out$space : NOVALUE;

EXTERNAL
    errors_detected;
GLOBAL ROUTINE utl$error (er_code) : NOVALUE = 				!

!++
! Functional description:
!
!	This routine writes a special comment line to the output file
!	in the form:
!	!!ERROR!! text
!	where 'text' describes the type of error detected in the
!	following line. The offending line may be broken at the
!	point at which the error was detected, in some instances.
!
! Formal parameters:
!
!	er_code	: Code identifying the error.
!
! Implicit inputs:
!
!	None
!
! Implicit outputs:
!
!	None
!
! Routine value:
!
!	None
!
! Side effects:
!
!	None
!
!--

!<BLF/page>
    BEGIN

    errors_detected = true;

    !+
    ! Build the error message from the table entry corresponding
    ! to the formal parameter.
    !-

    CH$MOVE (10, CH$PTR (UPLIT ('!!ERROR!! ')), CH$PTR (line));
    CH$MOVE (.er_length [.er_code], CH$PTR (.er_table [.er_code]), 	!
	CH$PLUS (CH$PTR (line), 10));

    IF ctl$switch (sw_error)
    THEN
	BEGIN
	out$break ();

	IF out$on ()
	THEN
	    $xpo_put (					!
		string = (10 + .er_length [.er_code], CH$PTR (line)),	!
		iob = out_iob);

	IF lst$on () THEN lst$line (10 + .er_length [.er_code], CH$PTR (line));

	END
    ELSE
	out$space (1);							! Insure lexeme separation

    CH$WCHAR (%C'?', CH$PTR (line));					! Modify line for batch files
    IF ctl$switch (sw_log)
    THEN
        $xpo_put (					
	    string = (10 + .er_length [.er_code], CH$PTR (line)),	!
	    iob = tty_iob);

    !+
    !	Check severity of error.
    !-

    SELECTONE .er_severity [.er_code] OF
	SET

	[warning, serious] :

	    !+
	    ! Warning: Return to processor.
	    !-

	    RETURN;

	[OTHERWISE] :
	    BEGIN

	    !+
	    ! Terminate processing of module.
	    !-

	    out$break ();						! Clear out last buffer.
	    $xpo_close ( IOB = out_iob);
	    $xpo_close ( IOB = list_iob);
	    $xpo_put (					!
		string = (50, CH$PTR (UPLIT (		!
		    '!!!WARNING!!! Files may have been damaged'))),
		iob = tty_iob);
	    END;
	TES;

    END;								! End of routine 'utl$error'
GLOBAL ROUTINE utl$init : NOVALUE = 					!

!++
! Functional description:
!
!	Assigns values to the error codes.
!
! Formal parameters:
!
!	None
!
! Implicit inputs:
!
!	None
!
! Implicit outputs:
!
!	None
!
! Routine value:
!
!	None
!
! Side effects:
!
!	None
!
!--

    BEGIN
    error (er_tok, warning, 'Token is too long to fit on line.');
    error (er_pthen, serious, '''%THEN'' missing.');
    error (er_eof, fatal, 'Attempted read past end-of file.');
    error (er_ill_sym, serious, 'Illegal symbol encountered.');
    error (er_quote, warning, 'Expected quote missing.');
    error (er_rparen, serious, 'Expected '')'' missing.');
    error (er_pmodule, serious, 'Syntax error in module header.');
    error (er_colon, serious, 'Expected '':'' missing.');
    error (er_block_start, serious, '''BEGIN'' or ''('' missing.');
    error (er_end_block, serious, 'Incorrect block ending.');
    error (er_plit_rparen, serious, ''')'' missing in PLIT.');
    error (er_plit_body, serious, 'Syntax error in PLIT body.');
    error (er_equal, serious, 'Expected ''='' missing.');
    error (er_string, serious, 'Expected string missing.');
    error (er_name, serious, 'Expected name missing.');
    error (er_formal_list, serious, 'Syntax Error in list of formal parameters.');
    error (er_macro_body, serious, 'Syntax error in macro body.');
    error (er_rbracket, serious, 'Expected '')'' missing.');
    error (er_end_macro, serious, 'Expected ''%'' missing.');
    error (er_name_list, serious, 'Wrong close of name list.');
    error (er_semi_decl, serious, ''';'' missing from list of declarations.');
    error (er_inv_bracket, serious, 'Wrong closing bracket used.');
    error (er_primary, serious, 'Syntax error in primary.');
    error (er_then, serious, '''THEN'' missing.');
    error (er_of, serious, '''OF'' missing.');
    error (er_set, serious, '''SET'' missing.');
    error (er_tes, serious, '''TES'' missing.');
    error (er_to, serious, '''TO'' missing.');
    error (er_from, serious, '''FROM'' missing.');
    error (er_set_tes, serious, 'Improper syntax in SET...TES.');
    error (er_do, serious, '''DO'' missing.');
    error (er_post_test, serious, 'Expected ''UNTIL'' OR ''WHILE'' missing.');
    error (er_file_spec, serious, 'Cannot open specified file.');
    error (er_syn_def, serious, 'Error in synonym definition.');
    error (er_stge_class, serious, 'Storage class missing.');
    error (er_then_else, serious, 'Dangling THEN or ELSE.');
    END;
%TITLE 'Last page of UTILIT.BLI'
END

ELUDOM