| 1 |
/* m2except.h header file for m2except.cc. |
| 2 |
|
| 3 |
Copyright (C) 2012-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with GNU Modula-2; see the file COPYING3. If not see |
| 20 |
<http://www.gnu.org/licenses/>. */ |
| 21 |
|
| 22 |
#if !defined(m2except_h) |
| 23 |
#define m2except_h |
| 24 |
#if defined(m2except_c) |
| 25 |
#if defined(__GNUG__) |
| 26 |
#define EXTERN extern "C" |
| 27 |
#else /* !__GNUG__. */ |
| 28 |
#define EXTERN |
| 29 |
#endif /* !__GNUG__. */ |
| 30 |
#else /* !m2except_c. */ |
| 31 |
#if defined(__GNUG__) |
| 32 |
#define EXTERN extern "C" |
| 33 |
#else /* !__GNUG__. */ |
| 34 |
#define EXTERN extern |
| 35 |
#endif /* !__GNUG__. */ |
| 36 |
#endif /* !m2except_c. */ |
| 37 |
|
| 38 |
/* InitExceptions - initialize this module, it declares the external |
| 39 |
functions and assigns them to the appropriate global tree |
| 40 |
variables. */ |
| 41 |
|
| 42 |
EXTERN void m2except_InitExceptions (location_t location); |
| 43 |
|
| 44 |
/* BuildThrow - builds a throw statement and return the tree. */ |
| 45 |
|
| 46 |
EXTERN tree m2except_BuildThrow (location_t location, tree exp); |
| 47 |
|
| 48 |
/* BuildTryBegin - returns a tree representing the 'try' block. */ |
| 49 |
|
| 50 |
EXTERN tree m2except_BuildTryBegin (location_t location); |
| 51 |
|
| 52 |
/* BuildTryEnd - builds the end of the Try block and prepares for the |
| 53 |
catch handlers. */ |
| 54 |
|
| 55 |
EXTERN void m2except_BuildTryEnd (tree tryBlock); |
| 56 |
|
| 57 |
/* BuildCatchBegin - creates a handler tree for the C++ statement |
| 58 |
'catch (...) {'. It returns the handler tree. */ |
| 59 |
|
| 60 |
EXTERN tree m2except_BuildCatchBegin (location_t location); |
| 61 |
|
| 62 |
/* BuildCatchEnd - completes a try catch block. It returns the, |
| 63 |
try_block, tree. It creates the C++ statement |
| 64 |
|
| 65 |
'}' which matches the catch above. */ |
| 66 |
|
| 67 |
EXTERN tree m2except_BuildCatchEnd (location_t location, tree handler, |
| 68 |
tree tryBlock); |
| 69 |
|
| 70 |
#endif /* m2except_h. */ |