]> icculus.org git repositories - btb/d2x.git/blob - unused/win95/error.h
cruft removal
[btb/d2x.git] / unused / win95 / error.h
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-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 int error_init(void (*func)(char *), char *fmt,...);                    //init error system, set default message, returns 0=ok
15 void set_exit_message(char *fmt,...);   //specify message to print at exit
16 void Warning(char *fmt,...);                            //print out warning message to user
17 void set_warn_func(void (*f)(char *s));//specifies the function to call with warning messages
18 void clear_warn_func(void (*f)(char *s));//say this function no longer valid
19 void _Assert(int expr,char *expr_text,char *filename,int linenum);      //assert func
20 void Error(char *fmt,...);                                      //exit with error code=1, print message
21
22 #ifndef NDEBUG          //macros for debugging
23
24 #ifndef MACINTOSH
25
26         #if defined(__NT__) 
27                 void WinInt3();
28                 #define Int3() WinInt3()
29                 #define Assert(expr) _Assert(expr, #expr, __FILE__, __LINE__)
30         #else // ifdef __NT__
31                 void Int3(void);                                                                        //generate int3
32                 #pragma aux Int3 = "int 3h";
33
34                 #define Assert(expr) _Assert(expr,#expr,__FILE__,__LINE__)
35
36         //make error do int3, then call func
37                 #pragma aux Error aborts = \
38                         "int    3"      \
39                 "jmp Error";
40
41         //#pragma aux Error aborts;
42
43         //make assert do int3 (if expr false), then call func
44                 #pragma aux _Assert parm [eax] [edx] [ebx] [ecx] = \
45                         "test eax,eax"          \
46                         "jnz    no_int3"                \
47                         "int    3"                              \
48                         "no_int3:"                      \
49                         "call _Assert";
50         #endif  
51
52 #else           // ifndef MACINTOSH
53
54 extern int MacEnableInt3;
55
56 #define Int3() do { key_close(); if (MacEnableInt3) Debugger(); } while(0)
57 #define Assert(expr) MacAssert(expr,#expr,__FILE__,__LINE__)
58
59 #endif          // ifndef MACINTOSH
60
61 #else                                   //macros for real game
62
63 #if !defined(__NT__)
64 #pragma aux Error aborts;
65 #endif
66
67 #define Assert(__ignore) ((void)0)
68 #define Int3() ((void)0)
69
70 #endif
71
72