w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Error Class Reference

#include <error.hpp>

Collaboration diagram for Error:
[legend]

Classes

struct  Cleanup
 
struct  Policy
 

Public Types

enum  level_t {
  ASSERT =4 , FATAL =3 , EERROR =2 , ERROR_CONT =-2 ,
  WARNING =-3 , WARNING_DEFER =-4 , NOTICE =-5 , NOTICE_DEFER =-6 ,
  INFO =-111 , DEBUG =-222
}
 

Static Public Member Functions

static char constlevel2str (level_t level)
 
static GenBuffer::Writablesev (level_t level)
 
static void pushPolicy (level_t killer_, level_t printed_, level_t recorded_, GenBuffer::Writable *err=(GenBuffer::Writable *)((void *) 0))
 
static SimBuffer::BgetRecorded ()
 
static void popPolicy ()
 
static void setTopPrinted (level_t printed_)
 
static level_t getTopPrinted ()
 
static CleanupnewCleanup (Cleanup::handler_t handler, void *data, slen_t bufSize)
 
static CleanupnewCleanup (Cleanup::handler_t handler, void *data, char const *bufCstr)
 
static int runCleanups (int exitCode)
 
static void cexit (int exitCode)
 

Static Public Attributes

static char constbanner0 =(char const*) ((void*)0)
 
static char constargv0 =(char const*) ((void*)0)
 
static char consttmpargv0 =(char const*)"pRg_tMp"
 
static char constlong_argv0 =(char const*) ((void*)0)
 
static GenBuffer::Writableserr = &serr_default
 

Static Protected Attributes

static Policypolicy_top =&defaultPolicy
 
static Policypolicy_bottom =&defaultPolicy
 
static Cleanupfirst_cleanup =(Error::Cleanup*) ((void*)0)
 

Friends

GenBuffer::Writableoperator<< (GenBuffer::Writable &, Error *)
 

Detailed Description

This may be usafe if an error happens inside an error. Usage: Error::sev(Error::WARNING) << "Zero-length image." << (Error*)0;

Definition at line 20 of file error.hpp.

Member Enumeration Documentation

◆ level_t

Error types.

Enumerator
ASSERT 
FATAL 
EERROR 
ERROR_CONT 
WARNING 
WARNING_DEFER 
NOTICE 
NOTICE_DEFER 
INFO 
DEBUG 

Definition at line 27 of file error.hpp.

Member Function Documentation

◆ cexit()

void Error::cexit ( int  exitCode)
static

Definition at line 168 of file error.cpp.

References exit().

Referenced by cleanup(), and run_sam2p_engine().

◆ getRecorded()

SimBuffer::B * Error::getRecorded ( )
static
Returns
the messages already recorded, and clears the ‘record’ entry of the current policy. The caller is responsible for deleting the pointer returned. May return NULLP for empty records. Typical example: delete Error::getRecorded();

Definition at line 115 of file error.cpp.

References NULLP, policy_top, Error::Policy::record, and ret.

Referenced by Rule::applyProfile(), and Rule::buildProfile().

◆ getTopPrinted()

Error::level_t Error::getTopPrinted ( )
static

Definition at line 125 of file error.cpp.

References policy_top, and Error::Policy::printed.

Referenced by Rule::applyProfile(), Rule::buildProfile(), and run_sam2p_engine().

◆ level2str()

char const * Error::level2str ( level_t  level)
static

Returns address to statically allocated buffer.

Definition at line 44 of file error.cpp.

References ASSERT, DEBUG, EERROR, ERROR_CONT, FATAL, INFO, level, NOTICE, NOTICE_DEFER, WARNING, and WARNING_DEFER.

Referenced by sev().

◆ newCleanup() [1/2]

Error::Cleanup * Error::newCleanup ( Cleanup::handler_t  handler,
void data,
char const bufCstr 
)
static

Creates and returns a new Cleanup, and registers it in front of the existing ones. Copies ‘handler’ and ‘data’ to it. Also allocates strlen(bufCstr)+1 bytes of char[] buffer (at result->getBuf()) owned by the cleanup, and initializes it from bufCstr.

Doesn't take ownership of ‘handler’, takes ownership of ‘data’. ‘handler’ must delete ‘data’ or pass on ownership when called, typically by runCleanups().

Definition at line 191 of file error.cpp.

References data, Error::Cleanup::getBuf(), memcpy, newCleanup(), and strlen().

◆ newCleanup() [2/2]

Error::Cleanup * Error::newCleanup ( Cleanup::handler_t  handler,
void data,
slen_t  bufSize 
)
static

Creates and returns a new Cleanup, and registers it in front of the existing ones. Copies ‘handler’ and ‘data’ to it. Also allocates ‘bufSize’ bytes of char[] buffer (at result->getBuf()) owned by the cleanup, but doesn't initialize the buffer.

Doesn't take ownership of ‘handler’, takes ownership of ‘data’. ‘handler’ must delete ‘data’ or pass on ownership when called, typically by runCleanups().

Definition at line 176 of file error.cpp.

References Error::Cleanup::bufSize, data, Error::Cleanup::data, first_cleanup, Error::Cleanup::handler, Error::Cleanup::next, and param_assert.

Referenced by newCleanup(), and Files::tmpRemoveCleanup().

◆ popPolicy()

void Error::popPolicy ( )
static

Prints all recorded error messages, and removes the topmost element of the policy stack. Typical example: delete Error::getRecorded(); popPolicy();

Definition at line 127 of file error.cpp.

References ASSERT, SimBuffer::B::begin_(), Error::Policy::err, SimBuffer::Flat::getLength(), Error::Policy::next, NULLP, policy_bottom, policy_top, Error::Policy::prev, Error::Policy::record, sev(), and GenBuffer::Writable::vi_write().

Referenced by Rule::applyProfile(), Rule::buildProfile(), do_samfun(), and runCleanups().

◆ pushPolicy()

void Error::pushPolicy ( level_t  killer_,
level_t  printed_,
level_t  recorded_,
GenBuffer::Writable err = (GenBuffer::Writable*) ((void*)0) 
)
static

Creates a new policy and makes it active by pushing it onto the top of the policy stack.

Definition at line 101 of file error.cpp.

References err, Error::Policy::err, NULLP, p, and policy_top.

Referenced by Rule::applyProfile(), Rule::buildProfile(), and do_samfun().

◆ runCleanups()

int Error::runCleanups ( int  exitCode)
static

Reverts to the default logging policy, executes the cleanup handlers (in reverse-registration order), unregisters and deletes all the cleanups, and returns the new exit code, which is at least exitCode.

Definition at line 146 of file error.cpp.

References first_cleanup, Error::Cleanup::handler, Error::Cleanup::next, next, NULLP, policy_bottom, policy_top, and popPolicy().

Referenced by cleanup(), and run_sam2p_engine().

◆ setTopPrinted()

void Error::setTopPrinted ( level_t  printed_)
static

Definition at line 121 of file error.cpp.

References policy_top, and Error::Policy::printed.

Referenced by one_liner().

◆ sev()

GenBuffer::Writable & Error::sev ( level_t  level)
static

This is the (carefully hidden :-)) method of raising errors (i.e displaying error messages and terminating the program). Example usage: Error::sev(Error::WARNING_DEFER) << "check_rule: /BMP requires " "/Predictor " << 1 << (Error*)0; The error is interpreted according to the current policy. The policy divides errors into three categories:

– secret: nothing happens (even the error message is not printed) – recorded: nothing happens (even the error message is not printed), but the message is remembered for further processing. – printed: the error message is printed, and program execution continues Before printing this message, all recorded errors on the policy stack are also printed (deepest first). – killer: like ‘printed’, but runs cleanup handlers and terminates the program immediately.

Parameters
levelis one of the constants mentioned above (FATAL, EERROR, WARNING, NOTICE etc). Can be positive, zero or negative. The larger the ‘level’, the more severe the error is. The default policy is: level>=0 errors are killer, -99<=level<=-1 errors are printed, -199<=level<=-100 are recorded and level<=-200 errors are secret.

Definition at line 58 of file error.cpp.

References argv0, assert(), B, Error::Policy::curlev, devNull, err, Error::Policy::err, level, level2str(), NULLP, policy_top, Error::Policy::printed, Error::Policy::record, Error::Policy::recorded, Error::Policy::topRecorded, and Error::Policy::topSecret.

Referenced by Image::Indexed::addAlpha(), Image::Gray::addAlpha(), Image::RGB::addAlpha(), JAI::addAlpha(), Image::Sampled::addAlpha0(), Rule::applyProfile(), Rule::buildProfile(), CCITTFaxEncode::CCITTFaxEncode(), cleanup_remove(), LBMRead::doit(), Rule::OutputRule::doSampleFormat(), MiniPS::dumpAdd3(), MiniPS::dumpScale(), LBMRead::err(), LBMRead::errUnEOF(), fatal_image_too_large(), Filter::FILEE::FILEE(), FlateEncode::FlateEncode(), fopenErr(), XPMTok::getcc(), XPMTok::getColor(), XPMTok::getComma(), XPMTok::getDimen(), Filter::UngetFILED::getFILE(), in_eps_reader(), in_gif_reader(), in_jai_reader(), in_pnm_reader(), in_ps_reader_low(), in_xpm_reader(), MiniPS::isEq(), MiniPS::isZero(), jai_parse_jpeg(), LZWEncode::LZWEncode(), PSEncoder::newLZWEncode(), one_liner(), operator<<(), out_bmp_check_rule(), out_gif89a_check_rule(), out_jpeg_check_rule(), out_jpegjai_check_rule(), out_l1c_check_rule(), out_l23_check_rule(), out_l2jbin_check_rule(), out_png_check_rule(), out_pnm_check_rule(), out_tiff_check_rule(), out_tiff_work(), out_tiffjai_check_rule(), out_tiffjai_work(), out_xpm_check_rule(), out_xwd_check_rule(), MiniPS::Parser::parse1(), MiniPS::Parser::Parser(), Filter::PipeD::PipeD(), Filter::PipeE::PipeE(), popPolicy(), XPMTok::read(), XPMTok::readInStr(), run_sam2p_engine(), MiniPS::scanf_dict(), Filter::UngetFILED::seek(), MiniPS::Parser::setDepth(), Image::SampledInfo::setSampleFormat(), Files::system3(), GSEncode::P::vi_check(), CjpegEncode::P::vi_copy(), Filter::PipeE::vi_copy(), Filter::PipeD::vi_precopy(), Filter::PipeD::vi_read(), JPEGSOF0Encode::vi_write(), FlateEncode::vi_write(), LZWEncode::vi_write(), Filter::PipeE::vi_write(), Rule::writeTTE(), Rule::writeTTM(), Rule::writeTTT(), and MiniPS::Tokenizer::yylex().

Friends And Related Function Documentation

◆ operator<<

Definition at line 81 of file error.cpp.

Member Data Documentation

◆ argv0

char const * Error::argv0 =(char const*) ((void*)0)
static

Definition at line 23 of file error.hpp.

Referenced by init_sam2p_engine(), and sev().

◆ banner0

char const * Error::banner0 =(char const*) ((void*)0)
static

◆ first_cleanup

Error::Cleanup * Error::first_cleanup =(Error::Cleanup*) ((void*)0)
staticprotected

Definition at line 165 of file error.hpp.

Referenced by newCleanup(), and runCleanups().

◆ long_argv0

char const * Error::long_argv0 =(char const*) ((void*)0)
static

Definition at line 25 of file error.hpp.

Referenced by init_sam2p_engine(), and run_sam2p_engine().

◆ policy_bottom

Error::Policy * Error::policy_bottom =&defaultPolicy
staticprotected

Definition at line 85 of file error.hpp.

Referenced by popPolicy(), and runCleanups().

◆ policy_top

Error::Policy * Error::policy_top =&defaultPolicy
staticprotected

Boundaries of the policy stack.

Definition at line 85 of file error.hpp.

Referenced by getRecorded(), getTopPrinted(), operator<<(), popPolicy(), pushPolicy(), runCleanups(), setTopPrinted(), and sev().

◆ serr

GenBuffer::Writable * Error::serr = &serr_default
static

Standard error stream (stderr) of the current process.

Definition at line 37 of file error.hpp.

Referenced by do_samfun(), and run_sam2p_engine().

◆ tmpargv0

char const * Error::tmpargv0 =(char const*)"pRg_tMp"
static

Definition at line 24 of file error.hpp.

Referenced by init_sam2p_engine(), and Files::open_tmpnam().


The documentation for this class was generated from the following files: