## error.api
# Compiled by:
#
src/lib/c-kit/src/parser/c-parser.sublib### "There is no danger that Titanic will sink.
### The boat is unsinkable and nothing but inconvenience
### will be suffered by the passengers."
###
### -- Phillip Franklin, White Star Line vice-president, 1912
stipulate
package fil = file__premicrothread; # file__premicrothread is from
src/lib/std/src/posix/file--premicrothread.pkg package pp = old_prettyprinter; # old_prettyprinter is from
src/lib/prettyprint/big/src/old-prettyprinter.pkgherein
api Error {
#
Error_State;
#
# Holds the information related to error reporting, including counters
# for errors and warnings and upper bounds thereon.
# Global limit variables:
errors_limit: Ref( Int ); # Caps number of errors reported on an error state. (See make_error_state.)
warnings_limit: Ref( Int ); # Caps number of warnings reported on an error state. (See make_error_state.)
# Creating Error_States:
#
make_error_state: fil::Output_Stream -> Error_State;
#
# mk_error_state (os): make an error state with destination Output_Stream os.
# Uses the current values of errorsLimit and warningsLimit as upper bounds
# on numbers of errors and warnings reported via the resulting errorState.
bug: Error_State -> String -> Void;
#
# Report internal bug.
# Generating warning messages:
warning: (Error_State, line_number_db::Location, String) -> Void;
#
# warning (es, loc, message): the message and location loc will be printed
# to the destination Output_Stream component of es
warningf
:
(Error_State, line_number_db::Location, String, List( sfprintf::Printf_Arg ) )
->
Void;
#
# warning (es, loc, message, items): the message and location loc and
# formated representation of items will be printed to the destination
# Output_Stream component of es
no_more_warnings
:
Error_State -> Void;
#
# Turn off printing of warning messages for the given Error_State.
# Generating error messages:
hint: String -> Void;
#
# MAGIC (i.e. really gross hack) that allows you to insert hints
# that will be utilized by the next call to error. This was introduced
# to support better parser error messages. The next call to error will
# consume the hint, so it only applies to the next error. Typically
# it is a hint as to why the error occurred.
error: (Error_State, line_number_db::Location, String) -> Void;
#
# warning (es, loc, message): the message and location loc will be printed
# to the destination Output_Stream component of es
errorf: (Error_State, line_number_db::Location, String, List( sfprintf::Printf_Arg ) ) -> Void;
#
# warning (es, loc, message, items): the message and location loc and
# formated representation of items will be printed to the destination
# Output_Stream component of es
no_more_errors: Error_State -> Void;
#
# Turn off printing of warning messages for the given Error_State
prettyprint_error
:
(Error_State, line_number_db::Location, (pp::Ppstream -> Void))
->
Void;
#
# Prettyprint an error message on the error stream.
err_stream
:
Error_State -> fil::Output_Stream;
#
# Return the destination Output_Stream of the Error_State.
error_count
:
Error_State -> Int;
#
# Return n, if there have been n>0 errors reported on the state since
# it was initialized or last reset.
warning_count
:
Error_State -> Int;
#
# Returns n, if there have been n>0 warnings reported on the state since
# it was initialized or last reset
reset
:
Error_State -> Void;
#
# Clears the error and warnings counts.
};
end;
## COPYRIGHT (c) 1992 AT&T Bell Laboratories
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.