ERROR.H 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/misc/rcs/error.h $
  15. * $Revision: 1.12 $
  16. * $Author: matt $
  17. * $Date: 1994/06/17 15:22:46 $
  18. *
  19. * Header for error handling/printing/exiting code
  20. *
  21. * $Log: error.h $
  22. * Revision 1.12 1994/06/17 15:22:46 matt
  23. * Added pragma for Error() for when NDEBUG
  24. *
  25. * Revision 1.11 1994/03/07 13:22:14 matt
  26. * Since the Error() function has 'aborts' set in pragma, we do a jmp
  27. * to the function rather than call.
  28. *
  29. * Revision 1.10 1994/02/17 12:37:15 matt
  30. * Combined two pragma's for Error(), since second superseded the first
  31. *
  32. * Revision 1.9 1994/02/10 18:02:53 matt
  33. * Changed 'if DEBUG_ON' to 'ifndef NDEBUG'
  34. *
  35. * Revision 1.8 1994/02/09 15:18:29 matt
  36. * Added pragma saying that Error() never returns
  37. *
  38. * Revision 1.7 1993/10/19 12:57:53 matt
  39. * If DEBUG_ON not defined, define it to be 1
  40. *
  41. * Revision 1.6 1993/10/15 21:40:39 matt
  42. * Made error functions generate int3's if debugging on
  43. *
  44. * Revision 1.5 1993/10/14 15:29:22 matt
  45. * Added new function clear_warn_func()
  46. *
  47. * Revision 1.4 1993/10/08 16:16:47 matt
  48. * Made Assert() call function _Assert(), rather to do 'if...' inline.
  49. *
  50. * Revision 1.3 1993/09/29 11:39:07 matt
  51. * Added Assert() macro, like the system one, but calls Error()
  52. *
  53. * Revision 1.2 1993/09/27 11:47:03 matt
  54. * Added function set_warn_func()
  55. *
  56. * Revision 1.1 1993/09/23 20:17:46 matt
  57. * Initial revision
  58. *
  59. *
  60. */
  61. int error_init(char *fmt,...); //init error system, set default message, returns 0=ok
  62. void set_exit_message(char *fmt,...); //specify message to print at exit
  63. void Warning(char *fmt,...); //print out warning message to user
  64. void set_warn_func(void (*f)(char *s));//specifies the function to call with warning messages
  65. void clear_warn_func(void (*f)(char *s));//say this function no longer valid
  66. void _Assert(int expr,char *expr_text,char *filename,int linenum); //assert func
  67. void Error(char *fmt,...); //exit with error code=1, print message
  68. void Assert(int expr);
  69. void Int3();
  70. #ifndef NDEBUG //macros for debugging
  71. //void Int3(void); //generate int3
  72. #pragma aux Int3 = "int 3h";
  73. //#define Assert(expr) _Assert(expr,#expr,__FILE__,__LINE__)
  74. //make error do int3, then call func
  75. #pragma aux Error aborts = \
  76. "int 3" \
  77. "jmp Error";
  78. //#pragma aux Error aborts;
  79. //make assert do int3 (if expr false), then call func
  80. #pragma aux _Assert parm [eax] [edx] [ebx] [ecx] = \
  81. "test eax,eax" \
  82. "jnz no_int3" \
  83. "int 3" \
  84. "no_int3:" \
  85. "call _Assert";
  86. #else //macros for real game
  87. #pragma aux Error aborts;
  88. //Changed Assert and Int3 because I couldn't get the macros to compile -KRB
  89. //#define Assert(__ignore) ((void)0)
  90. void Assert(int expr);
  91. //#define Int3() ((void)0)
  92. void Int3();
  93. #endif