error.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* $Header$ */
  2. /* error takes an error value in the range of 0-255 */
  3. /* and generates a trap */
  4. char *errortable[255]={
  5. /* 0 */ "",
  6. /* 1 */ "RETURN without GOSUB",
  7. /* 2 */ "Out of data",
  8. /* 3 */ "Illegal function call",
  9. /* 4 */ "Overflow",
  10. /* 5 */ "Out of memory",
  11. /* 6 */ "Undefined line ",
  12. /* 7 */ "Subscript out of range",
  13. /* 8 */ "Redimensioned array",
  14. /* 9 */ "Division by zero",
  15. /* 10 */ "Illegal indirect",
  16. /* 11 */ "Type mismatch",
  17. /* 12 */ "Out of string space",
  18. /* 13 */ "String too long",
  19. /* 14 */ "String formula too complex",
  20. /* 15 */ "Can't continue",
  21. /* 16 */ "Undefined user function",
  22. /* 17 */ "No resume",
  23. /* 18 */ "Resume without error",
  24. /* 19 */ "Unprintable error",
  25. /* 20 */ "Missing operand",
  26. /* 21 */ "Line buffer overflow",
  27. /* 22 */ "FOR without NEXT",
  28. /* 23 */ "WHILE without WEND",
  29. /* 24 */ "WEND without WHILE",
  30. /* 25 */ "Field overflow",
  31. /* 26 */ "Internal error",
  32. /* 27 */ "Bad file number",
  33. /* 28 */ "File not found",
  34. /* 29 */ "Bad file mode",
  35. /* 30 */ "File already open",
  36. /* 31 */ "Disk IO error",
  37. /* 32 */ "File already exists",
  38. /* 33 */ "Disk full",
  39. /* 34 */ "Input past end",
  40. /* 35 */ "Bad record number",
  41. /* 36 */ "Bad file name",
  42. /* 37 */ "Direct statement in file",
  43. /* 38 */ "Too many files",
  44. /* 39 */ "File not open",
  45. /* 40 */ "Syntax error in data",
  46. 0
  47. };
  48. error(index)
  49. int index;
  50. {
  51. extern int _errsym;
  52. extern int _erlsym;
  53. _setline();
  54. if( index<0 || index >40 )
  55. printf("LINE %d:ERROR %d: Unprintable error\n",_erlsym,index);
  56. else printf("LINE %d:ERROR %d: %s\n",_erlsym,index,errortable[index]);
  57. _errsym= index;
  58. _trap();
  59. }