Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendebug.h
Go to the documentation of this file.
00001 /* 00002 debug.h: 00003 if DEBUG defined: debugging macro fprintf wrappers 00004 else: macros defined to do nothing 00005 That saves typing #ifdef DEBUG all the time and still preserves 00006 lean code without debugging. 00007 00008 public domain (or LGPL / GPL, if you like that more;-) 00009 generated by debugdef.pl, what was 00010 trivially written by Thomas Orgis <thomas@orgis.org> 00011 */ 00012 00013 #include "config.h" 00014 00015 /* 00016 I could do that with variadic macros available: 00017 #define sdebug(me, s) fprintf(stderr, "[location] " s "\n") 00018 #define debug(me, s, ...) fprintf(stderr, "[location] " s "}n", __VA_ARGS__) 00019 00020 Variadic macros are a C99 feature... 00021 Now just predefining stuff non-variadic for up to 15 arguments. 00022 It's cumbersome to have them all with different names, though... 00023 */ 00024 00025 #ifdef DEBUG 00026 #include <stdio.h> 00027 #define debug(s) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__) 00028 #define debug1(s, a) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a) 00029 #define debug2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b) 00030 #define debug3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c) 00031 #define debug4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d) 00032 #define debug5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e) 00033 #define debug6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f) 00034 #define debug7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g) 00035 #define debug8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h) 00036 #define debug9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) 00037 #define debug10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) 00038 #define debug11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) 00039 #define debug12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) 00040 #define debug13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) 00041 #define debug14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) 00042 #define debug15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 00043 #else 00044 #define debug(s) 00045 #define debug1(s, a) 00046 #define debug2(s, a, b) 00047 #define debug3(s, a, b, c) 00048 #define debug4(s, a, b, c, d) 00049 #define debug5(s, a, b, c, d, e) 00050 #define debug6(s, a, b, c, d, e, f) 00051 #define debug7(s, a, b, c, d, e, f, g) 00052 #define debug8(s, a, b, c, d, e, f, g, h) 00053 #define debug9(s, a, b, c, d, e, f, g, h, i) 00054 #define debug10(s, a, b, c, d, e, f, g, h, i, j) 00055 #define debug11(s, a, b, c, d, e, f, g, h, i, j, k) 00056 #define debug12(s, a, b, c, d, e, f, g, h, i, j, k, l) 00057 #define debug13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) 00058 #define debug14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) 00059 #define debug15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 00060 #endif 00061 00062 /* warning macros also here... */ 00063 #ifndef NO_WARNING 00064 #define warning(s) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__) 00065 #define warning1(s, a) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a) 00066 #define warning2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b) 00067 #define warning3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c) 00068 #define warning4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d) 00069 #define warning5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e) 00070 #define warning6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f) 00071 #define warning7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g) 00072 #define warning8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h) 00073 #define warning9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) 00074 #define warning10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) 00075 #define warning11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) 00076 #define warning12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) 00077 #define warning13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) 00078 #define warning14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) 00079 #define warning15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 00080 #else 00081 #define warning(s) 00082 #define warning1(s, a) 00083 #define warning2(s, a, b) 00084 #define warning3(s, a, b, c) 00085 #define warning4(s, a, b, c, d) 00086 #define warning5(s, a, b, c, d, e) 00087 #define warning6(s, a, b, c, d, e, f) 00088 #define warning7(s, a, b, c, d, e, f, g) 00089 #define warning8(s, a, b, c, d, e, f, g, h) 00090 #define warning9(s, a, b, c, d, e, f, g, h, i) 00091 #define warning10(s, a, b, c, d, e, f, g, h, i, j) 00092 #define warning11(s, a, b, c, d, e, f, g, h, i, j, k) 00093 #define warning12(s, a, b, c, d, e, f, g, h, i, j, k, l) 00094 #define warning13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) 00095 #define warning14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) 00096 #define warning15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 00097 #endif 00098 00099 /* error macros also here... */ 00100 #ifndef NO_ERROR 00101 #define error(s) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__) 00102 #define error1(s, a) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a) 00103 #define error2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b) 00104 #define error3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c) 00105 #define error4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d) 00106 #define error5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e) 00107 #define error6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f) 00108 #define error7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g) 00109 #define error8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h) 00110 #define error9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) 00111 #define error10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) 00112 #define error11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) 00113 #define error12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) 00114 #define error13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) 00115 #define error14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) 00116 #define error15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 00117 #else 00118 #define error(s) 00119 #define error1(s, a) 00120 #define error2(s, a, b) 00121 #define error3(s, a, b, c) 00122 #define error4(s, a, b, c, d) 00123 #define error5(s, a, b, c, d, e) 00124 #define error6(s, a, b, c, d, e, f) 00125 #define error7(s, a, b, c, d, e, f, g) 00126 #define error8(s, a, b, c, d, e, f, g, h) 00127 #define error9(s, a, b, c, d, e, f, g, h, i) 00128 #define error10(s, a, b, c, d, e, f, g, h, i, j) 00129 #define error11(s, a, b, c, d, e, f, g, h, i, j, k) 00130 #define error12(s, a, b, c, d, e, f, g, h, i, j, k, l) 00131 #define error13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) 00132 #define error14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) 00133 #define error15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 00134 #endif 00135 00136 /* ereturn macros also here... */ 00137 #ifndef NO_ERETURN 00138 #define ereturn(rv, s) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__); return rv; }while(0) 00139 #define ereturn1(rv, s, a) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a); return rv; }while(0) 00140 #define ereturn2(rv, s, a, b) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b); return rv; }while(0) 00141 #define ereturn3(rv, s, a, b, c) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c); return rv; }while(0) 00142 #define ereturn4(rv, s, a, b, c, d) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d); return rv; }while(0) 00143 #define ereturn5(rv, s, a, b, c, d, e) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e); return rv; }while(0) 00144 #define ereturn6(rv, s, a, b, c, d, e, f) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f); return rv; }while(0) 00145 #define ereturn7(rv, s, a, b, c, d, e, f, g) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g); return rv; }while(0) 00146 #define ereturn8(rv, s, a, b, c, d, e, f, g, h) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h); return rv; }while(0) 00147 #define ereturn9(rv, s, a, b, c, d, e, f, g, h, i) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i); return rv; }while(0) 00148 #define ereturn10(rv, s, a, b, c, d, e, f, g, h, i, j) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j); return rv; }while(0) 00149 #define ereturn11(rv, s, a, b, c, d, e, f, g, h, i, j, k) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k); return rv; }while(0) 00150 #define ereturn12(rv, s, a, b, c, d, e, f, g, h, i, j, k, l) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l); return rv; }while(0) 00151 #define ereturn13(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m); return rv; }while(0) 00152 #define ereturn14(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n); return rv; }while(0) 00153 #define ereturn15(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); return rv; }while(0) 00154 #else 00155 #define ereturn(rv, s) return rv 00156 #define ereturn1(rv, s, a) return rv 00157 #define ereturn2(rv, s, a, b) return rv 00158 #define ereturn3(rv, s, a, b, c) return rv 00159 #define ereturn4(rv, s, a, b, c, d) return rv 00160 #define ereturn5(rv, s, a, b, c, d, e) return rv 00161 #define ereturn6(rv, s, a, b, c, d, e, f) return rv 00162 #define ereturn7(rv, s, a, b, c, d, e, f, g) return rv 00163 #define ereturn8(rv, s, a, b, c, d, e, f, g, h) return rv 00164 #define ereturn9(rv, s, a, b, c, d, e, f, g, h, i) return rv 00165 #define ereturn10(rv, s, a, b, c, d, e, f, g, h, i, j) return rv 00166 #define ereturn11(rv, s, a, b, c, d, e, f, g, h, i, j, k) return rv 00167 #define ereturn12(rv, s, a, b, c, d, e, f, g, h, i, j, k, l) return rv 00168 #define ereturn13(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m) return rv 00169 #define ereturn14(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) return rv 00170 #define ereturn15(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) return rv 00171 #endif Generated on Fri May 25 2012 04:15:52 for ReactOS by
1.7.6.1
|