57#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
62 #pragma error("hmmm: no code for error number for this operating system")
69#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
70 return strerror(to_name);
85 #pragma error("hmmm: no code for error text for this operating system")
92 static bool initted =
false;
100 return hidden_critical_events_dir();
104{ hidden_critical_events_dir() = directory; }
109 filename +=
"/runtime_issues.log";
110 FILE *errfile = fopen(filename.
s(),
"ab");
113 int indy = app_name.
find(
'/', app_name.
end(),
true);
115 indy = app_name.
find(
'\\', app_name.
end(),
true);
125{ fprintf(stderr,
"%s", (
char *)guards_message_space); fflush(stderr); }
131 const char border =
'=';
132 to_print +=
astring(border,
int(strlen(title)) + 4);
140 to_print +=
astring(border,
int(strlen(title)) + 4);
155 const char *error_class,
const char *error_function,
156 const char *info,
char *guards_message_space)
158 strcpy(guards_message_space,
"\nProblem reported for \"");
164 strcat(guards_message_space, error_class);
165 strcat(guards_message_space,
"::");
166 strcat(guards_message_space, error_function);
167 strcat(guards_message_space,
"\"\n(invoked at line ");
169 sprintf(line_num,
"%d", line);
170 strcat(guards_message_space, line_num);
171 strcat(guards_message_space,
" in ");
172 strcat(guards_message_space, file);
173 strcat(guards_message_space,
" at ");
175 strcat(guards_message_space,
")\n");
176 strcat(guards_message_space, info);
177 strcat(guards_message_space,
"\n\n\n");
181 const char *error_function,
const char *info)
184 "Deadly Error Information");
186 throw "deadly_error";
201void critical_events::FL_continuable_error_real(
const char *file,
int line,
202 const char *error_class,
const char *error_function,
const char *info,
213 guards_message_space);
215#ifdef ENABLE_CALLSTACK_TRACKING
224 const char *error_class,
const char *error_function,
const char *info,
227 FL_continuable_error_real(file, line, error_class, error_function, info, title);
234 FL_continuable_error_real(file.
s(), line, error_class.
s(),
235 error_function.
s(), info.
s(), title.
s());
239 const char *error_class,
const char *error_function,
const char *info,
242 FL_continuable_error_real(file, line, error_class, error_function, info,
251 FL_continuable_error_real(file.
s(), line, error_class.
s(),
252 error_function.
s(), info.
s(), title.
s());
257 const char *error_function,
const char *info)
261 guards_message_space);
266 const char *the_class_name,
const char *the_func)
269 "Program stopped due to memory allocation failure.",
270 "Out of Memory Now");
274 const char *value,
const char *low,
const char *high,
275 const char *error_addition)
278 strcpy(message,
"bounds error caught");
279 strcat(message, error_addition);
280 strcat(message,
":\r\n");
281 strcat(message, value);
282 strcat(message,
" is not between ");
283 strcat(message, low);
284 strcat(message,
" and ");
285 strcat(message, high);
286#ifdef ERRORS_ARE_FATAL
char * full_trace() const
provides the current stack trace in a newly malloc'd string.
Provides a dynamically resizable ASCII character string.
const char * s() const
synonym for observe. the 's' stands for "string", if that helps.
virtual void zap(int start, int end)
Deletes the characters between "start" and "end" inclusively.
int end() const
returns the index of the last (non-null) character in the string.
int find(char to_find, int position=0, bool reverse=false) const
Locates "to_find" in "this".
auto_synchronizer simplifies concurrent code by automatically unlocking.
virtual outcome log(const base_string &info, int filter)=0
writes the information in "info" to the logger using the "filter".
static basis::astring get_logging_directory()
< retrieves the core binary directory location from paths.ini.
static basis::astring application_name()
returns the full name of the current application.
Provides a means of logging events for runtime problems.
static void FL_console_error(const char *file, int line, const char *error_class, const char *error_function, const char *info)
Prints out an error message to the standard error file stream.
static void FL_non_continuable_error(const char *file, int line, const char *classname, const char *function_name, const char *info, const char *title)
Shows the same information as continuable_error, but causes an exit.
static void implement_bounds_halt(const char *the_class_name, const char *func, const char *value, const char *low, const char *high, const char *error_addition)
Provides the real implementation of bounds_halt to save code space.
static void set_critical_events_directory(const basis::astring &directory)
sets the internal location where the critical events will be logged.
static void FL_out_of_memory_now(const char *file, int line, const char *classname, const char *function_name)
Causes the program to exit due to a memory allocation failure.
static void write_to_critical_events(const char *message)
sends the "message" to the critical events log file.
static basis::astring critical_events_directory()
returns the current location where critical events are written.
static basis::astring system_error_text(basis::un_int error_to_show)
returns the OS's string form of the "error_to_show".
static void FL_deadly_error(const char *file, int line, const char *classname, const char *function_name, const char *info)
Prints out an error message and then exits the program.
static void make_error_message(const char *file, int line, const char *error_class, const char *error_function, const char *info, char *guards_message_space)
Used to build our particular type of error message.
static void alert_message(const char *info, const char *title="Alert Message")
shows the message in "info", with an optional "title" on the message.
static void write_to_console(const char *message)
Prints out a message to the standard error file stream.
static void FL_continuable_error(const char *file, int line, const char *classname, const char *function_name, const char *info, const char *title)
Describes an error like deadly_error, but does not exit the program.
static loggers::standard_log_base & get()
Provided by the startup code within each application for logging.
static const char * platform_eol_to_chars()
provides the characters that make up this platform's line ending.
static basis::astring notarize(bool add_space=true)
a useful method for getting a textual version of the time "right now".
const int MESSAGE_SPACE_PROVIDED
#define continuable_error(c, f, i)
#define deadly_error(c, f, i)
#define CAUSE_BREAKPOINT
This macro wraps the notion of stopping in the debugger.
#define NULL_POINTER
The value representing a pointer to nothing.
Implements an application lock to ensure only one is running at once.
callstack_tracker & thread_wide_stack_trace()
the provider of thread-wide (single instance per thread) callstack_trackers.
The guards collection helps in testing preconditions and reporting errors.
bool non_negative(const type &a)
non_negative returns true if "a" is greater than or equal to zero.
unsigned int un_int
Abbreviated name for unsigned integers.
A logger that sends to the console screen using the standard output device.
astring default_critical_location()
A dynamic container class that holds any kind of object via pointers.
#define SAFE_STATIC(type, func_name, parms)
Statically defines a singleton object whose scope is the program's lifetime.
Aids in achievement of platform independence.