| 1 |
(* m2convert.def definition module for m2convert.cc. |
| 2 |
|
| 3 |
Copyright (C) 2011-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" m2convert ; |
| 23 |
|
| 24 |
FROM gcctypes IMPORT location_t, tree ; |
| 25 |
|
| 26 |
|
| 27 |
(* |
| 28 |
ToWord - converts an expression (Integer or Ordinal type) into |
| 29 |
a WORD. |
| 30 |
*) |
| 31 |
|
| 32 |
PROCEDURE ToWord (location: location_t; expr: tree) : tree ; |
| 33 |
|
| 34 |
|
| 35 |
(* |
| 36 |
ToCardinal - convert an expression, expr, to a CARDINAL. |
| 37 |
*) |
| 38 |
|
| 39 |
PROCEDURE ToCardinal (location: location_t; expr: tree) : tree ; |
| 40 |
|
| 41 |
|
| 42 |
(* |
| 43 |
ToInteger - convert an expression, expr, to an INTEGER. |
| 44 |
*) |
| 45 |
|
| 46 |
PROCEDURE ToInteger (location: location_t; expr: tree) : tree ; |
| 47 |
|
| 48 |
|
| 49 |
(* |
| 50 |
ToBitset - convert an expression, expr, to a BITSET. |
| 51 |
*) |
| 52 |
|
| 53 |
PROCEDURE ToBitset (location: location_t; expr: tree) : tree ; |
| 54 |
|
| 55 |
|
| 56 |
(* |
| 57 |
ConvertToPtr - convert an expression to a void *. |
| 58 |
*) |
| 59 |
|
| 60 |
PROCEDURE ConvertToPtr (p: tree) : tree ; |
| 61 |
|
| 62 |
|
| 63 |
(* |
| 64 |
BuildConvert - build and return tree VAL(type, value) |
| 65 |
checkOverflow determines whether we |
| 66 |
should suppress overflow checking. |
| 67 |
*) |
| 68 |
|
| 69 |
PROCEDURE BuildConvert (location: location_t; type: tree; value: tree; checkOverflow: BOOLEAN) : tree ; |
| 70 |
|
| 71 |
|
| 72 |
(* |
| 73 |
ConvertConstantAndCheck - in Modula-2 sementics: return( VAL(type, expr) ) |
| 74 |
Only to be used for a constant expr, |
| 75 |
overflow checking is performed. |
| 76 |
*) |
| 77 |
|
| 78 |
PROCEDURE ConvertConstantAndCheck (location: location_t; type: tree; expr: tree) : tree ; |
| 79 |
|
| 80 |
|
| 81 |
(* |
| 82 |
ConvertString - converts string, expr, into a string of type, type. |
| 83 |
*) |
| 84 |
|
| 85 |
PROCEDURE ConvertString (type, expr: tree) : tree ; |
| 86 |
|
| 87 |
|
| 88 |
(* |
| 89 |
GenericToType - converts, expr, into, type, providing that expr is |
| 90 |
a generic system type (byte, word etc). Otherwise |
| 91 |
expr is returned unaltered. |
| 92 |
*) |
| 93 |
|
| 94 |
PROCEDURE GenericToType (location: location_t; type, expr: tree) : tree ; |
| 95 |
|
| 96 |
|
| 97 |
END m2convert. |