home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 499.lha / GamePortDeviceToolKit / gameport.lzh / src / DeviceToolKits / GamePort / test_proto / test2.c < prev    next >
C/C++ Source or Header  |  1991-01-03  |  1KB  |  56 lines

  1. #include <stdio.h>
  2.  
  3. #include "DeviceToolKits/GamePort.h"
  4. #ifndef  TESTPROTO
  5. #define  NO_PRAGMAS  1
  6. #endif
  7. #include "DeviceToolKits/proto/GamePort.h"
  8. #include "DeviceToolKits/GamePortBase.h"
  9.  
  10. DTGamePort_t   Unit1;
  11. BYTE           type;
  12.  
  13. main(argc,argv)
  14. int   argc;
  15. char  *argv[];
  16. {
  17.    long  status;
  18.  
  19. #ifdef   TESTSHARED
  20. /*  Open the GamePort library  */
  21.  
  22.    DTGamePortOpen(DTGAMEPORTREV);
  23. #endif
  24.  
  25. /*  Try to initialize unit 1 of the GamePort  */
  26.  
  27.    if ((Unit1 = DTGamePortCreate(1L,&status)) == NULL) {
  28.       fprintf(stderr,"Error initializing unit 1 = %ld.\n",status);
  29.       fflush(stderr);
  30.       goto cleanup;
  31.    }
  32.  
  33.    fprintf(stderr,"Unit1 = %lX\n",(long) Unit1);
  34.    fflush(stderr);
  35.  
  36. /*  Find out what kind of controller is on unit 1  */
  37.  
  38.    if ((status = DTGamePortGetType(Unit1,&type)) != 0) {
  39.       fprintf(stderr,"Error getting unit 1 type = %ld,%ld.\n",
  40.                status,Unit1->gp_error);
  41.       fflush(stderr);
  42.       goto cleanup;
  43.    }
  44.  
  45.    printf("Unit 1 controller type = %d.\n",type);
  46.  
  47. /*  Free the stuff  */
  48.  
  49. cleanup:
  50.    DTGamePortFree(Unit1);
  51. #ifdef   TESTSHARED
  52.    DTGamePortClose();
  53. #endif
  54. }
  55.  
  56.