home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / misc / error.h < prev    next >
C/C++ Source or Header  |  1998-06-08  |  4KB  |  106 lines

  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.  
  62. int error_init(char *fmt,...);            //init error system, set default message, returns 0=ok
  63. void set_exit_message(char *fmt,...);    //specify message to print at exit
  64. void Warning(char *fmt,...);                //print out warning message to user
  65. void set_warn_func(void (*f)(char *s));//specifies the function to call with warning messages
  66. void clear_warn_func(void (*f)(char *s));//say this function no longer valid
  67. void _Assert(int expr,char *expr_text,char *filename,int linenum);    //assert func
  68. void Error(char *fmt,...);                    //exit with error code=1, print message
  69.  
  70. void Assert(int expr);
  71. void Int3();
  72.  
  73. #ifndef NDEBUG        //macros for debugging
  74.  
  75. //void Int3(void);                                    //generate int3
  76. #pragma aux Int3 = "int 3h";
  77.  
  78. //#define Assert(expr) _Assert(expr,#expr,__FILE__,__LINE__)
  79.  
  80. //make error do int3, then call func
  81. #pragma aux Error aborts = \
  82.     "int    3"    \
  83.     "jmp Error";
  84.  
  85. //#pragma aux Error aborts;
  86.  
  87. //make assert do int3 (if expr false), then call func
  88. #pragma aux _Assert parm [eax] [edx] [ebx] [ecx] = \
  89.     "test eax,eax"        \
  90.     "jnz    no_int3"        \
  91.     "int    3"                \
  92.     "no_int3:"            \
  93.     "call _Assert";
  94.  
  95. #else                    //macros for real game
  96.  
  97. #pragma aux Error aborts;
  98. //Changed Assert and Int3 because I couldn't get the macros to compile -KRB
  99. //#define Assert(__ignore) ((void)0)
  100. void Assert(int expr);
  101. //#define Int3() ((void)0)
  102. void Int3();
  103. #endif
  104.  
  105.  
  106.