home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 196.lha / Exception_v0.6 / EIInit.c < prev    next >
C/C++ Source or Header  |  1988-12-27  |  3KB  |  67 lines

  1. /**************************************************************************/
  2. /*                                                                        */
  3. /*                                                                        */
  4. /*                                                                        */
  5. /*                EXCEPTION HANDLER / CHIP STACK                          */
  6. /*               ==========================================               */
  7. /*                                                                        */
  8. /*                                                                        */
  9. /*  MODULE      : Exception                                               */
  10. /*  NOM         : EIInit.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/tasks.h>
  33. #include <proto/exec.h>
  34.  
  35. extern E_ErrorStatus  E_global;  /* Declaration of Necessary Data */
  36.  
  37. /***************************** CODE ***************************************/
  38.  
  39. extern void EIInit(dike)
  40. E_ErrorStatus *dike;  /* Needed for the library version */
  41.  
  42.                 /************************************************/
  43.                 /* Initialises The Exception Handling           */
  44.                 /* Routines                                     */
  45.                 /************************************************/
  46.  
  47.  
  48. {
  49.  struct Task *taskloc;
  50.  
  51.    dike->E_top.E_pred = 0            ; /* Nothing before   */
  52.    dike->E_top.E_state = E_PROTECTED ; /* state of handler */
  53.    dike->E_up = &(dike->E_top)       ; /* hack             */
  54.    dike->E_top.E_magic = EM_MAGIC    ; /* enable handler   */
  55.  
  56.    taskloc = (struct Task *)FindTask(0);        /* Get Task Info      */
  57.    dike->E_OldTrapCode = taskloc->tc_TrapCode;  /* Keep Old Info      */
  58.    dike->E_OldTrapData = taskloc->tc_TrapData;
  59.    taskloc->tc_TrapCode = (APTR)EIExcpHandler;  /* Put in new handler */
  60.    taskloc->tc_TrapData = (APTR)dike;           /* For the Handler    */
  61.  
  62.    return;
  63. }
  64.  
  65. /*************************  CIVILISATION ENDS HERE  ***********************/
  66.  
  67.