FreeCalypso > hg > fc-magnetite
comparison src/gpf2/inc/tdc_base.h @ 1:864b8cc0cf63
src/gpf2: preened GPF goo from TCS211
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Sep 2016 23:38:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:945cf7f506b2 | 1:864b8cc0cf63 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : TDC | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #if defined TDC_PRECOMPILE && !defined TDC_BASE_TDC_H | |
22 #pragma message("TDC_BASE.H ENTERING PRECOMPILE MODE") | |
23 /* | |
24 This code is added to make a prettier and easier to navigate .i-file | |
25 Purpose: | |
26 A) maintain info of which macro codes come from | |
27 B) maintain line breaks from inside macros | |
28 | |
29 The process include the following steps: | |
30 | |
31 1: | |
32 Command: | |
33 perl tdc_h.pl ..\..\..\..\INC\tdc_base.h >tdc_base.tdc_h | |
34 (add TDC_BEGIN_MACRO TDC_NL TDC_MACRO_END TDC_NL macros) | |
35 | |
36 Example transformation: | |
37 Input: (tdc_base.h) | |
38 */ | |
39 #define MULTI_LINE_MACRO(A) ... \ | |
40 ... \ | |
41 ... | |
42 #define SINGLE_LINE_MACRO(A) ... | |
43 /* | |
44 Output: (tdc_base.tdc_h) | |
45 #define MULTI_LINE_MACRO(A) TDC_BEGIN_MACRO(MULTI_LINE_MACRO(A)) ... TDC_NL\ | |
46 ... TDC_NL\ | |
47 ... TDC_MACRO_END() | |
48 #define SINGLE_LINE_MACRO(A) TDC_MACRO(SINGLE_LINE_MACRO(A)) ... | |
49 2: | |
50 Command: | |
51 EDI preprocess .cpp-file with TDC and TDC_PRECOMPILE defined | |
52 (as a consequence tdc_base.tdc_h is used instead of tdc_base.h) | |
53 | |
54 Example transformation: | |
55 Input: (use_some_macro.cpp) | |
56 MULTI_LINE_MACRO(B) | |
57 Output: (use_some_macro.i) | |
58 TDC_BEGIN_MACRO("MULTI_LINE_MACRO(B)") ... TDC_NL ... TDC_NL ... TDC_MACRO_END() | |
59 | |
60 3: | |
61 Command: | |
62 perl tdc_i.pl .\tdc.i >tdc.tdc_i | |
63 (replace TDC_NL with real newline, make pretty indention | |
64 | |
65 Example transformation: | |
66 Input: (use_some_macro.i) | |
67 TDC_BEGIN_MACRO("MULTI_LINE_MACRO(B)") ... TDC_NL ... TDC_NL ... TDC_MACRO_END | |
68 Output: (use_some_macro.tdc_i) | |
69 TDC_BEGIN_MACRO("MULTI_LINE_MACRO(B)") ... | |
70 ... | |
71 ... TDC_MACRO_END() | |
72 | |
73 */ | |
74 #define TDC_BASE_TDC_H | |
75 #include "tdc_base.tdc_h" | |
76 #endif //defined TDC_PRECOMPILE && !defined TDC_BASE_TDC_H | |
77 | |
78 #ifndef TDC_BASE_H // stadard h-file guard | |
79 #define TDC_BASE_H | |
80 | |
81 //============================================================================ | |
82 /// \defgroup Configuration | |
83 //\{ | |
84 | |
85 ///memory leak detection | |
86 #define noTDC_USE_ALLOC_DEBUG_COUNTER | |
87 | |
88 #define TDC_DEBUG | |
89 | |
90 #define TDC_NO_PROFILING | |
91 | |
92 ///include T_PORT | |
93 #define TDC_PORT | |
94 | |
95 #define noM_TDC_MESSAGE_DEMO | |
96 | |
97 ///typeinfo not needed, everything we need is in cccdgen tables | |
98 #define noTDC_TYPEINFO | |
99 | |
100 ///never defined | |
101 #define noDOT_COMPLETE | |
102 | |
103 //\} | |
104 | |
105 //============================================================================ | |
106 // include files | |
107 //============================================================================ | |
108 | |
109 //tdc_test_header_begin | |
110 //extern int dummy_to_make_namespace_non_empty; | |
111 //} //temporare leave namespace tdc | |
112 #ifndef TDC_TEST_I_CPP | |
113 #include <setjmp.h> | |
114 #include <stddef.h> | |
115 #include <typeinfo.h> | |
116 #include <malloc.h> | |
117 #include <string.h> | |
118 #endif | |
119 //namespace tdc { // reenter namespace tdc | |
120 | |
121 //============================================================================ | |
122 // controling warning levels from compilers | |
123 //============================================================================ | |
124 | |
125 #pragma warning(disable:4786) | |
126 //tdc_test_header_end | |
127 | |
128 /* | |
129 general info members are constructed etc by generic functions so these are normal ok when | |
130 arriving inside M_TDC_... : | |
131 Warning 1539: member 'T_raw::handle' (line 3242, file M:\gpf\inc\tdc_base.h, module M:\gpf\util\tap\tdc\src\tdc_lib_main.cpp) not assigned by assignment operator | |
132 Warning 1401: member 'T_raw::handle' (line 3242, file M:\gpf\inc\tdc_base.h, module M:\gpf\util\tap\tdc\src\tdc_lib_main.cpp) not initialized by constructor | |
133 */ | |
134 | |
135 /*lint -e1717*/ //Info 1717: empty prototype for function declaration, assumed '(void)' | |
136 /*lint -e1505*/ //TODO: add access specifier for all base classes | |
137 /*lint -DLINT*/ | |
138 /*lint -esym(18,BUF_*)*/ //CCDGEN generates surplus typedefs for _dsc.h-files | |
139 /*#lint -libdir(M:\gpf\util\teststack\inc\tdcinc)*/ | |
140 /*#lint -libh(M:\gpf\util\teststack\inc\tdcinc\p_xx_tdc_1.h)*/ | |
141 | |
142 /// this lint option is used inside a macro, VA can not handle comments in macros correctly | |
143 #define TDC_LINT_UNUSED_MEMBER /*lint -e{754}*/ | |
144 #define TDC_LINT_UNASSIGNED_MEMBER /*lint -e{1539}*/ | |
145 #define TDC_LINT_UNCOPIED_BASE /*lint -e{1538}*/ | |
146 #define TDC_LINT_NO_SELFASSIGN_TEST /*lint -e{1529}*/ | |
147 #define TDC_LINT_UNINITIALIZED_MEMBER /*lint -e{1401}*/ | |
148 #define TDC_LINT_POSSIBLE_UNHANDLE_POINTER_MEMBER /*lint -e{1740}*/ | |
149 | |
150 //============================================================================ | |
151 /// \defgroup Constants | |
152 //============================================================================ | |
153 //\{ | |
154 | |
155 #define FALSE 0 | |
156 #define TRUE 1 | |
157 | |
158 /// TDSConstant comming from macros.h -> used in cc.doc | |
159 #define NOT_PRESENT_8BIT 0xff | |
160 | |
161 /// TDSConstant comming from macros.h -> used in cc.doc | |
162 #define NOT_PRESENT_16BIT 0xffff | |
163 | |
164 /// TDSConstant comming from macros.h -> used in cc.doc | |
165 #define NOT_PRESENT_32BIT 0xffffffffL | |
166 | |
167 //\} | |
168 | |
169 //============================================================================ | |
170 | |
171 #if TDC_DEBUG_DOT_COMPLETE | |
172 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_0 | |
173 { | |
174 int i0; | |
175 }; | |
176 | |
177 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 | |
178 { | |
179 int i; | |
180 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_0 operator->(){} | |
181 }; | |
182 | |
183 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1A() | |
184 { | |
185 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
186 s. | |
187 i; | |
188 s-> | |
189 i0; | |
190 } | |
191 #else | |
192 #endif | |
193 | |
194 //============================================================================ | |
195 // partial compiling tdcinc\*.cpp | |
196 //============================================================================ | |
197 | |
198 /** VC6 can not handle more than 30000 types per compilation unit, but this | |
199 has not so much to do with this, here we are trying to minimize the overall | |
200 memory usage during compilation, this is a problem for the umts asn1 file | |
201 the big isue is that determin this number is not an excat sicense since | |
202 VC give NO hint on whic entry is coursing this problem if it ocour during | |
203 pass2 of the compilation | |
204 | |
205 to overcome this problem CCDGEN generate additional gaurds in tdcinc\*.cpp files | |
206 | |
207 enum form | |
208 | |
209 #if TDC_ENUM_PART | |
210 #ifndef TDC_SKIP_FORWARD_MENUM_prefix_enumtypename | |
211 M_TDC_POST_MENUM (prefix_enumtypename) | |
212 #endif | |
213 #endif // TDC_ENUM_PART | |
214 | |
215 other form (example is for MSG but PRIM, STRUCT, UNION etc. use the same layout) | |
216 | |
217 #if N / TDC_SIZE == TDC_PART | |
218 #ifndef TDC_SKIP_FORWARD_msgname | |
219 M_TDC_POST_MSG (msgname) | |
220 #endif | |
221 #endif // N / TDC_SIZE == TDC_PART | |
222 | |
223 where N is a sequence number running from 0 and onwards, incremented by 1 for | |
224 each struct in the file | |
225 | |
226 by defining TDC_SIZE and TDC_PART the source files can be partial compiled | |
227 the default behaviour is to compile the hole file at once | |
228 | |
229 */ | |
230 | |
231 #ifndef TDC_PART | |
232 #define TDC_SIZE 99999L // number of structs per compilation | |
233 #define TDC_PART 0L // which struct part to compile in this session | |
234 #define TDC_ENUM_PART 1 // if enum part is to be compiled in this session | |
235 #elif TDC_PART == -1 | |
236 #define TDC_ENUM_PART 1 // if enum part is to be compiled in this session | |
237 #else | |
238 #define TDC_ENUM_PART 0 // if enum part is to be compiled in this session | |
239 #endif | |
240 | |
241 //============================================================================ | |
242 // configuration side effects | |
243 //============================================================================ | |
244 | |
245 #ifndef TDC_DESCRIPTOR | |
246 | |
247 #define NO_TDC_DESCRIPTOR | |
248 | |
249 #else //TDC_DESCRIPTOR | |
250 | |
251 #define __T_TDC_INTERFACE_MESSAGE__ | |
252 #define __T_TDC_INTERFACE_PRIMITIVE__ | |
253 | |
254 #endif //TDC_DESCRIPTOR | |
255 | |
256 //============================================================================ | |
257 /// \defgroup dot_complete helper macros | |
258 //============================================================================ | |
259 //\{ | |
260 | |
261 #if DOT_COMPLETE | |
262 #define TDC_DOT_COMPLETE_HIDE(code) \ | |
263 /* nothing */ | |
264 struct T_TDC_EMPTY {}; | |
265 #else//DOT_COMPLETE | |
266 #define TDC_DOT_COMPLETE_HIDE(code) \ | |
267 code | |
268 #endif//DOT_COMPLETE | |
269 | |
270 //\} | |
271 | |
272 //============================================================================ | |
273 // | |
274 //============================================================================ | |
275 | |
276 ///tdc_test_header_begin | |
277 #ifndef M_TDC_DOC | |
278 #if DOT_COMPLETE | |
279 | |
280 void TDC_NOTHING() {} // generate code for breakpoint | |
281 size_t TDC_LENGTHOF(array) {} | |
282 void TDC_DYNAMIC_DEAD_CODE() {} // program execution is not suposed to reach this point | |
283 | |
284 #else //DOT_COMPLETE | |
285 | |
286 void tdc_nothing(); | |
287 /** generate code for breakpoint */ | |
288 #define TDC_NOTHING() \ | |
289 tdc_nothing() | |
290 | |
291 #define TDC_DYNAMIC_DEAD_CODE() tdc_dynamic_dead_code() // program execution is not suposed to reach this point | |
292 | |
293 | |
294 #define TDC_LENGTHOF(array) (size_t(sizeof array / sizeof *array)) | |
295 | |
296 #define M_TDC_STRING1(text) #text | |
297 /** expand macros before stringify */ | |
298 #define M_TDC_STRING(text) M_TDC_STRING1(text) | |
299 | |
300 #endif //DOT_COMPLETE | |
301 #endif //M_TDC_DOC | |
302 | |
303 // macro to show pragma message with file name and line number when compiling (see M_TDC_MESSAGE_DEMO below) | |
304 //#define M_TDC_MESSAGE(text) message(__FILE__ "(" M_TDC_STRING(__LINE__) ") : message: \'" text "\'") | |
305 #define M_TDC_MESSAGE(text) message(__FILE__ "(" M_TDC_STRING(__LINE__) ") : message: \'" M_TDC_STRING(text) "\'") | |
306 #ifdef M_TDC_MESSAGE_DEMO | |
307 // e.g. show how a macro is expanded | |
308 #define MY(X) MY_##X | |
309 #pragma M_TDC_MESSAGE(M_TDC_STRING(MY(Y))) | |
310 // compiler output: \gpf\inc\tdc_base.h(130) : message: 'MY_Y' | |
311 #endif | |
312 | |
313 /// \defgroup IN_CLASS values for IN_CLASS macro argument | |
314 //\{ | |
315 #define M_TDC_IN_CLASS(code) code | |
316 #define M_TDC_NOT_IN_CLASS(code) | |
317 #define M_TDC_NOT_M_TDC_IN_CLASS(code) | |
318 #define M_TDC_NOT_M_TDC_NOT_IN_CLASS(code) code | |
319 //\} | |
320 | |
321 /// \defgroup WITH_BODY values for WITH_BODY macro argument | |
322 //\{ | |
323 #define M_TDC_WITH_BODY(code) code | |
324 #define M_TDC_WITHOUT_BODY(code) ; | |
325 //\} | |
326 | |
327 /// temporary removed multiline comments in multiline macros | |
328 /// <pre>(some compilers have problems with constructions like: | |
329 /// #define MY_MACRO() /* \\ | |
330 /// my comment */ my_code | |
331 /// )</pre> | |
332 #define M_TDC_COMMENT(code) ; | |
333 | |
334 | |
335 /// \defgroup MacroTesting | |
336 /** for testing macros | |
337 * these macros is only used when tdc.dsw has the active project set to "tdc_lib - Win32 Precompile" | |
338 */ | |
339 //\{ | |
340 #define TDC_MACRO_BEGIN_(name,line) | |
341 #define TDC_MACRO_(name,line) | |
342 #define TDC_MACRO_END_() | |
343 //\} | |
344 | |
345 // /tdc_test_header_end | |
346 | |
347 #ifndef USE_TDC_TEST_I_II// during testing we see this part in the preprocessed file tdc_test_i.ii | |
348 | |
349 struct T_TDC_BASE_DOT_COMPLETE_TEST | |
350 { | |
351 int i; //HINT | |
352 }; | |
353 | |
354 #define TDC_TBD() tdc_tbd(__FILE__, __LINE__) | |
355 | |
356 #define TDC_ASSERT(condition) tdc_assert(condition,#condition,__FILE__,__LINE__) | |
357 | |
358 #ifndef TDC_DEBUG | |
359 #define IF_TDC_DEBUG(code) | |
360 #else | |
361 #define IF_TDC_DEBUG(code) code | |
362 #endif | |
363 | |
364 #ifndef TDC_TEST_PROFILE | |
365 | |
366 #define TDC_PURE_BODY(code)\ | |
367 = 0; | |
368 | |
369 #else | |
370 | |
371 #define TDC_PURE_BODY(code)\ | |
372 {\ | |
373 tdc_pure_body();\ | |
374 code\ | |
375 }\ | |
376 | |
377 #endif | |
378 | |
379 #if TDC_DEBUG_DOT_COMPLETE | |
380 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1C() | |
381 { | |
382 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
383 s. | |
384 i; | |
385 } | |
386 #else | |
387 #endif | |
388 | |
389 void tdc_cursor_trace (char* file, int line, char* format, ...); | |
390 void tdc_trace (char* format, ...); | |
391 void __declspec(noreturn) tdc_trace_fail (char* format, ...); /*lint -sem(tdc_trace_fail,r_no)*/ | |
392 extern "C" void tdc_usi_trace (char* format, ...); | |
393 void __declspec(noreturn) tdc_internal_error (char* format, ...); /*lint -sem(tdc_internal_error,r_no)*/ | |
394 void __declspec(noreturn) tdc_user_error (char* format, ...); /*lint -sem(tdc_user_error,r_no)*/ | |
395 void tdc_check_array_assignment(const void* that, const void* address); | |
396 | |
397 // some error reporting functions, which have no argument becourse they have to be called from a lot of places | |
398 void __declspec(noreturn) tdc_tbd(char* file, int line); /*lint -sem(tdc_tbd,r_no)*/// this facility is yet to be defined i.e. implemented | |
399 void __declspec(noreturn) tdc_tbd(char* message); /*lint -sem(tdc_tbd,r_no)*/// this facility is yet to be defined i.e. implemented | |
400 | |
401 void __declspec(noreturn) tdc_tbd_pointer_assignment_error(); | |
402 void __declspec(noreturn) tdc_tbd_array_assignment_error(); | |
403 void __declspec(noreturn) tdc_tbd_array_assignment_error_T_ARRAY(); | |
404 void __declspec(noreturn) tdc_tbd_xxx_constructor_call(char* message); | |
405 void __declspec(noreturn) tdc_tbd_constructor_call(char* message); | |
406 void __declspec(noreturn) tdc_tbd_primitive_union_constructor_call(); | |
407 void __declspec(noreturn) tdc_tbd_message_union_constructor_call(); | |
408 | |
409 void tdc_pure_body(); | |
410 void tdc_dynamic_dead_code(); // program execution is not suposed to reach this point | |
411 void tdc_missing_h_file(); // use of AIM/SAP not included | |
412 void tdc_assert(int condition, char* message, char* file, int line); | |
413 | |
414 //============================================================================ | |
415 | |
416 #if TDC_DEBUG_DOT_COMPLETE | |
417 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1D() | |
418 { | |
419 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
420 s. | |
421 i; | |
422 } | |
423 #else | |
424 #endif | |
425 | |
426 //---------------------------------------------------------------------------- | |
427 | |
428 //tdc_test_header_begin | |
429 | |
430 //---------------------------------------------------------------------------- | |
431 // | |
432 //---------------------------------------------------------------------------- | |
433 #ifdef M_TDC_DOC | |
434 /* | |
435 The definitions in this sections is only present to be able to generate call graphs to be used | |
436 in documentation (call graphs are generated with SourceInsight 3.5) | |
437 */ | |
438 /// \defgroup NamingScheme Naming convention template tree | |
439 //\{ | |
440 /// \callgraph | |
441 #define BASE() MAIN() PART() | |
442 #define MAIN() all_unions() PRIM_and_MSG() XXX() | |
443 #define all_unions() PRMITIVE_UNION() MESSAGE_UNION() | |
444 #define XXX() XXX_PRMITIVE_UNION() XXX_MESSAGE_UNION() | |
445 #define PRIM_and_MSG() PRIM() MSG() | |
446 #define PART() COMP() VAR() | |
447 #define COMP() STRUCT() UNION() | |
448 #define VAR() INT() ENUM() | |
449 #define ENUM() PENUM() MENM() | |
450 #define PRMITIVE_UNION() | |
451 #define MESSAGE_UNION() | |
452 #define XXX_PRMITIVE_UNION() | |
453 #define XXX_MESSAGE_UNION() | |
454 #define PRIM() | |
455 #define MSG() | |
456 #define STRUCT() PSTRUCT() MSTRUCT() | |
457 #define UNION() PUNION() PUNION() | |
458 #define PSTRUCT() | |
459 #define MSTRUCT() | |
460 #define PUNION() | |
461 #define PUNION() | |
462 #define PENUM() | |
463 #define MENM() | |
464 #define INT() | |
465 //\} | |
466 // base entries | |
467 /* | |
468 #define M_TDC_BASE\ | |
469 M_TDC_FORWARD_BASE(SHORT_NAME, T_HANDLE)\ | |
470 M_TDC_INSTANCE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE_, T_INSTANCE, T_HANDLE_)\ | |
471 M_TDC_INTERFACE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE_, T_HANDLE)\ | |
472 M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ | |
473 M_TDC_FORWARD_BASE(SHORT_NAME, T_HANDLE)\ | |
474 //*/ | |
475 //TDC keywords | |
476 void TDC_keywords() | |
477 { | |
478 FAIL(); | |
479 PASS(); | |
480 SEND(primitive); | |
481 AWAIT(primitive); | |
482 START_TIMEOUT(timeout); | |
483 WAIT_TIMEOUT(); | |
484 MUTE(timeout); | |
485 COMMAND(command); | |
486 TIMEOUT(timeout); | |
487 PARKING(enable); | |
488 ALT() //dummy "()"to force call graph | |
489 { | |
490 ON(await); | |
491 OTHERWISE(); | |
492 } | |
493 TRAP() //dummy "()"to force call graph | |
494 { | |
495 } | |
496 ONFAIL() //dummy "()"to force call graph | |
497 { | |
498 } | |
499 } | |
500 #endif | |
501 //---------------------------------------------------------------------------- | |
502 | |
503 #if DOT_COMPLETE_DEFINES | |
504 | |
505 #define CCC(COMMENT) | |
506 | |
507 //---------------------------------------------------------------------------- | |
508 // macros to generate dummy functions body | |
509 //---------------------------------------------------------------------------- | |
510 | |
511 #define M_TDC_TYPE_NAME\ | |
512 //for(;;); /* no error for missing return */ | |
513 | |
514 #define T_TDC_TYPE_NAME | |
515 | |
516 //---------------------------------------------------------------------------- | |
517 // macros to repeat stuff that is similar in many descriptor classes | |
518 //---------------------------------------------------------------------------- | |
519 | |
520 #define M_TDC_FORWARD_PRIM(SAP,SHORT_NAME) | |
521 #define M_TDC_FORWARD_PSTRUCT(SHORT_NAME) | |
522 #define M_TDC_FORWARD_PUNION(SHORT_NAME) | |
523 #define M_TDC_FORWARD_SDU(SHORT_NAME) | |
524 #define M_TDC_FORWARD_PENUM(SHORT_NAME) | |
525 //----- | |
526 #define M_TDC_FORWARD_MSG(SHORT_NAME) | |
527 #define M_TDC_FORWARD_MSTRUCT(SHORT_NAME) | |
528 #define M_TDC_FORWARD_MUNION(SHORT_NAME) | |
529 #define M_TDC_FORWARD_MENUM(SHORT_NAME) | |
530 //----- | |
531 #define M_TDC_FORWARD_INT(SHORT_NAME) | |
532 #define M_TDC_FORWARD_XXX_PRIMITIVE_UNION(SAP) | |
533 #define M_TDC_FORWARD_XXX_MESSAGE_UNION(MSG) | |
534 #define M_TDC_FORWARD_PRIMITIVE() | |
535 #define M_TDC_FORWARD_MESSAGE() | |
536 | |
537 //---------------------------------------------------------------------------- | |
538 // macros to repeat stuff that is similar in many descriptor classes | |
539 //---------------------------------------------------------------------------- | |
540 | |
541 #define M_TDC_DESCRIPTOR_PRIM_ADDITIONAL(SHORT_NAME) | |
542 #define M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL(SHORT_NAME) | |
543 #define M_TDC_DESCRIPTOR_PUNION_ADDITIONAL(SHORT_NAME) | |
544 #define M_TDC_DESCRIPTOR_SDU_ADDITIONAL(SHORT_NAME) | |
545 #define M_TDC_DESCRIPTOR_PENUM_ADDITIONAL(SHORT_NAME) | |
546 //----- | |
547 #define M_TDC_DESCRIPTOR_MSG_ADDITIONAL(SHORT_NAME) | |
548 #define M_TDC_DESCRIPTOR_MSTRUCT_ADDITIONAL(SHORT_NAME) | |
549 #define M_TDC_DESCRIPTOR_MUNION_ADDITIONAL(SHORT_NAME) | |
550 #define M_TDC_DESCRIPTOR_MENUM_ADDITIONAL(SHORT_NAME) | |
551 //----- | |
552 #define M_TDC_DESCRIPTOR_INT_ADDITIONAL(SHORT_NAME) | |
553 #define M_TDC_DESCRIPTOR_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP) | |
554 #define M_TDC_DESCRIPTOR_XXX_MESSAGE_UNION_ADDITIONAL(MSG) | |
555 #define M_TDC_CREATE_DEFAULT_PRIMITIVE_DESCRIPTOR_CLASS(SAP) | |
556 #define M_TDC_DESCRIPTOR_PRIMITIVE_ADDITIONAL() | |
557 #define M_TDC_CREATE_DEFAULT_MESSAGE_DESCRIPTOR_CLASS(MSG) | |
558 #define M_TDC_DESCRIPTOR_MESSAGE_ADDITIONAL() | |
559 | |
560 //---------------------------------------------------------------------------- | |
561 // macros to repeat stuff that is similar in many interface classes | |
562 //---------------------------------------------------------------------------- | |
563 | |
564 #ifndef TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST | |
565 #define TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST | |
566 struct T_TDC_INTERFACE_DOT_COMPLETE_TEST | |
567 { | |
568 typedef char T_HANDLE; | |
569 }; | |
570 #endif //TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST | |
571 | |
572 //----- | |
573 #define M_TDC_INTERFACE_PRIM_ADDITIONAL(SHORT_NAME) /*nothing*/ | |
574 #define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
575 #define M_TDC_INTERFACE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
576 #define M_TDC_INTERFACE_SDU_ADDITIONAL(SHORT_NAME) /*nothing*/ | |
577 #define M_TDC_INTERFACE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
578 //----- | |
579 #define M_TDC_INTERFACE_MSG_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
580 #define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
581 #define M_TDC_INTERFACE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
582 #define M_TDC_INTERFACE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
583 //----- | |
584 #define M_TDC_INTERFACE_INT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
585 #define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP,PREFIXED_SAP) /*nothing*/ | |
586 #define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL(MSG,PREFIXED_MSG) /*nothing*/ | |
587 #define M_TDC_CREATE_DEFAULT_PRIMITIVE_INTERFACE_CLASS(SAP) /*nothing*/ | |
588 #define M_TDC_INTERFACE_PRIMITIVE_ADDITIONAL() /*nothing*/ | |
589 #define M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG) /*nothing*/ | |
590 #define M_TDC_INTERFACE_MESSAGE_ADDITIONAL() /*nothing*/ | |
591 | |
592 //---------------------------------------------------------------------------- | |
593 // macros to repeat stuff that is similar in many instance classes | |
594 //---------------------------------------------------------------------------- | |
595 | |
596 #define M_TDC_INSTANCE_PRIM_ADDITIONAL(SAP,SHORT_NAME) /*nothing*/ | |
597 #define M_TDC_INSTANCE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
598 #define M_TDC_INSTANCE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
599 #define M_TDC_INSTANCE_SDU_ADDITIONAL(SHORT_NAME) /*nothing*/ | |
600 #define M_TDC_INSTANCE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
601 //----- | |
602 #define M_TDC_INSTANCE_MSG_ADDITIONAL(MSG,SHORT_NAME) /*nothing*/ | |
603 #define M_TDC_INSTANCE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
604 #define M_TDC_INSTANCE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
605 #define M_TDC_INSTANCE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ | |
606 //----- | |
607 #define M_TDC_INSTANCE_INT_ADDITIONAL(SHORT_NAME) /*nothing*/ | |
608 #define M_TDC_INSTANCE_XXX_PRIMITIVE_ADDITIONAL(SAP) /*nothing*/ | |
609 #define M_TDC_INSTANCE_XXX_MESSAGE_ADDITIONAL(MSG) /*nothing*/ | |
610 #define M_TDC_INSTANCE_PRIMITIVE_ADDITIONAL() /*nothing*/ | |
611 #define M_TDC_INSTANCE_MESSAGE_ADDITIONAL() /*nothing*/ | |
612 | |
613 #else | |
614 #endif | |
615 | |
616 //tdc_test_header_end | |
617 | |
618 #if DOT_COMPLETE_DEFINES | |
619 #else //DOT_COMPLETE_DEFINES | |
620 | |
621 #ifndef TDC_KEEP_CCC | |
622 #define CCC(COMMENT) | |
623 #endif //TDC_KEEP_CCC | |
624 | |
625 //---------------------------------------------------------------------------- | |
626 // macros to control namespace | |
627 //---------------------------------------------------------------------------- | |
628 | |
629 #define M_TDC_ENTER() //TODO namespace TDC { | |
630 #define M_TDC_LEAVE() //TODO } | |
631 | |
632 //---------------------------------------------------------------------------- | |
633 // macros to generate dummy functions body | |
634 //---------------------------------------------------------------------------- | |
635 | |
636 #define M_TDC_TYPE_NAME\ | |
637 return T_TDC_TYPE_NAME(); | |
638 | |
639 //#define T_TDC_TYPE_NAME M_TDC_HIDE(T_TDC_TYPE_NAME) | |
640 | |
641 //---------------------------------------------------------------------------- | |
642 // macros to hide templates from dot-completion | |
643 //---------------------------------------------------------------------------- | |
644 | |
645 typedef char T_TDC_LEVEL; | |
646 extern T_TDC_LEVEL tdc_level; | |
647 | |
648 //---------------------------------------------------------------------------- | |
649 // macros to repeat stuff that is similar in many descriptor classes | |
650 //---------------------------------------------------------------------------- | |
651 | |
652 #ifndef TDC_DESCRIPTOR | |
653 | |
654 | |
655 #define M_TDC_FORWARD_BASE(SHORT_NAME,T_HANDLE)\ | |
656 struct T_TDC_INTERFACE_##SHORT_NAME;\ | |
657 T_TDC_INTERFACE_BASE* new_T_TDC_INTERFACE_##SHORT_NAME();\ | |
658 struct T_HANDLE;\ | |
659 T_TDC_HANDLE_BASE* new_##T_HANDLE();\ | |
660 | |
661 #define M_TDC_FORWARD_COMP(SHORT_NAME,TDC_IS)\ | |
662 M_TDC_FORWARD_BASE(SHORT_NAME, T_TDC_HANDLE_##SHORT_NAME)\ | |
663 | |
664 #define M_TDC_FORWARD_VAR(SHORT_NAME)\ | |
665 M_TDC_FORWARD_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ | |
666 | |
667 | |
668 #define M_TDC_POST_BASE(SHORT_NAME,T_HANDLE)\ | |
669 M_TDC_INTERFACE_ADDITIONAL_BASE (M_TDC_NOT_IN_CLASS, M_TDC_WITH_BODY, T_TDC_INTERFACE_##SHORT_NAME, T_##SHORT_NAME, T_HANDLE)\ | |
670 M_TDC_INSTANCE_ADDITIONAL_BASE (M_TDC_NOT_IN_CLASS, M_TDC_WITH_BODY, T_TDC_INTERFACE_##SHORT_NAME, T_##SHORT_NAME, T_HANDLE)\ | |
671 | |
672 #define M_TDC_POST_XXX(SHORT_NAME,TDC_IS)\ | |
673 M_TDC_POST_BASE(SHORT_NAME, T_TDC_HANDLE_##SHORT_NAME)\ | |
674 | |
675 #define M_TDC_POST_COMP(SHORT_NAME,TDC_IS)\ | |
676 M_TDC_POST_BASE(SHORT_NAME, T_TDC_HANDLE_##SHORT_NAME)\ | |
677 | |
678 #define M_TDC_POST_VAR(SHORT_NAME)\ | |
679 M_TDC_POST_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ | |
680 | |
681 | |
682 #else //TDC_DESCRIPTOR | |
683 | |
684 | |
685 #define M_TDC_FORWARD_BASE(SHORT_NAME,T_HANDLE)\ | |
686 | |
687 #define M_TDC_FORWARD_COMP(SHORT_NAME,TDC_IS)\ | |
688 M_TDC_FORWARD_DESCRIPTOR_COMP(SHORT_NAME,TDC_IS)\ | |
689 | |
690 // TODO:eliminate forwards: T_##SHORT_NAME and T_TDC_INTERFACE_##SHORT_NAME | |
691 #define M_TDC_FORWARD_VAR(SHORT_NAME)\ | |
692 M_TDC_FORWARD_BASE(SHORT_NAME,T_TDC_HANDLE_##SHORT_NAME)\ | |
693 struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
694 struct T_##SHORT_NAME;\ | |
695 struct T_TDC_INTERFACE_##SHORT_NAME;\ | |
696 typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_TDC_HANDLE_##SHORT_NAME;\ | |
697 T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME();\ | |
698 | |
699 #define M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME,T_HANDLE)\ | |
700 T_TDC_HANDLE_BASE* new_##T_HANDLE()\ | |
701 {\ | |
702 return new T_HANDLE;\ | |
703 }\ | |
704 | |
705 #if TDC_DEBUG_DOT_COMPLETE | |
706 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 | |
707 { | |
708 int i6; | |
709 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
710 }; | |
711 | |
712 inline void dot_complete_test(){ | |
713 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; | |
714 tdc_debug_dot_complete__tdc_h. i6; | |
715 tdc_debug_dot_complete__tdc_h-> i; | |
716 } | |
717 #else | |
718 #endif | |
719 | |
720 #define M_TDC_POST_XXX(SHORT_NAME,TDC_IS)\ | |
721 M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME,T_TDC_HANDLE_##SHORT_NAME)\ | |
722 T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ()\ | |
723 {\ | |
724 return new T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
725 }\ | |
726 | |
727 #define M_TDC_POST_COMP(SHORT_NAME, TDC_IS)\ | |
728 M_TDC_POST_DESCRIPTOR_COMP(SHORT_NAME, TDC_IS)\ | |
729 | |
730 #define M_TDC_POST_VAR(SHORT_NAME)\ | |
731 M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ | |
732 | |
733 | |
734 #endif //TDC_DESCRIPTOR | |
735 | |
736 | |
737 #define M_TDC_FORWARD_DESCRIPTOR_COMP(SHORT_NAME,TDC_IS)\ | |
738 M_TDC_HANDLE(M_TDC_IN_CLASS,M_TDC_WITHOUT_BODY,SHORT_NAME,TDC_IS)\ | |
739 | |
740 #define M_TDC_POST_DESCRIPTOR_COMP(SHORT_NAME, TDC_IS)\ | |
741 M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME,T_TDC_HANDLE_##SHORT_NAME)\ | |
742 T_TDC_DESCRIPTOR_BASE* T_TDC_HANDLE_##SHORT_NAME::implement_new_descriptor () const\ | |
743 {\ | |
744 return new T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
745 }\ | |
746 M_TDC_HANDLE_ADDITIONAL(M_TDC_NOT_IN_CLASS,M_TDC_WITH_BODY,T_TDC_HANDLE_##SHORT_NAME,SHORT_NAME,TDC_IS)\ | |
747 | |
748 | |
749 /*lint -emacro(1706,M_TDC_HANDLE_ADDITIONAL)*/ //we don't want M_TDC_NOT(IN_CLASS(...)) for all the scope operators | |
750 #define M_TDC_HANDLE_ADDITIONAL(IN_CLASS,WITH_BODY,T_HANDLE_,SHORT_NAME,TDC_IS)\ | |
751 IN_CLASS(virtual) char* T_HANDLE_::get_name () const\ | |
752 WITH_BODY({\ | |
753 return #SHORT_NAME;\ | |
754 })\ | |
755 IN_CLASS(virtual) long T_HANDLE_::get_sizeof ()\ | |
756 WITH_BODY({\ | |
757 return sizeof *this;\ | |
758 })\ | |
759 IN_CLASS(virtual) T_TDC_IS_ENUM T_HANDLE_::is ()\ | |
760 WITH_BODY({\ | |
761 return T_TDC_IS_ENUM (TDC_IS_COMP | TDC_IS);\ | |
762 })\ | |
763 IN_CLASS(static) T_TDC_HANDLE_BASE* T_HANDLE_::implement_new_handle ()\ | |
764 WITH_BODY({\ | |
765 return new T_HANDLE_();\ | |
766 })\ | |
767 | |
768 #define M_TDC_HANDLE(IN_CLASS,WITH_BODY,SHORT_NAME,TDC_IS)\ | |
769 struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
770 struct T_TDC_HANDLE_##SHORT_NAME:T_TDC_HANDLE_BASE\ | |
771 {\ | |
772 typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_DESCRIPTOR;\ | |
773 M_TDC_HANDLE_ADDITIONAL(IN_CLASS,WITH_BODY,T_TDC_HANDLE_##SHORT_NAME,SHORT_NAME,TDC_IS)\ | |
774 M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_TDC_DESCRIPTOR_##SHORT_NAME)\ | |
775 protected:\ | |
776 virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const;\ | |
777 };\ | |
778 | |
779 #if TDC_DEBUG_DOT_COMPLETE | |
780 inline void dot_complete_test(){ | |
781 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; | |
782 tdc_debug_dot_complete__tdc_h. i6; | |
783 tdc_debug_dot_complete__tdc_h-> i; | |
784 } | |
785 #else | |
786 #endif | |
787 | |
788 //------ | |
789 | |
790 #define M_TDC_FORWARD_PRIM(SHORT_NAME)\ | |
791 M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_PRIM) | |
792 | |
793 #define M_TDC_FORWARD_PSTRUCT(SHORT_NAME)\ | |
794 M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_STRUCT) | |
795 | |
796 #define M_TDC_FORWARD_PUNION(SHORT_NAME)\ | |
797 M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_UNION) | |
798 | |
799 #define M_TDC_FORWARD_SDU(SHORT_NAME)\ | |
800 M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_SDU) | |
801 | |
802 #define M_TDC_FORWARD_TYPEDEF_SDU(BUF)\ | |
803 typedef T_TDC_HANDLE_SDU T_TDC_HANDLE_##BUF;\ | |
804 typedef T_TDC_DESCRIPTOR_SDU T_TDC_DESCRIPTOR_##BUF;\ | |
805 | |
806 /**TODO: eliminate this macro*/ | |
807 #define M_FORWARD_TYPEDEF_SDU(BUF)\ | |
808 M_TDC_FORWARD_TYPEDEF_SDU(BUF)\ | |
809 | |
810 #define M_TDC_FORWARD_TYPEDEF(BASE,SHORT_NAME)\ | |
811 typedef T_TDC_HANDLE_##BASE T_TDC_HANDLE_##SHORT_NAME;\ | |
812 typedef T_TDC_DESCRIPTOR_##BASE T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
813 | |
814 #define M_TDC_FORWARD_PENUM(SHORT_NAME)\ | |
815 M_TDC_FORWARD_VAR (SHORT_NAME) | |
816 | |
817 #if TDC_DEBUG_DOT_COMPLETE | |
818 inline void dot_complete_test(){ | |
819 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; | |
820 tdc_debug_dot_complete__tdc_h. i6; | |
821 tdc_debug_dot_complete__tdc_h-> i; | |
822 } | |
823 #else | |
824 #endif | |
825 | |
826 //------ | |
827 | |
828 #define M_TDC_FORWARD_MSG(SHORT_NAME)\ | |
829 M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_MSG) | |
830 | |
831 #define M_TDC_FORWARD_MSTRUCT(SHORT_NAME)\ | |
832 M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_STRUCT) | |
833 | |
834 #define M_TDC_FORWARD_MUNION(SHORT_NAME)\ | |
835 M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_UNION) | |
836 | |
837 #define M_TDC_FORWARD_MENUM(SHORT_NAME)\ | |
838 M_TDC_FORWARD_VAR (SHORT_NAME) | |
839 | |
840 //------ | |
841 | |
842 #define M_TDC_FORWARD_INT(SHORT_NAME)\ | |
843 M_TDC_FORWARD_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ | |
844 struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
845 typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_TDC_HANDLE_##SHORT_NAME;\ | |
846 typedef T_TDC_INT_##SHORT_NAME SHORT_NAME;\ | |
847 T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME();\ | |
848 | |
849 #if TDC_DEBUG_DOT_COMPLETE | |
850 inline void dot_complete_test(){ | |
851 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; | |
852 tdc_debug_dot_complete__tdc_h. i6; | |
853 tdc_debug_dot_complete__tdc_h-> i; | |
854 } | |
855 #else | |
856 #endif | |
857 | |
858 #define M_TDC_FORWARD_XXX_PRIMITIVE_UNION(SAP)\ | |
859 M_TDC_FORWARD_BASE (SAP, T_TDC_HANDLE_##SAP)\ | |
860 | |
861 #define M_TDC_FORWARD_XXX_MESSAGE_UNION(MSG)\ | |
862 M_TDC_FORWARD_BASE (MSG,T_TDC_HANDLE_##MSG)\ | |
863 | |
864 #if TDC_DEBUG_DOT_COMPLETE | |
865 inline void dot_complete_test(){ | |
866 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; | |
867 tdc_debug_dot_complete__tdc_h. i6; | |
868 tdc_debug_dot_complete__tdc_h-> i; | |
869 } | |
870 #else | |
871 #endif | |
872 | |
873 //---------------------------------------------------------------------------- | |
874 // macros to repeat stuff that is similar in many descriptor classes | |
875 //---------------------------------------------------------------------------- | |
876 | |
877 #define M_TDC_POST_PRIM(SHORT_NAME)\ | |
878 M_TDC_POST_COMP (SHORT_NAME, TDC_IS_PRIM) | |
879 | |
880 #define M_TDC_POST_PSTRUCT(SHORT_NAME)\ | |
881 M_TDC_POST_COMP (SHORT_NAME, TDC_IS_STRUCT) | |
882 | |
883 #define M_TDC_POST_PUNION(SHORT_NAME)\ | |
884 M_TDC_POST_COMP (SHORT_NAME, TDC_IS_UNION) | |
885 | |
886 #define M_TDC_POST_SDU(SHORT_NAME) | |
887 | |
888 #define M_TDC_POST_PENUM(SHORT_NAME)\ | |
889 M_TDC_POST_VAR (SHORT_NAME) | |
890 | |
891 #define M_TDC_POST_MSG(SHORT_NAME)\ | |
892 M_TDC_POST_COMP (SHORT_NAME, TDC_IS_MSG) | |
893 | |
894 #define M_TDC_POST_MSTRUCT(SHORT_NAME)\ | |
895 M_TDC_POST_COMP (SHORT_NAME, TDC_IS_STRUCT) | |
896 | |
897 #define M_TDC_POST_MUNION(SHORT_NAME)\ | |
898 M_TDC_POST_COMP (SHORT_NAME, TDC_IS_UNION) | |
899 | |
900 #define M_TDC_POST_MENUM(SHORT_NAME)\ | |
901 M_TDC_POST_VAR (SHORT_NAME) | |
902 | |
903 #define M_TDC_POST_INT(SHORT_NAME) | |
904 | |
905 #define M_TDC_POST_XXX_PRIMITIVE_UNION(SAP)\ | |
906 M_TDC_POST_XXX(SAP,TDC_IS_XXX_PRIMITIE_UNION) | |
907 | |
908 #define M_TDC_POST_XXX_MESSAGE_UNION(MSG)\ | |
909 M_TDC_POST_XXX(MSG,TDC_IS_XXX_MESSAGE_UNION) | |
910 | |
911 #define M_TDC_POST_PRIMITIVE() | |
912 | |
913 #define M_TDC_POST_MESSAGE() | |
914 | |
915 #if TDC_DEBUG_DOT_COMPLETE | |
916 inline void dot_complete_test(){ | |
917 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; | |
918 tdc_debug_dot_complete__tdc_h. i6; | |
919 tdc_debug_dot_complete__tdc_h-> i; | |
920 } | |
921 | |
922 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_5 | |
923 { | |
924 int i5; | |
925 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
926 }; | |
927 | |
928 inline void dot_complete_test(){ | |
929 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_5 tdc_debug_dot_complete__tdc_h; | |
930 tdc_debug_dot_complete__tdc_h. i4; | |
931 tdc_debug_dot_complete__tdc_h-> i; | |
932 } | |
933 #else | |
934 #endif | |
935 | |
936 //============================================================================ | |
937 | |
938 #if TDC_DEBUG_DOT_COMPLETE | |
939 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1F | |
940 { | |
941 int i1F; | |
942 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
943 }; | |
944 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1F() | |
945 { | |
946 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
947 s. | |
948 i; | |
949 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1F s1F; | |
950 s1F-> | |
951 i0; | |
952 } | |
953 #else | |
954 #endif | |
955 | |
956 //---------------------------------------------------------------------------- | |
957 /// \defgroup M_TDC_DESCRIPTOR M_TDC_DESCRIPTOR | |
958 /// macros to repeat stuff that is similar in many descriptor classes | |
959 //---------------------------------------------------------------------------- | |
960 //\{ | |
961 | |
962 /** declare action and description elements that are accessed through typecast to stencil */ | |
963 #define M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART(T_DESCRIPTOR)\ | |
964 T_TDC_ACTION_ENUM action TDC_LINT_UNUSED_MEMBER;\ | |
965 T_DESCRIPTOR* descriptor TDC_LINT_UNUSED_MEMBER;\ | |
966 | |
967 #define M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ | |
968 private:\ | |
969 virtual long get_sizeof ()\ | |
970 {\ | |
971 return sizeof *this;\ | |
972 }\ | |
973 | |
974 #define M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE(SHORT_NAME)\ | |
975 M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ | |
976 public:\ | |
977 int ctrl;\ | |
978 virtual int read_ctrl () const\ | |
979 {\ | |
980 return ctrl;\ | |
981 }\ | |
982 T_TDC_HANDLE_BASE* get_element (unsigned index)\ | |
983 {\ | |
984 return implement_get_union_element (index, ctrl);\ | |
985 }\ | |
986 virtual char* get_name () const\ | |
987 {\ | |
988 return #SHORT_NAME;\ | |
989 }\ | |
990 T_TDC_DESCRIPTOR_##SHORT_NAME ():\ | |
991 ctrl (0)\ | |
992 {\ | |
993 }\ | |
994 | |
995 | |
996 #define M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE(SHORT_NAME)\ | |
997 M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ | |
998 public:\ | |
999 typedef T_TDC_HANDLE_##SHORT_NAME T_HANDLE;\ | |
1000 virtual char* get_name () const\ | |
1001 {\ | |
1002 extern char* TDC_NAME_##SHORT_NAME;\ | |
1003 return TDC_NAME_##SHORT_NAME;\ | |
1004 }\ | |
1005 friend T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ()\ | |
1006 {\ | |
1007 return new T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
1008 }\ | |
1009 T_TDC_DESCRIPTOR_##SHORT_NAME ()\ | |
1010 {\ | |
1011 }\ | |
1012 | |
1013 #define M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE(SHORT_NAME,TABLE_KIND)\ | |
1014 M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ | |
1015 public:\ | |
1016 typedef T_TDC_HANDLE_##SHORT_NAME T_HANDLE;\ | |
1017 int ctrl;\ | |
1018 virtual int read_ctrl () const\ | |
1019 {\ | |
1020 return ctrl;\ | |
1021 }\ | |
1022 T_TDC_HANDLE_BASE* get_element (unsigned index)\ | |
1023 {\ | |
1024 return implement_get_union_element (index, ctrl);\ | |
1025 }\ | |
1026 virtual char* get_name () const\ | |
1027 {\ | |
1028 extern char* TDC_NAME_##SHORT_NAME;\ | |
1029 return TDC_NAME_##SHORT_NAME;\ | |
1030 }\ | |
1031 T_TDC_DESCRIPTOR_##SHORT_NAME ():\ | |
1032 ctrl (0)\ | |
1033 {\ | |
1034 }\ | |
1035 | |
1036 /** | |
1037 * \todo move get_tap_handle() to var base class | |
1038 */ | |
1039 #define M_TDC_DESCRIPTOR_ADDITIONAL_VAR(T_DESCRIPTOR, T_VAR, SHORT_NAME)\ | |
1040 M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ | |
1041 public:\ | |
1042 typedef T_DESCRIPTOR T_HANDLE;\ | |
1043 T_TDC_ACTION_ENUM action;\ | |
1044 union \ | |
1045 {\ | |
1046 T_VAR value;\ | |
1047 T_TDC_BASIC_TYPES value_as_basic_types;\ | |
1048 };\ | |
1049 virtual char* get_name () const\ | |
1050 {\ | |
1051 extern char* TDC_NAME_##SHORT_NAME;\ | |
1052 return TDC_NAME_##SHORT_NAME;\ | |
1053 }\ | |
1054 T_DESCRIPTOR ():\ | |
1055 action (TDC_ACTION_DEFAULT)\ | |
1056 {\ | |
1057 }\ | |
1058 virtual unsigned get_sizeof_target ()\ | |
1059 {\ | |
1060 return sizeof T_VAR;\ | |
1061 }\ | |
1062 static T_TDC_HANDLE_BASE* implement_new_handle ()\ | |
1063 {\ | |
1064 return new_##T_DESCRIPTOR();\ | |
1065 }\ | |
1066 | |
1067 //----- | |
1068 | |
1069 #define M_TDC_DESCRIPTOR_INT_ADDITIONAL(SHORT_NAME)\ | |
1070 M_TDC_DESCRIPTOR_ADDITIONAL_VAR (T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_INT_##SHORT_NAME,SHORT_NAME)\ | |
1071 virtual T_TDC_IS_ENUM is ()\ | |
1072 {\ | |
1073 return TDC_IS_VAR;\ | |
1074 }\ | |
1075 | |
1076 //----- | |
1077 | |
1078 #define M_TDC_DESCRIPTOR_PRIM_ADDITIONAL(SHORT_NAME)\ | |
1079 M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ | |
1080 virtual int get_id () const\ | |
1081 {\ | |
1082 return SHORT_NAME;\ | |
1083 }\ | |
1084 | |
1085 #define M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL(SHORT_NAME)\ | |
1086 M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ | |
1087 | |
1088 #define M_TDC_DESCRIPTOR_PUNION_ADDITIONAL(SHORT_NAME)\ | |
1089 M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE (SHORT_NAME,TDC_TABLE_KIND_PRIM)\ | |
1090 | |
1091 #define M_TDC_DESCRIPTOR_SDU_ADDITIONAL(SHORT_NAME)\ | |
1092 M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE (SHORT_NAME,TDC_TABLE_KIND_PRIM)\ | |
1093 | |
1094 #define M_TDC_DESCRIPTOR_PENUM_ADDITIONAL(SHORT_NAME)\ | |
1095 M_TDC_DESCRIPTOR_ADDITIONAL_VAR (T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_ENUM_##SHORT_NAME,SHORT_NAME)\ | |
1096 friend T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ();\ | |
1097 | |
1098 //----- | |
1099 | |
1100 #define M_TDC_DESCRIPTOR_MSG_ADDITIONAL(SHORT_NAME)\ | |
1101 M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ | |
1102 virtual int get_id () const\ | |
1103 {\ | |
1104 return SHORT_NAME;\ | |
1105 }\ | |
1106 | |
1107 #define M_TDC_DESCRIPTOR_MSTRUCT_ADDITIONAL(SHORT_NAME)\ | |
1108 M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ | |
1109 | |
1110 #define M_TDC_DESCRIPTOR_MUNION_ADDITIONAL(SHORT_NAME)\ | |
1111 M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE (SHORT_NAME,TDC_TABLE_KIND_MSG)\ | |
1112 | |
1113 #define M_TDC_DESCRIPTOR_MENUM_ADDITIONAL(SHORT_NAME)\ | |
1114 M_TDC_DESCRIPTOR_ADDITIONAL_VAR (T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_ENUM_##SHORT_NAME,SHORT_NAME)\ | |
1115 friend T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ();\ | |
1116 | |
1117 //----- | |
1118 | |
1119 #define M_TDC_DESCRIPTOR_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP)\ | |
1120 M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (SAP)\ | |
1121 | |
1122 #define M_TDC_DESCRIPTOR_XXX_MESSAGE_UNION_ADDITIONAL(MSG)\ | |
1123 M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (MSG)\ | |
1124 virtual int get_id () const\ | |
1125 {\ | |
1126 return CCDENT_##MSG;\ | |
1127 }\ | |
1128 | |
1129 #ifdef TDC_LIB_MAIN_DSC | |
1130 #define IF_TDC_LIB_MAIN_DSC(code) code | |
1131 #else | |
1132 #define IF_TDC_LIB_MAIN_DSC(code) | |
1133 #endif | |
1134 | |
1135 #define M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(SHORT_NAME, TDC_IS)\ | |
1136 struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
1137 struct T_TDC_HANDLE_##SHORT_NAME:T_TDC_HANDLE_BASE\ | |
1138 {\ | |
1139 typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_DESCRIPTOR;\ | |
1140 M_TDC_HANDLE_ADDITIONAL(M_TDC_IN_CLASS,M_TDC_WITH_BODY,T_TDC_HANDLE_##SHORT_NAME,SHORT_NAME,TDC_IS)\ | |
1141 M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_TDC_DESCRIPTOR_##SHORT_NAME)\ | |
1142 protected:\ | |
1143 static T_TDC_NEW_DESCRIPTOR new_descriptor;\ | |
1144 virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const\ | |
1145 {\ | |
1146 return call_implement_new_descriptor(new_descriptor);\ | |
1147 }\ | |
1148 friend char set_new_descriptor_T_TDC_HANDLE_##SHORT_NAME()\ | |
1149 {\ | |
1150 extern T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ();\ | |
1151 new_descriptor = new_T_TDC_DESCRIPTOR_##SHORT_NAME;\ | |
1152 return 1;\ | |
1153 }\ | |
1154 };\ | |
1155 T_TDC_HANDLE_BASE* new_T_TDC_HANDLE_##SHORT_NAME();\ | |
1156 M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE_1(SHORT_NAME,SHORT_NAME)\ | |
1157 IF_TDC_LIB_MAIN_DSC(T_TDC_NEW_DESCRIPTOR T_TDC_HANDLE_##SHORT_NAME::new_descriptor;)\ | |
1158 | |
1159 #define M_TDC_CREATE_DEFAULT_PRIMITIVE_DESCRIPTOR_CLASS(SAP)\ | |
1160 M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(SAP##_PRIMITIVE_UNION,TDC_IS_XXX_PRIMITIVE_UNION)\ | |
1161 | |
1162 #define M_TDC_CREATE_DEFAULT__T_TDC_HANDLE_XXX_PRIMITIVE_UNION(SAP,CCDSAP)\ | |
1163 M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(SAP##_PRIMITIVE_UNION,TDC_IS_XXX_PRIMITIVE_UNION)\ | |
1164 | |
1165 #define M_TDC_DESCRIPTOR_PRIMITIVE_ADDITIONAL()\ | |
1166 M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (PRIMITIVE_UNION)\ | |
1167 | |
1168 #define M_TDC_CREATE_DEFAULT_MESSAGE_DESCRIPTOR_CLASS(MSG)\ | |
1169 M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(MSG##_MESSAGE_UNION,TDC_IS_XXX_MESSAGE_UNION)\ | |
1170 enum { CCDENT_##MSG##_MESSAGE_UNION = CCDENT_##MSG };\ | |
1171 | |
1172 #define M_TDC_CREATE_DEFAULT__T_TDC_HANDLE_XXX_MESSAGE_UNION(MSG,CCDENT)\ | |
1173 M_TDC_CREATE_DEFAULT_MESSAGE_DESCRIPTOR_CLASS(MSG) | |
1174 | |
1175 #define M_TDC_DESCRIPTOR_MESSAGE_ADDITIONAL()\ | |
1176 M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (MESSAGE_UNION)\ | |
1177 | |
1178 //\} | |
1179 //============================================================================ | |
1180 | |
1181 #if TDC_DEBUG_DOT_COMPLETE | |
1182 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1H | |
1183 { | |
1184 int i1H; | |
1185 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
1186 }; | |
1187 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1H() | |
1188 { | |
1189 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
1190 s. | |
1191 i; | |
1192 s-> | |
1193 i0; | |
1194 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1H s1H; | |
1195 s1H-> | |
1196 i0; | |
1197 } | |
1198 #else | |
1199 #endif | |
1200 | |
1201 //---------------------------------------------------------------------------- | |
1202 /// \defgroup M_TDC_INTERFACE | |
1203 // macros to repeat stuff that is similar in many inteface classes | |
1204 //---------------------------------------------------------------------------- | |
1205 //\{ | |
1206 | |
1207 /** | |
1208 * should these functions return T_RETURN / *this instead? | |
1209 */ | |
1210 #define M_TDC_ADDITIONAL_CALL_FUNCTION_BASE(IN_CLASS, WITH_BODY, T_SCOPE,T_RETURN,T_ARG)\ | |
1211 void T_SCOPE::operator = (T_ARG (*f) ())\ | |
1212 WITH_BODY({\ | |
1213 T_ARG value_ = f ();\ | |
1214 set_value (value_);\ | |
1215 TDC_LINT_UNASSIGNED_MEMBER\ | |
1216 })\ | |
1217 void T_SCOPE::operator = (void (*f) (T_ARG))\ | |
1218 WITH_BODY({\ | |
1219 T_ARG value_;\ | |
1220 f (value_);\ | |
1221 set_value (value_);\ | |
1222 TDC_LINT_UNASSIGNED_MEMBER\ | |
1223 })\ | |
1224 | |
1225 #define M_TDC_INTERFACE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE_, T_HANDLE)\ | |
1226 IN_CLASS(typedef T_INSTANCE_ T_INSTANCE;)\ | |
1227 IN_CLASS(friend struct T_INSTANCE_;)\ | |
1228 IN_CLASS(private:)\ | |
1229 void T_INTERFACE::set_value (const T_INSTANCE_& value_)\ | |
1230 WITH_BODY({\ | |
1231 copy_instance ((const T_TDC_INSTANCE_BASE*)&value_);\ | |
1232 })\ | |
1233 IN_CLASS(explicit) T_INTERFACE::T_INTERFACE (const T_INTERFACE& value_)\ | |
1234 WITH_BODY({\ | |
1235 copy_interface (&value_);\ | |
1236 TDC_LINT_UNCOPIED_BASE\ | |
1237 })\ | |
1238 IN_CLASS(public:)\ | |
1239 void T_INTERFACE::operator = (const T_TDC_ACTION& action_)\ | |
1240 WITH_BODY({\ | |
1241 set_action (action_);\ | |
1242 TDC_LINT_UNASSIGNED_MEMBER\ | |
1243 })\ | |
1244 void T_INTERFACE::operator = (const T_INTERFACE& value_)\ | |
1245 WITH_BODY({\ | |
1246 copy_interface (&value_);\ | |
1247 TDC_LINT_NO_SELFASSIGN_TEST\ | |
1248 TDC_LINT_UNASSIGNED_MEMBER\ | |
1249 })\ | |
1250 T_INSTANCE_ T_INTERFACE::operator = (const T_INSTANCE_& value_)\ | |
1251 WITH_BODY({\ | |
1252 copy_instance (&value_);\ | |
1253 return value_;\ | |
1254 TDC_LINT_UNASSIGNED_MEMBER\ | |
1255 })\ | |
1256 IN_CLASS(static) T_TDC_HANDLE_BASE* T_INTERFACE::implement_new_handle ()\ | |
1257 WITH_BODY({\ | |
1258 return new_##T_HANDLE();\ | |
1259 })\ | |
1260 IN_CLASS(friend) T_TDC_INTERFACE_BASE* new_##T_INTERFACE()\ | |
1261 WITH_BODY({\ | |
1262 return new T_INTERFACE;\ | |
1263 })\ | |
1264 M_TDC_ADDITIONAL_CALL_FUNCTION_BASE(IN_CLASS, WITH_BODY, T_INTERFACE,T_INSTANCE,T_INSTANCE)\ | |
1265 | |
1266 #define M_TDC_INTERFACE_ADDITIONAL_MAIN(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, BASE)\ | |
1267 public:\ | |
1268 void operator = (const T_TDC_INTERFACE_##BASE##_BASE& value_)\ | |
1269 {\ | |
1270 set_main_value (&value_);\ | |
1271 }\ | |
1272 void operator = (const T_TDC_INSTANCE_##BASE##_BASE& value_)\ | |
1273 {\ | |
1274 set_main_value (&value_);\ | |
1275 }\ | |
1276 T_TDC_INTERFACE_##PREFIXED_SHORT_NAME ()\ | |
1277 {\ | |
1278 tdc_level--;\ | |
1279 }\ | |
1280 M_TDC_INTERFACE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) | |
1281 | |
1282 #define M_TDC_INTERFACE_ADDITIONAL_COMP(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ | |
1283 public:\ | |
1284 T_TDC_INTERFACE_##PREFIXED_SHORT_NAME ()\ | |
1285 {\ | |
1286 tdc_level--;\ | |
1287 }\ | |
1288 M_TDC_INTERFACE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) | |
1289 | |
1290 #define M_TDC_INTERFACE_ADDITIONAL_VAR(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ | |
1291 public:\ | |
1292 T_TDC_INTERFACE_##PREFIXED_SHORT_NAME ()\ | |
1293 {\ | |
1294 }\ | |
1295 M_TDC_INTERFACE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) | |
1296 | |
1297 #define M_TDC_INTERFACE_INT_ADDITIONAL(SHORT_NAME)\ | |
1298 public:\ | |
1299 void operator = (int value_)\ | |
1300 {\ | |
1301 set_descriptor_value (value_);\ | |
1302 }\ | |
1303 M_TDC_INTERFACE_ADDITIONAL_VAR (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME, SHORT_NAME)\ | |
1304 | |
1305 #define M_TDC_INTERFACE_ADDITIONAL_ENUM(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ | |
1306 public:\ | |
1307 void set_value (int value_)\ | |
1308 {\ | |
1309 set_descriptor_value (value_);\ | |
1310 }\ | |
1311 void operator = (int value_)\ | |
1312 {\ | |
1313 set_descriptor_value (value_);\ | |
1314 }\ | |
1315 void set_value (const T_TDC_INSTANCE_INT_BASE &value_)\ | |
1316 {\ | |
1317 copy_instance (&value_);\ | |
1318 }\ | |
1319 void operator = (const T_TDC_INSTANCE_INT_BASE &value_)\ | |
1320 {\ | |
1321 copy_instance (&value_);\ | |
1322 }\ | |
1323 M_TDC_INTERFACE_ADDITIONAL_VAR (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ | |
1324 | |
1325 #define M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME,T_ARG)\ | |
1326 T_##SHORT_NAME operator = (const T_ARG& value_)\ | |
1327 {\ | |
1328 set_value (value_);\ | |
1329 return value_;\ | |
1330 TDC_LINT_UNASSIGNED_MEMBER\ | |
1331 }\ | |
1332 | |
1333 //----- | |
1334 | |
1335 #define M_TDC_INTERFACE_PRIM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1336 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE)\ | |
1337 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_PRIMITIVE_UNION)\ | |
1338 | |
1339 #define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1340 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1341 | |
1342 #define M_TDC_INTERFACE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1343 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1344 | |
1345 #define M_TDC_INTERFACE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1346 M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1347 | |
1348 //----- | |
1349 | |
1350 #define M_TDC_INTERFACE_MSG_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1351 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE)\ | |
1352 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_MESSAGE_UNION)\ | |
1353 | |
1354 #define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1355 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1356 | |
1357 #define M_TDC_INTERFACE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1358 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1359 | |
1360 #define M_TDC_INTERFACE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1361 M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1362 | |
1363 //----- | |
1364 | |
1365 #define M_TDC_INTERFACE_PRIM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1366 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE)\ | |
1367 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_PRIMITIVE_UNION)\ | |
1368 | |
1369 #define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1370 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1371 | |
1372 #define M_TDC_INTERFACE_PUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1373 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1374 | |
1375 #define M_TDC_INTERFACE_SDU_ADDITIONAL_INLINE(SHORT_NAME)\ | |
1376 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,SHORT_NAME) | |
1377 | |
1378 #define M_TDC_INTERFACE_PENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1379 M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1380 | |
1381 //----- | |
1382 | |
1383 #define M_TDC_INTERFACE_MSG_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1384 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE)\ | |
1385 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_MESSAGE_UNION)\ | |
1386 | |
1387 #define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1388 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1389 | |
1390 #define M_TDC_INTERFACE_MUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1391 M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1392 | |
1393 #define M_TDC_INTERFACE_MENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1394 M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1395 | |
1396 //----- | |
1397 | |
1398 #define M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX(M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY,XXX,PREFIXED_XXX)\ | |
1399 private:\ | |
1400 T_TDC_INTERFACE_##XXX (const T_TDC_INTERFACE_PRIMITIVE_BASE& primitive)\ | |
1401 {\ | |
1402 tdc_tbd_xxx_constructor_call(#XXX);\ | |
1403 }\ | |
1404 | |
1405 #define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP,PREFIXED_SAP)\ | |
1406 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP, PRIMITIVE)\ | |
1407 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP, T_PRIMITIVE_UNION)\ | |
1408 M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP)\ | |
1409 public:\ | |
1410 | |
1411 #define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ | |
1412 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SAP,PREFIXED_SAP, PRIMITIVE)\ | |
1413 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SAP,PREFIXED_SAP, T_PRIMITIVE_UNION)\ | |
1414 M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP)\ | |
1415 public:\ | |
1416 | |
1417 #define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL(MSG,PREFIXED_MSG)\ | |
1418 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG, PREFIXED_MSG, MESSAGE)\ | |
1419 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG, PREFIXED_MSG, T_MESSAGE_UNION)\ | |
1420 M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG,PREFIXED_MSG)\ | |
1421 public:\ | |
1422 | |
1423 #define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(MSG,PREFIXED_MSG)\ | |
1424 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, MSG, PREFIXED_MSG, MESSAGE)\ | |
1425 M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, MSG, PREFIXED_MSG, T_MESSAGE_UNION)\ | |
1426 M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG,PREFIXED_MSG)\ | |
1427 public:\ | |
1428 | |
1429 #define M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(SHORT_NAME)\ | |
1430 struct T_TDC_INTERFACE_##SHORT_NAME;\ | |
1431 struct T_TDC_HANDLE_##SHORT_NAME;\ | |
1432 | |
1433 #define M_TDC_CREATE_DEFAULT_PRIMITIVE_INTERFACE_CLASS(SAP)\ | |
1434 M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(SAP##_PRIMITIVE_UNION)\ | |
1435 | |
1436 #define M_TDC_CREATE_DEFAULT__T_TDC_INTERFACE_XXX_PRIMITIVE_UNION(SAP,CCDSAP)\ | |
1437 enum { CCDSAP_##SAP = CCDSAP };\ | |
1438 M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(SAP##_PRIMITIVE_UNION)\ | |
1439 | |
1440 #define M_TDC_INTERFACE_PRIMITIVE_ADDITIONAL()\ | |
1441 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, PRIMITIVE_UNION, PRIMITIVE_UNION, PRIMITIVE)\ | |
1442 private:\ | |
1443 T_TDC_INTERFACE_PRIMITIVE_UNION (const T_TDC_INTERFACE_PRIMITIVE_BASE& primitive)\ | |
1444 {\ | |
1445 tdc_tbd_primitive_union_constructor_call();\ | |
1446 }\ | |
1447 public:\ | |
1448 | |
1449 #define M_TDC_INTERFACE_PRIMITIVE_ELEMENT_ADDITIONAL(SAP)\ | |
1450 /*nothing*/ | |
1451 | |
1452 #define M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG)\ | |
1453 M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(MSG##_MESSAGE_UNION)\ | |
1454 | |
1455 #define M_TDC_CREATE_DEFAULT__T_TDC_INTERFACE_XXX_MESSAGE_UNION(MSG,CCDENT)\ | |
1456 enum { CCDENT_##MSG = CCDENT };\ | |
1457 M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG) | |
1458 | |
1459 #define M_TDC_INTERFACE_MESSAGE_ADDITIONAL()\ | |
1460 M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MESSAGE_UNION,MESSAGE_UNION, MESSAGE)\ | |
1461 private:\ | |
1462 T_TDC_INTERFACE_MESSAGE_UNION (const T_TDC_INTERFACE_MESSAGE_BASE& primitive)\ | |
1463 {\ | |
1464 tdc_tbd_message_union_constructor_call();\ | |
1465 }\ | |
1466 public:\ | |
1467 | |
1468 #define M_TDC_INTERFACE_MESSAGE_ELEMENT_ADDITIONAL(MSG)\ | |
1469 /*nothing*/ | |
1470 | |
1471 //\} | |
1472 | |
1473 //============================================================================ | |
1474 | |
1475 #if TDC_DEBUG_DOT_COMPLETE | |
1476 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1I() | |
1477 { | |
1478 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
1479 s. | |
1480 i; | |
1481 s-> | |
1482 i0; | |
1483 } | |
1484 #else | |
1485 #endif | |
1486 | |
1487 //---------------------------------------------------------------------------- | |
1488 /// \defgroup M_TDC_INSTANCE M_TDC_INSTANCE | |
1489 /// macros to repeat stuff that is similar in many instance classes | |
1490 //---------------------------------------------------------------------------- | |
1491 //\{ | |
1492 | |
1493 /*lint -emacro(1706,M_TDC_INSTANCE_ADDITIONAL_BASE)*/ //we don't want M_TDC_NOT(IN_CLASS(...)) for all the scope operators | |
1494 #define M_TDC_INSTANCE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE_, T_INSTANCE, T_HANDLE_)\ | |
1495 IN_CLASS(typedef T_INTERFACE_ T_INTERFACE;)\ | |
1496 IN_CLASS(typedef T_HANDLE_ T_HANDLE;)\ | |
1497 IN_CLASS(T_HANDLE* handle;)\ | |
1498 IN_CLASS(static) T_TDC_HANDLE_BASE* T_INSTANCE::implement_new_handle ()\ | |
1499 WITH_BODY({\ | |
1500 return new_##T_HANDLE_();\ | |
1501 })\ | |
1502 IN_CLASS(virtual) T_TDC_INTERFACE_BASE* T_INSTANCE::new_interface() const\ | |
1503 WITH_BODY({\ | |
1504 return new_##T_INTERFACE_();\ | |
1505 })\ | |
1506 void T_INSTANCE::construct()\ | |
1507 WITH_BODY({\ | |
1508 construct_handle(new_##T_HANDLE_);\ | |
1509 })\ | |
1510 T_INSTANCE::T_INSTANCE ()\ | |
1511 WITH_BODY({\ | |
1512 construct();\ | |
1513 TDC_LINT_UNINITIALIZED_MEMBER\ | |
1514 })\ | |
1515 T_INSTANCE::~T_INSTANCE ()\ | |
1516 WITH_BODY({\ | |
1517 destroy_handle ();\ | |
1518 TDC_LINT_POSSIBLE_UNHANDLE_POINTER_MEMBER\ | |
1519 })\ | |
1520 T_INSTANCE::T_INSTANCE (const T_INTERFACE_& value_)\ | |
1521 WITH_BODY({\ | |
1522 construct_from_interface ((T_TDC_INTERFACE_BASE*)&value_, new_##T_HANDLE_); M_TDC_COMMENT(T_INTERFACE not defined yet; means need cast here to the base type pointer)\ | |
1523 TDC_LINT_UNINITIALIZED_MEMBER\ | |
1524 })\ | |
1525 IN_CLASS(explicit) T_INSTANCE::T_INSTANCE (const T_TDC_HANDLE_BASE* value_)\ | |
1526 WITH_BODY({\ | |
1527 tdc_tbd_constructor_call(#T_INSTANCE);\ | |
1528 TDC_LINT_UNINITIALIZED_MEMBER\ | |
1529 })\ | |
1530 void T_INSTANCE::operator = (const T_INSTANCE& value_)\ | |
1531 WITH_BODY({\ | |
1532 set_value (value_);\ | |
1533 TDC_LINT_UNASSIGNED_MEMBER\ | |
1534 TDC_LINT_NO_SELFASSIGN_TEST\ | |
1535 })\ | |
1536 M_TDC_NOT_##IN_CLASS(T_INTERFACE_* T_INSTANCE::operator -> ()\ | |
1537 {\ | |
1538 return (T_INTERFACE*)get_navigation();\ | |
1539 })\ | |
1540 T_INSTANCE::T_INSTANCE (const T_INSTANCE& value_)\ | |
1541 WITH_BODY({\ | |
1542 construct_from_instance (value_, new_##T_HANDLE_);\ | |
1543 TDC_LINT_UNCOPIED_BASE\ | |
1544 TDC_LINT_UNINITIALIZED_MEMBER\ | |
1545 })\ | |
1546 T_INSTANCE::T_INSTANCE (T_INSTANCE (*f) ())\ | |
1547 WITH_BODY({\ | |
1548 T_INSTANCE value_ = f ();\ | |
1549 construct_from_instance (value_, new_##T_HANDLE_);\ | |
1550 TDC_LINT_UNINITIALIZED_MEMBER\ | |
1551 })\ | |
1552 M_TDC_ADDITIONAL_CALL_FUNCTION_BASE(IN_CLASS, WITH_BODY, T_INSTANCE, T_INSTANCE, T_INSTANCE) | |
1553 | |
1554 #define M_TDC_INSTANCE_ADDITIONAL_MAIN(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME, BASE)\ | |
1555 public:\ | |
1556 void operator = (const T_TDC_INTERFACE_##BASE##_BASE& value_)\ | |
1557 {\ | |
1558 set_main_value (&value_);\ | |
1559 }\ | |
1560 void operator = (const T_TDC_INSTANCE_##BASE##_BASE& value_)\ | |
1561 {\ | |
1562 set_main_value (&value_);\ | |
1563 }\ | |
1564 T_##SHORT_NAME (const T_TDC_INTERFACE_##BASE##_BASE& value_)\ | |
1565 {\ | |
1566 construct_main_value (&value_, new_T_TDC_HANDLE_##PREFIXED_SHORT_NAME);\ | |
1567 }\ | |
1568 T_##SHORT_NAME (const T_TDC_INSTANCE_##BASE##_BASE& value_)\ | |
1569 {\ | |
1570 construct_main_value (&value_, new_T_TDC_HANDLE_##PREFIXED_SHORT_NAME);\ | |
1571 }\ | |
1572 M_TDC_INSTANCE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) | |
1573 | |
1574 #define M_TDC_INSTANCE_PART_ADDITIONAL(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE, T_DESCRIPTOR, T_HANDLE)\ | |
1575 public:\ | |
1576 T_INSTANCE (const T_TDC_ACTION& action_)\ | |
1577 {\ | |
1578 construct_from_action (action_, new_##T_HANDLE);\ | |
1579 }\ | |
1580 T_TDC_ACTION operator = (const T_TDC_ACTION& action_)\ | |
1581 {\ | |
1582 set_action (action_);\ | |
1583 return action_;\ | |
1584 }\ | |
1585 M_TDC_INSTANCE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE, T_HANDLE) | |
1586 | |
1587 #define M_TDC_INSTANCE_COMP_ADDITIONAL(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1588 M_TDC_INSTANCE_PART_ADDITIONAL (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) | |
1589 | |
1590 #define M_TDC_INSTANCE_ENUM_ADDITIONAL(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1591 T_##SHORT_NAME (int value_)\ | |
1592 {\ | |
1593 construct_from_number (value_, new_T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME);\ | |
1594 }\ | |
1595 void operator = (int value_)\ | |
1596 {\ | |
1597 set_descriptor_value (value_);\ | |
1598 }\ | |
1599 bool operator == (T_TDC_ENUM_##PREFIXED_SHORT_NAME value_)\ | |
1600 {\ | |
1601 return cmp_descriptor_value (value_);\ | |
1602 }\ | |
1603 operator T_TDC_ENUM_##PREFIXED_SHORT_NAME ()\ | |
1604 {\ | |
1605 return (T_TDC_ENUM_##PREFIXED_SHORT_NAME) get_descriptor_value ();\ | |
1606 }\ | |
1607 M_TDC_INSTANCE_PART_ADDITIONAL (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME, T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME) | |
1608 | |
1609 #define M_TDC_INSTANCE_INT_ADDITIONAL(SHORT_NAME)\ | |
1610 T_##SHORT_NAME (int value_)\ | |
1611 {\ | |
1612 construct_from_number (value_, new_T_TDC_DESCRIPTOR_##SHORT_NAME);\ | |
1613 }\ | |
1614 void operator = (int value_)\ | |
1615 {\ | |
1616 set_descriptor_value (value_);\ | |
1617 }\ | |
1618 M_TDC_INSTANCE_PART_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, T_TDC_INTERFACE_##SHORT_NAME, T_##SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME) | |
1619 | |
1620 //----- | |
1621 | |
1622 #define M_TDC_INSTANCE_PRIM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1623 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE) | |
1624 | |
1625 #define M_TDC_INSTANCE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1626 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1627 | |
1628 #define M_TDC_INSTANCE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1629 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1630 | |
1631 #define M_TDC_INSTANCE_SDU_ADDITIONAL(SHORT_NAME)\ | |
1632 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,SHORT_NAME) | |
1633 | |
1634 #define M_TDC_INSTANCE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1635 M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1636 | |
1637 //----- | |
1638 | |
1639 #define M_TDC_INSTANCE_MSG_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1640 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE) | |
1641 | |
1642 #define M_TDC_INSTANCE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1643 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1644 | |
1645 #define M_TDC_INSTANCE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1646 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1647 | |
1648 #define M_TDC_INSTANCE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1649 M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1650 | |
1651 //----- | |
1652 | |
1653 #define M_TDC_INSTANCE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP,PREFIXED_SAP)\ | |
1654 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP, PRIMITIVE) | |
1655 | |
1656 #define M_TDC_INSTANCE_XXX_MESSAGE_UNION_ADDITIONAL(MSG,PREFIXED_MSG)\ | |
1657 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG,PREFIXED_MSG, MESSAGE) | |
1658 | |
1659 #define M_TDC_INSTANCE_PRIMITIVE_ADDITIONAL()\ | |
1660 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, PRIMITIVE_UNION,PRIMITIVE_UNION, PRIMITIVE)\ | |
1661 static int call_tdc_initialize_primitive ();\ | |
1662 | |
1663 #define M_TDC_INSTANCE_MESSAGE_ADDITIONAL()\ | |
1664 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MESSAGE_UNION,MESSAGE_UNION, MESSAGE)\ | |
1665 static int call_tdc_initialize_message ();\ | |
1666 | |
1667 //----- | |
1668 | |
1669 #define M_TDC_INSTANCE_PRIM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1670 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE) | |
1671 | |
1672 #define M_TDC_INSTANCE_PSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1673 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1674 | |
1675 #define M_TDC_INSTANCE_PUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1676 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1677 | |
1678 #define M_TDC_INSTANCE_PENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1679 M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1680 | |
1681 //----- | |
1682 | |
1683 #define M_TDC_INSTANCE_MSG_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1684 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE) | |
1685 | |
1686 #define M_TDC_INSTANCE_MSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1687 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1688 | |
1689 #define M_TDC_INSTANCE_MUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1690 M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1691 | |
1692 #define M_TDC_INSTANCE_MENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ | |
1693 M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) | |
1694 | |
1695 //----- | |
1696 | |
1697 template<class T_INSTANCE,class T_HANDLE>class T_TDC_FORCE_LINK_INSTANCE_WORKER | |
1698 { | |
1699 T_TDC_FORCE_LINK_INSTANCE_WORKER(){ | |
1700 T_HANDLE::new_descriptor = T_INSTANCE::get_new_descriptor(); | |
1701 } | |
1702 }; | |
1703 | |
1704 template<class T_INSTANCE,class T_HANDLE>class T_TDC_FORCE_LINK_INSTANCE | |
1705 { | |
1706 static T_TDC_FORCE_LINK_INSTANCE_WORKER<T_INSTANCE,T_HANDLE> worker; | |
1707 }; | |
1708 template<class T_INSTANCE,class T_HANDLE>T_TDC_FORCE_LINK_INSTANCE_WORKER<T_INSTANCE,T_HANDLE> T_TDC_FORCE_LINK_INSTANCE<T_INSTANCE,T_HANDLE>::worker; | |
1709 | |
1710 #define M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE_1(SAP,PREFIXED_SAP)\ | |
1711 extern char set_new_descriptor_T_TDC_HANDLE_##SAP();\ | |
1712 static char init_new_descriptor_T_TDC_HANDLE_##SAP = set_new_descriptor_T_TDC_HANDLE_##SAP();\ | |
1713 | |
1714 #define M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ | |
1715 | |
1716 #define M_TDC_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ | |
1717 | |
1718 /* | |
1719 #define M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ | |
1720 extern char set_new_descriptor_T_TDC_HANDLE_##SAP();\ | |
1721 static char init_new_descriptor_T_TDC_HANDLE_##SAP = set_new_descriptor_T_TDC_HANDLE_##SAP();\ | |
1722 | |
1723 #define M_TDC_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ | |
1724 extern char set_new_descriptor_T_TDC_HANDLE_##SAP();\ | |
1725 static char init_new_descriptor_T_TDC_HANDLE_##SAP = set_new_descriptor_T_TDC_HANDLE_##SAP();\ | |
1726 */ | |
1727 | |
1728 #define M_TDC_INSTANCE_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ | |
1729 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SAP,PREFIXED_SAP, PRIMITIVE)\ | |
1730 T_TDC_NEW_DESCRIPTOR get_new_descriptor()\ | |
1731 {\ | |
1732 extern T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SAP();\ | |
1733 return new_T_TDC_DESCRIPTOR_##SAP;\ | |
1734 }\ | |
1735 | |
1736 #define M_TDC_INSTANCE_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(MSG,PREFIXED_MSG)\ | |
1737 M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, MSG,PREFIXED_MSG, MESSAGE)\ | |
1738 T_TDC_NEW_DESCRIPTOR get_new_descriptor()\ | |
1739 {\ | |
1740 extern T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##MSG();\ | |
1741 return new_T_TDC_DESCRIPTOR_##MSG;\ | |
1742 }\ | |
1743 | |
1744 //\} | |
1745 | |
1746 //----- | |
1747 | |
1748 #ifdef TDC_TYPE_NAME_COMPLETE | |
1749 #define M_TDC_TYPE_NAME_COMPLETE TDC_DOT_COMPLETE_HIDE({ T_TDC_TYPE_NAME type_name = {0}; return type_name; }) | |
1750 #else | |
1751 #define M_TDC_TYPE_NAME_COMPLETE ; | |
1752 #endif | |
1753 | |
1754 #endif //DOT_COMPLETE_DEFINES | |
1755 | |
1756 //============================================================================ | |
1757 | |
1758 #if TDC_DEBUG_DOT_COMPLETE | |
1759 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1J() | |
1760 { | |
1761 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
1762 s. | |
1763 i; | |
1764 s-> | |
1765 i0; | |
1766 } | |
1767 #else | |
1768 #endif | |
1769 | |
1770 //============================================================================ | |
1771 // implementation classes | |
1772 //============================================================================ | |
1773 | |
1774 typedef bool T_TDC_TABLE_KIND; | |
1775 | |
1776 enum T_TDC_ACTION_ENUM | |
1777 { | |
1778 TDC_ACTION_UNKNOWN, | |
1779 // MANDATORY-SEND OPTIONAL-SEND MANDATORY-WAIT OPTIONAL-WAIT | |
1780 TDC_ACTION_SKIP, // ERROR ABSENT SKIPED SKIPED | |
1781 TDC_ACTION_SHOW, // ERROR ABSENT SKIPED SKIPED | |
1782 TDC_ACTION_FORBID, // ERROR ABSENT ERROR CHECKED | |
1783 TDC_ACTION_REQUIRE, // ERROR ERROR ERROR CHECKED PRESENT | |
1784 TDC_ACTION_MESSAGE, | |
1785 TDC_ACTION_DESTROYED, | |
1786 TDC_ACTION_SKIP_TO_END, | |
1787 TDC_ACTION_SET = 0x10, // PRESENT PRESENT CHECKED CHECKED VALUE | |
1788 TDC_ACTION_HAS_VALUE = 0x20, | |
1789 TDC_ACTION_HAS_REF = 0x40, | |
1790 TDC_ACTION_IS_IMPLICIT = 0x80, | |
1791 TDC_ACTION_SET_VALUE = TDC_ACTION_SET + TDC_ACTION_HAS_VALUE, | |
1792 TDC_ACTION_SET_REF = TDC_ACTION_SET + TDC_ACTION_HAS_REF, | |
1793 TDC_ACTION_CHILD_TOUCHED = TDC_ACTION_SET + TDC_ACTION_HAS_REF + TDC_ACTION_IS_IMPLICIT, | |
1794 TDC_ACTION_DEFAULT = TDC_ACTION_UNKNOWN | |
1795 }; | |
1796 | |
1797 /** allow one optional extra set of () on action member functions, first set is suplyed by macro | |
1798 * second set might be suplyed by the user, this will have no effect on behaviour of code | |
1799 */ | |
1800 struct T_TDC_ASSIGN_ACTION | |
1801 { | |
1802 void operator ()(); | |
1803 }; | |
1804 | |
1805 extern T_TDC_ASSIGN_ACTION tdc_assign_action; | |
1806 | |
1807 struct T_TDC_ACTION | |
1808 { | |
1809 //create a waper class for T_TDC_ACTION_ENUM so that the action constants can not be converted to integers | |
1810 T_TDC_ACTION_ENUM action; | |
1811 T_TDC_ACTION (T_TDC_ACTION_ENUM action_): | |
1812 action (action_) | |
1813 { | |
1814 //nothing | |
1815 } | |
1816 T_TDC_ACTION (); | |
1817 }; | |
1818 | |
1819 struct T_TDC_CREATE_ACTION:T_TDC_ACTION | |
1820 { | |
1821 /* This type is returned by constant action function, this allow the user to optional | |
1822 omit the "()" after the action name | |
1823 Src code After macro expantion Function returns After implicit type convting | |
1824 ======== ==================== ======================== ===================== | |
1825 _skip tdc_skip() SKIP::T_TDC_CREATE_ACTION SKIP::T_TDC_ACTION | |
1826 _skip() tdc_skip()() SKIP::T_TDC_ACTION SKIP::T_TDC_ACTION | |
1827 _skip()() tdc_skip()()() <error T_TDC_ACTION have no operator ()> | |
1828 */ | |
1829 T_TDC_CREATE_ACTION (); | |
1830 T_TDC_ACTION operator()(); | |
1831 }; | |
1832 | |
1833 extern T_TDC_CREATE_ACTION SKIP; | |
1834 extern T_TDC_CREATE_ACTION SHOW; | |
1835 extern T_TDC_CREATE_ACTION FORBID; | |
1836 extern T_TDC_CREATE_ACTION REQUIRE; | |
1837 extern T_TDC_CREATE_ACTION SKIP_TO_END; | |
1838 | |
1839 extern T_TDC_CREATE_ACTION tdc_skip(); | |
1840 extern T_TDC_CREATE_ACTION tdc_show(); | |
1841 extern T_TDC_CREATE_ACTION tdc_forbid(); | |
1842 extern T_TDC_CREATE_ACTION tdc_require(); | |
1843 extern T_TDC_CREATE_ACTION tdc_skip_to_end(); | |
1844 | |
1845 //---------------------------------------------------------------------------- | |
1846 | |
1847 enum T_TDC_EVENT_ENUM | |
1848 { | |
1849 TDC_EVENT_SEND, | |
1850 TDC_EVENT_AWAIT | |
1851 }; | |
1852 | |
1853 enum T_TDC_IS_ENUM | |
1854 { | |
1855 TDC_IS_UNKNOWN = 0, | |
1856 TDC_IS_VAR = 0x001, | |
1857 TDC_IS_STRUCT = 0x002, | |
1858 TDC_IS_SDU = 0x004, | |
1859 TDC_IS_P = 0x008, | |
1860 TDC_IS_M = 0x010, | |
1861 TDC_IS_COMP = 0x20, | |
1862 TDC_IS_ARRAY = 0x40, | |
1863 TDC_IS_UNION = 0x80, | |
1864 TDC_IS_MESSAGE_UNION = 0x100, | |
1865 TDC_IS_PRIMITIVE_UNION = 0x200, | |
1866 TDC_IS_MSG = 0x400, | |
1867 TDC_IS_PRIM = 0x800, | |
1868 TDC_IS_XXX_MESSAGE_UNION = 0x1000, | |
1869 TDC_IS_XXX_PRIMITIVE_UNION = 0x2000, | |
1870 TDC_IS_POINTER = 0x4000, | |
1871 TDC_IS_PVAR = TDC_IS_VAR | TDC_IS_P, | |
1872 TDC_IS_MVAR = TDC_IS_VAR | TDC_IS_M | |
1873 }; | |
1874 | |
1875 //---------------------------------------------------------------------------- | |
1876 | |
1877 struct T_TDC_HANDLE_BASE; | |
1878 struct T_TDC_DESCRIPTOR_BASE; | |
1879 struct T_TDC_INSTANCE_MAIN_BASE; | |
1880 struct T_TDC_INTERFACE_BASE; | |
1881 struct T_TDC_INSTANCE_BASE; | |
1882 struct T_TDC_PATH; | |
1883 struct T_TDC_PATH_TEXT; | |
1884 | |
1885 typedef T_TDC_INTERFACE_BASE* (*T_TDC_NEW_INTERFACE)(); | |
1886 typedef T_TDC_HANDLE_BASE* (*T_TDC_NEW_HANDLE)(); | |
1887 typedef T_TDC_DESCRIPTOR_BASE* (*T_TDC_NEW_DESCRIPTOR)(); | |
1888 | |
1889 struct T_PRIMITIVE_UNION; | |
1890 struct T_TDC_INTERFACE_PRIMITIVE_UNION; | |
1891 struct T_TDC_DESCRIPTOR_PRIMITIVE_UNION; | |
1892 | |
1893 struct T_MESSAGE_UNION; | |
1894 struct T_TDC_INTERFACE_MESSAGE_UNION; | |
1895 struct T_TDC_DESCRIPTOR_MESSAGE_UNION; | |
1896 | |
1897 typedef signed long T_TDC_INT_S32; | |
1898 typedef signed short T_TDC_INT_S16; | |
1899 typedef signed char T_TDC_INT_S8; | |
1900 typedef unsigned long T_TDC_INT_U32; | |
1901 typedef unsigned short T_TDC_INT_U16; | |
1902 typedef unsigned char T_TDC_INT_U8; | |
1903 typedef char CHAR; | |
1904 | |
1905 //---------------------------------------------------------------------------- | |
1906 inline unsigned long num_elements(const unsigned char* array) | |
1907 { | |
1908 return strlen((const char*)array); | |
1909 } | |
1910 | |
1911 inline unsigned long num_elements(const signed char* array) | |
1912 { | |
1913 return strlen((const char*)array); | |
1914 } | |
1915 | |
1916 | |
1917 //---------------------------------------------------------------------------- | |
1918 | |
1919 enum T_TDC_RW_MODE | |
1920 { | |
1921 TDC_RW_MODE_READ, | |
1922 TDC_RW_MODE_WRITE | |
1923 }; | |
1924 | |
1925 struct T_TDC_HANDLE_BASE | |
1926 { | |
1927 friend struct T_TDC_COPY; | |
1928 protected: | |
1929 T_TDC_ACTION_ENUM implement_get_action () const; | |
1930 void implement_set_action (T_TDC_ACTION_ENUM action_); | |
1931 T_TDC_DESCRIPTOR_BASE* implement_get_descriptor () const; | |
1932 void implement_set_descriptor (T_TDC_DESCRIPTOR_BASE* descriptor_); | |
1933 long implement_get_value () const; | |
1934 void implement_set_value (long value_); | |
1935 friend void add_name_info (T_TDC_HANDLE_BASE* descriptor_ref, int level, int parent, int index); | |
1936 T_TDC_PATH_TEXT path_text(); | |
1937 virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; | |
1938 static T_TDC_DESCRIPTOR_BASE* call_implement_new_descriptor(T_TDC_NEW_DESCRIPTOR new_descriptor); | |
1939 public: | |
1940 T_TDC_DESCRIPTOR_BASE* make_descriptor (); | |
1941 T_TDC_DESCRIPTOR_BASE* make_array_descriptor (T_TDC_NEW_HANDLE new_element_handle); | |
1942 virtual char* get_name () const | |
1943 TDC_PURE_BODY({ | |
1944 //TDC_ERROR(); | |
1945 return 0; | |
1946 }) | |
1947 virtual long get_sizeof () = 0 | |
1948 { | |
1949 return sizeof *this; | |
1950 } | |
1951 T_TDC_HANDLE_BASE (); | |
1952 ~T_TDC_HANDLE_BASE (); | |
1953 T_TDC_HANDLE_BASE* get_element (int index)const; | |
1954 T_TDC_HANDLE_BASE* get_union_element (); | |
1955 void destroy (); | |
1956 T_TDC_DESCRIPTOR_BASE* get_descriptor()const; | |
1957 T_TDC_ACTION_ENUM get_action()const; | |
1958 long get_value()const; | |
1959 int get_ctrl()const; | |
1960 void clear(); | |
1961 void set_descriptor_value(long value_); | |
1962 virtual unsigned get_sizeof_target (); | |
1963 virtual T_TDC_IS_ENUM is (); | |
1964 }; | |
1965 | |
1966 #ifdef TDC_USE_ALLOC_DEBUG_COUNTER | |
1967 struct T_TDC_ALLOC_DEBUG_COUNTER | |
1968 { | |
1969 int count; | |
1970 int max_count; | |
1971 int alloc_count; | |
1972 int free_count; | |
1973 bool alloc[1000]; | |
1974 T_TDC_ALLOC_DEBUG_COUNTER () | |
1975 { | |
1976 /* nothing here should allways be static allocated and there for cleared, | |
1977 futher more it is used before construction so intializing here will be fatal */ | |
1978 } | |
1979 ~T_TDC_ALLOC_DEBUG_COUNTER () | |
1980 { | |
1981 for (int first_not_freed = 0; !alloc[first_not_freed]; first_not_freed++) | |
1982 TDC_ASSERT (first_not_freed < sizeof alloc); | |
1983 TDC_ASSERT (count==0); // some where we have a leak | |
1984 } | |
1985 }; | |
1986 | |
1987 template<class T> | |
1988 struct T_TDC_ALLOC_DEBUG | |
1989 { | |
1990 static T_TDC_ALLOC_DEBUG_COUNTER counter; | |
1991 int alloc_count; | |
1992 T_TDC_ALLOC_DEBUG_COUNTER& counter_; | |
1993 T_TDC_ALLOC_DEBUG (): | |
1994 counter_ (counter) | |
1995 { | |
1996 counter.count++; | |
1997 alloc_count = counter.alloc_count++; | |
1998 if (alloc_count < sizeof counter.alloc) | |
1999 counter.alloc[alloc_count]=true; | |
2000 if (counter.max_count < counter.count) | |
2001 counter.max_count = counter.count; | |
2002 } | |
2003 ~T_TDC_ALLOC_DEBUG () | |
2004 { | |
2005 if (alloc_count < sizeof counter.alloc) | |
2006 counter.alloc[alloc_count]=false; | |
2007 TDC_ASSERT (counter.count > 0); // deallocating more than ever allocated | |
2008 counter.free_count++; | |
2009 counter.count--; | |
2010 } | |
2011 }; | |
2012 | |
2013 template<class T>T_TDC_ALLOC_DEBUG_COUNTER T_TDC_ALLOC_DEBUG<T>::counter; | |
2014 #endif | |
2015 | |
2016 enum { | |
2017 TDC_CTRL_DEFAULT = 0, | |
2018 TDC_CTRL_NO_DESCRIPTOR = -1, | |
2019 TDC_CTRL_NOT_AN_UNION = -2, | |
2020 TDC_REF_COUNT_ELEMENTS_DESTROYED = -2, | |
2021 TDC_DESCRIPTOR_DESTROYED_VALUE = -4, | |
2022 TDC_DUMMY_TAP_HANDLE = -16 | |
2023 }; | |
2024 | |
2025 #define TDC_DESCRIPTOR_DESTROYED ((T_TDC_DESCRIPTOR_BASE*)TDC_DESCRIPTOR_DESTROYED_VALUE) | |
2026 | |
2027 struct T_TDC_DESCRIPTOR_BASE | |
2028 #ifdef TDC_USE_ALLOC_DEBUG_COUNTER | |
2029 :T_TDC_ALLOC_DEBUG<T_TDC_DESCRIPTOR_BASE> | |
2030 #endif | |
2031 { | |
2032 private: | |
2033 friend struct T_TDC_COPY; | |
2034 friend void unsubscribe (T_TDC_DESCRIPTOR_BASE* descriptor); | |
2035 int ref_count; | |
2036 virtual long get_sizeof () | |
2037 TDC_PURE_BODY( | |
2038 return 0; | |
2039 ) | |
2040 | |
2041 void destroy_elements (); | |
2042 protected: | |
2043 T_TDC_HANDLE_BASE* implement_get_element (unsigned index, char *first_element); | |
2044 T_TDC_HANDLE_BASE* implement_get_union_element (unsigned index, int& ctrl); | |
2045 public: | |
2046 void *operator new (size_t size);//TODO: operator new (size_t size); + eliminate T_TDC_HANDLE_BASE::T_TDC_HANDLE_BASE i.e. todo T_TDC_HANDLE_BASE::operator new (size_t size); | |
2047 T_TDC_PATH_TEXT path_text(); | |
2048 virtual int read_ctrl () const | |
2049 { | |
2050 return TDC_CTRL_NOT_AN_UNION; | |
2051 } | |
2052 void set_skip_to_end_from_action (T_TDC_ACTION_ENUM action); | |
2053 virtual void set_skip_to_end (bool skip_to_end); | |
2054 virtual bool get_skip_to_end () const; | |
2055 virtual T_TDC_HANDLE_BASE* make_element (unsigned index); | |
2056 virtual T_TDC_HANDLE_BASE* get_element (unsigned index); | |
2057 virtual int get_tap_handle (); | |
2058 T_TDC_DESCRIPTOR_BASE (); | |
2059 virtual ~T_TDC_DESCRIPTOR_BASE (); | |
2060 virtual char* get_name () const | |
2061 TDC_PURE_BODY( | |
2062 return 0; | |
2063 ) | |
2064 virtual T_TDC_IS_ENUM is () | |
2065 { | |
2066 //TODO: TDC_ERROR() here and mov is function to distinct base classes; | |
2067 return TDC_IS_UNKNOWN; | |
2068 } | |
2069 }; | |
2070 | |
2071 union T_TDC_BASIC_TYPES | |
2072 { | |
2073 unsigned long u32; | |
2074 signed long s32; | |
2075 signed int s16; | |
2076 signed char s8; | |
2077 char c[4]; | |
2078 }; | |
2079 | |
2080 //---------------------------------------------------------------------------- | |
2081 | |
2082 struct T_TDC_INTERFACE_BASE | |
2083 { | |
2084 private: | |
2085 void* operator &(); /* this member function is only here to prevent the user from taking the address of | |
2086 an interface, which make no sence to the user as it gives the address of | |
2087 some internal tdc navigation data */ | |
2088 #ifdef LINT //TODO: introduce for VC too | |
2089 const void* operator &() const; /* but we don't want ripling errors from LINT | |
2090 the ripling errors comes from the fact that LINT seems to have a more correct | |
2091 interpretion of where to use the overloaded function and where to truely take | |
2092 the address*/ | |
2093 #endif | |
2094 protected: | |
2095 T_TDC_LEVEL level[1]; | |
2096 T_TDC_ASSIGN_ACTION set_action (const T_TDC_ACTION& action_); | |
2097 T_TDC_INTERFACE_BASE () | |
2098 { | |
2099 //nothing | |
2100 } | |
2101 public: | |
2102 T_TDC_PATH* implement_make_descriptor_ref (T_TDC_RW_MODE rw_mode); | |
2103 T_TDC_PATH* make_descriptor_ref (T_TDC_RW_MODE rw_mode); | |
2104 const T_TDC_PATH* make_descriptor_ref (T_TDC_RW_MODE rw_mode) const; | |
2105 void set_descriptor_value (long value_); | |
2106 //bool cmp_descriptor_value (long value_); | |
2107 void copy_instance (const T_TDC_INSTANCE_BASE * value_); | |
2108 void copy_interface (const T_TDC_INTERFACE_BASE * value_); | |
2109 }; | |
2110 | |
2111 struct T_TDC_INTERFACE_MAIN_BASE | |
2112 #if DOT_COMPLETE_MEMBERS | |
2113 #else | |
2114 TDC_DOT_COMPLETE_HIDE(:T_TDC_INTERFACE_BASE) | |
2115 #endif | |
2116 { | |
2117 #if DOT_COMPLETE_MEMBERS | |
2118 #else | |
2119 protected: | |
2120 void set_main_value (const T_TDC_INTERFACE_MAIN_BASE* value_); | |
2121 void set_main_value (const T_TDC_INSTANCE_MAIN_BASE* value_); | |
2122 T_TDC_INTERFACE_BASE* get_element_navigation(T_TDC_NEW_INTERFACE new_element_interface); | |
2123 /*T_TDC_INTERFACE_MAIN_BASE () | |
2124 { | |
2125 tdc_level++; | |
2126 }*/ | |
2127 #endif | |
2128 }; | |
2129 | |
2130 struct T_TDC_INTERFACE_REF_BASE | |
2131 #if DOT_COMPLETE_MEMBERS | |
2132 #else | |
2133 TDC_DOT_COMPLETE_HIDE(:T_TDC_INTERFACE_BASE) | |
2134 #endif | |
2135 { | |
2136 #if DOT_COMPLETE_MEMBERS | |
2137 T_TDC_ASSIGN_ACTION _skip () {} /* you can use '= SKIP' as well */ | |
2138 T_TDC_ASSIGN_ACTION _show () {} /* you can use '= SHOW' as well */ | |
2139 T_TDC_ASSIGN_ACTION _forbid () {} /* you can use '= FORBID' as well */ | |
2140 T_TDC_ASSIGN_ACTION _require () {} /* you can use '= REQUIRE' as well */ | |
2141 #else//DOT_COMPLETE_MEMBERS | |
2142 T_TDC_INTERFACE_REF_BASE () | |
2143 { | |
2144 level[0] = 'A'+tdc_level; | |
2145 } | |
2146 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_skip ();) /* you can use '= SKIP' as well */ | |
2147 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_show ();) /* you can use '= SHOW' as well */ | |
2148 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_forbid ();) /* you can use '= FORBID' as well */ | |
2149 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_require ();) /* you can use '= REQUIRE' as well */ | |
2150 #endif//DOT_COMPLETE_MEMBERS | |
2151 }; | |
2152 | |
2153 struct T_TDC_INTERFACE_VAR_BASE | |
2154 #if DOT_COMPLETE_MEMBERS | |
2155 #else | |
2156 TDC_DOT_COMPLETE_HIDE(:T_TDC_INTERFACE_BASE) | |
2157 #endif | |
2158 { | |
2159 #if DOT_COMPLETE_MEMBERS | |
2160 T_TDC_ASSIGN_ACTION _skip () {} /* you can use '= SKIP' as well */ | |
2161 T_TDC_ASSIGN_ACTION _show () {} /* you can use '= SHOW' as well */ | |
2162 T_TDC_ASSIGN_ACTION _forbid () {} /* you can use '= FORBID' as well */ | |
2163 T_TDC_ASSIGN_ACTION _require () {} /* you can use '= REQUIRE' as well */ | |
2164 #else//DOT_COMPLETE_MEMBERS | |
2165 T_TDC_INTERFACE_VAR_BASE () | |
2166 { | |
2167 level[0] = 'A'+tdc_level; | |
2168 } | |
2169 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_skip ();) /* you can use '= SKIP' as well */ | |
2170 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_show ();) /* you can use '= SHOW' as well */ | |
2171 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_forbid ();) /* you can use '= FORBID' as well */ | |
2172 TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_require ();) /* you can use '= REQUIRE' as well */ | |
2173 #endif//DOT_COMPLETE_MEMBERS | |
2174 }; | |
2175 | |
2176 //---------------------------------------------------------------------------- | |
2177 | |
2178 #if TDC_DEBUG_DOT_COMPLETE | |
2179 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1K() | |
2180 { | |
2181 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
2182 s. | |
2183 i; | |
2184 s-> | |
2185 i0; | |
2186 } | |
2187 #else | |
2188 #endif | |
2189 | |
2190 //---------------------------------------------------------------------------- | |
2191 /** \defgroup PATH PATH | |
2192 * A set of classes and functions that is used for generating the path of | |
2193 * an element when generating warning or error messages. | |
2194 * TODO: need more work | |
2195 */ | |
2196 //\{ | |
2197 | |
2198 struct T_TDC_PATH | |
2199 #ifdef TDC_USE_ALLOC_DEBUG_COUNTER | |
2200 :T_TDC_ALLOC_DEBUG<T_TDC_PATH> | |
2201 #endif | |
2202 { | |
2203 T_TDC_HANDLE_BASE* handle; | |
2204 T_TDC_DESCRIPTOR_BASE* cahed_descriptor; | |
2205 int indexes_count; | |
2206 union{ | |
2207 int *indexes; | |
2208 struct T_WATCH_INDEXES{ | |
2209 int i0,i1,i2,i3,i4,i5,i6,i7,i8,i9; | |
2210 }*watch_indexes; | |
2211 }; | |
2212 T_TDC_INTERFACE_BASE* pattern; | |
2213 T_TDC_PATH* next; | |
2214 T_TDC_PATH (T_TDC_HANDLE_BASE* handle_); | |
2215 ~T_TDC_PATH (); | |
2216 void add_index(T_TDC_DESCRIPTOR_BASE* descriptor, int index); | |
2217 void add_to_cashed_path_list (); | |
2218 T_TDC_HANDLE_BASE* get_leaf(); | |
2219 T_TDC_PATH_TEXT get_path_text (); | |
2220 T_TDC_PATH* duplicate()const; | |
2221 }; | |
2222 | |
2223 //---------------------------------------------------------------------------- | |
2224 | |
2225 #if TDC_DEBUG_DOT_COMPLETE | |
2226 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1L() | |
2227 { | |
2228 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
2229 s. | |
2230 i; | |
2231 s-> | |
2232 i0; | |
2233 | |
2234 } | |
2235 #else | |
2236 #endif | |
2237 | |
2238 //---------------------------------------------------------------------------- | |
2239 | |
2240 struct const_T_TDC_COPY | |
2241 { | |
2242 T_TDC_HANDLE_BASE* descriptor_ref; | |
2243 const T_TDC_PATH* path; | |
2244 const_T_TDC_COPY (const T_TDC_PATH* path_): | |
2245 descriptor_ref (const_cast<T_TDC_PATH*>(path_)->get_leaf()), | |
2246 path (path_) | |
2247 { | |
2248 } | |
2249 const_T_TDC_COPY (const T_TDC_HANDLE_BASE* descriptor_ref_): | |
2250 descriptor_ref (const_cast<T_TDC_HANDLE_BASE*>(descriptor_ref_)), | |
2251 path (0) | |
2252 { | |
2253 } | |
2254 const_T_TDC_COPY (const const_T_TDC_COPY& src): | |
2255 descriptor_ref (src.descriptor_ref), | |
2256 path (0) | |
2257 { | |
2258 if (src.path) | |
2259 path = src.path->duplicate(); | |
2260 } | |
2261 void operator = (const const_T_TDC_COPY& src) | |
2262 { | |
2263 descriptor_ref = src.descriptor_ref; | |
2264 if (path) | |
2265 delete path; | |
2266 if (src.path) | |
2267 path = src.path->duplicate(); | |
2268 else | |
2269 path = 0; | |
2270 } | |
2271 const T_TDC_HANDLE_BASE* operator->() | |
2272 { | |
2273 return descriptor_ref; | |
2274 } | |
2275 operator const T_TDC_HANDLE_BASE*()const | |
2276 { | |
2277 return descriptor_ref; | |
2278 } | |
2279 ~const_T_TDC_COPY () | |
2280 { | |
2281 if (path) | |
2282 delete path; | |
2283 } | |
2284 T_TDC_PATH_TEXT path_text (); | |
2285 T_TDC_ACTION_ENUM get_action () const | |
2286 { | |
2287 return descriptor_ref->get_action(); | |
2288 } | |
2289 bool has_value () const | |
2290 { | |
2291 return (descriptor_ref->get_action() & TDC_ACTION_HAS_VALUE) != 0; | |
2292 } | |
2293 int get_value () const | |
2294 { | |
2295 return descriptor_ref->get_value(); | |
2296 } | |
2297 }; | |
2298 | |
2299 struct T_TDC_COPY:const_T_TDC_COPY | |
2300 { | |
2301 friend struct T_TDC_COPY; | |
2302 T_TDC_COPY (T_TDC_PATH* path_): | |
2303 const_T_TDC_COPY (path_) | |
2304 { | |
2305 } | |
2306 T_TDC_COPY (T_TDC_HANDLE_BASE* descriptor_ref_): | |
2307 const_T_TDC_COPY (descriptor_ref_) | |
2308 { | |
2309 } | |
2310 T_TDC_HANDLE_BASE* operator->() | |
2311 { | |
2312 return descriptor_ref; | |
2313 } | |
2314 operator T_TDC_HANDLE_BASE*()const | |
2315 { | |
2316 return descriptor_ref; | |
2317 } | |
2318 void copy_descriptor_ref (const const_T_TDC_COPY& value_); | |
2319 void copy_number (long value_); | |
2320 T_TDC_ASSIGN_ACTION copy_action (T_TDC_ACTION_ENUM action_); | |
2321 private: | |
2322 void set_action_and_value (T_TDC_ACTION_ENUM action_, long value_=0xFCFCFCFC); | |
2323 }; | |
2324 | |
2325 //---------------------------------------------------------------------------- | |
2326 | |
2327 /** \struct T_TDC_PATH_TEXT | |
2328 T_TDC_PATH_TEXT is used to return a string on the heap that will auto dealloc | |
2329 <pre> | |
2330 e.g. | |
2331 | |
2332 T_TDC_PATH_TEXT f() | |
2333 { | |
2334 return strdup ("..."); | |
2335 } | |
2336 | |
2337 void g() | |
2338 { | |
2339 printf ("%s", f()); // free of string allocated in f() will happen automatic | |
2340 // when ~T_TDC_PATH_TEXT is called at the end of sentence (at ';') | |
2341 } | |
2342 </pre> | |
2343 */ | |
2344 struct T_TDC_PATH_TEXT | |
2345 { | |
2346 char* str; | |
2347 T_TDC_PATH_TEXT(char* str_); | |
2348 ~T_TDC_PATH_TEXT(); | |
2349 }; | |
2350 | |
2351 //\} | |
2352 | |
2353 //---------------------------------------------------------------------------- | |
2354 | |
2355 #if TDC_DEBUG_DOT_COMPLETE | |
2356 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1N() | |
2357 { | |
2358 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
2359 s. | |
2360 i; | |
2361 s-> | |
2362 i0; | |
2363 | |
2364 } | |
2365 #else | |
2366 #endif | |
2367 | |
2368 //============================================================================ | |
2369 /// \defgroup T_TDC_INTERFACE | |
2370 //\{ | |
2371 | |
2372 struct T_TDC_INTERFACE_REF:T_TDC_INTERFACE_REF_BASE | |
2373 { | |
2374 #if DOT_COMPLETE_MEMBERS | |
2375 #else | |
2376 T_TDC_INTERFACE_REF () | |
2377 { | |
2378 tdc_level++; | |
2379 } | |
2380 #endif | |
2381 }; | |
2382 | |
2383 struct T_TDC_INTERFACE_VAR:T_TDC_INTERFACE_VAR_BASE | |
2384 { | |
2385 #if DOT_COMPLETE_MEMBERS | |
2386 #else | |
2387 T_TDC_INTERFACE_VAR () | |
2388 { | |
2389 //nothing | |
2390 } | |
2391 #endif | |
2392 }; | |
2393 | |
2394 //============================================================================ | |
2395 | |
2396 #if TDC_DEBUG_DOT_COMPLETE | |
2397 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1O | |
2398 { | |
2399 int i1O; | |
2400 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
2401 }; | |
2402 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1O() | |
2403 { | |
2404 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
2405 s. | |
2406 i; | |
2407 s-> | |
2408 i0; | |
2409 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1O s10; | |
2410 s10-> | |
2411 i0; | |
2412 } | |
2413 #else | |
2414 #endif | |
2415 | |
2416 //---------------------------------------------------------------------------- | |
2417 | |
2418 #if DOT_COMPLETE | |
2419 #define TDC_HIDDEN_LEVEL_DEF | |
2420 #define TDC_HIDDEN_LEVEL(T_BASE) | |
2421 #define TDC_HIDDEN_LEVEL_MAIN_DEF | |
2422 #define TDC_HIDDEN_LEVEL_MAIN(T_BASE) | |
2423 struct T_TDC_INTERFACE_POINTER_MAIN_BASE:T_TDC_INTERFACE_REF_BASE | |
2424 { | |
2425 }; | |
2426 #else | |
2427 #define TDC_HIDDEN_LEVEL_DEF | |
2428 #define TDC_HIDDEN_LEVEL | |
2429 #define TDC_HIDDEN_LEVEL_MAIN_DEF , class T_TDC_INTERFACE_POINTER_MAIN_BASE = T_TDC_INTERFACE_POINTER_MAIN_BASE_DEFAULT | |
2430 #define TDC_HIDDEN_LEVEL_MAIN(T_BASE) , T_BASE | |
2431 #endif | |
2432 | |
2433 struct T_TDC_INTERFACE_PRIMITIVE_BASE:T_TDC_INTERFACE_MAIN_BASE | |
2434 { | |
2435 }; | |
2436 | |
2437 struct T_TDC_INTERFACE_MESSAGE_BASE:T_TDC_INTERFACE_MAIN_BASE | |
2438 { | |
2439 }; | |
2440 | |
2441 //template<class T TDC_HIDDEN_LEVEL_MAIN_DEF > struct T_TDC_INTERFACE_POINTER_MAIN:T_TDC_INTERFACE_POINTER_BASE | |
2442 template<class T TDC_HIDDEN_LEVEL_MAIN_DEF > struct T_TDC_INTERFACE_POINTER_MAIN:T_TDC_INTERFACE_POINTER_MAIN_BASE | |
2443 { | |
2444 T_TDC_INTERFACE_POINTER_MAIN () | |
2445 { | |
2446 level[0] = 'A'+tdc_level; | |
2447 } | |
2448 #if DOT_COMPLETE_MEMBERS | |
2449 #else //DOT_COMPLETE_MEMBERS | |
2450 operator = (const T& t) | |
2451 { | |
2452 tdc_tbd_pointer_assignment_error(); | |
2453 //get_navigation()->_set(t); | |
2454 return 0; | |
2455 } | |
2456 #endif //DOT_COMPLETE_MEMBERS | |
2457 /*operator = (const T_TDC_INSTANCE& t) | |
2458 { | |
2459 get_navigation()->_set(t); | |
2460 }*/ | |
2461 T* operator-> (){ | |
2462 return (T*)get_element_navigation(new_element_interface); | |
2463 } | |
2464 /*operator const T&() | |
2465 { | |
2466 return *get_navigation(); | |
2467 }*/ | |
2468 private: | |
2469 #if DOT_COMPLETE_MEMBERS | |
2470 #else //DOT_COMPLETE_MEMBERS | |
2471 static T_TDC_INTERFACE_BASE* new_element_interface() | |
2472 { | |
2473 return new T; | |
2474 } | |
2475 #endif //DOT_COMPLETE_MEMBERS | |
2476 }; | |
2477 | |
2478 template<class T> struct T_ARRAY; | |
2479 | |
2480 struct T_TDC_INTERFACE_ARRAY_BASE | |
2481 :T_TDC_INTERFACE_REF_BASE | |
2482 { | |
2483 #if DOT_COMPLETE | |
2484 #else | |
2485 protected: | |
2486 T_TDC_INTERFACE_BASE* get_element_navigation(int index, T_TDC_NEW_INTERFACE new_element_interface, T_TDC_NEW_HANDLE new_handle); | |
2487 void copy_basic_array (const T_TDC_INT_U8* array, unsigned size, void *address); | |
2488 void copy_basic_array (const T_TDC_INT_S8* array, unsigned size, void *address); | |
2489 void copy_basic_array (const T_TDC_INT_U16* array, unsigned size, void *address); | |
2490 void copy_basic_array (const T_TDC_INT_S16* array, unsigned size, void *address); | |
2491 void copy_basic_array (const T_TDC_INT_U32* array, unsigned size, void *address); | |
2492 void copy_basic_array (const T_TDC_INT_S32* array, unsigned size, void *address); | |
2493 #endif | |
2494 }; | |
2495 | |
2496 /* | |
2497 ** TODO: Function header (this is a comment for an bug fix) | |
2498 ** | |
2499 ** I would expect dropdown to work for this | |
2500 ** template<class T, int MAX_INDEX > struct T_TDC_INTERFACE_ARRAY:T_TDC_INTERFACE_POINTER_BASE_DEFAULT | |
2501 ** ^^ | |
2502 ** and to fail for this | |
2503 ** template<class T, int MAX_INDEX, int DUMMY=0 > struct T_TDC_INTERFACE_ARRAY:T_TDC_INTERFACE_POINTER_BASE_DEFAULT | |
2504 ** ^^^^^^^^^^^^^ | |
2505 ** | |
2506 ** but it seams to be the otherway around (see more info in tcd_test.cpp::test_1000()) | |
2507 */ | |
2508 | |
2509 #if DOT_COMPLETE | |
2510 template<class T /*T_INTERFACE*/, int MAX_INDEX = 1, int DUMMY=0> struct T_TDC_INTERFACE_ARRAY | |
2511 #else | |
2512 template<class T /*T_INTERFACE*/, int MAX_INDEX = 1> struct T_TDC_INTERFACE_ARRAY | |
2513 //template<class T /*T_INTERFACE*/> struct T_TDC_INTERFACE_ARRAY | |
2514 #endif | |
2515 :T_TDC_INTERFACE_ARRAY_BASE | |
2516 { | |
2517 public: | |
2518 T& operator [] (int index)//HINT: blah | |
2519 { | |
2520 return *(T*)get_element_navigation (index, new_element_interface, T::implement_new_handle); | |
2521 } | |
2522 T* operator-> ()//HINT: blah | |
2523 { | |
2524 return (T*)get_element_navigation (0, new_element_interface, T::implement_new_handle); | |
2525 } | |
2526 #if DOT_COMPLETE_MEMBERS | |
2527 #else//DOT_COMPLETE_MEMBERS | |
2528 T_TDC_INTERFACE_ARRAY () | |
2529 { | |
2530 //nothing | |
2531 } | |
2532 void assign (const T_TDC_INT_U8* array, unsigned size, void *address) | |
2533 { | |
2534 copy_basic_array (array, size, address); | |
2535 } | |
2536 void assign (const T_TDC_INT_S8* array, unsigned size, void *address) | |
2537 { | |
2538 copy_basic_array (array, size, address); | |
2539 } | |
2540 void assign (const T_TDC_INT_U16* array, unsigned size, void *address) | |
2541 { | |
2542 copy_basic_array (array, size, address); | |
2543 } | |
2544 void assign (const T_TDC_INT_S16* array, unsigned size, void *address) | |
2545 { | |
2546 copy_basic_array (array, size, address); | |
2547 } | |
2548 void assign (const T_TDC_INT_U32* array, unsigned size, void *address) | |
2549 { | |
2550 copy_basic_array (array, size, address); | |
2551 } | |
2552 void assign (const T_TDC_INT_S32* array, unsigned size, void *address) | |
2553 { | |
2554 copy_basic_array (array, size, address); | |
2555 } | |
2556 void assign (const T_TDC_ACTION& action_, unsigned size, void *address) | |
2557 { | |
2558 set_action(action_); | |
2559 } | |
2560 /*template <class U> | |
2561 void assign (const U* u, unsigned size) | |
2562 { | |
2563 //TDC_TBD(); | |
2564 }*/ | |
2565 template <class U> | |
2566 void assign (const T_ARRAY<U>& src, unsigned size, void *address) | |
2567 { | |
2568 T_TDC_COPY handle = make_descriptor_ref (TDC_RW_MODE_WRITE); | |
2569 handle.copy_descriptor_ref (src.handle); | |
2570 } | |
2571 void assign (const T* t, unsigned size, void *address) | |
2572 { | |
2573 //tdc_check_array_assignment(array, address); | |
2574 tdc_tbd_array_assignment_error(); | |
2575 } | |
2576 void assign (const T::T_INSTANCE* array, unsigned size, void *address) | |
2577 { | |
2578 tdc_check_array_assignment(array, address); | |
2579 //copy_instance_array (array, size); | |
2580 T_TDC_COPY handle = make_descriptor_ref (TDC_RW_MODE_WRITE); | |
2581 T_TDC_HANDLE_BASE* descriptor_ref = handle.descriptor_ref; | |
2582 T_TDC_DESCRIPTOR_BASE* descriptor = descriptor_ref->make_descriptor (); | |
2583 T_TDC_HANDLE_BASE** elements = ((T_TDC_DESCRIPTOR_ARRAY_BASE*)descriptor)->get_elements(); | |
2584 if (!*elements) | |
2585 *elements = T::implement_new_handle (); | |
2586 int count = size / sizeof *array; | |
2587 | |
2588 for (int i = 0; i < count; i++) | |
2589 { | |
2590 T_TDC_COPY dst_element = descriptor->make_element(i); | |
2591 const_T_TDC_COPY src_element = (T_TDC_HANDLE_BASE*) array[i].handle; | |
2592 dst_element.copy_descriptor_ref (src_element); | |
2593 } | |
2594 } | |
2595 template <class U> | |
2596 T_TDC_INTERFACE_ARRAY& operator = (const U& array) | |
2597 { | |
2598 int size = sizeof array; /* if you have error "illegal indirection" here the right hand operator can not be converted to an array | |
2599 see next error message for the bad assignment */ | |
2600 assign (array, size, (void*)&array); | |
2601 return *this; | |
2602 } | |
2603 private: | |
2604 static T_TDC_INTERFACE_BASE* new_element_interface() | |
2605 { | |
2606 return new T; | |
2607 } | |
2608 #endif//DOT_COMPLETE_MEMBERS | |
2609 }; | |
2610 | |
2611 /* | |
2612 ** TODO: Function header (this is a comment for an bug fix) | |
2613 ** | |
2614 ** When we change T_TDC_INTERFACE_ARRAY we have to change T_TDC_INTERFACE_POINTER too | |
2615 ** template<class T TDC_HIDDEN_LEVEL_DEF > struct T_TDC_INTERFACE_POINTER:T_TDC_INTERFACE_ARRAY<T, 1 TDC_HIDDEN_LEVEL> | |
2616 */ | |
2617 | |
2618 struct T_TDC_INTERFACE_POINTER_BASE:T_TDC_INTERFACE_REF_BASE | |
2619 { | |
2620 protected: | |
2621 T_TDC_INTERFACE_BASE* get_navigation(T_TDC_NEW_INTERFACE new_element_interface, T_TDC_NEW_HANDLE new_handle); | |
2622 T_TDC_INTERFACE_BASE* get_navigation(T_TDC_NEW_INTERFACE new_element_interface, T_TDC_NEW_HANDLE new_handle, int index); | |
2623 }; | |
2624 | |
2625 template<class T_INTERFACE> struct T_TDC_INTERFACE_POINTER | |
2626 #if DOT_COMPLETE | |
2627 #else | |
2628 :T_TDC_INTERFACE_POINTER_BASE | |
2629 #endif | |
2630 { | |
2631 T_INTERFACE* operator-> () | |
2632 { | |
2633 return (T_INTERFACE*)get_navigation (new_element_interface, T_INTERFACE::implement_new_handle); | |
2634 } | |
2635 #if DOT_COMPLETE_MEMBERS | |
2636 #else//DOT_COMPLETE_MEMBERS | |
2637 T_INTERFACE& operator [] (int index) | |
2638 { | |
2639 return *(T_INTERFACE*)get_navigation (new_element_interface, T_INTERFACE::implement_new_handle, index); | |
2640 } | |
2641 static T_TDC_INTERFACE_BASE* new_element_interface() | |
2642 { | |
2643 return new T_INTERFACE; | |
2644 } | |
2645 /*T_TDC_INTERFACE_POINTER () | |
2646 { | |
2647 //nothing | |
2648 }*/ | |
2649 #endif//DOT_COMPLETE_MEMBERS | |
2650 }; | |
2651 | |
2652 //============================================================================ | |
2653 | |
2654 #if TDC_DEBUG_DOT_COMPLETE | |
2655 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1P | |
2656 { | |
2657 int i1P; | |
2658 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
2659 }; | |
2660 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1P() | |
2661 { | |
2662 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
2663 s. | |
2664 i; | |
2665 s-> | |
2666 i0; | |
2667 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1P s1P; | |
2668 s1P-> | |
2669 i0; | |
2670 T_TDC_INTERFACE_ARRAY<int> i; | |
2671 i.assign(0,0); | |
2672 T_ARRAY<int> array; | |
2673 array. | |
2674 | |
2675 } | |
2676 #else | |
2677 #endif | |
2678 | |
2679 //---------------------------------------------------------------------------- | |
2680 // T_TDC_INTERFACE | |
2681 //---------------------------------------------------------------------------- | |
2682 | |
2683 struct T_TDC_INTERFACE_PRIM_BASE:T_TDC_INTERFACE_PRIMITIVE_BASE | |
2684 { | |
2685 T_TDC_INTERFACE_PRIM_BASE () | |
2686 { | |
2687 level[0] = 'A'+tdc_level; | |
2688 tdc_level++; | |
2689 } | |
2690 #if DOT_COMPLETE_MEMBERS//{{ | |
2691 T_TDC_ASSIGN_ACTION _require () {} // you can use '= REQUIRE' as well | |
2692 #else//}DOT_COMPLETE_MEMBERS{ | |
2693 T_TDC_ASSIGN_ACTION tdc_require() // you can use '= REQUIRE' as well | |
2694 { | |
2695 return set_action (REQUIRE); | |
2696 } | |
2697 #endif//}}DOT_COMPLETE_MEMBERS | |
2698 }; | |
2699 | |
2700 struct T_TDC_INTERFACE_PSTRUCT_BASE:T_TDC_INTERFACE_REF | |
2701 { | |
2702 }; | |
2703 | |
2704 struct T_TDC_INTERFACE_PUNION_BASE:T_TDC_INTERFACE_REF | |
2705 { | |
2706 }; | |
2707 | |
2708 struct T_TDC_INTERFACE_SDU_BASE:T_TDC_INTERFACE_REF | |
2709 { | |
2710 }; | |
2711 | |
2712 struct T_TDC_INTERFACE_PENUM_BASE:T_TDC_INTERFACE_VAR | |
2713 { | |
2714 }; | |
2715 | |
2716 struct T_TDC_INTERFACE_MSG_BASE:T_TDC_INTERFACE_MESSAGE_BASE | |
2717 { | |
2718 T_TDC_INTERFACE_MSG_BASE () | |
2719 { | |
2720 level[0] = 'A'+tdc_level; | |
2721 tdc_level++; | |
2722 } | |
2723 #if DOT_COMPLETE_MEMBERS | |
2724 T_TDC_ASSIGN_ACTION _require () {} // you can use '= REQUIRE' as well | |
2725 #else//DOT_COMPLETE_MEMBERS | |
2726 T_TDC_ASSIGN_ACTION tdc_require() // you can use '= REQUIRE' as well | |
2727 { | |
2728 return set_action (REQUIRE); | |
2729 } | |
2730 #endif//DOT_COMPLETE_MEMBERS | |
2731 }; | |
2732 | |
2733 struct T_TDC_INTERFACE_MSTRUCT_BASE:T_TDC_INTERFACE_REF | |
2734 { | |
2735 }; | |
2736 | |
2737 struct T_TDC_INTERFACE_MUNION_BASE:T_TDC_INTERFACE_REF | |
2738 { | |
2739 }; | |
2740 | |
2741 struct T_TDC_INTERFACE_MENUM_BASE:T_TDC_INTERFACE_VAR | |
2742 { | |
2743 }; | |
2744 | |
2745 struct T_TDC_INTERFACE_INT_BASE:T_TDC_INTERFACE_VAR | |
2746 { | |
2747 }; | |
2748 | |
2749 struct T_TDC_INTERFACE_XXX_PRIMITIVE_UNION_BASE:T_TDC_INTERFACE_PRIMITIVE_BASE | |
2750 { | |
2751 T_TDC_INTERFACE_XXX_PRIMITIVE_UNION_BASE () | |
2752 { | |
2753 level[0] = 'A'+tdc_level; | |
2754 tdc_level++; | |
2755 } | |
2756 }; | |
2757 | |
2758 struct T_TDC_INTERFACE_XXX_MESSAGE_UNION_BASE:T_TDC_INTERFACE_MESSAGE_BASE | |
2759 { | |
2760 T_TDC_INTERFACE_XXX_MESSAGE_UNION_BASE () | |
2761 { | |
2762 level[0] = 'A'+tdc_level; | |
2763 tdc_level++; | |
2764 } | |
2765 }; | |
2766 | |
2767 struct T_TDC_INTERFACE_PRIMITIVE_UNION_BASE:T_TDC_INTERFACE_PRIMITIVE_BASE | |
2768 { | |
2769 T_TDC_INTERFACE_PRIMITIVE_UNION_BASE () | |
2770 { | |
2771 level[0] = 'A'+tdc_level; | |
2772 tdc_level++; | |
2773 } | |
2774 }; | |
2775 | |
2776 struct T_TDC_INTERFACE_MESSAGE_UNION_BASE:T_TDC_INTERFACE_MESSAGE_BASE | |
2777 { | |
2778 T_TDC_INTERFACE_MESSAGE_UNION_BASE () | |
2779 { | |
2780 level[0] = 'A'+tdc_level; | |
2781 tdc_level++; | |
2782 } | |
2783 }; | |
2784 | |
2785 #if TDC_DEBUG_DOT_COMPLETE | |
2786 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q | |
2787 { | |
2788 int i1Q; | |
2789 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
2790 }; | |
2791 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q() | |
2792 { | |
2793 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
2794 s. | |
2795 i; | |
2796 s-> | |
2797 i0; | |
2798 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q s1Q; | |
2799 s1Q-> | |
2800 i; | |
2801 } | |
2802 #else | |
2803 #endif | |
2804 | |
2805 template<class T> struct T_TDC_INTERFACE_XXX_PRIMITIVE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_PRIMITIVE_BASE) > | |
2806 { | |
2807 }; | |
2808 | |
2809 template<class T> struct T_TDC_INTERFACE_XXX_MESSAGE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_MESSAGE_BASE) > | |
2810 { | |
2811 }; | |
2812 | |
2813 template<class T> struct T_TDC_INTERFACE_PRIMITIVE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_PRIMITIVE_BASE) > | |
2814 { | |
2815 }; | |
2816 | |
2817 template<class T> struct T_TDC_INTERFACE_PRIMITIVE_UNION_POINTER:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_PRIMITIVE_BASE) > | |
2818 { | |
2819 }; | |
2820 | |
2821 template<class T> struct T_TDC_INTERFACE_MESSAGE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_MESSAGE_BASE) > | |
2822 { | |
2823 }; | |
2824 | |
2825 template<class T> struct T_TDC_INTERFACE_MESSAGE_UNION_POINTER:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_MESSAGE_BASE) > | |
2826 { | |
2827 }; | |
2828 | |
2829 //\} | |
2830 | |
2831 #if TDC_DEBUG_DOT_COMPLETE | |
2832 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1 | |
2833 { | |
2834 int i1Q1; | |
2835 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
2836 }; | |
2837 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1u | |
2838 { | |
2839 int i1Q1u; | |
2840 }; | |
2841 template<class T> | |
2842 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1t1 | |
2843 { | |
2844 int i1Q1t; | |
2845 //T* operator->(){return 0;} | |
2846 }; | |
2847 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1() | |
2848 { | |
2849 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1 s1Q1; | |
2850 s1Q1-> | |
2851 i; | |
2852 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1t1<T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1u> s1Q1t1u; | |
2853 s1Q1t1u. | |
2854 i1Q1t; | |
2855 s1Q1t1u-> | |
2856 i1Q1u; | |
2857 /*T_TDC_INTERFACE_PRIMITIVE_UNION_POINTER z1Q1_; | |
2858 z1Q1_-> | |
2859 i;*/ | |
2860 T_TDC_INTERFACE_PRIMITIVE_UNION_POINTER<T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1> z1Q1; | |
2861 z1Q1. | |
2862 x; | |
2863 z1Q1-> | |
2864 i; | |
2865 } | |
2866 #else | |
2867 #endif | |
2868 | |
2869 //============================================================================ | |
2870 | |
2871 #if TDC_DEBUG_DOT_COMPLETE | |
2872 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1R | |
2873 { | |
2874 int i1R; | |
2875 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
2876 }; | |
2877 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1R() | |
2878 { | |
2879 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
2880 s. | |
2881 i; | |
2882 s-> | |
2883 i0; | |
2884 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1R s1R; | |
2885 s1R-> | |
2886 i0; | |
2887 } | |
2888 #else | |
2889 #endif | |
2890 | |
2891 //---------------------------------------------------------------------------- | |
2892 /// \defgroup T_TDC_DESCRIPTOR T_TDC_DESCRIPTOR | |
2893 /// base classes to repeat stuff that is similar in many descriptor classes | |
2894 //---------------------------------------------------------------------------- | |
2895 //\{ | |
2896 | |
2897 struct T_TDC_DESCRIPTOR_ARRAY_BASE:T_TDC_DESCRIPTOR_BASE | |
2898 { | |
2899 int tap_handle; | |
2900 int implement_get_tap_array_handle (unsigned c_elements, T_TDC_DESCRIPTOR_BASE* sdu_handle); | |
2901 int get_tap_array_handle (unsigned c_elements); | |
2902 bool skip_to_end; | |
2903 virtual T_TDC_IS_ENUM is (); | |
2904 virtual void set_skip_to_end (bool skip_to_end_); | |
2905 virtual bool get_skip_to_end (); | |
2906 T_TDC_DESCRIPTOR_ARRAY_BASE (); | |
2907 virtual char* get_name () const; | |
2908 ~T_TDC_DESCRIPTOR_ARRAY_BASE (); | |
2909 T_TDC_HANDLE_BASE** get_elements(); | |
2910 unsigned get_c_elements(); | |
2911 void set_c_elements(unsigned c_elements); | |
2912 T_TDC_HANDLE_BASE* make_element (unsigned index); | |
2913 T_TDC_HANDLE_BASE* get_element (unsigned index); | |
2914 }; | |
2915 | |
2916 template<class T, int MAX_INDEX = 1> | |
2917 struct T_TDC_DESCRIPTOR_ARRAY:T_TDC_DESCRIPTOR_ARRAY_BASE | |
2918 { | |
2919 typedef T_TDC_DESCRIPTOR_ARRAY<T, MAX_INDEX> T_DESCRIPTOR_ARRAY; | |
2920 friend T_TDC_DESCRIPTOR_BASE * new_T_DESCRIPTOR_ARRAY(void) | |
2921 { | |
2922 return new T_TDC_DESCRIPTOR_ARRAY<T, MAX_INDEX>; | |
2923 } | |
2924 unsigned c_elements; | |
2925 typedef T T_ELEMENT; | |
2926 T_ELEMENT* elements; | |
2927 T_TDC_DESCRIPTOR_ARRAY() | |
2928 { | |
2929 c_elements = 0; | |
2930 elements = 0; | |
2931 } | |
2932 virtual int get_tap_handle () | |
2933 { | |
2934 return get_tap_array_handle (c_elements); | |
2935 } | |
2936 #ifndef TDC_TEST_PROFILE | |
2937 virtual long get_sizeof () | |
2938 { | |
2939 /* this function should never be called but the base version have no chance of returning a proper value so we keep it just in case */ | |
2940 TDC_DYNAMIC_DEAD_CODE(); | |
2941 return sizeof *this; | |
2942 } | |
2943 #endif | |
2944 }; | |
2945 | |
2946 struct T_TDC_HANDLE_ARRAY_BASE:T_TDC_HANDLE_BASE | |
2947 { | |
2948 virtual char* get_name () const; | |
2949 virtual T_TDC_IS_ENUM is () | |
2950 { | |
2951 return TDC_IS_ARRAY; | |
2952 } | |
2953 }; | |
2954 | |
2955 template<class T, int MAX_INDEX = 1> | |
2956 struct T_TDC_HANDLE_ARRAY:T_TDC_HANDLE_ARRAY_BASE | |
2957 { | |
2958 typedef T_TDC_DESCRIPTOR_ARRAY<T, MAX_INDEX> T_DESCRIPTOR_ARRAY; | |
2959 virtual long get_sizeof () | |
2960 { | |
2961 return sizeof *this; | |
2962 } | |
2963 M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_DESCRIPTOR_ARRAY) | |
2964 protected: | |
2965 virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; | |
2966 }; | |
2967 | |
2968 #if DOT_COMPLETE | |
2969 #else | |
2970 // the dot complete compiler can not handle this code | |
2971 template<class T, int MAX_INDEX> | |
2972 T_TDC_DESCRIPTOR_BASE* T_TDC_HANDLE_ARRAY<T, MAX_INDEX>::implement_new_descriptor(void) const | |
2973 { | |
2974 //return new T_DESCRIPTOR_ARRAY; | |
2975 /*TODO: We don't allways need the element array and the code was once remove | |
2976 but it seems like there are still problems with code like: | |
2977 T_ARRAY<T_S8> parray_ps8c; | |
2978 parray_ps8c[0]. _require; | |
2979 */ | |
2980 T_DESCRIPTOR_ARRAY *descriptor = new T_DESCRIPTOR_ARRAY; | |
2981 /*T_TDC_HANDLE_BASE** elements = ((T_TDC_DESCRIPTOR_ARRAY_BASE*)descriptor)->get_elements(); | |
2982 if (!*elements) | |
2983 //*elements = new_handle (); | |
2984 *elements = T::implement_new_handle();*/ | |
2985 return descriptor; | |
2986 } | |
2987 #endif | |
2988 | |
2989 #ifdef TDC_SIMULATE_POINTER | |
2990 #define T_TDC_DESCRIPTOR_POINTER T_TDC_DESCRIPTOR_ARRAY | |
2991 #define T_TDC_HANDLE_POINTER T_TDC_HANDLE_ARRAY | |
2992 #else | |
2993 | |
2994 struct T_TDC_DESCRIPTOR_POINTER_BASE:T_TDC_DESCRIPTOR_BASE | |
2995 { | |
2996 virtual T_TDC_IS_ENUM is (); | |
2997 virtual char* get_name () const; | |
2998 T_TDC_HANDLE_BASE** get_elements(); | |
2999 virtual T_TDC_HANDLE_BASE* get_element (unsigned index); | |
3000 virtual int get_tap_handle (); | |
3001 //virtual int read_ctrl () const; | |
3002 }; | |
3003 | |
3004 template<class T /*T_HANDLE*/> struct T_TDC_DESCRIPTOR_POINTER:T_TDC_DESCRIPTOR_POINTER_BASE | |
3005 { | |
3006 typedef T_TDC_DESCRIPTOR_POINTER<T> T_DESCRIPTOR_POINTER; | |
3007 friend T_TDC_DESCRIPTOR_BASE * new_T_DESCRIPTOR_POINTER(void) | |
3008 { | |
3009 return new T_TDC_DESCRIPTOR_POINTER<T, MAX_INDEX>; | |
3010 } | |
3011 //T::T_DESCRIPTOR element; | |
3012 T* element; | |
3013 //T element; | |
3014 #ifndef TDC_TEST_PROFILE | |
3015 virtual long get_sizeof () | |
3016 { | |
3017 /* this function should never be called but the base version have no chance of returning a proper value so we keep it just in case */ | |
3018 TDC_DYNAMIC_DEAD_CODE(); | |
3019 return sizeof *this; | |
3020 } | |
3021 #endif | |
3022 }; | |
3023 | |
3024 struct T_TDC_HANDLE_POINTER_BASE:T_TDC_HANDLE_BASE | |
3025 { | |
3026 virtual char* get_name () const; | |
3027 virtual T_TDC_IS_ENUM is () | |
3028 { | |
3029 return TDC_IS_POINTER; | |
3030 } | |
3031 virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; | |
3032 }; | |
3033 | |
3034 template<class T> struct T_TDC_HANDLE_POINTER:T_TDC_HANDLE_POINTER_BASE | |
3035 { | |
3036 typedef T_TDC_DESCRIPTOR_POINTER<T> T_DESCRIPTOR_POINTER; | |
3037 virtual long get_sizeof () | |
3038 { | |
3039 return sizeof *this; | |
3040 } | |
3041 M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_DESCRIPTOR_POINTER) | |
3042 protected: | |
3043 virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; | |
3044 }; | |
3045 | |
3046 #if DOT_COMPLETE | |
3047 #else | |
3048 // the dot complete compiler can not handle this code | |
3049 template<class T> | |
3050 T_TDC_DESCRIPTOR_BASE* T_TDC_HANDLE_POINTER<T>::implement_new_descriptor(void) const | |
3051 { | |
3052 return new T_DESCRIPTOR_POINTER; | |
3053 } | |
3054 #endif | |
3055 | |
3056 #endif | |
3057 | |
3058 //---------------------------------------------------------------------------- | |
3059 | |
3060 struct T_TDC_DESCRIPTOR_MAIN_BASE:T_TDC_DESCRIPTOR_BASE | |
3061 { | |
3062 virtual int get_id () const | |
3063 TDC_PURE_BODY( | |
3064 return 0; | |
3065 ) | |
3066 T_TDC_HANDLE_BASE* get_element (unsigned index) | |
3067 { | |
3068 char *first_element = (char*) this + sizeof *this; | |
3069 return implement_get_element (index, first_element); | |
3070 } | |
3071 }; | |
3072 | |
3073 struct T_TDC_DESCRIPTOR_XSTRUCT_BASE:T_TDC_DESCRIPTOR_BASE | |
3074 { | |
3075 int tap_handle; | |
3076 int get_tap_xstruct_handle (T_TDC_TABLE_KIND table_kind); | |
3077 T_TDC_DESCRIPTOR_XSTRUCT_BASE (); | |
3078 ~T_TDC_DESCRIPTOR_XSTRUCT_BASE (); | |
3079 T_TDC_HANDLE_BASE* get_element (unsigned index); | |
3080 }; | |
3081 | |
3082 struct T_TDC_DESCRIPTOR_INT_BASE:T_TDC_HANDLE_BASE | |
3083 { | |
3084 virtual int get_tap_handle (); | |
3085 }; | |
3086 | |
3087 //----- | |
3088 | |
3089 struct T_TDC_DESCRIPTOR_PRIM_BASE:T_TDC_DESCRIPTOR_MAIN_BASE | |
3090 { | |
3091 virtual T_TDC_IS_ENUM is () | |
3092 { | |
3093 return T_TDC_IS_ENUM (TDC_IS_COMP | TDC_IS_PRIM); | |
3094 } | |
3095 }; | |
3096 | |
3097 struct T_TDC_DESCRIPTOR_PSTRUCT_BASE:T_TDC_DESCRIPTOR_XSTRUCT_BASE | |
3098 { | |
3099 virtual T_TDC_IS_ENUM is () | |
3100 { | |
3101 return TDC_IS_STRUCT; | |
3102 } | |
3103 virtual int get_tap_handle (); | |
3104 }; | |
3105 | |
3106 struct T_TDC_DESCRIPTOR_PUNION_BASE:T_TDC_DESCRIPTOR_BASE | |
3107 { | |
3108 virtual T_TDC_IS_ENUM is () | |
3109 { | |
3110 return TDC_IS_UNION; | |
3111 } | |
3112 }; | |
3113 | |
3114 struct T_TDC_DESCRIPTOR_SDU_BASE:T_TDC_DESCRIPTOR_BASE | |
3115 { | |
3116 virtual T_TDC_IS_ENUM is () | |
3117 { | |
3118 return TDC_IS_SDU; | |
3119 } | |
3120 virtual int get_tap_handle () | |
3121 { | |
3122 return TDC_DUMMY_TAP_HANDLE; | |
3123 } | |
3124 void invoke_tap (T_TDC_EVENT_ENUM event) const; | |
3125 }; | |
3126 | |
3127 struct T_TDC_DESCRIPTOR_PENUM_BASE:T_TDC_HANDLE_BASE | |
3128 { | |
3129 virtual int get_tap_handle (); | |
3130 virtual T_TDC_IS_ENUM is () | |
3131 { | |
3132 return TDC_IS_PVAR; | |
3133 } | |
3134 }; | |
3135 | |
3136 //----- | |
3137 | |
3138 struct T_TDC_DESCRIPTOR_MSG_BASE:T_TDC_DESCRIPTOR_MAIN_BASE | |
3139 { | |
3140 virtual T_TDC_IS_ENUM is () | |
3141 { | |
3142 return T_TDC_IS_ENUM (TDC_IS_COMP | TDC_IS_MSG); | |
3143 } | |
3144 }; | |
3145 | |
3146 struct T_TDC_DESCRIPTOR_MSTRUCT_BASE:T_TDC_DESCRIPTOR_XSTRUCT_BASE | |
3147 { | |
3148 virtual T_TDC_IS_ENUM is () | |
3149 { | |
3150 return TDC_IS_STRUCT; | |
3151 } | |
3152 virtual int get_tap_handle (); | |
3153 }; | |
3154 | |
3155 struct T_TDC_DESCRIPTOR_MUNION_BASE:T_TDC_DESCRIPTOR_BASE | |
3156 { | |
3157 virtual T_TDC_IS_ENUM is () | |
3158 { | |
3159 return TDC_IS_UNION; | |
3160 } | |
3161 }; | |
3162 | |
3163 struct T_TDC_DESCRIPTOR_MENUM_BASE:T_TDC_HANDLE_BASE | |
3164 { | |
3165 virtual int get_tap_handle (); | |
3166 virtual T_TDC_IS_ENUM is () | |
3167 { | |
3168 return TDC_IS_MVAR; | |
3169 } | |
3170 }; | |
3171 | |
3172 //----- | |
3173 | |
3174 struct T_TDC_DESCRIPTOR_XXX_PRIMITIVE_UNION_BASE:T_TDC_DESCRIPTOR_BASE | |
3175 { | |
3176 }; | |
3177 | |
3178 struct T_TDC_DESCRIPTOR_XXX_MESSAGE_UNION_BASE:T_TDC_DESCRIPTOR_BASE | |
3179 { | |
3180 }; | |
3181 | |
3182 struct T_TDC_DESCRIPTOR_PRIMITIVE_UNION_BASE:T_TDC_DESCRIPTOR_BASE | |
3183 { | |
3184 }; | |
3185 | |
3186 struct T_TDC_DESCRIPTOR_MESSAGE_UNION_BASE:T_TDC_DESCRIPTOR_BASE | |
3187 { | |
3188 //TODO: construct munions (when called from make_element_info, shold be hamless in get_element_info) | |
3189 }; | |
3190 | |
3191 //\} | |
3192 | |
3193 //============================================================================ | |
3194 | |
3195 #if TDC_DEBUG_DOT_COMPLETE | |
3196 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1S | |
3197 { | |
3198 int i1S; | |
3199 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3200 }; | |
3201 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1S() | |
3202 { | |
3203 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3204 s. | |
3205 i; | |
3206 s-> | |
3207 i0; | |
3208 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1S s1S; | |
3209 s1S-> | |
3210 i0; | |
3211 } | |
3212 #else | |
3213 #endif | |
3214 | |
3215 //---------------------------------------------------------------------------- | |
3216 /// \defgroup T_TDC_INSTANCE T_TDC_INSTANCE | |
3217 /// base classes to repeat stuff that is similar in many instance classes | |
3218 //---------------------------------------------------------------------------- | |
3219 ///\{ | |
3220 | |
3221 struct T_TDC_INSTANCE_BASE | |
3222 { | |
3223 //private: | |
3224 T_TDC_HANDLE_BASE* implement_get_handle () const; | |
3225 void implement_set_handle(T_TDC_HANDLE_BASE* handle); | |
3226 //protected: | |
3227 virtual T_TDC_INTERFACE_BASE *new_interface () const; | |
3228 //public: | |
3229 T_TDC_INTERFACE_BASE *get_navigation () const; | |
3230 //protected: | |
3231 T_TDC_INTERFACE_BASE *get_element_navigation (int index) const; | |
3232 //public: | |
3233 T_TDC_INTERFACE_BASE *make_element_navigation (int index, T_TDC_NEW_HANDLE new_element_handle); | |
3234 T_TDC_HANDLE_BASE* get_descriptor_ref () const; | |
3235 T_TDC_ASSIGN_ACTION set_action(const T_TDC_ACTION& action_); | |
3236 void set_value (const T_TDC_INSTANCE_BASE& value_); | |
3237 void copy_instance (const T_TDC_INSTANCE_BASE * value_); | |
3238 void copy_interface (const T_TDC_INTERFACE_BASE * value_); | |
3239 T_TDC_ASSIGN_ACTION construct_from_action(const T_TDC_ACTION& action_, T_TDC_NEW_HANDLE new_handle); | |
3240 void construct_from_instance (const T_TDC_INSTANCE_BASE& value_, T_TDC_NEW_HANDLE new_handle); | |
3241 void construct_from_interface (const T_TDC_INTERFACE_BASE * value_, T_TDC_NEW_HANDLE new_handle); | |
3242 void set_descriptor_value (long value_); | |
3243 long get_descriptor_value (); | |
3244 bool cmp_descriptor_value (long value_); | |
3245 void construct_from_number (long value_, T_TDC_NEW_HANDLE new_handle); | |
3246 void destroy_handle (); | |
3247 T_TDC_HANDLE_BASE* construct_handle (T_TDC_NEW_HANDLE new_handle); | |
3248 T_TDC_HANDLE_BASE* construct_array_handle (T_TDC_NEW_HANDLE new_handle,T_TDC_NEW_HANDLE new_element_handle); | |
3249 T_TDC_DESCRIPTOR_BASE* construct_descriptor (T_TDC_NEW_HANDLE new_handle); | |
3250 T_TDC_DESCRIPTOR_BASE* construct_array_descriptor (T_TDC_NEW_HANDLE new_handle,T_TDC_NEW_HANDLE new_element_handle); | |
3251 T_TDC_INSTANCE_BASE(); | |
3252 ~T_TDC_INSTANCE_BASE(); | |
3253 private: | |
3254 ///Check for copy constructor missing in class derived from T_TDC_INSTANCE_BASE | |
3255 T_TDC_INSTANCE_BASE(const T_TDC_INSTANCE_BASE&); | |
3256 }; | |
3257 | |
3258 struct T_TDC_INSTANCE_MAIN_BASE:T_TDC_INSTANCE_BASE | |
3259 { | |
3260 void set_main_value (const T_TDC_INTERFACE_MAIN_BASE* value_); | |
3261 void set_main_value (const T_TDC_INSTANCE_MAIN_BASE* value_); | |
3262 void construct_main_value (const T_TDC_INTERFACE_MAIN_BASE* value_, T_TDC_NEW_HANDLE new_handle); | |
3263 void construct_main_value (const T_TDC_INSTANCE_MAIN_BASE* value_, T_TDC_NEW_HANDLE new_handle); | |
3264 }; | |
3265 | |
3266 struct T_TDC_INSTANCE_PART_BASE | |
3267 #if DOT_COMPLETE | |
3268 #else | |
3269 TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_BASE) | |
3270 #endif | |
3271 { | |
3272 }; | |
3273 | |
3274 struct T_TDC_INSTANCE_PRIMITIVE_BASE | |
3275 #if DOT_COMPLETE | |
3276 #else | |
3277 TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_MAIN_BASE) | |
3278 #endif | |
3279 { | |
3280 #if DOT_COMPLETE | |
3281 #else | |
3282 TDC_DOT_COMPLETE_HIDE(void invoke_tap (T_TDC_EVENT_ENUM) const;) | |
3283 #endif | |
3284 }; | |
3285 | |
3286 struct T_TDC_INSTANCE_MESSAGE_BASE | |
3287 #if DOT_COMPLETE | |
3288 #else | |
3289 TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_MAIN_BASE) | |
3290 #endif | |
3291 { | |
3292 }; | |
3293 | |
3294 struct T_TDC_INSTANCE_PRIM_BASE:T_TDC_INSTANCE_PRIMITIVE_BASE | |
3295 { | |
3296 }; | |
3297 | |
3298 struct T_TDC_INSTANCE_PSTRUCT_BASE:T_TDC_INSTANCE_PART_BASE | |
3299 { | |
3300 }; | |
3301 | |
3302 struct T_TDC_INSTANCE_PUNION_BASE:T_TDC_INSTANCE_PART_BASE | |
3303 { | |
3304 }; | |
3305 | |
3306 struct T_TDC_INSTANCE_SDU_BASE:T_TDC_INSTANCE_PART_BASE | |
3307 { | |
3308 }; | |
3309 | |
3310 struct T_TDC_INSTANCE_PENUM_BASE:T_TDC_INSTANCE_PART_BASE | |
3311 { | |
3312 }; | |
3313 | |
3314 struct T_TDC_INSTANCE_MSG_BASE:T_TDC_INSTANCE_MESSAGE_BASE | |
3315 { | |
3316 }; | |
3317 | |
3318 struct T_TDC_INSTANCE_MSTRUCT_BASE:T_TDC_INSTANCE_PART_BASE | |
3319 { | |
3320 }; | |
3321 | |
3322 struct T_TDC_INSTANCE_MUNION_BASE:T_TDC_INSTANCE_PART_BASE | |
3323 { | |
3324 }; | |
3325 | |
3326 struct T_TDC_INSTANCE_MENUM_BASE:T_TDC_INSTANCE_PART_BASE | |
3327 { | |
3328 }; | |
3329 | |
3330 struct T_TDC_INSTANCE_INT_BASE:T_TDC_INSTANCE_PART_BASE | |
3331 { | |
3332 }; | |
3333 | |
3334 struct T_TDC_INSTANCE_XXX_PRIMITIVE_UNION_BASE:T_TDC_INSTANCE_PRIMITIVE_BASE | |
3335 { | |
3336 }; | |
3337 | |
3338 struct T_TDC_INSTANCE_XXX_MESSAGE_UNION_BASE:T_TDC_INSTANCE_MESSAGE_BASE | |
3339 { | |
3340 }; | |
3341 | |
3342 struct T_TDC_INSTANCE_PRIMITIVE_UNION_BASE:T_TDC_INSTANCE_PRIMITIVE_BASE | |
3343 { | |
3344 }; | |
3345 | |
3346 struct T_TDC_INSTANCE_MESSAGE_UNION_BASE:T_TDC_INSTANCE_MESSAGE_BASE | |
3347 { | |
3348 }; | |
3349 | |
3350 //---------------------------------------------------------------------------- | |
3351 | |
3352 struct T_TDC_INSTANCE_ARRAY_BASE | |
3353 #if DOT_COMPLETE | |
3354 #else | |
3355 TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_BASE) | |
3356 #endif | |
3357 { | |
3358 #if DOT_COMPLETE_MEMBERS | |
3359 T_TDC_ASSIGN_ACTION _skip () {} /* you can use '= SKIP' as well */ | |
3360 T_TDC_ASSIGN_ACTION _show () {} /* you can use '= SHOW' as well */ | |
3361 T_TDC_ASSIGN_ACTION _forbid () {} /* you can use '= FORBID' as well */ | |
3362 T_TDC_ASSIGN_ACTION _require () {} /* you can use '= REQUIRE' as well */ | |
3363 #else//DOT_COMPLETE_MEMBERS | |
3364 T_TDC_ASSIGN_ACTION tdc_skip (); /* you can use '= SKIP' as well */ | |
3365 T_TDC_ASSIGN_ACTION tdc_show (); /* you can use '= SHOW' as well */ | |
3366 T_TDC_ASSIGN_ACTION tdc_forbid (); /* you can use '= FORBID' as well */ | |
3367 T_TDC_ASSIGN_ACTION tdc_require (); /* you can use '= REQUIRE' as well */ | |
3368 /*T_ARRAY operator = (const T_TDC_ACTION& action_) | |
3369 { | |
3370 set_action (action_); | |
3371 return *this; | |
3372 }*/ | |
3373 #endif//DOT_COMPLETE_MEMBERS | |
3374 }; | |
3375 | |
3376 #if DOT_COMPLETE | |
3377 template<class T /*T_INSTANCE*/, int DUMMY> struct T_ARRAY | |
3378 #else | |
3379 template<class T /*T_INSTANCE*/> struct T_ARRAY | |
3380 #endif | |
3381 :T_TDC_INSTANCE_ARRAY_BASE | |
3382 { | |
3383 T::T_INTERFACE& operator [] (int index_) | |
3384 { | |
3385 return *(T::T_INTERFACE*)make_element_navigation(index_,T::implement_new_handle); | |
3386 } | |
3387 /* | |
3388 T::T_INTERFACE& operator -> () | |
3389 { | |
3390 return *(T::T_INTERFACE*)get_element_navigation(0); | |
3391 } | |
3392 */ | |
3393 #if DOT_COMPLETE | |
3394 #else | |
3395 typedef T_TDC_HANDLE_ARRAY<T::T_HANDLE> T_HANDLE; | |
3396 T_HANDLE* handle; | |
3397 friend T_TDC_HANDLE_BASE* new_T_HANDLE()\ | |
3398 { | |
3399 return new T_HANDLE;//(T::implement_new_handle); | |
3400 } | |
3401 T_ARRAY operator = (const T_ARRAY& value_) | |
3402 { | |
3403 set_value (value_); | |
3404 return *this; | |
3405 } | |
3406 T_ARRAY () | |
3407 { | |
3408 construct_array_handle(new_T_HANDLE,T::implement_new_handle); | |
3409 } | |
3410 ~T_ARRAY () | |
3411 { | |
3412 destroy_handle(); | |
3413 } | |
3414 // T_ARRAY (const T_ARRAY<T>& u1) => ambiguous call to overloaded function | |
3415 void assign (const T_ARRAY<T>& array, unsigned size, void* address) | |
3416 { | |
3417 construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3418 T_TDC_COPY(handle).copy_descriptor_ref (array.handle); | |
3419 } | |
3420 template<class U1> void assign (const U1* array, unsigned size, void* address) | |
3421 { | |
3422 tdc_check_array_assignment(array, address); | |
3423 int count = size / sizeof *array; | |
3424 T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3425 for (int i = 0; i < count; i++) | |
3426 { | |
3427 T_TDC_COPY element = descriptor->make_element(i); | |
3428 element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); | |
3429 } | |
3430 } | |
3431 void assign (const T_TDC_ACTION& action_, unsigned size, void *address) | |
3432 { | |
3433 construct_from_action (action_, new_T_HANDLE); | |
3434 } | |
3435 /*T_ARRAY (const T_ARRAY& array) //ambiguous call to overloaded function | |
3436 { | |
3437 assign (array, sizeof array, (void*)&array); | |
3438 }*/ | |
3439 template<class U1> T_ARRAY (const U1& array) | |
3440 { | |
3441 assign (array, sizeof array, (void*)&array); | |
3442 } | |
3443 template<class U1> T_ARRAY (const U1& u1, T_TDC_ACTION action) | |
3444 { | |
3445 const T* array = u1; | |
3446 int count = sizeof u1 / sizeof *u1; | |
3447 T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3448 descriptor->set_skip_to_end_from_action (action.action); | |
3449 for (int i = 0; i < count; i++) | |
3450 { | |
3451 T_TDC_COPY element = descriptor->make_element(i); | |
3452 element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); | |
3453 } | |
3454 } | |
3455 template<class U1> T_ARRAY (const U1& u1, T_TDC_CREATE_ACTION action) | |
3456 { | |
3457 const T* array = u1; | |
3458 int count = sizeof u1 / sizeof *u1; | |
3459 T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3460 descriptor->set_skip_to_end_from_action (action.action); | |
3461 for (int i = 0; i < count; i++) | |
3462 { | |
3463 T_TDC_COPY element = descriptor->make_element(i); | |
3464 element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); | |
3465 } | |
3466 } | |
3467 template<class U1, class U2> T_ARRAY (const U1& u1, const U2& u2) | |
3468 { | |
3469 tdc_tbd_array_assignment_error_T_ARRAY(); | |
3470 } | |
3471 /* | |
3472 template<class U1, class U2, class U3> T_ARRAY (U1 u1, U2 u2, U3 u3) | |
3473 { | |
3474 TDC_TBD(); | |
3475 } | |
3476 template<class U1, class U2, class U3, class U4> T_ARRAY (U1 u1, U2 u2, U3 u3, U4 u4) | |
3477 { | |
3478 TDC_TBD(); | |
3479 } | |
3480 template<class U1, class U2, class U3, class U4, class U5> T_ARRAY (U1 u1, U2 u2, U3 u3, U4 u4, U5 u5) | |
3481 { | |
3482 TDC_TBD(); | |
3483 } | |
3484 */ | |
3485 virtual T_TDC_INTERFACE_BASE *new_interface () const | |
3486 { | |
3487 return new T::T_INTERFACE; | |
3488 } | |
3489 #endif | |
3490 }; | |
3491 | |
3492 | |
3493 #define M_TDC_BASIC_ARRAY(T_BASIC)\ | |
3494 T_ARRAY ()\ | |
3495 {\ | |
3496 /*construct_handle(new_T_HANDLE);*/\ | |
3497 }\ | |
3498 template<class U1>\ | |
3499 T_ARRAY (const U1& array, T_TDC_ACTION action)\ | |
3500 {\ | |
3501 assign (array, sizeof array, (void*)&array, action);\ | |
3502 }\ | |
3503 template<class U1>\ | |
3504 T_ARRAY (const U1& array)\ | |
3505 {\ | |
3506 assign (array, sizeof array, (void*)&array, TDC_ACTION_UNKNOWN);\ | |
3507 }\ | |
3508 T_ARRAY operator = (const T_ARRAY& value_)\ | |
3509 {\ | |
3510 set_value (value_);\ | |
3511 return *this;\ | |
3512 }\ | |
3513 T_ARRAY operator = (const T_TDC_ACTION& action_)\ | |
3514 {\ | |
3515 construct_from_action (action_,new_T_HANDLE);\ | |
3516 return *this;\ | |
3517 }\ | |
3518 | |
3519 template<class T, class T_BASIC> struct T_TDC_INSTANCE_BASIC_ARRAY:T_TDC_INSTANCE_ARRAY_BASE | |
3520 { | |
3521 typedef T_TDC_HANDLE_ARRAY<T::T_HANDLE> T_HANDLE; | |
3522 T_HANDLE* handle; | |
3523 static T_TDC_HANDLE_BASE* new_T_HANDLE()\ | |
3524 { | |
3525 return new T_HANDLE;//(T::implement_new_handle); | |
3526 } | |
3527 T_TDC_INSTANCE_BASIC_ARRAY () | |
3528 { | |
3529 construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3530 } | |
3531 void assign (const T_BASIC* array, unsigned size, void* address, T_TDC_ACTION action) | |
3532 { | |
3533 tdc_check_array_assignment(array, address); | |
3534 unsigned count = size / sizeof T_BASIC; | |
3535 T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3536 descriptor->set_skip_to_end_from_action (action.action); | |
3537 for (int i = 0; i < count; i++) | |
3538 { | |
3539 T_TDC_COPY element= descriptor->make_element(i); | |
3540 element.copy_number (array[i]); | |
3541 } | |
3542 } | |
3543 void assign (const T_BASIC* array, unsigned size, void* address, T_TDC_CREATE_ACTION action) | |
3544 { | |
3545 tdc_check_array_assignment(array, address); | |
3546 unsigned count = size / sizeof T_BASIC; | |
3547 T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3548 descriptor->set_skip_to_end_from_action (action.action); | |
3549 for (int i = 0; i < count; i++) | |
3550 { | |
3551 T_TDC_COPY element= descriptor->make_element(i); | |
3552 element.copy_number (array[i]); | |
3553 } | |
3554 } | |
3555 void assign (const T_ARRAY<T>& array, unsigned size, void* address) | |
3556 { | |
3557 construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3558 T_TDC_COPY(handle).copy_descriptor_ref (array.handle); | |
3559 } | |
3560 template<class U1> void assign (const U1* array, unsigned size, void* address) | |
3561 { | |
3562 tdc_check_array_assignment(array, address); | |
3563 int count = size / sizeof *array; | |
3564 T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); | |
3565 for (int i = 0; i < count; i++) | |
3566 { | |
3567 T_TDC_COPY element = descriptor->make_element(i); | |
3568 element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); | |
3569 } | |
3570 } | |
3571 void assign (const T_TDC_ACTION& action_, unsigned size, void *address) | |
3572 { | |
3573 construct_from_action (action_, new_T_HANDLE); | |
3574 } | |
3575 void assign (const T_ARRAY<T_BASIC>& array, unsigned size, void* address, T_TDC_ACTION action) | |
3576 { | |
3577 construct_from_instance(array,new_T_HANDLE); | |
3578 } | |
3579 T::T_INTERFACE& operator [] (int index_) | |
3580 { | |
3581 return *(T::T_INTERFACE*)get_element_navigation(index_); | |
3582 } | |
3583 virtual T_TDC_INTERFACE_BASE *new_interface () const | |
3584 { | |
3585 return new T::T_INTERFACE; | |
3586 } | |
3587 }; | |
3588 | |
3589 //\} | |
3590 | |
3591 //============================================================================ | |
3592 | |
3593 #if TDC_DEBUG_DOT_COMPLETE | |
3594 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W | |
3595 { | |
3596 int i1W; | |
3597 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3598 }; | |
3599 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W() | |
3600 { | |
3601 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3602 s. | |
3603 i; | |
3604 s-> | |
3605 i0; | |
3606 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W s1W; | |
3607 s1W-> | |
3608 i0; | |
3609 } | |
3610 #else | |
3611 #endif | |
3612 | |
3613 //============================================================================ | |
3614 /// \defgroup BuildInTypes build in types | |
3615 //============================================================================ | |
3616 //\{ | |
3617 | |
3618 //#pragma M_TDC_MESSAGE (M_TDC_STRING(M_TDC_FORWARD_INT (U8))) | |
3619 M_TDC_FORWARD_INT (U8) | |
3620 M_TDC_FORWARD_INT (S8) | |
3621 M_TDC_FORWARD_INT (U16) | |
3622 M_TDC_FORWARD_INT (S16) | |
3623 M_TDC_FORWARD_INT (U32) | |
3624 M_TDC_FORWARD_INT (S32) | |
3625 | |
3626 M_TDC_FORWARD_PSTRUCT (raw) | |
3627 M_TDC_FORWARD_PSTRUCT (aim) | |
3628 M_TDC_FORWARD_COMP (MESSAGE_UNION,TDC_IS_MESSAGE_UNION) | |
3629 | |
3630 //M_TDC_FORWARD_MSTRUCT(COMP_STENCIL) | |
3631 M_TDC_FORWARD_BASE(COMP_STENCIL, T_TDC_HANDLE_COMP_STENCIL) | |
3632 M_TDC_HANDLE(M_TDC_IN_CLASS,M_TDC_WITHOUT_BODY,COMP_STENCIL,TDC_IS_COMP) | |
3633 | |
3634 #ifndef TDC_DOT_COMPLETE_HIDE_PROTOTYPES | |
3635 struct T_PRIMITIVE_UNION; | |
3636 struct T_TDC_INTERFACE_PRIMITIVE_UNION; | |
3637 struct T_TDC_DESCRIPTOR_PRIMITIVE_UNION; | |
3638 struct T_TDC_HANDLE_PRIMITIVE_UNION; | |
3639 T_TDC_HANDLE_BASE* new_T_TDC_HANDLE_PRIMITIVE_UNION(); | |
3640 | |
3641 struct T_MESSAGE_UNION; | |
3642 struct T_TDC_INTERFACE_MESSAGE_UNION; | |
3643 struct T_TDC_DESCRIPTOR_MESSAGE_UNION; | |
3644 struct T_TDC_HANDLE_MESSAGE_UNION; | |
3645 T_TDC_HANDLE_BASE* new_T_TDC_HANDLE_MESSAGE_UNION(); | |
3646 #endif | |
3647 | |
3648 struct T_TDC_DESCRIPTOR_S8:T_TDC_DESCRIPTOR_INT_BASE | |
3649 { | |
3650 M_TDC_DESCRIPTOR_INT_ADDITIONAL (S8) | |
3651 }; | |
3652 | |
3653 struct T_TDC_DESCRIPTOR_U8:T_TDC_DESCRIPTOR_INT_BASE | |
3654 { | |
3655 M_TDC_DESCRIPTOR_INT_ADDITIONAL (U8) | |
3656 }; | |
3657 | |
3658 struct T_TDC_DESCRIPTOR_S16:T_TDC_DESCRIPTOR_INT_BASE | |
3659 { | |
3660 M_TDC_DESCRIPTOR_INT_ADDITIONAL (S16) | |
3661 }; | |
3662 | |
3663 struct T_TDC_DESCRIPTOR_U16:T_TDC_DESCRIPTOR_INT_BASE | |
3664 { | |
3665 M_TDC_DESCRIPTOR_INT_ADDITIONAL (U16) | |
3666 }; | |
3667 | |
3668 struct T_TDC_DESCRIPTOR_S32:T_TDC_DESCRIPTOR_INT_BASE | |
3669 { | |
3670 M_TDC_DESCRIPTOR_INT_ADDITIONAL (S32) | |
3671 }; | |
3672 | |
3673 struct T_TDC_DESCRIPTOR_U32:T_TDC_DESCRIPTOR_INT_BASE | |
3674 { | |
3675 M_TDC_DESCRIPTOR_INT_ADDITIONAL (U32) | |
3676 }; | |
3677 | |
3678 struct T_TDC_DESCRIPTOR_raw:T_TDC_DESCRIPTOR_PSTRUCT_BASE | |
3679 { | |
3680 M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL (raw) | |
3681 T_TDC_HANDLE_U16 l_buf; | |
3682 T_TDC_HANDLE_U16 o_buf; | |
3683 T_TDC_HANDLE_ARRAY<T_TDC_DESCRIPTOR_U8> buf; | |
3684 virtual int get_tap_handle (); | |
3685 }; | |
3686 | |
3687 struct T_TDC_DESCRIPTOR_COMP_STENCIL:T_TDC_DESCRIPTOR_MSTRUCT_BASE | |
3688 { | |
3689 M_TDC_DESCRIPTOR_MSTRUCT_ADDITIONAL (COMP_STENCIL) | |
3690 }; | |
3691 | |
3692 struct T_TDC_DESCRIPTOR_VAR_STENCIL:T_TDC_DESCRIPTOR_MENUM_BASE | |
3693 { | |
3694 typedef long T_TDC_ENUM_VAR_STENCIL; | |
3695 M_TDC_DESCRIPTOR_MENUM_ADDITIONAL (VAR_STENCIL) | |
3696 }; | |
3697 | |
3698 #if TDC_DEBUG_DOT_COMPLETE | |
3699 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W1 | |
3700 { | |
3701 int i1W1; | |
3702 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3703 }; | |
3704 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W1() | |
3705 { | |
3706 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3707 s. | |
3708 i; | |
3709 s-> | |
3710 i0; | |
3711 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W1 s1W1; | |
3712 s1W1-> | |
3713 i0; | |
3714 } | |
3715 #else | |
3716 #endif | |
3717 | |
3718 | |
3719 typedef T_TDC_DESCRIPTOR_ARRAY<T_TDC_HANDLE_COMP_STENCIL> T_TDC_DESCRIPTOR_ARRAY_STENCIL; | |
3720 typedef T_TDC_DESCRIPTOR_POINTER<T_TDC_HANDLE_COMP_STENCIL> T_TDC_DESCRIPTOR_POINTER_STENCIL; | |
3721 typedef T_TDC_HANDLE_POINTER<T_TDC_HANDLE_COMP_STENCIL> T_TDC_HANDLE_POINTER_STENCIL; | |
3722 | |
3723 | |
3724 #if TDC_DEBUG_DOT_COMPLETE | |
3725 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W4 | |
3726 { | |
3727 int i1W4; | |
3728 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3729 }; | |
3730 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W4() | |
3731 { | |
3732 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3733 s. | |
3734 i; | |
3735 s-> | |
3736 i0; | |
3737 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W4 s1W4; | |
3738 s1W4-> | |
3739 i0; | |
3740 } | |
3741 #else | |
3742 #endif | |
3743 | |
3744 #if !defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE | |
3745 | |
3746 #if TDC_DEBUG_DOT_COMPLETE | |
3747 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W5 | |
3748 { | |
3749 int i1W5; | |
3750 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3751 }; | |
3752 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W5() | |
3753 { | |
3754 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3755 s. | |
3756 i; | |
3757 s-> | |
3758 i0; | |
3759 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W5 s1W5; | |
3760 s1W5-> | |
3761 i0; | |
3762 } | |
3763 #else | |
3764 #endif | |
3765 | |
3766 struct T_U8:T_TDC_INSTANCE_INT_BASE | |
3767 { | |
3768 //enable pragma line to see expanded version of macro in list file | |
3769 //#pragma M_TDC_MESSAGE (M_TDC_STRING(M_TDC_INSTANCE_INT_ADDITIONAL (U8))) | |
3770 M_TDC_INSTANCE_INT_ADDITIONAL (U8) | |
3771 T_TDC_INTERFACE_U8* operator-> (); | |
3772 }; | |
3773 struct T_TDC_INTERFACE_U8:T_TDC_INTERFACE_INT_BASE | |
3774 { | |
3775 //enable pragma line to see expanded version of macro in list file | |
3776 //#pragma M_TDC_MESSAGE (M_TDC_STRING(M_TDC_INTERFACE_INT_ADDITIONAL (U8))) | |
3777 M_TDC_INTERFACE_INT_ADDITIONAL (U8) | |
3778 #ifdef TDC_TYPE_NAME_COMPLETE | |
3779 struct T_TDC_TYPE_NAME { char T_U8, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable | |
3780 #endif | |
3781 }; | |
3782 | |
3783 #if TDC_DEBUG_DOT_COMPLETE | |
3784 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W6 | |
3785 { | |
3786 int i1W6; | |
3787 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3788 }; | |
3789 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W6() | |
3790 { | |
3791 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3792 s. | |
3793 i; | |
3794 s-> | |
3795 i0; | |
3796 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W6 s1W6; | |
3797 s1W6-> | |
3798 i0; | |
3799 } | |
3800 #else | |
3801 #endif | |
3802 | |
3803 struct T_S8:T_TDC_INSTANCE_INT_BASE | |
3804 { | |
3805 M_TDC_INSTANCE_INT_ADDITIONAL (S8) | |
3806 T_TDC_INTERFACE_S8* operator-> (); | |
3807 }; | |
3808 struct T_TDC_INTERFACE_S8:T_TDC_INTERFACE_INT_BASE | |
3809 { | |
3810 M_TDC_INTERFACE_INT_ADDITIONAL (S8) | |
3811 #ifdef TDC_TYPE_NAME_COMPLETE | |
3812 struct T_TDC_TYPE_NAME { char T_S8, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable | |
3813 #endif | |
3814 }; | |
3815 | |
3816 struct T_U16:T_TDC_INSTANCE_INT_BASE | |
3817 { | |
3818 M_TDC_INSTANCE_INT_ADDITIONAL (U16) | |
3819 T_TDC_INTERFACE_U16* operator-> (); | |
3820 }; | |
3821 struct T_TDC_INTERFACE_U16:T_TDC_INTERFACE_INT_BASE | |
3822 { | |
3823 M_TDC_INTERFACE_INT_ADDITIONAL (U16) | |
3824 #ifdef TDC_TYPE_NAME_COMPLETE | |
3825 struct T_TDC_TYPE_NAME { char T_U16, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable | |
3826 #endif | |
3827 }; | |
3828 | |
3829 struct T_S16:T_TDC_INSTANCE_INT_BASE | |
3830 { | |
3831 M_TDC_INSTANCE_INT_ADDITIONAL (S16) | |
3832 T_TDC_INTERFACE_S16* operator-> (); | |
3833 }; | |
3834 struct T_TDC_INTERFACE_S16:T_TDC_INTERFACE_INT_BASE | |
3835 { | |
3836 M_TDC_INTERFACE_INT_ADDITIONAL (S16) | |
3837 #ifdef TDC_TYPE_NAME_COMPLETE | |
3838 struct T_TDC_TYPE_NAME { char T_S16, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable | |
3839 #endif | |
3840 }; | |
3841 | |
3842 struct T_U32:T_TDC_INSTANCE_INT_BASE | |
3843 { | |
3844 M_TDC_INSTANCE_INT_ADDITIONAL (U32) | |
3845 T_TDC_INTERFACE_U32* operator-> (); | |
3846 }; | |
3847 struct T_TDC_INTERFACE_U32:T_TDC_INTERFACE_INT_BASE | |
3848 { | |
3849 M_TDC_INTERFACE_INT_ADDITIONAL (U32) | |
3850 #ifdef TDC_TYPE_NAME_COMPLETE | |
3851 struct T_TDC_TYPE_NAME { char T_U32, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable | |
3852 #endif | |
3853 }; | |
3854 | |
3855 struct T_S32:T_TDC_INSTANCE_INT_BASE | |
3856 { | |
3857 M_TDC_INSTANCE_INT_ADDITIONAL (S32) | |
3858 T_TDC_INTERFACE_S32* operator-> (); | |
3859 }; | |
3860 struct T_TDC_INTERFACE_S32:T_TDC_INTERFACE_INT_BASE | |
3861 { | |
3862 M_TDC_INTERFACE_INT_ADDITIONAL (S32) | |
3863 #ifdef TDC_TYPE_NAME_COMPLETE | |
3864 struct T_TDC_TYPE_NAME { char T_S32, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable | |
3865 #endif | |
3866 }; | |
3867 | |
3868 struct T_raw:T_TDC_INSTANCE_PSTRUCT_BASE | |
3869 { | |
3870 M_TDC_INSTANCE_PSTRUCT_ADDITIONAL (raw,raw) | |
3871 T_TDC_INTERFACE_raw* operator-> (); | |
3872 }; | |
3873 struct T_TDC_INTERFACE_raw:T_TDC_INTERFACE_PSTRUCT_BASE | |
3874 { | |
3875 M_TDC_INTERFACE_PSTRUCT_ADDITIONAL (raw,raw) | |
3876 T_TDC_INTERFACE_U16 l_buf; //number of valid bits | |
3877 T_TDC_INTERFACE_U16 o_buf; //offset of first valid bit | |
3878 T_TDC_INTERFACE_ARRAY<T_TDC_INTERFACE_U8> buf; //array size = (o_buf + l_buf + 7) /8 | |
3879 #ifdef TDC_TYPE_NAME_COMPLETE | |
3880 struct T_TDC_TYPE_NAME { char T_raw, ___l_buf___o_buf___buf; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable | |
3881 #endif | |
3882 }; | |
3883 | |
3884 #if TDC_DEBUG_DOT_COMPLETE | |
3885 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9 | |
3886 { | |
3887 int i1W9; | |
3888 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3889 }; | |
3890 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9() | |
3891 { | |
3892 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3893 s. | |
3894 i; | |
3895 s-> | |
3896 i0; | |
3897 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9 s1W9; | |
3898 s1W9-> | |
3899 i0; | |
3900 } | |
3901 #else | |
3902 #endif | |
3903 | |
3904 struct T_COMP_STENCIL:T_TDC_INSTANCE_MSTRUCT_BASE | |
3905 { | |
3906 /*void copy_instance (const T_TDC_INSTANCE_BASE * value_) | |
3907 { | |
3908 TDC_INTERNAL_ERROR(); | |
3909 }*/ | |
3910 M_TDC_INSTANCE_MSTRUCT_ADDITIONAL (COMP_STENCIL,COMP_STENCIL) | |
3911 }; | |
3912 struct T_TDC_INTERFACE_COMP_STENCIL:T_TDC_INTERFACE_MSTRUCT_BASE | |
3913 { | |
3914 M_TDC_INTERFACE_MSTRUCT_ADDITIONAL (COMP_STENCIL,COMP_STENCIL) | |
3915 }; | |
3916 | |
3917 #if TDC_DEBUG_DOT_COMPLETE | |
3918 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9A9 | |
3919 { | |
3920 int i1W9A9; | |
3921 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3922 }; | |
3923 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9A9() | |
3924 { | |
3925 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3926 s. | |
3927 i; | |
3928 s-> | |
3929 i0; | |
3930 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9A9 s1W9A9; | |
3931 s1W9A9-> | |
3932 i0; | |
3933 } | |
3934 #else | |
3935 #endif | |
3936 | |
3937 #ifndef TDC_DOT_COMPLETE_SOURCE_INSIGHT | |
3938 /** | |
3939 allocation call tree: | |
3940 function defined in | |
3941 T_PRIMITIVE_UNION() tdc_base.h | |
3942 T_PRIMITIVE_UNION | |
3943 M_TDC_INSTANCE_ADDITIONAL_BASE | |
3944 construct_handle(new_T_TDC_HANDLE_PRIMITIVE_UNION) tdc.cpp | |
3945 T_TDC_INSTANCE_BASE | |
3946 new_T_TDC_HANDLE_PRIMITIVE_UNION ??? global | |
3947 ??? | |
3948 implement_new_handle () tdc_lib_main_dsc.cpp virtual in T_TDC_HANDLE_PRIMITIVE_UNION | |
3949 M_TDC_POST_COMP | |
3950 M_TDC_POST_DESCRIPTOR_COMP | |
3951 M_TDC_HANDLE_ADDITIONAL | |
3952 new T_TDC_HANDLE_PRIMITIVE_UNION() not explicit declared | |
3953 T_TDC_HANDLE_BASE () tdc_dsc.cpp | |
3954 implement_set_action(TDC_ACTION_DEFAULT) tdc_dsc.cpp | |
3955 | |
3956 T_PRIMITIVE_UNION | |
3957 | |
3958 make_descriptor() tdc.cpp | |
3959 implement_new_descriptor () tdc.cpp | |
3960 new T_TDC_DESCRIPTOR_PRIMITIVE_UNION tdc_lib_main_dsc.cpp | |
3961 M_TDC_POST_COMP | |
3962 M_TDC_POST_DESCRIPTOR_COMP | |
3963 | |
3964 | |
3965 */ | |
3966 #if TDC_DEBUG_DOT_COMPLETE | |
3967 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B | |
3968 { | |
3969 int i1W9B; | |
3970 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
3971 }; | |
3972 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B() | |
3973 { | |
3974 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
3975 s. | |
3976 i; | |
3977 s-> | |
3978 i0; | |
3979 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B s1W9B; | |
3980 s1W9B-> | |
3981 i0; | |
3982 } | |
3983 #else | |
3984 #endif | |
3985 | |
3986 struct T_PRIMITIVE_UNION | |
3987 TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_PRIMITIVE_UNION_BASE) | |
3988 { | |
3989 TDC_DOT_COMPLETE_HIDE(M_TDC_INSTANCE_PRIMITIVE_ADDITIONAL ()) | |
3990 T_TDC_INTERFACE_PRIMITIVE_UNION* operator-> (); | |
3991 }; | |
3992 | |
3993 struct T_MESSAGE_UNION:T_TDC_INSTANCE_MESSAGE_UNION_BASE | |
3994 { | |
3995 TDC_DOT_COMPLETE_HIDE(M_TDC_INSTANCE_MESSAGE_ADDITIONAL ()) | |
3996 T_TDC_INTERFACE_MESSAGE_UNION* operator-> (); | |
3997 }; | |
3998 | |
3999 #if TDC_DEBUG_DOT_COMPLETE | |
4000 struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B | |
4001 { | |
4002 int i1W9B; | |
4003 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} | |
4004 }; | |
4005 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B() | |
4006 { | |
4007 T_PRIMITIVE_UNION primitive_union; | |
4008 primitive_union-> XX_TDC_1; | |
4009 } | |
4010 #else | |
4011 #endif | |
4012 | |
4013 #else | |
4014 typedef T_TDC_INTERFACE_PRIMITIVE_UNION* T_PRIMITIVE_UNION; | |
4015 typedef T_TDC_INTERFACE_MESSAGE_UNION* T_MESSAGE_UNION; | |
4016 #endif | |
4017 | |
4018 //---------------------------------------------------------------------------- | |
4019 | |
4020 //#if TDC_DOT_COMPLETE | |
4021 //#else | |
4022 template<> struct T_ARRAY<U8>:T_TDC_INSTANCE_BASIC_ARRAY<T_U8, U8> | |
4023 { | |
4024 M_TDC_BASIC_ARRAY(U8) | |
4025 }; | |
4026 | |
4027 template<> struct T_ARRAY<S8>:T_TDC_INSTANCE_BASIC_ARRAY<T_S8, S8> | |
4028 { | |
4029 M_TDC_BASIC_ARRAY(S8) | |
4030 }; | |
4031 | |
4032 template<> struct T_ARRAY<U16>:T_TDC_INSTANCE_BASIC_ARRAY<T_U16, U16> | |
4033 { | |
4034 M_TDC_BASIC_ARRAY(U16) | |
4035 }; | |
4036 | |
4037 template<> struct T_ARRAY<S16>:T_TDC_INSTANCE_BASIC_ARRAY<T_S16, S16> | |
4038 { | |
4039 M_TDC_BASIC_ARRAY(S16) | |
4040 }; | |
4041 | |
4042 template<> struct T_ARRAY<U32>:T_TDC_INSTANCE_BASIC_ARRAY<T_U32, U32> | |
4043 { | |
4044 M_TDC_BASIC_ARRAY(U32) | |
4045 }; | |
4046 | |
4047 template<> struct T_ARRAY<S32>:T_TDC_INSTANCE_BASIC_ARRAY<T_S32, S32> | |
4048 { | |
4049 M_TDC_BASIC_ARRAY(S32) | |
4050 }; | |
4051 //#endif | |
4052 | |
4053 #endif //!defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE | |
4054 | |
4055 //\} | |
4056 | |
4057 //============================================================================ | |
4058 // types used by dynamic part | |
4059 //============================================================================ | |
4060 | |
4061 struct T_TDC_AWAIT_CONTEXT; | |
4062 struct T_TDC_SEND_CONTEXT; | |
4063 struct T_TDC_AWAIT; | |
4064 | |
4065 #ifdef DOT_COMPLETE | |
4066 struct T_ON{}; | |
4067 #endif | |
4068 | |
4069 //============================================================================ | |
4070 | |
4071 enum T_TDC_JMPRET | |
4072 { | |
4073 TDC_JMPRET_SETJMP = 0, //setjmp is hard coded to return 0 | |
4074 TDC_JMPRET_INITIAL = 1, | |
4075 TDC_JMPRET_FAIL = 2, | |
4076 TDC_JMPRET_PASS = 3, | |
4077 TDC_JMPRET_BAD_BREAK = 4, | |
4078 TDC_JMPRET_CASE_PASS = 5, | |
4079 TDC_JMPRET_STEP_PASS = 6, | |
4080 TDC_JMPRET_ON_PASS = 7, | |
4081 TDC_JMPRET_ON_TEST = 8, | |
4082 TDC_JMPRET_ALT_ENTER = 9, | |
4083 TDC_JMPRET_OTHERWISE_PASS = 10, | |
4084 TDC_JMPRET_OTHERWISE_PARK = 11, | |
4085 TDC_JMPRET_TRAP_PASS = 12, | |
4086 TDC_JMPRET_POPED = 13, | |
4087 TDC_JMPRET_USER_ERROR = 14, | |
4088 TDC_JMPRET_INTERNAL_ERROR = 15, | |
4089 TDC_JMPRET_TAP_EXCLUDED = 16 | |
4090 }; | |
4091 | |
4092 enum T_TDC_CONTEXT | |
4093 { | |
4094 TDC_CONTEXT_UNKNOWN, | |
4095 TDC_CONTEXT_FUNCTION, | |
4096 TDC_CONTEXT_CASE, | |
4097 TDC_CONTEXT_STEP, | |
4098 TDC_CONTEXT_ALT, | |
4099 TDC_CONTEXT_ON, | |
4100 TDC_CONTEXT_OTHERWISE, | |
4101 TDC_CONTEXT_TRAP | |
4102 }; | |
4103 | |
4104 struct T_TDC_DYNAMIC_CONTEXT_DATA | |
4105 { | |
4106 T_TDC_DYNAMIC_CONTEXT_DATA* parent; | |
4107 jmp_buf mark; | |
4108 T_TDC_DYNAMIC_CONTEXT_DATA* prev; | |
4109 T_TDC_JMPRET jmpret; | |
4110 char* file; | |
4111 int line; | |
4112 int event; | |
4113 bool testing; | |
4114 char *text; | |
4115 int destroy_on_fail_handles_count; | |
4116 T_TDC_CONTEXT context; | |
4117 T_TDC_HANDLE_BASE** destroy_on_fail_handles; | |
4118 void add_destroy_on_fail (T_TDC_HANDLE_BASE* handle); | |
4119 void remove_destroy_on_fail (T_TDC_HANDLE_BASE* handle); | |
4120 T_TDC_DYNAMIC_CONTEXT_DATA* pop (); | |
4121 T_TDC_DYNAMIC_CONTEXT_DATA (T_TDC_CONTEXT | |
4122 context_, T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_, char* text_); | |
4123 ~T_TDC_DYNAMIC_CONTEXT_DATA(); | |
4124 void jmp(T_TDC_JMPRET jmpret_); | |
4125 }; | |
4126 | |
4127 struct T_TDC_CONTEXT_BASE | |
4128 { | |
4129 }; | |
4130 | |
4131 struct T_TDC_FUNCTION_CONTEXT:T_TDC_CONTEXT_BASE //the name of this type is contructed to give more info from error message | |
4132 { | |
4133 /* | |
4134 Got this error? | |
4135 error C2039: 'tdc_alt_context' : is not a member of 'T_TDC_FUNCTION_CONTEXT' | |
4136 you are violating the following rules: | |
4137 | |
4138 "ON(...)...;" and "OTHERWISE()...;" must be inside an "ALT{...}" | |
4139 | |
4140 TODO: test above statement | |
4141 */ | |
4142 T_TDC_DYNAMIC_CONTEXT_DATA tdc_function_context; //this member name is contructed to give more info from error message | |
4143 T_TDC_FUNCTION_CONTEXT (char* file_, int line_); | |
4144 }; | |
4145 | |
4146 struct T_TDC_USER_ERROR_CASE_BASE | |
4147 { | |
4148 // for testing TDC only | |
4149 unsigned int failed; | |
4150 }; | |
4151 | |
4152 struct T_TDC_CASE | |
4153 { | |
4154 /** \struct T_TDC_CASE | |
4155 this type can not have constructor or member functions as it virolate 'extern "C"' in T_CASE macro | |
4156 | |
4157 this type should only contain one member so that if returned from a function with '__declspec(dllexport)' | |
4158 it will be returned in the same way as if such a function returned int, returning an int is what tap2.exe | |
4159 expect | |
4160 | |
4161 from an internal tdc point of view there is no difference between a function of type T_CASE and one of | |
4162 type T_TDC_CASE, this is used in some tdc_test test cases | |
4163 | |
4164 founctions of type T_CASE (T_TDC_CASE) should not have explicit returns instead they should contain | |
4165 a BEGIN_CASE(...) which will make an implicit return (return is hidden inside macro); | |
4166 */ | |
4167 unsigned int passed; | |
4168 }; | |
4169 | |
4170 struct T_TDC_CASE_CONTEXT:T_TDC_CONTEXT_BASE | |
4171 { | |
4172 T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; | |
4173 T_TDC_CASE_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_, char* text_); | |
4174 void tdc_end_for (); | |
4175 bool tdc_do_return (); | |
4176 void prepare_exit (int exit_code, char *message); | |
4177 T_TDC_CASE tdc_return_value (); | |
4178 T_TDC_USER_ERROR_CASE_BASE tdc_user_error_return_value (); | |
4179 }; | |
4180 | |
4181 struct T_TDC_only_one__BEGIN_CASE__allowed_per_function:T_TDC_CONTEXT_BASE | |
4182 { | |
4183 /* TODO: wrong text type name should say it all | |
4184 Got this error? | |
4185 error C2039: 'tdc_alt_context' : is not a member of 'T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT' | |
4186 | |
4187 you are violating one of the following rules: | |
4188 A) | |
4189 "ON(...)...;" cannot follow "OTHERWISE()...;" | |
4190 | |
4191 B) | |
4192 "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" | |
4193 e.g. ALT{... ON(AWAIT(...))...; ...} | |
4194 C) | |
4195 "FAIL()", "PASS()", "SEND(...)" are not allowed inside "ALT{...}" they must be | |
4196 inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" | |
4197 | |
4198 remember to use curly parantheses "{...}" when the body contain more than one command | |
4199 */ | |
4200 T_TDC_DYNAMIC_CONTEXT_DATA* parent; | |
4201 T_TDC_only_one__BEGIN_CASE__allowed_per_function (T_TDC_DYNAMIC_CONTEXT_DATA& parent_); | |
4202 }; | |
4203 | |
4204 /// return of a step | |
4205 struct T_STEP | |
4206 { | |
4207 T_STEP () | |
4208 { | |
4209 //nothing | |
4210 } | |
4211 }; | |
4212 | |
4213 struct T_TDC_STEP_CONTEXT:T_TDC_CONTEXT_BASE | |
4214 { | |
4215 T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; | |
4216 T_TDC_STEP_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_, char* text_); | |
4217 void tdc_end_for (); | |
4218 bool tdc_do_return (); | |
4219 T_STEP tdc_return_value (); | |
4220 }; | |
4221 | |
4222 struct T_TDC_only_one__BEGIN_STEP__allowed_per_function:T_TDC_CONTEXT_BASE | |
4223 { | |
4224 /* TODO: wrong text type name should say it all | |
4225 Got this error? | |
4226 error C2039: 'tdc_alt_context' : is not a member of 'T_TDC_only_one__BEGIN_STEP__allowed_per_function' | |
4227 | |
4228 you are violating one of the following rules: | |
4229 A) | |
4230 "ON(...)...;" cannot follow "OTHERWISE()...;" | |
4231 | |
4232 B) | |
4233 "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" | |
4234 e.g. ALT{... ON(AWAIT(...))...; ...} | |
4235 C) | |
4236 "FAIL()", "PASS()", "SEND(...)" are not allowed inside "ALT{...}" they must be | |
4237 inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" | |
4238 | |
4239 remember to use curly parantheses "{...}" when the body contain more than one command | |
4240 */ | |
4241 T_TDC_DYNAMIC_CONTEXT_DATA* parent; | |
4242 T_TDC_only_one__BEGIN_STEP__allowed_per_function (T_TDC_DYNAMIC_CONTEXT_DATA& parent_); | |
4243 }; | |
4244 | |
4245 struct T_TDC_ALT_CONTEXT:T_TDC_CONTEXT_BASE | |
4246 { | |
4247 /* | |
4248 Got this error? | |
4249 error C2039: 'tdc_not_alt_context' : is not a member of 'T_TDC_ALT_CONTEXT' | |
4250 | |
4251 you are violating one of the following rules: | |
4252 A) | |
4253 "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" | |
4254 e.g. ALT{... ON(AWAIT(...))...; ...} | |
4255 B) | |
4256 "FAIL()", "PASS()", "SEND(...)", "ALT{...}" are not allowed inside "ALT{...}" they must be | |
4257 inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" | |
4258 | |
4259 remember to use curly parantheses "{...}" when the body contain more than one command | |
4260 */ | |
4261 T_TDC_DYNAMIC_CONTEXT_DATA tdc_alt_context; | |
4262 T_TDC_ALT_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_, char* file_, int line_); | |
4263 void tdc_end_for(); | |
4264 bool tdc_enter_for(); | |
4265 }; | |
4266 | |
4267 struct T_TDC_ON_CONTEXT:T_TDC_CONTEXT_BASE | |
4268 { | |
4269 T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; | |
4270 T_TDC_ON_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_, char* file_, int line_, char* text_); | |
4271 void tdc_end_for (); | |
4272 bool tdc_enter_for(); | |
4273 bool tdc_on_expects_await(T_TDC_AWAIT& await_); | |
4274 }; | |
4275 | |
4276 struct T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT:T_TDC_CONTEXT_BASE | |
4277 { | |
4278 /* | |
4279 Got this error? | |
4280 error C2039: 'tdc_alt_context' : is not a member of 'T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT' | |
4281 | |
4282 you are violating one of the following rules: | |
4283 A) | |
4284 "ON(...)...;" cannot follow "OTHERWISE()...;" | |
4285 | |
4286 B) | |
4287 "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" | |
4288 e.g. ALT{... ON(AWAIT(...))...; ...} | |
4289 C) | |
4290 "FAIL()", "PASS()", "SEND(...)" are not allowed inside "ALT{...}" they must be | |
4291 inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" | |
4292 | |
4293 remember to use curly parantheses "{...}" when the body contain more than one command | |
4294 */ | |
4295 T_TDC_DYNAMIC_CONTEXT_DATA* parent; | |
4296 T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_); | |
4297 }; | |
4298 | |
4299 struct T_TDC_OTHERWISE_CONTEXT:T_TDC_CONTEXT_BASE | |
4300 { | |
4301 T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; | |
4302 T_TDC_OTHERWISE_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_); | |
4303 void tdc_end_for (); | |
4304 bool tdc_enter_for (); | |
4305 }; | |
4306 | |
4307 struct T_TDC_TRAP_CONTEXT:T_TDC_CONTEXT_BASE | |
4308 { | |
4309 T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; | |
4310 T_TDC_TRAP_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_, char* file_, int line_); | |
4311 void tdc_end_for (); | |
4312 bool tdc_trap_testing (); | |
4313 bool tdc_initial (); | |
4314 bool tdc_enter_for (); | |
4315 }; | |
4316 | |
4317 struct T_TDC_EVENT_CONTEXT:T_TDC_CONTEXT_BASE | |
4318 { | |
4319 T_TDC_EVENT_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* text_, char* primitive_); | |
4320 T_TDC_EVENT_CONTEXT (); | |
4321 }; | |
4322 | |
4323 //============================================================================ | |
4324 | |
4325 #ifdef TDC_PORT | |
4326 struct T_PORT | |
4327 { | |
4328 T_PORT operator +(T_PORT& port); // be aware: ("x->y","z") + ("a->b","c") != ("x;a->y;b","z;c") | |
4329 #if DOT_COMPLETE | |
4330 T_ON AWAIT (T_PRIMITIVE_UNION primitive){} | |
4331 void SEND (T_PRIMITIVE_UNION primitive){} | |
4332 #else//DOT_COMPLETE | |
4333 char* src_list; | |
4334 char* dst_list; | |
4335 char* sap_list; | |
4336 bool is_send_port; // -> or <-> was specified | |
4337 bool is_await_port;// <- or <-> was specified | |
4338 T_PORT* next; // used when 2 or more ports have been linked together with operator + | |
4339 void construct(char* src_and_dst_list, char* sap_list_); | |
4340 T_PORT (char* src_and_dst_list, char* sap_list_); | |
4341 T_PORT (char* src_and_dst_list); | |
4342 T_PORT (T_PORT& port,T_PORT* port2=0); | |
4343 ~T_PORT (); | |
4344 T_TDC_AWAIT_CONTEXT tdc_await_context(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4345 T_TDC_SEND_CONTEXT tdc_send_context(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4346 #endif//DOT_COMPLETE | |
4347 }; | |
4348 | |
4349 extern T_PORT DEFAULT_PORT; | |
4350 #endif | |
4351 | |
4352 //============================================================================ | |
4353 /// \defgroup AWAIT | |
4354 //\{ | |
4355 | |
4356 /// Special values that can be awaited for the sake of testing TDC | |
4357 enum T_TDC_AWAIT_TESTING { | |
4358 TDC_AWAIT_FAIL, /// Hardcode AWAIT to fail | |
4359 TDC_AWAIT_PASS, /// Hardcode AWAIT to pass | |
4360 TDC_AWAIT_FORCE_PASS, | |
4361 }; | |
4362 | |
4363 #if DOT_COMPLETE | |
4364 int TDC_AWAIT_FAIL; | |
4365 int TDC_AWAIT_PASS; | |
4366 int TDC_AWAIT_FORCE_PASS; | |
4367 #endif | |
4368 | |
4369 ///What an AWAIT returns | |
4370 struct T_TDC_AWAIT | |
4371 { | |
4372 T_TDC_AWAIT(); | |
4373 private: | |
4374 template<class T> T_TDC_AWAIT operator, (T) | |
4375 { | |
4376 tdc_user_error ("AWAIT can not be part of a comma expression"); // should be courth compiletime as this function is private | |
4377 return T_TDC_AWAIT (); | |
4378 } | |
4379 }; | |
4380 | |
4381 struct T_TDC_AWAIT_CONTEXT:T_TDC_EVENT_CONTEXT | |
4382 { | |
4383 friend T_TDC_AWAIT_CONTEXT tdc_await_context (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4384 #ifdef TDC_PORT | |
4385 T_TDC_AWAIT_CONTEXT (T_PORT* port_, T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4386 #else | |
4387 T_TDC_AWAIT_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4388 #endif | |
4389 ~T_TDC_AWAIT_CONTEXT (); | |
4390 T_TDC_AWAIT tdc_implement_await (T_TDC_AWAIT_TESTING pass_or_fail); | |
4391 T_TDC_AWAIT tdc_implement_await (const T_TDC_INSTANCE_PRIMITIVE_BASE& primitive); | |
4392 template<class T> T_TDC_AWAIT tdc_implement_await (T (*f) ()) | |
4393 { | |
4394 T primitive = f (); | |
4395 return tdc_implement_await (primitive); | |
4396 } | |
4397 template<class T> T_TDC_AWAIT tdc_implement_await (void (*f) (T)) | |
4398 { | |
4399 T primitive; | |
4400 f (primitive); | |
4401 return tdc_implement_await (primitive); | |
4402 } | |
4403 }; | |
4404 | |
4405 //\} | |
4406 | |
4407 //---------------------------------------------------------------------------- | |
4408 /// \defgroup SEND | |
4409 //\{ | |
4410 | |
4411 struct T_TDC_SEND_CONTEXT | |
4412 :T_TDC_EVENT_CONTEXT | |
4413 { | |
4414 friend T_TDC_SEND_CONTEXT tdc_send_context (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4415 #ifdef TDC_PORT | |
4416 T_TDC_SEND_CONTEXT (T_PORT* port_, T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4417 #else | |
4418 T_TDC_SEND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); | |
4419 #endif | |
4420 ~T_TDC_SEND_CONTEXT (); | |
4421 void tdc_implement_send (T_TDC_AWAIT_TESTING pass_or_fail); | |
4422 void tdc_implement_send (const T_TDC_INSTANCE_PRIMITIVE_BASE& primitive); | |
4423 template<class T>void tdc_implement_send (T (*f) ()) | |
4424 { | |
4425 T primitive = f (); | |
4426 return tdc_implement_send (primitive); | |
4427 } | |
4428 template<class T>void tdc_implement_send (void (*f) (T)) | |
4429 { | |
4430 T primitive; | |
4431 f (primitive); | |
4432 return tdc_implement_send (primitive); | |
4433 } | |
4434 }; | |
4435 | |
4436 //\} | |
4437 | |
4438 //---------------------------------------------------------------------------- | |
4439 /// \defgroup COMMAND COMMAND | |
4440 //\{ | |
4441 | |
4442 ///What a COMMAND returns | |
4443 struct T_TDC_COMMAND | |
4444 { | |
4445 T_TDC_COMMAND (); | |
4446 private: | |
4447 ///Hides ',' operator for COMMANDS | |
4448 template<class T> | |
4449 T_TDC_COMMAND operator, (T) | |
4450 { | |
4451 tdc_user_error ("COMMAND can not be part of comma expression"); // should be courth compiletime as this function is private | |
4452 return T_TDC_COMMAND(); | |
4453 } | |
4454 }; | |
4455 | |
4456 struct T_TDC_COMMAND_CONTEXT:T_TDC_EVENT_CONTEXT | |
4457 { | |
4458 T_TDC_COMMAND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* text_); | |
4459 T_TDC_COMMAND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* text_, char* command_); | |
4460 T_TDC_COMMAND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* text_, char* value_text_, long value_); | |
4461 T_TDC_COMMAND operator || (T_TDC_COMMAND& command_); | |
4462 }; | |
4463 | |
4464 //\} | |
4465 | |
4466 /// \defgroup PARKING PARKING Command | |
4467 //\{ | |
4468 | |
4469 enum T_TDC_PARKING_ENUM /// Values should be indentical to those defined in tap_int.h | |
4470 { | |
4471 DISABLE = 0, | |
4472 SHORT_TERM = 1, | |
4473 LONG_TERM = 2, | |
4474 SHORT_TERM_FAIL = 3, | |
4475 LONG_TERM_FAIL = 4 | |
4476 }; | |
4477 | |
4478 struct T_TDC_PARKING_CONTEXT:private T_TDC_COMMAND_CONTEXT | |
4479 { | |
4480 T_TDC_PARKING_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* value_text_, T_TDC_PARKING_ENUM value_); | |
4481 T_TDC_PARKING_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* value_text_, bool value_); | |
4482 T_TDC_PARKING_ENUM operator || (T_TDC_PARKING_ENUM value_); | |
4483 }; | |
4484 | |
4485 //\} | |
4486 | |
4487 //============================================================================ | |
4488 | |
4489 extern T_TDC_FUNCTION_CONTEXT tdc_syntax_context; | |
4490 | |
4491 extern T_TDC_DYNAMIC_CONTEXT_DATA* tdc_dynamic_context; | |
4492 | |
4493 //---------------------------------------------------------------------------- | |
4494 | |
4495 extern void tdc_implement_fail(T_TDC_JMPRET jmpret); | |
4496 | |
4497 extern void tdc_implement_user_fail(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_); | |
4498 | |
4499 extern void tdc_implement_pass(); | |
4500 | |
4501 extern void tdc_implement_user_pass(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_); | |
4502 | |
4503 //---------------------------------------------------------------------------- | |
4504 | |
4505 extern T_TDC_COMMAND tdc_implement_command (const char* text); | |
4506 | |
4507 extern T_TDC_COMMAND tdc_implement_timeout (int time); | |
4508 | |
4509 extern T_TDC_COMMAND tdc_implement_mute (int time); | |
4510 | |
4511 extern T_TDC_COMMAND tdc_implement_start_timeout (int time); | |
4512 | |
4513 extern T_TDC_COMMAND tdc_implement_wait_timeout (); | |
4514 | |
4515 extern T_TDC_PARKING_ENUM tdc_implement_parking (T_TDC_PARKING_ENUM enabled); | |
4516 extern T_TDC_PARKING_ENUM tdc_implement_parking (bool enabled); | |
4517 | |
4518 //============================================================================ | |
4519 | |
4520 #endif //TDC_TESTING | |
4521 | |
4522 //============================================================================ | |
4523 /// \defgroup TryCatchProtection | |
4524 //\{ | |
4525 | |
4526 /** | |
4527 map try, catch and throw to our version that prevent the user from using them | |
4528 by having both a plain and a "tdc_implement_..." version it is faily simple | |
4529 temporary to disable the mapping through #undef when need be | |
4530 this is some thing that the user should never do, but tdc have to, so the debugger | |
4531 see our longjmps as exceptions | |
4532 | |
4533 //TODO: do this stuff debugger see longjumps as exceptions | |
4534 */ | |
4535 | |
4536 /// try, catch and throw conflicts with longjmp in vc6, use TRAP | |
4537 #define try tdc_implement_try | |
4538 /// try, catch and throw conflicts with longjmp in vc6, use ELSE | |
4539 #define catch(exception) tdc_implement_catch(exception) | |
4540 /// try, catch and throw conflicts with longjmp in vc6, use FAIL or PASS | |
4541 #define throw tdc_implement_throw | |
4542 | |
4543 /// try, catch and throw conflicts with longjmp in vc6, use TRAP | |
4544 #define tdc_implement_try while(tdc_try_disabled) | |
4545 /// try, catch and throw conflicts with longjmp in vc6, use ELSE | |
4546 #define tdc_implement_catch(exception) while(tdc_catch_disabled) | |
4547 /// try, catch and throw conflicts with longjmp in vc6, use FAIL or PASS | |
4548 #define tdc_implement_throw while(tdc_throw_disabled)throw | |
4549 | |
4550 //\} | |
4551 //---------------------------------------------------------------------------- | |
4552 | |
4553 #if DOT_COMPLETE //DOT_COMPLETE_PROTOTYPES | |
4554 #ifndef M_TDC_DOC //we don't want theses to occour twice in the call graph | |
4555 | |
4556 // dummy functions to generate hint in dot-complete (e.g. when pressing <ctrl-shift-space> ) | |
4557 // remember that functions must have a body to be considered for dot-completion by Visual Studio | |
4558 | |
4559 void FAIL (void){} | |
4560 | |
4561 void PASS (void){} | |
4562 | |
4563 void SEND (T_PRIMITIVE_UNION primitive){} | |
4564 | |
4565 T_ON AWAIT (T_PRIMITIVE_UNION primitive){} | |
4566 | |
4567 void COMMAND (char* command_string){} | |
4568 | |
4569 void TIMEOUT (int timeout){} | |
4570 | |
4571 void START_TIMEOUT (int timeout){} | |
4572 | |
4573 void WAIT_TIMEOUT (){} | |
4574 | |
4575 void MUTE (int timeout){} | |
4576 | |
4577 T_TDC_PARKING_ENUM PARKING (T_TDC_PARKING_ENUM enable){} | |
4578 | |
4579 T_similar_syntax_as_while_statement BEGIN_CASE (char* trace_comment){} | |
4580 | |
4581 T_similar_syntax_as_while_statement BEGIN_STEP (char* trace_comment){} | |
4582 | |
4583 T_similar_syntax_as_while_statement ON (T_AWAIT){} | |
4584 | |
4585 T_similar_syntax_as_while_statement OTHERWISE (){} | |
4586 | |
4587 #endif//M_TDC_DOC | |
4588 #else//DOT_COMPLETE_PROTOTYPES | |
4589 | |
4590 // real implementation | |
4591 | |
4592 /* | |
4593 special constructions used in these macros: | |
4594 | |
4595 ensure that only a ; is allowed after this macro | |
4596 do {...} while(0) | |
4597 | |
4598 make variable declared in for(...) private to the statements ({...} or ...;) after this macro | |
4599 if(0);else | |
4600 | |
4601 make implicit return at exit of loop (x might be replace by more code in the actual macros) | |
4602 for (int x=0;;x=1) if (x) return ...; else | |
4603 */ | |
4604 | |
4605 #define FAIL() do {tdc_implement_user_fail (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__); } while (0) | |
4606 | |
4607 #define PASS() do {tdc_implement_user_pass (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__); } while (0) | |
4608 | |
4609 #define SEND(primitive) tdc_send_context(tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #primitive).tdc_implement_send(T_PRIMITIVE_UNION(primitive)) | |
4610 | |
4611 #define AWAIT(primitive) tdc_await_context(tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #primitive).tdc_implement_await(T_PRIMITIVE_UNION(primitive)) | |
4612 | |
4613 #define START_TIMEOUT(timeout) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, "START_TIMEOUT", #timeout, timeout) || tdc_implement_start_timeout(timeout)) | |
4614 | |
4615 #ifdef WAIT_TIMEOUT | |
4616 #undef WAIT_TIMEOUT /* To avoid class with defined macro in winbase.h */ | |
4617 #endif | |
4618 #define WAIT_TIMEOUT() (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, "WAIT_TIMEOUT") || tdc_implement_wait_timeout()) | |
4619 | |
4620 #define MUTE(timeout) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, "MUTE", #timeout, timeout) || tdc_implement_mute(timeout)) | |
4621 | |
4622 #define COMMAND(command) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #command) || tdc_implement_command(command)) | |
4623 | |
4624 #define TIMEOUT(timeout) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #timeout) || tdc_implement_timeout(timeout)) | |
4625 | |
4626 #define PARKING(enable) (T_TDC_PARKING_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #enable, enable) || tdc_implement_parking(enable)) | |
4627 | |
4628 // some short cuts where user forgot '()' after '_skip' etc. | |
4629 | |
4630 #define _skip tdc_skip() | |
4631 #define _show tdc_show() | |
4632 #define _forbid tdc_forbid() | |
4633 #define _require tdc_require() | |
4634 #define _skip_to_end tdc_skip_to_end() | |
4635 | |
4636 #define _SKIP tdc_skip() | |
4637 #define _SHOW tdc_show() | |
4638 #define _FORBID tdc_forbid() | |
4639 #define _REQUIRE tdc_require() | |
4640 #define _SKIP_TO_END tdc_skip_to_end() | |
4641 | |
4642 #endif//DOT_COMPLETE_PROTOTYPES | |
4643 | |
4644 #define M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE true | |
4645 | |
4646 /** \defgroup BEGIN_CASE BEGIN_CASE(){} | |
4647 Usage: | |
4648 <pre> | |
4649 T_CASE casename () | |
4650 { | |
4651 BEGIN_CASE ("trace_comment") | |
4652 { | |
4653 ... | |
4654 } | |
4655 } | |
4656 </pre> | |
4657 */ | |
4658 //\{ | |
4659 | |
4660 /// return type for a test CASE | |
4661 #define T_CASE \ | |
4662 extern "C" __declspec(dllexport) T_TDC_CASE | |
4663 | |
4664 /** \def T_TDC_USER_ERROR_CASE | |
4665 Test cases defined with T_TDC_USER_ERROR_CASE | |
4666 are cases that passes when they fail and fails when they passes, | |
4667 this is only intended for testing TDC it self. | |
4668 T_TDC_USER_ERROR_CASE will not reverse the result of a syntax error. | |
4669 | |
4670 <pre> | |
4671 Usage: | |
4672 T_TDC_USER_ERROR_CASE casename () | |
4673 { | |
4674 TDC_BEGIN_USER_ERROR_CASE ("trace_comment") | |
4675 { | |
4676 ... | |
4677 } | |
4678 } | |
4679 </pre> | |
4680 */ | |
4681 | |
4682 /// return type for a test USER ERROR CASE | |
4683 #define T_TDC_USER_ERROR_CASE\ | |
4684 extern "C" __declspec(dllexport) T_TDC_USER_ERROR_CASE_BASE | |
4685 | |
4686 /// stuff common to BEGIN_CASE and TDC_BEGIN_USER_ERROR_CASE | |
4687 #define M_TDC_BEGIN_CASE_BASE(trace_comment,return_value)\ | |
4688 T_TDC_only_one__BEGIN_CASE__allowed_per_function tdc_begin_case (tdc_syntax_context.tdc_function_context);\ | |
4689 if(0);else/*hide tdc_syntax_context after for body*/\ | |
4690 for (T_TDC_CASE_CONTEXT tdc_context (tdc_begin_case.parent,__FILE__,__LINE__,trace_comment),\ | |
4691 &tdc_syntax_context = ((tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark))),tdc_context);\ | |
4692 M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE;\ | |
4693 tdc_context.tdc_end_for ())\ | |
4694 if (tdc_context.tdc_do_return ())\ | |
4695 return tdc_context.return_value ();\ | |
4696 else | |
4697 | |
4698 /// BEGIN_CASE should be the outermost scope in a CASE | |
4699 #define BEGIN_CASE(trace_comment)\ | |
4700 M_TDC_BEGIN_CASE_BASE(trace_comment,tdc_return_value) | |
4701 | |
4702 /// TDC_BEGIN_USER_ERROR_CASE a BEGIN_CASE for T_TDC_USER_ERROR_CASE | |
4703 #define TDC_BEGIN_USER_ERROR_CASE(trace_comment)\ | |
4704 M_TDC_BEGIN_CASE_BASE(trace_comment,tdc_user_error_return_value) | |
4705 | |
4706 //\} | |
4707 | |
4708 /** \defgroup BEGIN_STEP BEGIN_STEP(){} | |
4709 <pre> | |
4710 Usage: | |
4711 T_STEP stepname (...) | |
4712 { | |
4713 BEGIN_STEP ("trace_comment") | |
4714 { | |
4715 ... | |
4716 } | |
4717 } | |
4718 </pre> | |
4719 */ | |
4720 //\{ | |
4721 | |
4722 //TODO: move functionality from tdc_context to tdc_begin_step and delete tdc_context | |
4723 #define BEGIN_STEP(trace_comment)\ | |
4724 T_TDC_only_one__BEGIN_STEP__allowed_per_function tdc_begin_step (tdc_syntax_context.tdc_function_context), &tdc_syntax_context = tdc_begin_step;\ | |
4725 if (0); else\ | |
4726 for (T_TDC_STEP_CONTEXT tdc_context (tdc_begin_step.parent,__FILE__,__LINE__,trace_comment),\ | |
4727 &tdc_syntax_context = ((tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark))),tdc_context);\ | |
4728 M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE;\ | |
4729 tdc_context.tdc_end_for ())\ | |
4730 if (tdc_context.tdc_do_return ())\ | |
4731 return tdc_context.tdc_return_value ();\ | |
4732 else | |
4733 | |
4734 //\} | |
4735 | |
4736 /** \defgroup TRAP_ONFAIL TRAP{} & ONFAIL{} | |
4737 <pre> | |
4738 Usage: | |
4739 TRAP | |
4740 { | |
4741 ... | |
4742 FAIL(); | |
4743 } | |
4744 ONFAIL | |
4745 { | |
4746 ... | |
4747 } | |
4748 </pre> | |
4749 */ | |
4750 //\{ | |
4751 | |
4752 #define TRAP\ | |
4753 if (0); else\ | |
4754 for (T_TDC_TRAP_CONTEXT tdc_context (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__);\ | |
4755 tdc_context.tdc_initial () && \ | |
4756 (tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark)),\ | |
4757 tdc_context.tdc_enter_for ());\ | |
4758 )\ | |
4759 if (tdc_context.tdc_trap_testing ())\ | |
4760 for (T_TDC_TRAP_CONTEXT &tdc_syntax_context = tdc_context; ; tdc_syntax_context.tdc_end_for()) | |
4761 | |
4762 #ifdef M_TDC_DOC | |
4763 #define ONFAIL() //Soure Insight will only draw call gaphs if "()" is present | |
4764 #else | |
4765 #define ONFAIL else // we don't want to do something special here, as we can't ensure warning on a plain else | |
4766 #endif | |
4767 | |
4768 //\} | |
4769 | |
4770 /** \defgroup ALT_ON_OTHERWISE ALT{}, ON() & OTHERWISE() | |
4771 <pre> | |
4772 Usage: | |
4773 ALT | |
4774 { | |
4775 ON (AWAIT (...)) ...; | |
4776 ON (AWAIT (...)) ...; | |
4777 ON (AWAIT (...)) ...; | |
4778 OTHERWISE () ...; | |
4779 } | |
4780 </pre> | |
4781 */ | |
4782 //\{ | |
4783 | |
4784 #define ALT\ | |
4785 if (0); else\ | |
4786 for (T_TDC_ALT_CONTEXT tdc_context (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__), &tdc_syntax_context = tdc_context;\ | |
4787 tdc_context.tdc_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_alt_context.mark)),\ | |
4788 tdc_context.tdc_enter_for ();\ | |
4789 tdc_context.tdc_end_for ()) | |
4790 | |
4791 #define ON(await)\ | |
4792 if (0); else\ | |
4793 for (T_TDC_ON_CONTEXT tdc_context (tdc_syntax_context.tdc_alt_context,__FILE__,__LINE__,#await), &tdc_syntax_context = tdc_context;\ | |
4794 tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark)),\ | |
4795 tdc_context.tdc_enter_for () && tdc_context.tdc_on_expects_await (await);\ | |
4796 tdc_context.tdc_end_for ()) | |
4797 | |
4798 #define OTHERWISE()\ | |
4799 T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT tdc_otherwise (tdc_syntax_context.tdc_alt_context), &tdc_syntax_context = tdc_otherwise;\ | |
4800 if (0); else\ | |
4801 for (T_TDC_OTHERWISE_CONTEXT tdc_syntax_context (tdc_otherwise.parent, __FILE__, __LINE__);\ | |
4802 tdc_syntax_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_syntax_context.tdc_not_alt_context.mark)),\ | |
4803 tdc_syntax_context.tdc_enter_for (), M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE ;\ | |
4804 tdc_syntax_context.tdc_end_for ()) | |
4805 | |
4806 //\} | |
4807 | |
4808 //============================================================================ | |
4809 | |
4810 #if TDC_DEBUG_DOT_COMPLETE | |
4811 void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Z() | |
4812 { | |
4813 T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; | |
4814 s. | |
4815 i; | |
4816 s->i0; | |
4817 T_TDC_INTERFACE_ARRAY<int> i; | |
4818 i. | |
4819 } | |
4820 #else | |
4821 #endif | |
4822 | |
4823 //============================================================================ | |
4824 | |
4825 #endif //TDC_BASE_H | |
4826 | |
4827 |