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

  1. /*      ERRORS.C
  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. #include <stdio.h>
  16. #include "lang.h"
  17. #include "errors.h"
  18.  
  19. char            *errorMsg[] =
  20. {
  21.     "OK",
  22.     "Undefined error",
  23.     "Out of conventional memory",
  24.     "Conventional memory heap corrupted",
  25.     "Invalid conventional memory block",
  26.     "Out of EMS memory",
  27.     "EMS memory heap corrupted",
  28.     "Invalid EMS memory block",
  29.     "Expanded Memory Manager failure",
  30.     "Out of soundcard memory",
  31.     "Soundcard memory heap corrupted",
  32.     "Invalid soundcard memory block",
  33.     "Out of instrument handles",
  34.     "Unable to open file",
  35.     "Unable to read file",
  36.     "Invalid module file",
  37.     "Invalid instrument in module",
  38.     "Invalid pattern data in module",
  39.     "Invalid channel number",
  40.     "Invalid instrument handle",
  41.     "Sound Device channels not open",
  42.     "Sound Device hardware failure",
  43.     "Invalid function arguments",
  44.     "File does not exist",
  45.     "Invalid file handle",
  46.     "Access denied",
  47.     "File exists",
  48.     "Too many open files",
  49.     "Disk full",
  50.     "Unexpected end of file",
  51.     "Invalid path",
  52.     "Unable to write file"
  53. };
  54.  
  55.  
  56.  
  57.  
  58. #ifdef DEBUG
  59.  
  60. errRecord   errorList[MAXERRORS];       /* error list */
  61. unsigned    numErrors = 0;              /* number of errors in list */
  62.  
  63.  
  64.  
  65. /****************************************************************************\
  66. *
  67. * Function:     void errAdd(int errorCode, unsigned functID);
  68. *
  69. * Description:  Add an error to error list
  70. *
  71. * Input:        int errorCode           error code
  72. *               unsigned functID        ID for function that caused the error
  73. *
  74. \****************************************************************************/
  75.  
  76. void CALLING errAdd(int errorCode, unsigned functID)
  77. {
  78.     /* make sure that error list does not overflow */
  79.     if ( numErrors <= MAXERRORS )
  80.     {
  81.         /* store error information to list: */
  82.         errorList[numErrors].errorCode = errorCode;
  83.         errorList[numErrors].functID = functID;
  84.  
  85.         numErrors++;
  86.     }
  87. }
  88.  
  89.  
  90.  
  91.  
  92. /****************************************************************************\
  93. *
  94. * Function:     void errPrintList(void);
  95. *
  96. * Description:  Prints the error list to stderr
  97. *
  98. \****************************************************************************/
  99.  
  100. void CALLING errPrintList(void)
  101. {
  102.     unsigned    i;
  103.  
  104.     fprintf(stderr, "MIDAS error list:\n");
  105.  
  106.     for ( i = 0; i < numErrors; i++ )
  107.     {
  108.         fprintf(stderr, "%u: <%i, %u> - %s at %u\n", i,
  109.             errorList[i].errorCode, errorList[i].functID,
  110.             errorMsg[errorList[i].errorCode], errorList[i].functID);
  111.     }
  112. }
  113.  
  114.  
  115.  
  116. #endif
  117.