polylib 5.22.8
errors.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <polylib/arithmetique.h>

Go to the source code of this file.

Classes

struct  linear_exception_holder
 

Macros

#define FALSE   0 /* values of boolean */
 
#define TRUE   1
 
#define MAX_STACKED_CONTEXTS   64
 
#define exception_debug_message(type)
 
#define exception_debug_trace(type)
 
#define same_string_p(s1, s2)   (strcmp((s1), (s2)) == 0)
 

Typedefs

typedef int boolean
 

Functions

const char * get_exception_name (unsigned int exception)
 
void free_exception_stack ()
 
void set_exception_callbacks (exception_callback_t push, exception_callback_t pop)
 
void dump_exception_stack_to_file (FILE *f)
 
void dump_exception_stack ()
 
jmp_buf * push_exception_on_stack (int what, const char *function, const char *file, int line)
 
void pop_exception_from_stack (int what, const char *function, const char *file, int line)
 
void throw_exception (int what, const char *function, const char *file, int line)
 
void linear_initialize_exception_stack (unsigned int verbose_exceptions, exception_callback_t push, exception_callback_t pop)
 

Variables

unsigned int overflow_error = 1
 
unsigned int simplex_arithmetic_error = 2
 
unsigned int user_exception_error = 4
 
unsigned int parser_exception_error = 8
 
unsigned int timeout_error = 16
 
unsigned int any_exception_error = ~0
 
unsigned int the_last_just_thrown_exception = 0
 
static int linear_exception_debug_mode = FALSE
 
static unsigned int linear_exception_verbose = 1 | 2 | 16
 
static linear_exception_holder exception_stack [MAX_STACKED_CONTEXTS]
 Vincent's patch to enable POSIX multithreading. More...
 
static int exception_index = 0
 
static exception_callback_t push_callback = NULL
 
static exception_callback_t pop_callback = NULL
 
int linear_number_of_exception_thrown = 0
 

Macro Definition Documentation

◆ exception_debug_message

#define exception_debug_message (   type)
Value:
fprintf(stderr, "%s[%s:%d %s (%s)/%d]\n", type, file, line, function, \
const char * get_exception_name(unsigned int exception)
Definition: errors.c:122
static int exception_index
Definition: errors.c:203

Definition at line 259 of file errors.c.

◆ exception_debug_trace

#define exception_debug_trace (   type)
Value:
exception_debug_message(type); \
}
static int linear_exception_debug_mode
Definition: errors.c:145

Definition at line 263 of file errors.c.

◆ FALSE

#define FALSE   0 /* values of boolean */

Definition at line 116 of file errors.c.

◆ MAX_STACKED_CONTEXTS

#define MAX_STACKED_CONTEXTS   64

Definition at line 166 of file errors.c.

◆ same_string_p

#define same_string_p (   s1,
  s2 
)    (strcmp((s1), (s2)) == 0)

Definition at line 302 of file errors.c.

◆ TRUE

#define TRUE   1

Definition at line 119 of file errors.c.

Typedef Documentation

◆ boolean

typedef int boolean

Definition at line 113 of file errors.c.

Function Documentation

◆ dump_exception_stack()

void dump_exception_stack ( void  )

◆ dump_exception_stack_to_file()

void dump_exception_stack_to_file ( FILE *  f)

Definition at line 240 of file errors.c.

References exception_index, and exception_stack.

Referenced by dump_exception_stack().

◆ free_exception_stack()

void free_exception_stack ( void  )

Definition at line 207 of file errors.c.

References assert, and exception_stack.

Referenced by polylib_close().

◆ get_exception_name()

const char * get_exception_name ( unsigned int  exception)

◆ linear_initialize_exception_stack()

void linear_initialize_exception_stack ( unsigned int  verbose_exceptions,
exception_callback_t  push,
exception_callback_t  pop 
)

Definition at line 400 of file errors.c.

References linear_exception_verbose, and set_exception_callbacks().

◆ pop_exception_from_stack()

void pop_exception_from_stack ( int  what,
const char *  function,
const char *  file,
int  line 
)

◆ push_exception_on_stack()

◆ set_exception_callbacks()

void set_exception_callbacks ( exception_callback_t  push,
exception_callback_t  pop 
)

Definition at line 222 of file errors.c.

References pop_callback, and push_callback.

Referenced by linear_initialize_exception_stack().

◆ throw_exception()

void throw_exception ( int  what,
const char *  function,
const char *  file,
int  line 
)

Variable Documentation

◆ any_exception_error

◆ exception_index

int exception_index = 0
static

◆ exception_stack

Vincent's patch to enable POSIX multithreading.

Feb. 2012

Definition at line 202 of file errors.c.

Referenced by dump_exception_stack_to_file(), free_exception_stack(), pop_exception_from_stack(), push_exception_on_stack(), and throw_exception().

◆ linear_exception_debug_mode

int linear_exception_debug_mode = FALSE
static

Definition at line 145 of file errors.c.

Referenced by throw_exception().

◆ linear_exception_verbose

unsigned int linear_exception_verbose = 1 | 2 | 16
static

Definition at line 146 of file errors.c.

Referenced by linear_initialize_exception_stack(), and throw_exception().

◆ linear_number_of_exception_thrown

int linear_number_of_exception_thrown = 0

Definition at line 236 of file errors.c.

Referenced by throw_exception().

◆ overflow_error

unsigned int overflow_error = 1

◆ parser_exception_error

unsigned int parser_exception_error = 8

Definition at line 99 of file errors.c.

Referenced by get_exception_name().

◆ pop_callback

exception_callback_t pop_callback = NULL
static

Definition at line 220 of file errors.c.

Referenced by pop_exception_from_stack(), set_exception_callbacks(), and throw_exception().

◆ push_callback

exception_callback_t push_callback = NULL
static

Definition at line 219 of file errors.c.

Referenced by push_exception_on_stack(), and set_exception_callbacks().

◆ simplex_arithmetic_error

unsigned int simplex_arithmetic_error = 2

Definition at line 97 of file errors.c.

Referenced by get_exception_name().

◆ the_last_just_thrown_exception

unsigned int the_last_just_thrown_exception = 0

Definition at line 141 of file errors.c.

Referenced by pop_exception_from_stack(), push_exception_on_stack(), and throw_exception().

◆ timeout_error

unsigned int timeout_error = 16

Definition at line 100 of file errors.c.

Referenced by get_exception_name().

◆ user_exception_error

unsigned int user_exception_error = 4

Definition at line 98 of file errors.c.

Referenced by get_exception_name().