diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/stable/trace.h | |
parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip |
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/stable/trace.h')
-rw-r--r-- | src/stable/trace.h | 310 |
1 files changed, 155 insertions, 155 deletions
diff --git a/src/stable/trace.h b/src/stable/trace.h index da67f03..d47df9c 100644 --- a/src/stable/trace.h +++ b/src/stable/trace.h | |||
@@ -17,165 +17,165 @@ | |||
17 | 17 | ||
18 | namespace Bu | 18 | namespace Bu |
19 | { | 19 | { |
20 | /* template<typename t> void __tracer_format( t &v ) | 20 | /* template<typename t> void __tracer_format( t &v ) |
21 | { | 21 | { |
22 | __tracer_format( *const_cast<const t *>(&v) ); | 22 | __tracer_format( *const_cast<const t *>(&v) ); |
23 | } | 23 | } |
24 | */ | 24 | */ |
25 | template<typename t> void __tracer_format( const t &v ) | 25 | template<typename t> void __tracer_format( const t &v ) |
26 | { | 26 | { |
27 | Bu::sio << v; | 27 | Bu::sio << v; |
28 | } | 28 | } |
29 | 29 | ||
30 | void __tracer( const char *pf ); | 30 | void __tracer( const char *pf ); |
31 | 31 | ||
32 | #define looper( vv ) \ | 32 | #define looper( vv ) \ |
33 | for( ; *n; n++ ) \ | 33 | for( ; *n; n++ ) \ |
34 | { \ | 34 | { \ |
35 | if( bInBracket == true ) \ | 35 | if( bInBracket == true ) \ |
36 | { \ | 36 | { \ |
37 | if( *n == '>' ) \ | 37 | if( *n == '>' ) \ |
38 | bInBracket = false; \ | 38 | bInBracket = false; \ |
39 | } \ | 39 | } \ |
40 | else if( *n == ',' || *n == ')' ) \ | 40 | else if( *n == ',' || *n == ')' ) \ |
41 | { \ | 41 | { \ |
42 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); \ | 42 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); \ |
43 | fwrite("=", 1, 1, stdout); \ | 43 | fwrite("=", 1, 1, stdout); \ |
44 | __tracer_format( vv ); \ | 44 | __tracer_format( vv ); \ |
45 | s = n; \ | 45 | s = n; \ |
46 | n++; \ | 46 | n++; \ |
47 | break; \ | 47 | break; \ |
48 | } \ | 48 | } \ |
49 | else if( *n == '<' ) \ | 49 | else if( *n == '<' ) \ |
50 | { \ | 50 | { \ |
51 | bInBracket = true; \ | 51 | bInBracket = true; \ |
52 | } \ | 52 | } \ |
53 | } (void)0 | 53 | } (void)0 |
54 | 54 | ||
55 | template<typename t1> void __tracer( const char *pf, t1 &v1 ) | 55 | template<typename t1> void __tracer( const char *pf, t1 &v1 ) |
56 | { | 56 | { |
57 | printf("trace: "); | 57 | printf("trace: "); |
58 | const char *s = pf; | 58 | const char *s = pf; |
59 | const char *n = pf; | 59 | const char *n = pf; |
60 | bool bInBracket = false; | 60 | bool bInBracket = false; |
61 | looper( v1 ); | 61 | looper( v1 ); |
62 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); | 62 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
63 | fwrite( "\n", 1, 1, stdout ); | 63 | fwrite( "\n", 1, 1, stdout ); |
64 | fflush( stdout ); | 64 | fflush( stdout ); |
65 | } | 65 | } |
66 | 66 | ||
67 | template<typename t1, typename t2> void __tracer( const char *pf, | 67 | template<typename t1, typename t2> void __tracer( const char *pf, |
68 | t1 &v1, t2 &v2 ) | 68 | t1 &v1, t2 &v2 ) |
69 | { | 69 | { |
70 | printf("trace: "); | 70 | printf("trace: "); |
71 | const char *s = pf; | 71 | const char *s = pf; |
72 | const char *n = pf; | 72 | const char *n = pf; |
73 | bool bInBracket = false; | 73 | bool bInBracket = false; |
74 | looper( v1 ); | 74 | looper( v1 ); |
75 | looper( v2 ); | 75 | looper( v2 ); |
76 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); | 76 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
77 | fwrite( "\n", 1, 1, stdout ); | 77 | fwrite( "\n", 1, 1, stdout ); |
78 | fflush( stdout ); | 78 | fflush( stdout ); |
79 | } | 79 | } |
80 | 80 | ||
81 | template<typename t1, typename t2, typename t3> | 81 | template<typename t1, typename t2, typename t3> |
82 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3 ) | 82 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3 ) |
83 | { | 83 | { |
84 | printf("trace: "); | 84 | printf("trace: "); |
85 | const char *s = pf; | 85 | const char *s = pf; |
86 | const char *n = pf; | 86 | const char *n = pf; |
87 | bool bInBracket = false; | 87 | bool bInBracket = false; |
88 | looper( v1 ); | 88 | looper( v1 ); |
89 | looper( v2 ); | 89 | looper( v2 ); |
90 | looper( v3 ); | 90 | looper( v3 ); |
91 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); | 91 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
92 | fwrite( "\n", 1, 1, stdout ); | 92 | fwrite( "\n", 1, 1, stdout ); |
93 | fflush( stdout ); | 93 | fflush( stdout ); |
94 | } | 94 | } |
95 | 95 | ||
96 | template<typename t1, typename t2, typename t3, typename t4> | 96 | template<typename t1, typename t2, typename t3, typename t4> |
97 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4 ) | 97 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4 ) |
98 | { | 98 | { |
99 | printf("trace: "); | 99 | printf("trace: "); |
100 | const char *s = pf; | 100 | const char *s = pf; |
101 | const char *n = pf; | 101 | const char *n = pf; |
102 | bool bInBracket = false; | 102 | bool bInBracket = false; |
103 | looper( v1 ); | 103 | looper( v1 ); |
104 | looper( v2 ); | 104 | looper( v2 ); |
105 | looper( v3 ); | 105 | looper( v3 ); |
106 | looper( v4 ); | 106 | looper( v4 ); |
107 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); | 107 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
108 | fwrite( "\n", 1, 1, stdout ); | 108 | fwrite( "\n", 1, 1, stdout ); |
109 | fflush( stdout ); | 109 | fflush( stdout ); |
110 | } | 110 | } |
111 | 111 | ||
112 | template<typename t1, typename t2, typename t3, typename t4, typename t5> | 112 | template<typename t1, typename t2, typename t3, typename t4, typename t5> |
113 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4, t5 &v5 ) | 113 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4, t5 &v5 ) |
114 | { | 114 | { |
115 | printf("trace: "); | 115 | printf("trace: "); |
116 | const char *s = pf; | 116 | const char *s = pf; |
117 | const char *n = pf; | 117 | const char *n = pf; |
118 | bool bInBracket = false; | 118 | bool bInBracket = false; |
119 | looper( v1 ); | 119 | looper( v1 ); |
120 | looper( v2 ); | 120 | looper( v2 ); |
121 | looper( v3 ); | 121 | looper( v3 ); |
122 | looper( v4 ); | 122 | looper( v4 ); |
123 | looper( v5 ); | 123 | looper( v5 ); |
124 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); | 124 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
125 | fwrite( "\n", 1, 1, stdout ); | 125 | fwrite( "\n", 1, 1, stdout ); |
126 | fflush( stdout ); | 126 | fflush( stdout ); |
127 | } | 127 | } |
128 | 128 | ||
129 | template<typename t1, typename t2, typename t3, typename t4, typename t5, | 129 | template<typename t1, typename t2, typename t3, typename t4, typename t5, |
130 | typename t6> | 130 | typename t6> |
131 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4, t5 &v5, | 131 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4, t5 &v5, |
132 | t6 &v6) | 132 | t6 &v6) |
133 | { | 133 | { |
134 | printf("trace: "); | 134 | printf("trace: "); |
135 | const char *s = pf; | 135 | const char *s = pf; |
136 | const char *n = pf; | 136 | const char *n = pf; |
137 | bool bInBracket = false; | 137 | bool bInBracket = false; |
138 | looper( v1 ); | 138 | looper( v1 ); |
139 | looper( v2 ); | 139 | looper( v2 ); |
140 | looper( v3 ); | 140 | looper( v3 ); |
141 | looper( v4 ); | 141 | looper( v4 ); |
142 | looper( v5 ); | 142 | looper( v5 ); |
143 | looper( v6 ); | 143 | looper( v6 ); |
144 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); | 144 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
145 | fwrite( "\n", 1, 1, stdout ); | 145 | fwrite( "\n", 1, 1, stdout ); |
146 | fflush( stdout ); | 146 | fflush( stdout ); |
147 | } | 147 | } |
148 | 148 | ||
149 | template<typename t1, typename t2, typename t3, typename t4, typename t5, | 149 | template<typename t1, typename t2, typename t3, typename t4, typename t5, |
150 | typename t6, typename t7> | 150 | typename t6, typename t7> |
151 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4, t5 &v5, | 151 | void __tracer( const char *pf, t1 &v1, t2 &v2, t3 &v3, t4 &v4, t5 &v5, |
152 | t6 &v6, t7 &v7 ) | 152 | t6 &v6, t7 &v7 ) |
153 | { | 153 | { |
154 | printf("trace: "); | 154 | printf("trace: "); |
155 | const char *s = pf; | 155 | const char *s = pf; |
156 | const char *n = pf; | 156 | const char *n = pf; |
157 | bool bInBracket = false; | 157 | bool bInBracket = false; |
158 | looper( v1 ); | 158 | looper( v1 ); |
159 | looper( v2 ); | 159 | looper( v2 ); |
160 | looper( v3 ); | 160 | looper( v3 ); |
161 | looper( v4 ); | 161 | looper( v4 ); |
162 | looper( v5 ); | 162 | looper( v5 ); |
163 | looper( v6 ); | 163 | looper( v6 ); |
164 | looper( v7 ); | 164 | looper( v7 ); |
165 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); | 165 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
166 | fwrite( "\n", 1, 1, stdout ); | 166 | fwrite( "\n", 1, 1, stdout ); |
167 | fflush( stdout ); | 167 | fflush( stdout ); |
168 | } | 168 | } |
169 | #undef looper | 169 | #undef looper |
170 | 170 | ||
171 | template<> void __tracer_format<float>( const float &v ); | 171 | template<> void __tracer_format<float>( const float &v ); |
172 | template<> void __tracer_format<double>( const double &v ); | 172 | template<> void __tracer_format<double>( const double &v ); |
173 | template<> void __tracer_format<void *>( void * const &v ); | 173 | template<> void __tracer_format<void *>( void * const &v ); |
174 | template<> void __tracer_format<char *>( char * const &v ); | 174 | template<> void __tracer_format<char *>( char * const &v ); |
175 | template<> void __tracer_format<char **>( char ** const &v ); | 175 | template<> void __tracer_format<char **>( char ** const &v ); |
176 | template<> void __tracer_format<void const *>( void const * const &v ); | 176 | template<> void __tracer_format<void const *>( void const * const &v ); |
177 | template<> void __tracer_format<char const *>( char const * const &v ); | 177 | template<> void __tracer_format<char const *>( char const * const &v ); |
178 | template<> void __tracer_format<char const **>( char const ** const &v ); | 178 | template<> void __tracer_format<char const **>( char const ** const &v ); |
179 | } | 179 | } |
180 | 180 | ||
181 | #ifdef BU_TRACE | 181 | #ifdef BU_TRACE |