| /* a68-low-runtime.def -- Definitions for Algol 68 runtime functions. |
| Copyright (C) 2025 Jose E. Marchesi. |
| |
| GCC is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 3, or (at your option) |
| any later version. |
| |
| GCC is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with GCC; see the file COPYING3. If not see |
| <http://www.gnu.org/licenses/>. */ |
| |
| /* Helper macros for parameter building. */ |
| #define P0() 0 |
| #define P1(T1) 1, LCT_ ## T1 |
| #define P2(T1, T2) \ |
| 2, LCT_ ## T1, LCT_ ## T2 |
| #define P3(T1, T2, T3) \ |
| 3, LCT_ ## T1, LCT_ ## T2, LCT_ ## T3 |
| #define P4(T1, T2, T3, T4) \ |
| 4, LCT_ ## T1, LCT_ ## T2, LCT_ ## T3, LCT_ ## T4 |
| #define P5(T1, T2, T3, T4, T5) \ |
| 5, LCT_ ## T1, LCT_ ## T2, LCT_ ## T3, LCT_ ## T4, LCT_ ## T5 |
| #define P6(T1, T2, T3, T4, T5, T6) \ |
| 6, LCT_ ## T1, LCT_ ## T2, LCT_ ## T3, LCT_ ## T4, LCT_ ## T5, LCT_ ## T6 |
| #define P7(T1, T2, T3, T4, T5, T6, T7) \ |
| 7, LCT_ ## T1, LCT_ ## T2, LCT_ ## T3, LCT_ ## T4, LCT_ ## T5, LCT_ ## T6, LCT_ ## T7 |
| #define RT(T1) LCT_ ## T1 |
| |
| /* Algol 68 runtime library functions. */ |
| |
| /* DEF_A68_RUNTIME (CODE, NAME, TYPE, PARAMS, FLAGS) |
| CODE The enum code used to refer to this function. |
| NAME The name of this function as a string. |
| FLAGS ECF flags to describe attributes of the function. |
| |
| Used for declaring functions that are called by generated code. */ |
| |
| DEF_A68_RUNTIME (ASSERT, "_libga68_assert", RT(VOID), P2(CONSTCHARPTR, UINT), ECF_NORETURN) |
| DEF_A68_RUNTIME (MALLOC, "_libga68_malloc", RT(VOIDPTR), P1(SIZE), ECF_NOTHROW | ECF_LEAF | ECF_MALLOC) |
| DEF_A68_RUNTIME (MALLOC_LEAF, "_libga68_malloc_leaf", RT(VOIDPTR), P1(SIZE), ECF_NOTHROW | ECF_LEAF | ECF_MALLOC) |
| DEF_A68_RUNTIME (DEREFNIL, "_libga68_derefnil", RT(VOID), P2(CONSTCHARPTR, UINT), ECF_NORETURN) |
| DEF_A68_RUNTIME (UNREACHABLE, "_libga68_unreachable", RT(VOID), P2(CONSTCHARPTR, UINT), ECF_NORETURN) |
| DEF_A68_RUNTIME (INVALIDCHARERROR, "_libga68_invalidcharerror", RT(VOID), P3(CONSTCHARPTR,UINT,INT), ECF_NORETURN) |
| DEF_A68_RUNTIME (BITSBOUNDSERROR, "_libga68_bitsboundserror", RT(VOID), P3(CONSTCHARPTR,UINT,SSIZE), ECF_NORETURN) |
| DEF_A68_RUNTIME (ARRAYLOWERBOUND, "_libga68_lower_bound", RT(VOID), |
| P4(CONSTCHARPTR, UINT, SSIZE, SSIZE), ECF_NORETURN) |
| DEF_A68_RUNTIME (ARRAYUPPERBOUND, "_libga68_upper_bound", RT(VOID), |
| P4(CONSTCHARPTR, UINT, SSIZE, SSIZE), ECF_NORETURN) |
| DEF_A68_RUNTIME (ARRAYBOUNDS, "_libga68_bounds", RT(VOID), |
| P5(CONSTCHARPTR, UINT, SSIZE, SSIZE, SSIZE), ECF_NORETURN) |
| DEF_A68_RUNTIME (ARRAYBOUNDSMISMATCH, "_libga68_bounds_mismatch", RT(VOID), |
| P7(CONSTCHARPTR, UINT, SIZE, SSIZE, SSIZE, SSIZE, SSIZE), ECF_NORETURN) |
| DEF_A68_RUNTIME (ARRAYDIM, "_libga68_dim", RT(VOID), |
| P4(CONSTCHARPTR, UINT, SIZE, SIZE), ECF_NORETURN) |
| DEF_A68_RUNTIME (RANDOM, "_libga68_random", RT(FLOAT), P0(), 0) |
| DEF_A68_RUNTIME (LONGRANDOM, "_libga68_longrandom", RT(DOUBLE), P0(), 0) |
| DEF_A68_RUNTIME (LONGLONGRANDOM, "_libga68_longlongrandom", RT(LONGDOUBLE), P0(), 0) |
| DEF_A68_RUNTIME (U32_CMP2, "_libga68_u32_cmp2", RT(INT), P6(UNISTR, SIZE, SIZE, UNISTR, SIZE, SIZE), 0) |
| |
| #undef P0 |
| #undef P1 |
| #undef P2 |
| #undef P3 |
| #undef P4 |
| #undef P5 |
| #undef RT |