home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d179 / excption.lha / Excption / EIRaise.c < prev    next >
C/C++ Source or Header  |  1989-02-25  |  3KB  |  82 lines

  1. /**************************************************************************/
  2. /*                                                                        */
  3. /*                                                                        */
  4. /*                                                                        */
  5. /*                EXCEPTION HANDLER / CHIP STACK                          */
  6. /*               ==========================================               */
  7. /*                                                                        */
  8. /*                                                                        */
  9. /*  MODULE      : Exception                                               */
  10. /*  NOM         : EIRaise.c                                               */
  11. /*  FONCTION    :                                                         */
  12. /*                                                                        */
  13. /*  RESPONSABLE : HEWES Gerald                                            */
  14. /*  TEL         : 33 (1) 46 24 20 27                                      */
  15. /*                                                                        */
  16. /**************************************************************************/
  17.  
  18. /**************************************************************************/
  19. /*                                                                        */
  20. /* HEW 880310 Ver 0.1 : First Soft Version                                */
  21. /* HEW 880324 Ver 0.2 : Handle 68000 exceptions                           */
  22. /* HEW 880413 Ver 0.3 : Handle 680X0 Formats                              */
  23. /* HEW 880508 Ver 0.4 : First Released version : routines split           */
  24. /*                      Major name changes for better homogeneity         */
  25. /* HEW 880517 Ver 0.5 : include change. No more puts in library           */
  26. /* HEW 880605 Ver 0.6 : Disable/Enable Function + Prototypes              */
  27. /*                                                                        */
  28. /**************************************************************************/
  29.  
  30. #include <stdio.h>
  31. #include "local:excption.h"
  32. #include <exec/execbase.h>
  33. #include <exec/tasks.h>
  34. #include <proto/exec.h>
  35.  
  36. extern E_ErrorStatus  E_global;  /* Declaration of Necessary Data */
  37.  
  38. /***************************** CODE ***************************************/
  39.  
  40. extern void EIRaise(dike,number)
  41. E_ErrorStatus *dike;  /* Needed for the library version */
  42. ExcpClass number;
  43.  
  44.                 /************************************************/
  45.                 /* This Routine Propagates an Exception         */
  46.                 /* depending on context                         */
  47.                 /************************************************/
  48.  
  49.  
  50. {
  51.   if ((dike->E_up == NULL)||(dike->E_up->E_magic != EM_MAGIC))
  52.    {
  53. #if DEBUG
  54.     fputs("Internal Error EXEERR01\n",stderr);
  55. #endif
  56.     exit(200);
  57.    }
  58.  
  59.   if (dike->E_up->E_state == E_PROTECTED)
  60.    {
  61.     dike->E_up->E_state = E_HANDLER;
  62.     longjmp(dike->E_up->E_current,(int)number); /* we have to cast */
  63.    }
  64.   else
  65.    {
  66.     dike->E_up = dike->E_up->E_pred;
  67.     if ((dike->E_up == NULL)||(dike->E_up->E_magic != EM_MAGIC))
  68.      {
  69. #if DEBUG
  70.        fputs("Internal Error EXEERR02\n",stderr);
  71. #endif
  72.        exit(201);
  73.      }
  74.     else
  75.      longjmp(dike->E_up->E_current,(int)number); /* we have to cast */
  76.    }
  77. }
  78.  
  79.  
  80.  
  81. /*************************  CIVILISATION ENDS HERE  ***********************/
  82.