Lichen

templates/exceptions.h

338:61776a5a0e16
2016-12-07 Paul Boddie Associate constant name information with references so that structure members such as function instance default members can be generated statically, thus eliminating unnecessary structure initialisation in the translated code. Improved the determination of dynamic functions in the importer to consider only non-constant defaults.
     1 #ifndef __EXCEPTIONS_H__     2 #define __EXCEPTIONS_H__     3      4 #include "cexcept.h"     5 #include "types.h"     6      7 /* Define the exception type. */     8      9 typedef struct    10 {    11     __attr arg;    12     int raising;    13     int raising_else;    14     int completing;    15 } __exc;    16     17 define_exception_type(__exc);    18 #undef define_exception_type    19     20 extern struct __exception_context __the_exception_context[1];    21     22 /* More specific macros. */    23     24 #define __Raise(value) __Throw ((__exc) {value, 1, 0, 0})    25 #define __RaiseElse(value) __Throw ((__exc) {value, 0, 1, 0})    26 #define __Return(value) __Throw ((__exc) {value, 0, 0, 1})    27 #define __Complete __Throw((__exc) {__NULL, 0, 0, 1})    28     29 #endif /* __EXCEPTIONS_H__ */