home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 594b.lha / Precognition_rel1 / std_main.c < prev    next >
C/C++ Source or Header  |  1991-12-12  |  1KB  |  57 lines

  1. /*
  2. **    File "std_main.c"
  3. **
  4. ** Example of a 'standard' main program for Precognition.
  5. **
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <exec/types.h>
  10. #include <graphics/gfxbase.h>
  11. #include <intuition/intuitionbase.h>
  12. #include "precognition.h"
  13.  
  14. /* declare lib structures */
  15. struct IntuitionBase *IntuitionBase = NULL;
  16. struct GfxBase       *GfxBase       = NULL;
  17.  
  18. void main( int argc, char **argv  )
  19. {
  20.    void GracefulExit( short ExitStatus );
  21.    void do_window( void );
  22.  
  23.    /* open intuition library */
  24.    IntuitionBase = (struct IntuitionBase *)
  25.       OpenLibrary ("intuition.library", 0 );
  26.    if (IntuitionBase == NULL)
  27.    {
  28.       printf("couldn't open intuition.library\n");
  29.       GracefulExit( FALSE );
  30.    }
  31.  
  32.    GfxBase = (struct GfxBase *)
  33.       OpenLibrary("graphics.library", 0 );
  34.    if (GfxBase == NULL)
  35.    {
  36.       printf("couldn't open graphics.library\n");
  37.       GracefulExit( FALSE );
  38.    }
  39.  
  40.    do_window(); /* *** Change this to call your window routine! *** */
  41.    
  42.    GracefulExit( TRUE );
  43.  
  44. }
  45.  
  46.  
  47. void GracefulExit( short ExitStatus )
  48. {
  49.    /* Close all libraries. */
  50.  
  51.    if (GfxBase)         CloseLibrary    (GfxBase);
  52.    if (IntuitionBase)   CloseLibrary    (IntuitionBase);
  53.  
  54.    exit( ExitStatus );
  55. }
  56.  
  57.