| 1 |
(* m2except.def provides an interface to build exception trees. |
| 2 |
|
| 3 |
Copyright (C) 2008-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 |
DEFINITION MODULE FOR "C" m2except ; |
| 23 |
|
| 24 |
FROM gcctypes IMPORT location_t, tree ; |
| 25 |
|
| 26 |
|
| 27 |
(* |
| 28 |
InitExceptions - initialize this module, it declares the |
| 29 |
external functions and assigns them to |
| 30 |
the appropriate global tree variables. |
| 31 |
*) |
| 32 |
|
| 33 |
PROCEDURE InitExceptions (location: location_t) ; |
| 34 |
|
| 35 |
|
| 36 |
(* |
| 37 |
BuildThrow - builds a throw statement and return the tree. |
| 38 |
*) |
| 39 |
|
| 40 |
PROCEDURE BuildThrow (location: location_t; t: tree) : tree ; |
| 41 |
|
| 42 |
|
| 43 |
(* |
| 44 |
BuildTryBegin - returns a tree representing the 'try' block. |
| 45 |
*) |
| 46 |
|
| 47 |
PROCEDURE BuildTryBegin (location: location_t) : tree ; |
| 48 |
|
| 49 |
|
| 50 |
(* |
| 51 |
BuildTryEnd - builds the end of the Try block and prepares |
| 52 |
for the catch handlers. |
| 53 |
*) |
| 54 |
|
| 55 |
PROCEDURE BuildTryEnd (tryBlock: tree) ; |
| 56 |
|
| 57 |
|
| 58 |
(* |
| 59 |
BuildCatchBegin - creates a handler tree for the C++ |
| 60 |
statement 'catch (...) {'. |
| 61 |
It returns the handler tree. |
| 62 |
*) |
| 63 |
|
| 64 |
PROCEDURE BuildCatchBegin (location: location_t) : tree ; |
| 65 |
|
| 66 |
|
| 67 |
(* |
| 68 |
BuildCatchEnd - completes a try catch block. |
| 69 |
It returns the, try_block, tree. |
| 70 |
It creates the C++ statement |
| 71 |
|
| 72 |
'}' which matches the catch above. |
| 73 |
*) |
| 74 |
|
| 75 |
PROCEDURE BuildCatchEnd (location: location_t; handler, tryBlock: tree) : tree ; |
| 76 |
|
| 77 |
|
| 78 |
END m2except. |