home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / msdos / animutil / pvquan / animdat / error.c < prev    next >
C/C++ Source or Header  |  1992-11-30  |  2KB  |  44 lines

  1. /*--------------------------------------------------------------*/
  2. /*            ANIMDAT 1.1                */
  3. /*        copyright 1992 - TODD SANKEY            */
  4. /*                                */
  5. /*  The author hereby grants permission for the use and sharing    */
  6. /* of both source code end executable versions of this software    */
  7. /* at no charge. This software is not for sale and no other    */
  8. /* shall charge for it without the expressed consent of the    */
  9. /* author.                            */
  10. /*                                */
  11. /*  The source code can be freely modified, but it must retain    */
  12. /* the original copyright notice, and the author must be    */
  13. /* notified of these changes if the altered code is to be    */
  14. /* distributed.                            */
  15. /*--------------------------------------------------------------*/
  16. /*------------------------------------------------------*/
  17. /* error.c        Default error handler.        */
  18. /*------------------------------------------------------*/
  19.  
  20. #include <stdlib.h>
  21. #include <stdio.h>
  22. #include "common.h"
  23.  
  24. char *error_msg[] = {    "No error","Syntax error","Failed file open",
  25.             "Invalid number","Missing right parenthesis",
  26.             "Invalid expression","Missing identifier",
  27.             "Stack overflow","Failed memory allocation",
  28.             "Symbol redefined","Line too long in input file",
  29.             "Symbol not defined","Unsupported function",
  30.             "Nothing to do - num_scenes not defined",
  31.             "File system error"
  32.             };
  33.  
  34. void error(ERROR_CODE code,char *error_string)
  35. {
  36.  if (error_string != NULL)
  37.     printf("\n%s\n",error_string);
  38.  printf("%s: %s",cur_file,error_msg[code]);
  39.  if (cur_line_num)
  40.     printf(" on line %u",cur_line_num);
  41.  printf("\n");
  42.  exit(1);
  43. }
  44.