errmsg.h File Reference

More...

#include "utilib_dll.h"
#include "_generic.h"

Go to the source code of this file.

Defines

#define Warning(str)   DoWarning(__FILE__,__LINE__,str);
 Write a warning message.

#define ErrReturn(str)   {Warning(str); return ERR;}
 Write a warning message and return with value ERR.

#define ErrAbort(str)   DoErrAbort(__FILE__,__LINE__,str);
 Write a warning message and abort.

#define ErrExit(str)   DoErrExit(__FILE__,__LINE__,str);
 Write a warning message and exit.


Typedefs

typedef void(* null_fn_type )(void)
 A typedef for functions passed into the errmsg_exec_fn function.


Functions

UTILIB_API char * errmsg (const char *string,...)
 Used to compose a message, using the format specified by string.

UTILIB_API void errmsg_abort (const int flag)
 Call errmsg_abort to indicate that all messages cause aborts.

UTILIB_API void errmsg_exit_fn (null_fn_type fn)
 Call errmsg_exit_fn to indicate that exit and abort calls are preceded by a call to a user-provided exit function.

UTILIB_API void DoWarning (const char *file, const int line, const char *str)
 Create a warning about an error in file at line line, printing string str.

UTILIB_API void DoErrAbort (const char *file, const int line, const char *str)
 Print an error in file at line line, printing string str and then abort.

UTILIB_API void DoErrExit (const char *file, const int line, const char *str)
 Print an error in file at line line, printing string str and then exit.


Detailed Description

Author:
William E. Hart
This header defines macros and functions that can be used to notify the user of errors, as well as abort or exit from some code. These error facilites are designed to be compileable into C or C++ code. However, the code that is executed calls a C++-compiled routine that sends its output to ucout. Consequently, these routines can only be used for code that ultimately gets compiled by C++. This is unfortunate, but necessary because of the incompatability between stdout and ucout.