(root)/
gcc-13.2.0/
gcc/
m2/
pge-boot/
GRTExceptions.h
       1  /* do not edit automatically generated by mc from RTExceptions.  */
       2  /* RTExceptions.def runtime exception handler routines.
       3  
       4  Copyright (C) 2008-2023 Free Software Foundation, Inc.
       5  Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
       6  
       7  This file is part of GNU Modula-2.
       8  
       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.
      13  
      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.
      18  
      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.
      22  
      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/>.  */
      27  
      28  
      29  #if !defined (_RTExceptions_H)
      30  #   define _RTExceptions_H
      31  
      32  #include "config.h"
      33  #include "system.h"
      34  #   ifdef __cplusplus
      35  extern "C" {
      36  #   endif
      37  #   if !defined (PROC_D)
      38  #      define PROC_D
      39         typedef void (*PROC_t) (void);
      40         typedef struct { PROC_t proc; } PROC;
      41  #   endif
      42  
      43  #   include "GSYSTEM.h"
      44  
      45  #   if defined (_RTExceptions_C)
      46  #      define EXTERN
      47  #   else
      48  #      define EXTERN extern
      49  #   endif
      50  
      51  #if !defined (RTExceptions_EHBlock_D)
      52  #  define RTExceptions_EHBlock_D
      53     typedef void *RTExceptions_EHBlock;
      54  #endif
      55  
      56  typedef struct RTExceptions_ProcedureHandler_p RTExceptions_ProcedureHandler;
      57  
      58  typedef void (*RTExceptions_ProcedureHandler_t) (void);
      59  struct RTExceptions_ProcedureHandler_p { RTExceptions_ProcedureHandler_t proc; };
      60  
      61  
      62  /*
      63     Raise - invoke the exception handler associated with, number,
      64             in the active EHBlock.  It keeps a record of the number
      65             and message in the EHBlock for later use.
      66  */
      67  
      68  EXTERN void RTExceptions_Raise (unsigned int number, void * file, unsigned int line, unsigned int column, void * function, void * message);
      69  
      70  /*
      71     SetExceptionBlock - sets, source, as the active EHB.
      72  */
      73  
      74  EXTERN void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source);
      75  
      76  /*
      77     GetExceptionBlock - returns the active EHB.
      78  */
      79  
      80  EXTERN RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void);
      81  
      82  /*
      83     GetTextBuffer - returns the address of the EHB buffer.
      84  */
      85  
      86  EXTERN void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e);
      87  
      88  /*
      89     GetTextBufferSize - return the size of the EHB text buffer.
      90  */
      91  
      92  EXTERN unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e);
      93  
      94  /*
      95     GetNumber - return the exception number associated with,
      96                 source.
      97  */
      98  
      99  EXTERN unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source);
     100  
     101  /*
     102     InitExceptionBlock - creates and returns a new exception block.
     103  */
     104  
     105  EXTERN RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void);
     106  
     107  /*
     108     KillExceptionBlock - destroys the EHB, e, and all its handlers.
     109  */
     110  
     111  EXTERN RTExceptions_EHBlock RTExceptions_KillExceptionBlock (RTExceptions_EHBlock e);
     112  
     113  /*
     114     PushHandler - install a handler in EHB, e.
     115  */
     116  
     117  EXTERN void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int number, RTExceptions_ProcedureHandler p);
     118  
     119  /*
     120     PopHandler - removes the handler associated with, number, from
     121                  EHB, e.
     122  */
     123  
     124  EXTERN void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int number);
     125  
     126  /*
     127     DefaultErrorCatch - displays the current error message in
     128                         the current exception block and then
     129                         calls HALT.
     130  */
     131  
     132  EXTERN void RTExceptions_DefaultErrorCatch (void);
     133  
     134  /*
     135     BaseExceptionsThrow - configures the Modula-2 exceptions to call
     136                           THROW which in turn can be caught by an
     137                           exception block.  If this is not called then
     138                           a Modula-2 exception will simply call an
     139                           error message routine and then HALT.
     140  */
     141  
     142  EXTERN void RTExceptions_BaseExceptionsThrow (void);
     143  
     144  /*
     145     IsInExceptionState - returns TRUE if the program is currently
     146                          in the exception state.
     147  */
     148  
     149  EXTERN unsigned int RTExceptions_IsInExceptionState (void);
     150  
     151  /*
     152     SetExceptionState - returns the current exception state and
     153                         then sets the current exception state to,
     154                         to.
     155  */
     156  
     157  EXTERN unsigned int RTExceptions_SetExceptionState (unsigned int to);
     158  
     159  /*
     160     SwitchExceptionState - assigns, from, with the current exception
     161                            state and then assigns the current exception
     162                            to, to.
     163  */
     164  
     165  EXTERN void RTExceptions_SwitchExceptionState (unsigned int *from, unsigned int to);
     166  
     167  /*
     168     GetBaseExceptionBlock - returns the initial language exception block
     169                             created.
     170  */
     171  
     172  EXTERN RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void);
     173  
     174  /*
     175     SetExceptionSource - sets the current exception source to, source.
     176  */
     177  
     178  EXTERN void RTExceptions_SetExceptionSource (void * source);
     179  
     180  /*
     181     GetExceptionSource - returns the current exception source.
     182  */
     183  
     184  EXTERN void * RTExceptions_GetExceptionSource (void);
     185  #   ifdef __cplusplus
     186  }
     187  #   endif
     188  
     189  #   undef EXTERN
     190  #endif