home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / errors.h < prev    next >
C/C++ Source or Header  |  1994-08-06  |  7KB  |  183 lines

  1. /*      ERRORS.H
  2.  *
  3.  * MIDAS Sound System error codes and error message strings
  4.  *
  5.  * Copyright 1994 Petteri Kangaslampi and Jarno Paananen
  6.  *
  7.  * This file is part of the MIDAS Sound System, and may only be
  8.  * used, modified and distributed under the terms of the MIDAS
  9.  * Sound System license, LICENSE.TXT. By continuing to use,
  10.  * modify or distribute this file you indicate that you have
  11.  * read the license and understand and accept it fully.
  12. */
  13.  
  14.  
  15. #ifndef __ERRORS_H
  16. #define __ERRORS_H
  17.  
  18.  
  19. #define MAXERRORS 256       /* maximum number of errors to store */
  20.  
  21.  
  22. /****************************************************************************\
  23. *       enum ErrorCodes
  24. *       ---------------
  25. * Description:  MIDAS Sound System error codes
  26. \****************************************************************************/
  27.  
  28. enum ErrorCodes
  29. {
  30.     OK = 0,                             /* no error */
  31.     errUndefined,                       /* undefined error */
  32.     errOutOfMemory,                     /* out of (conventional) memory */
  33.     errHeapCorrupted,                   /* (conventional memory) heap
  34.                                            corrupted */
  35.     errInvalidBlock,                    /* invalid memory block */
  36.     errOutOfEMS,                        /* out of EMS memory */
  37.     errEMSHeapCorrupted,                /* EMS heap corrupted */
  38.     errInvalidEMSBlock,                 /* invalid EMS memory block */
  39.     errEMMFailure,                      /* Expanded Memory Manager failure */
  40.     errOutOfCardMemory,                 /* out of soundcard memory */
  41.     errCardHeapCorrupted,               /* soundcard heap corrupted */
  42.     errInvalidCardBlock,                /* invalid soundcard memory block */
  43.     errNoInstHandles,                   /* out of instrument handles */
  44.     errFileOpen,                        /* unable to open file */
  45.     errFileRead,                        /* unable to read file */
  46.     errInvalidModule,                   /* invalid module file */
  47.     errInvalidInst,                     /* invalid instrument in module */
  48.     errInvalidPatt,                     /* invalid pattern data in module */
  49.     errInvalidChanNumber,               /* invalid channel number */
  50.     errInvalidInstHandle,               /* invalid instrument handle */
  51.     errNoChannels,                      /* Sound Device channels not open */
  52.     errSDFailure,                       /* Sound Device hardware failure */
  53.     errInvalidArguments,                /* invalid function arguments */
  54.  
  55.     errFileNotFound,                    /* file does not exist */
  56.     errInvalidFileHandle,               /* invalid file handle */
  57.     errAccessDenied,                    /* access denied */
  58.     errFileExists,                      /* file exists */
  59.     errTooManyFiles,                    /* too many open files */
  60.     errDiskFull,                        /* disk full */
  61.     errEndOfFile,                       /* unexpected end of file */
  62.     errInvalidPath,                     /* invalid path */
  63.     errFileWrite                        /* unable to write file */
  64. };
  65.  
  66.  
  67.  
  68. /****************************************************************************\
  69. *       enum FunctionIDs
  70. *       ----------------
  71. * Description:  ID numbers for first functions in all modules
  72. \****************************************************************************/
  73.  
  74. enum FunctionIDs
  75. {
  76.     ID_error = 0,                       /* error handling */
  77.     ID_dma = 100,                       /* DMA handling routines */
  78.     ID_dsm = 200,                       /* Digital Sound Mixer */
  79.     ID_ems = 300,                       /* EMS heap manager */
  80.     ID_mem = 400,                       /* Conventional memory management */
  81.     ID_mod = 500,                       /* Protracker Module Player */
  82.     ID_s3m = 600,                       /* Scream Tracker 3 Module Player */
  83.     ID_tmr = 700,                       /* TempoTimer */
  84.     ID_vu = 800,                        /* Real VU meters */
  85.     ID_rf = 900,                        /* Raw file I/O */
  86.     ID_file = 1000,                     /* High-level file I/O */
  87.     ID_gus = 2000,                      /* GUS Sound Device */
  88.     ID_pas = 2100,                      /* PAS Sound Device */
  89.     ID_wss = 2200,                      /* WSS Sound Device */
  90.     ID_sb = 2300,                       /* SB Sound Device */
  91.     ID_nsnd = 2900                      /* No Sound Sound Device */
  92. };
  93.  
  94.  
  95.  
  96. #ifdef DEBUG
  97.  
  98. /****************************************************************************\
  99. *       struct errRecord
  100. *       ----------------
  101. * Description:  Error record for error list
  102. \****************************************************************************/
  103.  
  104. typedef struct
  105. {
  106.     int         errorCode;              /* error code number */
  107.     unsigned    functID;                /* ID for function that caused the
  108.                                            error */
  109. } errRecord;
  110.  
  111.  
  112. extern  errRecord   errorList[MAXERRORS];   /* error list */
  113. extern  unsigned    numErrors;              /* number of errors in list */
  114.  
  115.  
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119.  
  120.  
  121.  
  122. /****************************************************************************\
  123. *
  124. * Function:     void errAdd(int errorCode, unsigned functID);
  125. *
  126. * Description:  Add an error to error list
  127. *
  128. * Input:        int errorCode           error code
  129. *               unsigned functID        ID for function that caused the error
  130. *
  131. \****************************************************************************/
  132.  
  133. void CALLING errAdd(int errorCode, unsigned functID);
  134.  
  135.  
  136.  
  137.  
  138. /****************************************************************************\
  139. *
  140. * Function:     void errPrintList(void);
  141. *
  142. * Description:  Prints the error list to stderr
  143. *
  144. \****************************************************************************/
  145.  
  146. void CALLING errPrintList(void);
  147.  
  148.  
  149. #ifdef __cplusplus
  150. }
  151. #endif
  152.  
  153.  
  154. #endif
  155.  
  156.  
  157.  
  158. extern char     *errorMsg[];            /* error message strings */
  159.  
  160.  
  161.  
  162. /* ERROR - adds an error to the MIDAS error list if DEBUG is defined.
  163.    Does nothing otherwise. */
  164.  
  165. #ifdef DEBUG
  166.     #define ERROR(errCode, functID) errAdd(errCode, functID)
  167. #else
  168.     #define ERROR(errCode, functID)
  169. #endif
  170.  
  171.  
  172. /* PASSERROR - passes error value in variable error on */
  173.  
  174. #ifdef DEBUG
  175.     #define PASSERROR(functID) { errAdd(error, functID); return error; }
  176. #else
  177.     #define PASSERROR(functID) return error;
  178. #endif
  179.  
  180.  
  181.  
  182. #endif
  183.