home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / gfx / superview-lib-9.12.lha / SuperView-Lib / Programmers / Example_SVDrivers / ECS / SD_SuperVisor.c < prev    next >
C/C++ Source or Header  |  1994-12-28  |  3KB  |  95 lines

  1.  
  2.  /* SD_SuperVisor.c
  3.     - SuperVising (global exit) Functions for AGA-Support -
  4.     (c) 1990-94 by Andreas R. Kleinert
  5.     Last changes : 07.05.1994
  6.  */
  7.  
  8. #include "svdriver.h"
  9.  
  10.  
  11. struct SVDriverHandle * __saveds __asm SVD_AllocHandle( register __a1 APTR future_a1);
  12. void __saveds __asm SVD_FreeHandle( register __a1 struct SVDriverHandle *SVDriverHandle_a1);
  13. void __saveds __asm SVD_CloseDisplay( register __a1 struct SVDriverHandle *SVDriverHandle_a1);
  14. void __saveds __asm SVD_FreeResources( register __a1 struct SVDriverHandle *SVDriverHandle_a1);
  15.  
  16. /* *************************************************** */
  17. /* *                             * */
  18. /* * SVD_AllocHandle : Free SVDriverHandle and more  * */
  19. /* *                             * */
  20. /* *************************************************** */
  21.  
  22. struct SVDriverHandle * __saveds __asm SVD_AllocHandle( register __a1 APTR future_a1)
  23. {
  24.  APTR future = future_a1;
  25.  struct SVDriverHandle *handle;
  26.  
  27.  handle = (APTR) AllocVec(sizeof(struct SVDriverHandle), (MEMF_CLEAR|MEMF_PUBLIC));
  28.  
  29.  return(handle);
  30. }
  31.  
  32. /* *************************************************** */
  33. /* *                             * */
  34. /* * SVD_FreeHandle : Free SVDriverHandle and more   * */
  35. /* *                             * */
  36. /* *************************************************** */
  37.  
  38. void __saveds __asm SVD_FreeHandle( register __a1 struct SVDriverHandle *SVDriverHandle_a1)
  39. {
  40.  struct SVDriverHandle *SVDriverHandle = SVDriverHandle_a1;
  41.  
  42.  SVD_CloseDisplay(SVDriverHandle);
  43.  SVD_FreeResources(SVDriverHandle);
  44.  
  45.  FreeVec(SVDriverHandle);
  46. }
  47.  
  48. /* *************************************************** */
  49. /* *                             * */
  50. /* * SVD_CloseDisplay : Close Display, ...           * */
  51. /* *                             * */
  52. /* *************************************************** */
  53.  
  54. void __saveds __asm SVD_CloseDisplay( register __a1 struct SVDriverHandle *SVDriverHandle_a1)
  55. {
  56.  struct SVDriverHandle *SVDriverHandle = SVDriverHandle_a1;
  57.  struct SVDriverBase *SVDriverBase = N;
  58.  APTR msg;
  59.  
  60.  if(!SVDriverHandle) return;
  61.  
  62.  if(SVDriverHandle->ah_Screen)
  63.   {
  64.    if(SVDriverHandle->ah_Window)
  65.     {
  66.      while( msg = GetMsg(SVDriverHandle->ah_Window->UserPort) ) ReplyMsg(msg);
  67.  
  68.      CloseWindow(SVDriverHandle->ah_Window);
  69.     }
  70.  
  71.    CloseScreen(SVDriverHandle->ah_Screen);
  72.  
  73.    SVDriverHandle->ah_Window = N;
  74.    SVDriverHandle->ah_Screen = N;
  75.   }
  76. }
  77.  
  78. /* *************************************************** */
  79. /* *                             * */
  80. /* * SVD_FreeResources : Free Memory and more        * */
  81. /* *                             * */
  82. /* *************************************************** */
  83.  
  84. void __saveds __asm SVD_FreeResources( register __a1 struct SVDriverHandle *SVDriverHandle_a1)
  85. {
  86.  struct SVDriverHandle *SVDriverHandle = SVDriverHandle_a1;
  87.  struct SVDriverBase *SVDriverBase = N;
  88.  
  89.  if(!SVDriverHandle) return;
  90.  
  91.  if(SVDriverHandle->ah_ramhandle) SVSUP_FreeMemList(SVDriverHandle->ah_ramhandle);
  92.  
  93.  SVDriverHandle->ah_ramhandle = N;
  94. }
  95.