PIPS
arithmetic_errors.h
Go to the documentation of this file.
1
/*
2
3
$Id: arithmetic_errors.h 1641 2016-03-02 08:20:19Z coelho $
4
5
Copyright 1989-2016 MINES ParisTech
6
7
This file is part of Linear/C3 Library.
8
9
Linear/C3 Library is free software: you can redistribute it and/or modify it
10
under the terms of the GNU Lesser General Public License as published by
11
the Free Software Foundation, either version 3 of the License, or
12
any later version.
13
14
Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15
WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
FITNESS FOR A PARTICULAR PURPOSE.
17
18
See the GNU Lesser General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22
23
*/
24
25
/*
26
* managing arithmetic errors...
27
* detecting and managing arithmetic errors on Values should be
28
* systematic. These macros gives a C++ look and feel to this
29
* management.
30
*
31
* (c) CA et FC, Sept 1997
32
*/
33
34
#if !defined(linear_arithmetic_error_included)
35
#define linear_arithmetic_error_included
36
37
#include <setjmp.h>
38
39
/* callback for timeout
40
* expecting: delay, function, file, lineno
41
*/
42
typedef
void (*
timeout_callback_f
)(
int
,
const
char
*,
const
char
*,
int
);
43
44
/* Global constants to designate exceptions.
45
To be used in the type field.
46
*/
47
typedef
enum
{
48
overflow_error
= 1,
49
simplex_arithmetic_error
= 2,
50
user_exception_error
= 4,
51
parser_exception_error
= 8,
52
timeout_error
= 16,
53
/* catch all */
54
any_exception_error
= ~0
55
}
linear_exception_t
;
56
57
/* HACK: there is a throw exception in linear and another version in polylib
58
* ensure that the one from linear is used...
59
*/
60
#define throw_exception linear_throw_exception
61
#define push_exception_on_stack linear_push_exception_on_stack
62
#define pop_exception_from_stack linear_pop_exception_from_stack
63
64
typedef
void (*
exception_callback_t
)(
char
const
*,
char
const
*,
int
const
);
65
66
/* 'const' out because of cproto 4.6. FC 13/06/2003 */
67
#define EXCEPTION extern unsigned int
68
69
#define THROW(what) \
70
(throw_exception(what, CURRENT_FUNCTION, __FILE__, __LINE__))
71
72
#define CATCH(what) \
73
if (setjmp(*push_exception_on_stack(what, CURRENT_FUNCTION, \
74
__FILE__, __LINE__)))
75
76
#define UNCATCH(what) \
77
(pop_exception_from_stack(what, CURRENT_FUNCTION, \
78
__FILE__, __LINE__))
79
80
#define TRY else
81
82
#define RETHROW() THROW(the_last_just_thrown_exception)
83
84
#endif
/* linear_arithmetic_error_included */
85
86
/* end of it.
87
*/
linear_exception_t
linear_exception_t
Global constants to designate exceptions.
Definition:
arithmetic_errors.h:47
overflow_error
@ overflow_error
Definition:
arithmetic_errors.h:48
simplex_arithmetic_error
@ simplex_arithmetic_error
Definition:
arithmetic_errors.h:49
user_exception_error
@ user_exception_error
Definition:
arithmetic_errors.h:50
timeout_error
@ timeout_error
Definition:
arithmetic_errors.h:52
any_exception_error
@ any_exception_error
catch all
Definition:
arithmetic_errors.h:54
parser_exception_error
@ parser_exception_error
Definition:
arithmetic_errors.h:51
exception_callback_t
void(* exception_callback_t)(char const *, char const *, int const)
Definition:
arithmetic_errors.h:64
timeout_callback_f
void(* timeout_callback_f)(int, const char *, const char *, int)
callback for timeout expecting: delay, function, file, lineno
Definition:
arithmetic_errors.h:42
int
void const char const char const int
Definition:
arithmetique-local.h:585
linear
src
arithmetique
arithmetic_errors.h
Generated on Thu Sep 26 2024 22:11:28 for PIPS by
1.9.1