libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / m2 / mc-boot / GRTExceptions.h
blob9e188bcbad4d3c637c82359f12f6e05d0bf51b69
1 /* do not edit automatically generated by mc from RTExceptions. */
2 /* RTExceptions.def runtime exception handler routines.
4 Copyright (C) 2008-2024 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
7 This file is part of GNU Modula-2.
9 GNU Modula-2 is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 GNU Modula-2 is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
29 #if !defined (_RTExceptions_H)
30 # define _RTExceptions_H
32 #include "config.h"
33 #include "system.h"
34 # ifdef __cplusplus
35 extern "C" {
36 # endif
37 #include <stdbool.h>
38 # if !defined (PROC_D)
39 # define PROC_D
40 typedef void (*PROC_t) (void);
41 typedef struct { PROC_t proc; } PROC;
42 # endif
44 # include "GSYSTEM.h"
46 # if defined (_RTExceptions_C)
47 # define EXTERN
48 # else
49 # define EXTERN extern
50 # endif
52 #if !defined (RTExceptions_EHBlock_D)
53 # define RTExceptions_EHBlock_D
54 typedef void *RTExceptions_EHBlock;
55 #endif
57 typedef struct RTExceptions_ProcedureHandler_p RTExceptions_ProcedureHandler;
59 typedef void (*RTExceptions_ProcedureHandler_t) (void);
60 struct RTExceptions_ProcedureHandler_p { RTExceptions_ProcedureHandler_t proc; };
64 Raise - invoke the exception handler associated with, number,
65 in the active EHBlock. It keeps a record of the number
66 and message in the EHBlock for later use.
69 EXTERN void RTExceptions_Raise (unsigned int number, void * file, unsigned int line, unsigned int column, void * function, void * message) __attribute__ ((noreturn));
72 SetExceptionBlock - sets, source, as the active EHB.
75 EXTERN void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source);
78 GetExceptionBlock - returns the active EHB.
81 EXTERN RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void);
84 GetTextBuffer - returns the address of the EHB buffer.
87 EXTERN void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e);
90 GetTextBufferSize - return the size of the EHB text buffer.
93 EXTERN unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e);
96 GetNumber - return the exception number associated with,
97 source.
100 EXTERN unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source);
103 InitExceptionBlock - creates and returns a new exception block.
106 EXTERN RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void);
109 KillExceptionBlock - destroys the EHB, e, and all its handlers.
112 EXTERN RTExceptions_EHBlock RTExceptions_KillExceptionBlock (RTExceptions_EHBlock e);
115 PushHandler - install a handler in EHB, e.
118 EXTERN void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int number, RTExceptions_ProcedureHandler p);
121 PopHandler - removes the handler associated with, number, from
122 EHB, e.
125 EXTERN void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int number);
128 DefaultErrorCatch - displays the current error message in
129 the current exception block and then
130 calls HALT.
133 EXTERN void RTExceptions_DefaultErrorCatch (void);
136 BaseExceptionsThrow - configures the Modula-2 exceptions to call
137 THROW which in turn can be caught by an
138 exception block. If this is not called then
139 a Modula-2 exception will simply call an
140 error message routine and then HALT.
143 EXTERN void RTExceptions_BaseExceptionsThrow (void);
146 IsInExceptionState - returns TRUE if the program is currently
147 in the exception state.
150 EXTERN bool RTExceptions_IsInExceptionState (void);
153 SetExceptionState - returns the current exception state and
154 then sets the current exception state to,
158 EXTERN bool RTExceptions_SetExceptionState (bool to);
161 SwitchExceptionState - assigns, from, with the current exception
162 state and then assigns the current exception
163 to, to.
166 EXTERN void RTExceptions_SwitchExceptionState (bool *from, bool to);
169 GetBaseExceptionBlock - returns the initial language exception block
170 created.
173 EXTERN RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void);
176 SetExceptionSource - sets the current exception source to, source.
179 EXTERN void RTExceptions_SetExceptionSource (void * source);
182 GetExceptionSource - returns the current exception source.
185 EXTERN void * RTExceptions_GetExceptionSource (void);
186 # ifdef __cplusplus
188 # endif
190 # undef EXTERN
191 #endif