1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/templates/exceptions.h Fri Oct 28 22:58:50 2016 +0200
1.3 @@ -0,0 +1,29 @@
1.4 +#ifndef __EXCEPTIONS_H__
1.5 +#define __EXCEPTIONS_H__
1.6 +
1.7 +#include "cexcept.h"
1.8 +#include "types.h"
1.9 +
1.10 +/* Define the exception type. */
1.11 +
1.12 +typedef struct
1.13 +{
1.14 + __attr arg;
1.15 + int raising;
1.16 + int raising_else;
1.17 + int completing;
1.18 +} __exc;
1.19 +
1.20 +define_exception_type(__exc);
1.21 +#undef define_exception_type
1.22 +
1.23 +extern struct __exception_context __the_exception_context[1];
1.24 +
1.25 +/* More specific macros. */
1.26 +
1.27 +#define __Raise(value) __Throw ((__exc) {value, 1, 0, 0})
1.28 +#define __RaiseElse(value) __Throw ((__exc) {value, 0, 1, 0})
1.29 +#define __Return(value) __Throw ((__exc) {value, 0, 0, 1})
1.30 +#define __Complete __Throw((__exc) {__NULL, 0, 0, 1})
1.31 +
1.32 +#endif /* __EXCEPTIONS_H__ */