MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
myapi.hpp
1 /*
2  Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 /*
18  * myapi.hpp
19  */
20 
21 #ifndef _myapi
22 #define _myapi
23 
24 #include <stdio.h> // not using namespaces yet
25 
26 /*
27  * This test uses the C99 exact-width type aliases s int8_t, uint8_t,
28  * ... int64_t, uint64_t as defined in <stdint.h>.
29  *
30  * Unfortunately, some C/C++ compiler still lack a stdint.h header file.
31  * (For instance, MS Visual Studio until VS2010.) We delegate to a helper
32  * file that handles the absence of the <stdint.h> (without introducing
33  * a dependency upon JTie or NDB API).
34  */
35 #include "mystdint.h"
36 
37 #include "helpers.hpp"
38 
39 // ----------------------------------------------------------------------
40 // initializer and finalizer functions
41 // ----------------------------------------------------------------------
42 
43 // initializer avoiding issues with static construction of objects
44 extern void myapi_init();
45 extern void myapi_finit();
46 
47 // ----------------------------------------------------------------------
48 // void result/parameter types
49 // ----------------------------------------------------------------------
50 
51 extern void f0();
52 
53 // ----------------------------------------------------------------------
54 // [const] void/char * [const] result/parameter types
55 // ----------------------------------------------------------------------
56 
57 // non-NULL-returning/accepting functions
58 
59 extern const void * s010();
60 extern const char * s012();
61 extern void * s030();
62 extern char * s032();
63 extern const void * const s050();
64 extern const char * const s052();
65 extern void * const s070();
66 extern char * const s072();
67 
68 extern void s110(const void * p0);
69 extern void s112(const char * p0);
70 extern void s130(void * p0);
71 extern void s132(char * p0);
72 extern void s150(const void * const p0);
73 extern void s152(const char * const p0);
74 extern void s170(void * const p0);
75 extern void s172(char * const p0);
76 
77 // NULL-returning/accepting functions
78 
79 extern const void * s210();
80 extern const char * s212();
81 extern void * s230();
82 extern char * s232();
83 extern const void * const s250();
84 extern const char * const s252();
85 extern void * const s270();
86 extern char * const s272();
87 
88 extern void s310(const void * p0);
89 extern void s312(const char * p0);
90 extern void s330(void * p0);
91 extern void s332(char * p0);
92 extern void s350(const void * const p0);
93 extern void s352(const char * const p0);
94 extern void s370(void * const p0);
95 extern void s372(char * const p0);
96 
97 // ----------------------------------------------------------------------
98 // all primitive result/parameter types
99 // ----------------------------------------------------------------------
100 
101 extern const bool f11(const bool p0);
102 extern const char f12(const char p0);
103 extern const signed char f13(const signed char p0);
104 extern const unsigned char f14(const unsigned char p0);
105 extern const signed short f15(const signed short p0);
106 extern const unsigned short f16(const unsigned short p0);
107 extern const signed int f17(const signed int p0);
108 extern const unsigned int f18(const unsigned int p0);
109 extern const signed long f19(const signed long p0);
110 extern const unsigned long f20(const unsigned long p0);
111 extern const signed long long f21(const signed long long p0);
112 extern const unsigned long long f22(const unsigned long long p0);
113 extern const float f23(const float p0);
114 extern const double f24(const double p0);
115 extern const long double f25(const long double p0);
116 
117 extern bool f31(bool p0);
118 extern char f32(char p0);
119 extern signed char f33(signed char p0);
120 extern unsigned char f34(unsigned char p0);
121 extern signed short f35(signed short p0);
122 extern unsigned short f36(unsigned short p0);
123 extern signed int f37(signed int p0);
124 extern unsigned int f38(unsigned int p0);
125 extern signed long f39(signed long p0);
126 extern unsigned long f40(unsigned long p0);
127 extern signed long long f41(signed long long p0);
128 extern unsigned long long f42(unsigned long long p0);
129 extern float f43(float p0);
130 extern double f44(double p0);
131 extern long double f45(long double p0);
132 
133 // ----------------------------------------------------------------------
134 // all fixed-size primitive result/parameter types
135 // ----------------------------------------------------------------------
136 
137 extern const bool f011();
138 extern const char f012();
139 extern const int8_t f013();
140 extern const uint8_t f014();
141 extern const int16_t f015();
142 extern const uint16_t f016();
143 extern const int32_t f017();
144 extern const uint32_t f018();
145 extern const int64_t f021();
146 extern const uint64_t f022();
147 extern const float f023();
148 extern const double f024();
149 
150 extern bool f031();
151 extern char f032();
152 extern int8_t f033();
153 extern uint8_t f034();
154 extern int16_t f035();
155 extern uint16_t f036();
156 extern int32_t f037();
157 extern uint32_t f038();
158 extern int64_t f041();
159 extern uint64_t f042();
160 extern float f043();
161 extern double f044();
162 
163 extern void f111(const bool);
164 extern void f112(const char);
165 extern void f113(const int8_t);
166 extern void f114(const uint8_t);
167 extern void f115(const int16_t);
168 extern void f116(const uint16_t);
169 extern void f117(const int32_t);
170 extern void f118(const uint32_t);
171 extern void f121(const int64_t);
172 extern void f122(const uint64_t);
173 extern void f123(const float);
174 extern void f124(const double);
175 
176 extern void f131(bool);
177 extern void f132(char);
178 extern void f133(int8_t);
179 extern void f134(uint8_t);
180 extern void f135(int16_t);
181 extern void f136(uint16_t);
182 extern void f137(int32_t);
183 extern void f138(uint32_t);
184 extern void f141(int64_t);
185 extern void f142(uint64_t);
186 extern void f143(float);
187 extern void f144(double);
188 
189 // ----------------------------------------------------------------------
190 // references of primitive result/parameter types
191 // ----------------------------------------------------------------------
192 
193 extern const bool & f211();
194 extern const char & f212();
195 extern const int8_t & f213();
196 extern const uint8_t & f214();
197 extern const int16_t & f215();
198 extern const uint16_t & f216();
199 extern const int32_t & f217();
200 extern const uint32_t & f218();
201 extern const int64_t & f221();
202 extern const uint64_t & f222();
203 extern const float & f223();
204 extern const double & f224();
205 
206 extern bool & f231();
207 extern char & f232();
208 extern int8_t & f233();
209 extern uint8_t & f234();
210 extern int16_t & f235();
211 extern uint16_t & f236();
212 extern int32_t & f237();
213 extern uint32_t & f238();
214 extern int64_t & f241();
215 extern uint64_t & f242();
216 extern float & f243();
217 extern double & f244();
218 
219 extern void f311(const bool &);
220 extern void f312(const char &);
221 extern void f313(const int8_t &);
222 extern void f314(const uint8_t &);
223 extern void f315(const int16_t &);
224 extern void f316(const uint16_t &);
225 extern void f317(const int32_t &);
226 extern void f318(const uint32_t &);
227 extern void f321(const int64_t &);
228 extern void f322(const uint64_t &);
229 extern void f323(const float &);
230 extern void f324(const double &);
231 
232 extern void f331(bool &);
233 extern void f332(char &);
234 extern void f333(int8_t &);
235 extern void f334(uint8_t &);
236 extern void f335(int16_t &);
237 extern void f336(uint16_t &);
238 extern void f337(int32_t &);
239 extern void f338(uint32_t &);
240 extern void f341(int64_t &);
241 extern void f342(uint64_t &);
242 extern void f343(float &);
243 extern void f344(double &);
244 
245 // ----------------------------------------------------------------------
246 // pointers to primitive result/parameter types (array size == 1)
247 // ----------------------------------------------------------------------
248 
249 extern const bool * f411();
250 extern const char * f412();
251 extern const int8_t * f413();
252 extern const uint8_t * f414();
253 extern const int16_t * f415();
254 extern const uint16_t * f416();
255 extern const int32_t * f417();
256 extern const uint32_t * f418();
257 extern const int64_t * f421();
258 extern const uint64_t * f422();
259 extern const float * f423();
260 extern const double * f424();
261 
262 extern bool * f431();
263 extern char * f432();
264 extern int8_t * f433();
265 extern uint8_t * f434();
266 extern int16_t * f435();
267 extern uint16_t * f436();
268 extern int32_t * f437();
269 extern uint32_t * f438();
270 extern int64_t * f441();
271 extern uint64_t * f442();
272 extern float * f443();
273 extern double * f444();
274 
275 extern const bool * const f451();
276 extern const char * const f452();
277 extern const int8_t * const f453();
278 extern const uint8_t * const f454();
279 extern const int16_t * const f455();
280 extern const uint16_t * const f456();
281 extern const int32_t * const f457();
282 extern const uint32_t * const f458();
283 extern const int64_t * const f461();
284 extern const uint64_t * const f462();
285 extern const float * const f463();
286 extern const double * const f464();
287 
288 extern bool * const f471();
289 extern char * const f472();
290 extern int8_t * const f473();
291 extern uint8_t * const f474();
292 extern int16_t * const f475();
293 extern uint16_t * const f476();
294 extern int32_t * const f477();
295 extern uint32_t * const f478();
296 extern int64_t * const f481();
297 extern uint64_t * const f482();
298 extern float * const f483();
299 extern double * const f484();
300 
301 extern void f511(const bool *);
302 extern void f512(const char *);
303 extern void f513(const int8_t *);
304 extern void f514(const uint8_t *);
305 extern void f515(const int16_t *);
306 extern void f516(const uint16_t *);
307 extern void f517(const int32_t *);
308 extern void f518(const uint32_t *);
309 extern void f521(const int64_t *);
310 extern void f522(const uint64_t *);
311 extern void f523(const float *);
312 extern void f524(const double *);
313 
314 extern void f531(bool *);
315 extern void f532(char *);
316 extern void f533(int8_t *);
317 extern void f534(uint8_t *);
318 extern void f535(int16_t *);
319 extern void f536(uint16_t *);
320 extern void f537(int32_t *);
321 extern void f538(uint32_t *);
322 extern void f541(int64_t *);
323 extern void f542(uint64_t *);
324 extern void f543(float *);
325 extern void f544(double *);
326 
327 extern void f551(const bool * const);
328 extern void f552(const char * const);
329 extern void f553(const int8_t * const);
330 extern void f554(const uint8_t * const);
331 extern void f555(const int16_t * const);
332 extern void f556(const uint16_t * const);
333 extern void f557(const int32_t * const);
334 extern void f558(const uint32_t * const);
335 extern void f561(const int64_t * const);
336 extern void f562(const uint64_t * const);
337 extern void f563(const float * const);
338 extern void f564(const double * const);
339 
340 extern void f571(bool * const);
341 extern void f572(char * const);
342 extern void f573(int8_t * const);
343 extern void f574(uint8_t * const);
344 extern void f575(int16_t * const);
345 extern void f576(uint16_t * const);
346 extern void f577(int32_t * const);
347 extern void f578(uint32_t * const);
348 extern void f581(int64_t * const);
349 extern void f582(uint64_t * const);
350 extern void f583(float * const);
351 extern void f584(double * const);
352 
353 // ----------------------------------------------------------------------
354 // pointers to primitive result/parameter types (array size == 0)
355 // ----------------------------------------------------------------------
356 
357 extern const bool * f611();
358 extern const char * f612();
359 extern const int8_t * f613();
360 extern const uint8_t * f614();
361 extern const int16_t * f615();
362 extern const uint16_t * f616();
363 extern const int32_t * f617();
364 extern const uint32_t * f618();
365 extern const int64_t * f621();
366 extern const uint64_t * f622();
367 extern const float * f623();
368 extern const double * f624();
369 
370 extern bool * f631();
371 extern char * f632();
372 extern int8_t * f633();
373 extern uint8_t * f634();
374 extern int16_t * f635();
375 extern uint16_t * f636();
376 extern int32_t * f637();
377 extern uint32_t * f638();
378 extern int64_t * f641();
379 extern uint64_t * f642();
380 extern float * f643();
381 extern double * f644();
382 
383 extern const bool * const f651();
384 extern const char * const f652();
385 extern const int8_t * const f653();
386 extern const uint8_t * const f654();
387 extern const int16_t * const f655();
388 extern const uint16_t * const f656();
389 extern const int32_t * const f657();
390 extern const uint32_t * const f658();
391 extern const int64_t * const f661();
392 extern const uint64_t * const f662();
393 extern const float * const f663();
394 extern const double * const f664();
395 
396 extern bool * const f671();
397 extern char * const f672();
398 extern int8_t * const f673();
399 extern uint8_t * const f674();
400 extern int16_t * const f675();
401 extern uint16_t * const f676();
402 extern int32_t * const f677();
403 extern uint32_t * const f678();
404 extern int64_t * const f681();
405 extern uint64_t * const f682();
406 extern float * const f683();
407 extern double * const f684();
408 
409 extern void f711(const bool *);
410 extern void f712(const char *);
411 extern void f713(const int8_t *);
412 extern void f714(const uint8_t *);
413 extern void f715(const int16_t *);
414 extern void f716(const uint16_t *);
415 extern void f717(const int32_t *);
416 extern void f718(const uint32_t *);
417 extern void f721(const int64_t *);
418 extern void f722(const uint64_t *);
419 extern void f723(const float *);
420 extern void f724(const double *);
421 
422 extern void f731(bool *);
423 extern void f732(char *);
424 extern void f733(int8_t *);
425 extern void f734(uint8_t *);
426 extern void f735(int16_t *);
427 extern void f736(uint16_t *);
428 extern void f737(int32_t *);
429 extern void f738(uint32_t *);
430 extern void f741(int64_t *);
431 extern void f742(uint64_t *);
432 extern void f743(float *);
433 extern void f744(double *);
434 
435 extern void f751(const bool * const);
436 extern void f752(const char * const);
437 extern void f753(const int8_t * const);
438 extern void f754(const uint8_t * const);
439 extern void f755(const int16_t * const);
440 extern void f756(const uint16_t * const);
441 extern void f757(const int32_t * const);
442 extern void f758(const uint32_t * const);
443 extern void f761(const int64_t * const);
444 extern void f762(const uint64_t * const);
445 extern void f763(const float * const);
446 extern void f764(const double * const);
447 
448 extern void f771(bool * const);
449 extern void f772(char * const);
450 extern void f773(int8_t * const);
451 extern void f774(uint8_t * const);
452 extern void f775(int16_t * const);
453 extern void f776(uint16_t * const);
454 extern void f777(int32_t * const);
455 extern void f778(uint32_t * const);
456 extern void f781(int64_t * const);
457 extern void f782(uint64_t * const);
458 extern void f783(float * const);
459 extern void f784(double * const);
460 
461 // ----------------------------------------------------------------------
462 // object result/parameter types
463 // ----------------------------------------------------------------------
464 
465 struct B0 {
466  static int32_t d0s;
467  static const int32_t d0sc;
468 
469  int32_t d0;
470  const int32_t d0c;
471 
472  static void init();
473 
474  static void finit();
475 
476  B0() : d0(21), d0c(-21) {
477  TRACE("B0()");
478  };
479 
480  B0(const B0 & b0) : d0(b0.d0), d0c(b0.d0c) {
481  TRACE("B0(const B0 &)");
482  ABORT_ERROR("!USE OF COPY CONSTRUCTOR!");
483  };
484 
485  virtual ~B0() {};
486 
487  B0 & operator=(const B0 & p) {
488  TRACE("B0 & operator=(const B0 &)");
489  (void)p;
490  ABORT_ERROR("!USE OF ASSIGNMENT OPERATOR!");
491  return *this;
492  }
493 
494  // ----------------------------------------------------------------------
495 
496  static int32_t f0s() {
497  TRACE("int32_t B0::f0s()");
498  return 20;
499  };
500 
501  int32_t f0n() const {
502  TRACE("int32_t B0::f0n()");
503  return 21;
504  };
505 
506  virtual int32_t f0v() const {
507  TRACE("int32_t B0::f0v()");
508  return 22;
509  };
510 
511 };
512 
513 struct B1 : public B0 {
514  static int32_t d0s;
515  static const int32_t d0sc;
516 
517  int32_t d0;
518  const int32_t d0c;
519 
520  static void init();
521 
522  static void finit();
523 
524  B1() : d0(31), d0c(-31) {
525  TRACE("B1()");
526  };
527 
528  B1(const B1 & b1) : B0(b1), d0(b1.d0), d0c(b1.d0c) {
529  TRACE("B1(const B1 &)");
530  ABORT_ERROR("!USE OF COPY CONSTRUCTOR!");
531  };
532 
533  virtual ~B1() {};
534 
535  B1 & operator=(const B1 & p) {
536  TRACE("B1 & operator=(const B1 &)");
537  (void)p;
538  ABORT_ERROR("!USE OF ASSIGNMENT OPERATOR!");
539  return *this;
540  }
541 
542  // ----------------------------------------------------------------------
543 
544  static int32_t f0s() {
545  TRACE("int32_t B1::f0s()");
546  return 30;
547  };
548 
549  int32_t f0n() const {
550  TRACE("int32_t B1::f0n()");
551  return 31;
552  };
553 
554  virtual int32_t f0v() const {
555  TRACE("int32_t B1::f0v()");
556  return 32;
557  };
558 };
559 
560 struct A {
561  static A * a;
562  static int32_t d0s;
563  static const int32_t d0sc;
564 
565  int32_t d0;
566  const int32_t d0c;
567 
568  static void init();
569 
570  static void finit();
571 
572  A() : d0(11), d0c(-11) {
573  TRACE("A()");
574  };
575 
576  A(int i) : d0(11), d0c(-11) {
577  TRACE("A(int)");
578  (void)i;
579  };
580 
581  A(const A & a) : d0(a.d0), d0c(a.d0c) {
582  TRACE("A(const A &)");
583  ABORT_ERROR("!USE OF COPY CONSTRUCTOR!");
584  };
585 
586  virtual ~A() {
587  TRACE("~A()");
588  };
589 
590  A & operator=(const A & p) {
591  TRACE("A & operator=(const A &)");
592  (void)p;
593  ABORT_ERROR("!USE OF ASSIGNMENT OPERATOR!");
594  return *this;
595  }
596 
597  // ----------------------------------------------------------------------
598 
599  static A * deliver_ptr() {
600  TRACE("A * A::deliver_ptr()");
601  return A::a;
602  };
603 
604  static A * deliver_null_ptr() {
605  TRACE("A * A::deliver_null_ptr()");
606  return NULL;
607  };
608 
609  static A & deliver_ref() {
610  TRACE("A & A::deliver_ref()");
611  return *A::a;
612  };
613 
614  static A & deliver_null_ref() {
615  TRACE("A & A::deliver_null_ref()");
616  return *((A *)0);
617  };
618 
619  static void take_ptr(A * o) {
620  TRACE("void A::take_ptr(A *)");
621  if (o != A::a) ABORT_ERROR("void A::take_ptr(A *)");
622  };
623 
624  static void take_null_ptr(A * o) {
625  TRACE("void A::take_null_ptr(A *)");
626  if (o != NULL) ABORT_ERROR("void A::take_null_ptr(A *)");
627  };
628 
629  static void take_ref(A & o) {
630  TRACE("void A::take_ref(A &)");
631  if (&o != A::a) ABORT_ERROR("void A::take_ref(A &)");
632  };
633 
634  static void take_null_ref(A & o) {
635  TRACE("void A::take_null_ref(A &)");
636  if (&o != NULL) ABORT_ERROR("void A::take_null_ref(A &)");
637  };
638 
639  static void print(A * p0) {
640  TRACE("void A::print(A *)");
641  printf(" p0 = %p\n", (void*)p0);
642  fflush(stdout);
643  };
644 
645  // ----------------------------------------------------------------------
646 
647  B0 * newB0() const {
648  TRACE("B0 A::newB0()");
649  return new B0();
650  };
651 
652  B1 * newB1() const {
653  TRACE("B1 A::newB1()");
654  return new B1();
655  };
656 
657  static int32_t f0s() {
658  TRACE("int32_t A::f0s()");
659  return 10;
660  };
661 
662  int32_t f0n() const {
663  TRACE("int32_t A::f0n()");
664  return 11;
665  };
666 
667  virtual int32_t f0v() const {
668  TRACE("int32_t A::f0v()");
669  return 12;
670  };
671 
672  void del(B0 & b) {
673  TRACE("void A::del(B0 &)");
674  delete &b;
675  };
676 
677  void del(B1 & b) {
678  TRACE("void A::del(B1 &)");
679  delete &b;
680  };
681 
682  // ----------------------------------------------------------------------
683  // varying number of result/parameters
684  // ----------------------------------------------------------------------
685 
686  void g0c() const {
687  TRACE("void A::g0c()");
688  };
689 
690  void g1c(int8_t p0) const {
691  TRACE("void A::g1c(int8_t)");
692  if (p0 != 1) ABORT_ERROR("wrong arg value");
693  };
694 
695  void g2c(int8_t p0, int16_t p1) const {
696  TRACE("void A::g2c(int8_t, int16_t)");
697  if (p0 != 1) ABORT_ERROR("wrong arg value");
698  if (p1 != 2) ABORT_ERROR("wrong arg value");
699  };
700 
701  void g3c(int8_t p0, int16_t p1, int32_t p2) const {
702  TRACE("void A::g3c(int8_t, int16_t, int32_t)");
703  if (p0 != 1) ABORT_ERROR("wrong arg value");
704  if (p1 != 2) ABORT_ERROR("wrong arg value");
705  if (p2 != 3) ABORT_ERROR("wrong arg value");
706  };
707 
708  void g0() {
709  TRACE("void A::g0()");
710  };
711 
712  void g1(int8_t p0) {
713  TRACE("void A::g1(int8_t)");
714  if (p0 != 1) ABORT_ERROR("wrong arg value");
715  };
716 
717  void g2(int8_t p0, int16_t p1) {
718  TRACE("void A::g2(int8_t, int16_t)");
719  if (p0 != 1) ABORT_ERROR("wrong arg value");
720  if (p1 != 2) ABORT_ERROR("wrong arg value");
721  };
722 
723  void g3(int8_t p0, int16_t p1, int32_t p2) {
724  TRACE("void A::g3(int8_t, int16_t, int32_t)");
725  if (p0 != 1) ABORT_ERROR("wrong arg value");
726  if (p1 != 2) ABORT_ERROR("wrong arg value");
727  if (p2 != 3) ABORT_ERROR("wrong arg value");
728  };
729 
730  // ----------------------------------------------------------------------
731 
732  int32_t g0rc() const {
733  TRACE("int32_t A::g0rc()");
734  return 0;
735  };
736 
737  int32_t g1rc(int8_t p0) const {
738  TRACE("int32_t A::g1rc(int8_t)");
739  if (p0 != 1) ABORT_ERROR("wrong arg value");
740  return p0;
741  };
742 
743  int32_t g2rc(int8_t p0, int16_t p1) const {
744  TRACE("int32_t A::g2rc(int8_t, int16_t)");
745  if (p0 != 1) ABORT_ERROR("wrong arg value");
746  if (p1 != 2) ABORT_ERROR("wrong arg value");
747  return p0 + p1;
748  };
749 
750  int32_t g3rc(int8_t p0, int16_t p1, int32_t p2) const {
751  TRACE("int32_t A::g3rc(int8_t, int16_t, int32_t)");
752  if (p0 != 1) ABORT_ERROR("wrong arg value");
753  if (p1 != 2) ABORT_ERROR("wrong arg value");
754  if (p2 != 3) ABORT_ERROR("wrong arg value");
755  return p0 + p1 + p2;
756  };
757 
758  int32_t g0r() {
759  TRACE("int32_t A::g0r()");
760  return 0;
761  };
762 
763  int32_t g1r(int8_t p0) {
764  TRACE("int32_t A::g1r(int8_t)");
765  if (p0 != 1) ABORT_ERROR("wrong arg value");
766  return p0;
767  };
768 
769  int32_t g2r(int8_t p0, int16_t p1) {
770  TRACE("int32_t A::g2r(int8_t, int16_t)");
771  if (p0 != 1) ABORT_ERROR("wrong arg value");
772  if (p1 != 2) ABORT_ERROR("wrong arg value");
773  return p0 + p1;
774  };
775 
776  int32_t g3r(int8_t p0, int16_t p1, int32_t p2) {
777  TRACE("int32_t A::g3r(int8_t, int16_t, int32_t)");
778  if (p0 != 1) ABORT_ERROR("wrong arg value");
779  if (p1 != 2) ABORT_ERROR("wrong arg value");
780  if (p2 != 3) ABORT_ERROR("wrong arg value");
781  return p0 + p1 + p2;
782  };
783 };
784 
785 // ----------------------------------------------------------------------
786 
787 inline void h0() {
788  TRACE("void h0()");
789 }
790 
791 inline void h1(int8_t p0) {
792  TRACE("void h1(int8_t)");
793  if (p0 != 1) ABORT_ERROR("wrong arg value");
794 }
795 
796 inline void h2(int8_t p0, int16_t p1) {
797  TRACE("void h2(int8_t, int16_t)");
798  if (p0 != 1) ABORT_ERROR("wrong arg value");
799  if (p1 != 2) ABORT_ERROR("wrong arg value");
800 }
801 
802 inline void h3(int8_t p0, int16_t p1, int32_t p2) {
803  TRACE("void h3(int8_t, int16_t, int32_t)");
804  if (p0 != 1) ABORT_ERROR("wrong arg value");
805  if (p1 != 2) ABORT_ERROR("wrong arg value");
806  if (p2 != 3) ABORT_ERROR("wrong arg value");
807 }
808 
809 inline int32_t h0r() {
810  TRACE("int32_t h0r()");
811  return 0;
812 }
813 
814 inline int32_t h1r(int8_t p0) {
815  TRACE("int32_t h1r(int8_t)");
816  if (p0 != 1) ABORT_ERROR("wrong arg value");
817  return p0;
818 }
819 
820 inline int32_t h2r(int8_t p0, int16_t p1) {
821  TRACE("int32_t h2r(int8_t, int16_t)");
822  if (p0 != 1) ABORT_ERROR("wrong arg value");
823  if (p1 != 2) ABORT_ERROR("wrong arg value");
824  return p0 + p1;
825 }
826 
827 inline int32_t h3r(int8_t p0, int16_t p1, int32_t p2) {
828  TRACE("int32_t h3r(int8_t, int16_t, int32_t)");
829  if (p0 != 1) ABORT_ERROR("wrong arg value");
830  if (p1 != 2) ABORT_ERROR("wrong arg value");
831  if (p2 != 3) ABORT_ERROR("wrong arg value");
832  return p0 + p1 + p2;
833 }
834 
835 // ----------------------------------------------------------------------
836 // [non-]const member functions and object[-array] result/parameter types
837 // ----------------------------------------------------------------------
838 
839 struct C0 {
840  static C0 * c;
841  static const C0 * cc;
842 
843  const int64_t id;
844 
845  static void init();
846 
847  static void finit();
848 
849  C0() : id((int64_t)this) {
850  TRACE("C0()");
851  }
852 
853  C0(const C0 & o) : id(o.id) {
854  TRACE("C0(const C0 &)");
855  (void)o;
856  ABORT_ERROR("!USE OF COPY CONSTRUCTOR!");
857  }
858 
859  virtual ~C0() {
860  TRACE("~C0()");
861  }
862 
863  C0 & operator=(const C0 & o) {
864  TRACE("C0 & operator=(const C0 &)");
865  (void)o;
866  ABORT_ERROR("!USE OF ASSIGNMENT OPERATOR!");
867  return *this;
868  }
869 
870  // ----------------------------------------------------------------------
871  // static (on purpose) array functions
872  // ----------------------------------------------------------------------
873 
874  static C0 * pass(C0 * c0) {
875  return c0;
876  }
877 
878  static const C0 * pass(const C0 * c0) {
879  return c0;
880  }
881 
882  static int64_t hash(const C0 * c0, int32_t n) {
883  TRACE("int64_t C0::hash(const C0 *, int32_t)");
884  if (c0 == NULL)
885  ABORT_ERROR("c0 == NULL");
886  if (n < 0)
887  ABORT_ERROR("n < 0");
888 
889  int64_t r = 0;
890  for (int i = 0; i < n; i++) {
891  r ^= c0[i].id;
892  }
893  return r;
894  }
895 
896  // ----------------------------------------------------------------------
897  // (non-virtual) instance (on purpose) array functions
898  // ----------------------------------------------------------------------
899 
900  void check(int64_t id) const {
901  TRACE("void check(int64_t) const");
902  if (id != this->id) ABORT_ERROR("id != this->id");
903  }
904 
905  void print() const {
906  TRACE("void C0::print() const");
907  printf(" this->id = %llx\n", (long long unsigned int)id);
908  fflush(stdout);
909  }
910 
911  const C0 * deliver_C0Cp() const {
912  TRACE("const C0 * C0::deliver_C0Cp() const");
913  return cc;
914  }
915 
916  const C0 & deliver_C0Cr() const {
917  TRACE("const C0 & C0::deliver_C0Cr() const");
918  return *cc;
919  }
920 
921  void take_C0Cp(const C0 * cp) const {
922  TRACE("void C0::take_C0Cp(const C0 *) const");
923  if (cp != C0::c && cp != C0::cc)
924  ABORT_ERROR("cp != C0::c && cp != C0::cc");
925  }
926 
927  void take_C0Cr(const C0 & cp) const {
928  TRACE("void C0::take_C0Cr(const C0 &) const");
929  if (&cp != C0::c && &cp != C0::cc)
930  ABORT_ERROR("&cp != C0::c && &cp != C0::cc");
931  }
932 
933  C0 * deliver_C0p() {
934  TRACE("C0 * C0::deliver_C0p()");
935  return c;
936  }
937 
938  C0 & deliver_C0r() {
939  TRACE("C0 & C0::deliver_C0r()");
940  return *c;
941  }
942 
943  void take_C0p(C0 * p) {
944  TRACE("void C0::take_C0p(C0 *)");
945  if (p != C0::c)
946  ABORT_ERROR("p != C0::c");
947  }
948 
949  void take_C0r(C0 & p) {
950  TRACE("void C0::take_C0r(C0 &)");
951  if (&p != C0::c)
952  ABORT_ERROR("&p != C0::c");
953  }
954 };
955 
956 struct C1 : public C0 {
957  static C1 * c;
958  static const C1 * cc;
959 
960  static void init();
961 
962  static void finit();
963 
964  C1() {
965  TRACE("C1()");
966  };
967 
968  C1(const C1 & o) : C0(o) {
969  TRACE("C1(const C1 &)");
970  (void)o;
971  ABORT_ERROR("!USE OF COPY CONSTRUCTOR!");
972  };
973 
974  virtual ~C1() {
975  TRACE("~C1()");
976  };
977 
978  C1 & operator=(const C1 & p) {
979  TRACE("C1 & operator=(const C1 &)");
980  (void)p;
981  ABORT_ERROR("!USE OF ASSIGNMENT OPERATOR!");
982  return *this;
983  }
984 
985  // ----------------------------------------------------------------------
986  // static (on purpose) array functions
987  // ----------------------------------------------------------------------
988 
989  static C1 * pass(C1 * c1) {
990  return c1;
991  }
992 
993  static const C1 * pass(const C1 * c1) {
994  return c1;
995  }
996 
997  static int64_t hash(const C1 * c1, int32_t n) {
998  TRACE("int64_t C1::hash(const C1 *, int32_t)");
999  if (c1 == NULL)
1000  ABORT_ERROR("c1 == NULL");
1001  if (n < 0)
1002  ABORT_ERROR("n < 0");
1003 
1004  int64_t r = 0;
1005  for (int i = 0; i < n; i++) {
1006  r ^= c1[i].id;
1007  }
1008  return r;
1009  }
1010 
1011  // ----------------------------------------------------------------------
1012  // (non-virtual) instance (on purpose) array functions
1013  // ----------------------------------------------------------------------
1014 
1015  const C1 * deliver_C1Cp() const {
1016  TRACE("const C1 * C1::deliver_C1Cp() const");
1017  return cc;
1018  };
1019 
1020  const C1 & deliver_C1Cr() const {
1021  TRACE("const C1 & C1::deliver_C1Cr() const");
1022  return *cc;
1023  };
1024 
1025  void take_C1Cp(const C1 * cp) const {
1026  TRACE("void C1::take_C1Cp(const C1 *) const");
1027  if (cp != C1::c && cp != C1::cc)
1028  ABORT_ERROR("cp != C1::c && cp != C1::cc");
1029  };
1030 
1031  void take_C1Cr(const C1 & cp) const {
1032  TRACE("void C1::take_C1Cr(const C1 &) const");
1033  if (&cp != C1::c && &cp != C1::cc)
1034  ABORT_ERROR("&cp != C1::c && &cp != C1::cc");
1035  };
1036 
1037  C1 * deliver_C1p() {
1038  TRACE("C1 * C1::deliver_C1p()");
1039  return c;
1040  };
1041 
1042  C1 & deliver_C1r() {
1043  TRACE("C1 & C1::deliver_C1r()");
1044  return *c;
1045  };
1046 
1047  void take_C1p(C1 * p) {
1048  TRACE("void C1::take_C1p(C1 *)");
1049  if (p != C1::c)
1050  ABORT_ERROR("p != C1::c");
1051  };
1052 
1053  void take_C1r(C1 & p) {
1054  TRACE("void C1::take_C1r(C1 &)");
1055  if (&p != C1::c)
1056  ABORT_ERROR("&p != C1::c");
1057  };
1058 };
1059 
1060 // ----------------------------------------------------------------------
1061 // overriding and virtual/non-virtual functions
1062 // ----------------------------------------------------------------------
1063 
1064 struct D1;
1065 
1066 struct D0 {
1067  static D0 * d;
1068  static void init();
1069  static void finit();
1070  virtual ~D0() {}
1071 
1072  int f_d0() { TRACE("D0::f_d0()"); return 20; }
1073  int f_nv() { TRACE("D0::f_nv()"); return 21; }
1074  virtual int f_v() { TRACE("D0::f_v()"); return 22; }
1075  static D1 * sub();
1076 };
1077 
1078 struct D1 : D0 {
1079  static D1 * d;
1080  static void init();
1081  static void finit();
1082  virtual ~D1() {}
1083 
1084  int f_d1() { TRACE("D0::f_d1()"); return 30; }
1085  int f_nv() { TRACE("D1::f_nv()"); return 31; }
1086  virtual int f_v() { TRACE("D1::f_v()"); return 32; }
1087  static D1 * sub();
1088 };
1089 
1090 struct D2 : D1 {
1091  static D2 * d;
1092  static void init();
1093  static void finit();
1094  virtual ~D2() {}
1095 
1096  int f_d2() { TRACE("D2::f_d2()"); return 40; }
1097  int f_nv() { TRACE("D2::f_nv()"); return 41; }
1098  virtual int f_v() { TRACE("D2::f_v()"); return 42; }
1099  static D1 * sub();
1100 };
1101 
1102 // d1class instance returns (casts unnecessary but for attention)
1103 inline D1 * D0::sub() { TRACE("D1 * D0::sub()"); return ((D1*)D1::d); } // D1
1104 inline D1 * D1::sub() { TRACE("D1 * D1::sub()"); return ((D1*)D2::d); } // D2
1105 inline D1 * D2::sub() { TRACE("D1 * D2::sub()"); return NULL; } // --
1106 
1107 // ----------------------------------------------------------------------
1108 // enums
1109 // ----------------------------------------------------------------------
1110 
1111 struct E {
1112  enum EE { EE0, EE1 };
1113 
1114  static EE deliver_EE1() {
1115  TRACE("E::EE E::deliver_EE1()");
1116  return EE1;
1117  };
1118 
1119  static void take_EE1(EE e) {
1120  TRACE("void E::take_EE1(E::EE)");
1121  if (e != EE1) ABORT_ERROR("e != EE1");
1122  };
1123 
1124  static const EE deliver_EE1c() {
1125  TRACE("const E::EE E::deliver_EE1c()");
1126  return EE1;
1127  };
1128 
1129  static void take_EE1c(const EE e) {
1130  TRACE("void E::take_EE1c(const E::EE)");
1131  if (e != EE1) ABORT_ERROR("e != EE1");
1132  };
1133 
1134 private:
1135  // no need to instantiate
1136  E() {
1137  TRACE("E()");
1138  }
1139 
1140  E(const E & o) {
1141  TRACE("E(const E &)");
1142  (void)o;
1143  ABORT_ERROR("!USE OF COPY CONSTRUCTOR!");
1144  }
1145 
1146  virtual ~E() {
1147  TRACE("~E()");
1148  }
1149 
1150  E & operator=(const E & o) {
1151  TRACE("E & operator=(const E &)");
1152  (void)o;
1153  ABORT_ERROR("!USE OF ASSIGNMENT OPERATOR!");
1154  return *this;
1155  }
1156 };
1157 
1158 // ----------------------------------------------------------------------
1159 
1160 #endif // _myapi