b1ea6bf42e76d24c3347d521f2aff6353658c22a
[com/asn1c.git] / tests / tests-asn1c-compiler / 37-indirect-choice-OK.asn1.-Pfwide-types
1
2 /*** <<< INCLUDES [T] >>> ***/
3
4 #include <INTEGER.h>
5 #include <OCTET_STRING.h>
6 #include "Choice1.h"
7 #include "Choice2.h"
8 #include <constr_CHOICE.h>
9
10 /*** <<< DEPS [T] >>> ***/
11
12 typedef enum T_PR {
13         T_PR_NOTHING,   /* No components present */
14         T_PR_t_a,
15         T_PR_t_b,
16         T_PR_t_c,
17         T_PR_t_d
18 } T_PR;
19
20 /*** <<< TYPE-DECLS [T] >>> ***/
21
22 typedef struct T {
23         T_PR present;
24         union T_u {
25                 INTEGER_t        t_a;
26                 OCTET_STRING_t   t_b;
27                 Choice1_t        t_c;
28                 Choice2_t        t_d;
29         } choice;
30         
31         /* Context for parsing across buffer boundaries */
32         asn_struct_ctx_t _asn_ctx;
33 } T_t;
34
35 /*** <<< FUNC-DECLS [T] >>> ***/
36
37 extern asn_TYPE_descriptor_t asn_DEF_T;
38
39 /*** <<< STAT-DEFS [T] >>> ***/
40
41 static asn_TYPE_member_t asn_MBR_T_1[] = {
42         { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_a),
43                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
44                 .tag_mode = 0,
45                 .type = &asn_DEF_INTEGER,
46                 .type_selector = 0,
47                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
48                 0, 0, /* No default value */
49                 .name = "t-a"
50                 },
51         { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_b),
52                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
53                 .tag_mode = 0,
54                 .type = &asn_DEF_OCTET_STRING,
55                 .type_selector = 0,
56                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
57                 0, 0, /* No default value */
58                 .name = "t-b"
59                 },
60         { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_c),
61                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
62                 .tag_mode = +1, /* EXPLICIT tag at current level */
63                 .type = &asn_DEF_Choice1,
64                 .type_selector = 0,
65                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
66                 0, 0, /* No default value */
67                 .name = "t-c"
68                 },
69         { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_d),
70                 .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
71                 .tag_mode = -1, /* IMPLICIT tag at current level */
72                 .type = &asn_DEF_Choice2,
73                 .type_selector = 0,
74                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
75                 0, 0, /* No default value */
76                 .name = "t-d"
77                 },
78 };
79 static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = {
80     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* t-a */
81     { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* t-b */
82     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 }, /* t-c */
83     { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* t-d */
84 };
85 static asn_CHOICE_specifics_t asn_SPC_T_specs_1 = {
86         sizeof(struct T),
87         offsetof(struct T, _asn_ctx),
88         offsetof(struct T, present),
89         sizeof(((struct T *)0)->present),
90         .tag2el = asn_MAP_T_tag2el_1,
91         .tag2el_count = 4,      /* Count of tags in the map */
92         0, 0,
93         .first_extension = -1   /* Extensions start */
94 };
95 asn_TYPE_descriptor_t asn_DEF_T = {
96         "T",
97         "T",
98         &asn_OP_CHOICE,
99         0,      /* No effective tags (pointer) */
100         0,      /* No effective tags (count) */
101         0,      /* No tags (pointer) */
102         0,      /* No tags (count) */
103         { 0, 0, CHOICE_constraint },
104         asn_MBR_T_1,
105         4,      /* Elements count */
106         &asn_SPC_T_specs_1      /* Additional specs */
107 };
108
109
110 /*** <<< INCLUDES [Choice1] >>> ***/
111
112 #include <OCTET_STRING.h>
113 #include <INTEGER.h>
114 #include <constr_CHOICE.h>
115
116 /*** <<< DEPS [Choice1] >>> ***/
117
118 typedef enum Choice1_PR {
119         Choice1_PR_NOTHING,     /* No components present */
120         Choice1_PR_c_a,
121         Choice1_PR_c_b
122 } Choice1_PR;
123
124 /*** <<< TYPE-DECLS [Choice1] >>> ***/
125
126 typedef struct Choice1 {
127         Choice1_PR present;
128         union Choice1_u {
129                 OCTET_STRING_t   c_a;
130                 INTEGER_t        c_b;
131         } choice;
132         
133         /* Context for parsing across buffer boundaries */
134         asn_struct_ctx_t _asn_ctx;
135 } Choice1_t;
136
137 /*** <<< FUNC-DECLS [Choice1] >>> ***/
138
139 extern asn_TYPE_descriptor_t asn_DEF_Choice1;
140 extern asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1;
141 extern asn_TYPE_member_t asn_MBR_Choice1_1[2];
142
143 /*** <<< STAT-DEFS [Choice1] >>> ***/
144
145 asn_TYPE_member_t asn_MBR_Choice1_1[] = {
146         { ATF_NOFLAGS, 0, offsetof(struct Choice1, choice.c_a),
147                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
148                 .tag_mode = 0,
149                 .type = &asn_DEF_OCTET_STRING,
150                 .type_selector = 0,
151                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
152                 0, 0, /* No default value */
153                 .name = "c-a"
154                 },
155         { ATF_NOFLAGS, 0, offsetof(struct Choice1, choice.c_b),
156                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
157                 .tag_mode = 0,
158                 .type = &asn_DEF_INTEGER,
159                 .type_selector = 0,
160                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
161                 0, 0, /* No default value */
162                 .name = "c-b"
163                 },
164 };
165 static const asn_TYPE_tag2member_t asn_MAP_Choice1_tag2el_1[] = {
166     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* c-b */
167     { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 0 } /* c-a */
168 };
169 asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1 = {
170         sizeof(struct Choice1),
171         offsetof(struct Choice1, _asn_ctx),
172         offsetof(struct Choice1, present),
173         sizeof(((struct Choice1 *)0)->present),
174         .tag2el = asn_MAP_Choice1_tag2el_1,
175         .tag2el_count = 2,      /* Count of tags in the map */
176         0, 0,
177         .first_extension = -1   /* Extensions start */
178 };
179 asn_TYPE_descriptor_t asn_DEF_Choice1 = {
180         "Choice1",
181         "Choice1",
182         &asn_OP_CHOICE,
183         0,      /* No effective tags (pointer) */
184         0,      /* No effective tags (count) */
185         0,      /* No tags (pointer) */
186         0,      /* No tags (count) */
187         { 0, 0, CHOICE_constraint },
188         asn_MBR_Choice1_1,
189         2,      /* Elements count */
190         &asn_SPC_Choice1_specs_1        /* Additional specs */
191 };
192
193
194 /*** <<< INCLUDES [Choice2] >>> ***/
195
196 #include <OCTET_STRING.h>
197 #include <INTEGER.h>
198 #include "Choice1.h"
199 #include <constr_CHOICE.h>
200
201 /*** <<< DEPS [Choice2] >>> ***/
202
203 typedef enum Choice2_PR {
204         Choice2_PR_NOTHING,     /* No components present */
205         Choice2_PR_c_a,
206         Choice2_PR_c_b,
207         Choice2_PR_c_d,
208         Choice2_PR_c_e
209 } Choice2_PR;
210
211 /*** <<< TYPE-DECLS [Choice2] >>> ***/
212
213 typedef struct Choice2 {
214         Choice2_PR present;
215         union Choice2_u {
216                 OCTET_STRING_t   c_a;
217                 INTEGER_t        c_b;
218                 Choice1_t        c_d;
219                 Choice1_t        c_e;
220         } choice;
221         
222         /* Context for parsing across buffer boundaries */
223         asn_struct_ctx_t _asn_ctx;
224 } Choice2_t;
225
226 /*** <<< FUNC-DECLS [Choice2] >>> ***/
227
228 extern asn_TYPE_descriptor_t asn_DEF_Choice2;
229 extern asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1;
230 extern asn_TYPE_member_t asn_MBR_Choice2_1[4];
231
232 /*** <<< STAT-DEFS [Choice2] >>> ***/
233
234 asn_TYPE_member_t asn_MBR_Choice2_1[] = {
235         { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_a),
236                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
237                 .tag_mode = 0,
238                 .type = &asn_DEF_OCTET_STRING,
239                 .type_selector = 0,
240                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
241                 0, 0, /* No default value */
242                 .name = "c-a"
243                 },
244         { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_b),
245                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
246                 .tag_mode = 0,
247                 .type = &asn_DEF_INTEGER,
248                 .type_selector = 0,
249                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
250                 0, 0, /* No default value */
251                 .name = "c-b"
252                 },
253         { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_d),
254                 .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
255                 .tag_mode = +1, /* EXPLICIT tag at current level */
256                 .type = &asn_DEF_Choice1,
257                 .type_selector = 0,
258                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
259                 0, 0, /* No default value */
260                 .name = "c-d"
261                 },
262         { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_e),
263                 .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
264                 .tag_mode = +1, /* EXPLICIT tag at current level */
265                 .type = &asn_DEF_Choice1,
266                 .type_selector = 0,
267                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
268                 0, 0, /* No default value */
269                 .name = "c-e"
270                 },
271 };
272 static const ber_tlv_tag_t asn_DEF_Choice2_tags_1[] = {
273         (ASN_TAG_CLASS_CONTEXT | (2 << 2))
274 };
275 static const asn_TYPE_tag2member_t asn_MAP_Choice2_tag2el_1[] = {
276     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* c-b */
277     { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 0 }, /* c-a */
278     { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 }, /* c-d */
279     { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 3, 0, 0 } /* c-e */
280 };
281 asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = {
282         sizeof(struct Choice2),
283         offsetof(struct Choice2, _asn_ctx),
284         offsetof(struct Choice2, present),
285         sizeof(((struct Choice2 *)0)->present),
286         .tag2el = asn_MAP_Choice2_tag2el_1,
287         .tag2el_count = 4,      /* Count of tags in the map */
288         0, 0,
289         .first_extension = -1   /* Extensions start */
290 };
291 asn_TYPE_descriptor_t asn_DEF_Choice2 = {
292         "Choice2",
293         "Choice2",
294         &asn_OP_CHOICE,
295         asn_DEF_Choice2_tags_1,
296         sizeof(asn_DEF_Choice2_tags_1)
297                 /sizeof(asn_DEF_Choice2_tags_1[0]), /* 1 */
298         asn_DEF_Choice2_tags_1, /* Same as above */
299         sizeof(asn_DEF_Choice2_tags_1)
300                 /sizeof(asn_DEF_Choice2_tags_1[0]), /* 1 */
301         { 0, 0, CHOICE_constraint },
302         asn_MBR_Choice2_1,
303         4,      /* Elements count */
304         &asn_SPC_Choice2_specs_1        /* Additional specs */
305 };
306
307
308 /*** <<< INCLUDES [Choice3] >>> ***/
309
310 #include "Choice2.h"
311
312 /*** <<< TYPE-DECLS [Choice3] >>> ***/
313
314 typedef Choice2_t        Choice3_t;
315
316 /*** <<< FUNC-DECLS [Choice3] >>> ***/
317
318 extern asn_TYPE_descriptor_t asn_DEF_Choice3;
319 asn_struct_free_f Choice3_free;
320 asn_struct_print_f Choice3_print;
321 asn_constr_check_f Choice3_constraint;
322 ber_type_decoder_f Choice3_decode_ber;
323 der_type_encoder_f Choice3_encode_der;
324 xer_type_decoder_f Choice3_decode_xer;
325 xer_type_encoder_f Choice3_encode_xer;
326
327 /*** <<< CODE [Choice3] >>> ***/
328
329 /*
330  * This type is implemented using Choice2,
331  * so here we adjust the DEF accordingly.
332  */
333
334 /*** <<< STAT-DEFS [Choice3] >>> ***/
335
336 static const ber_tlv_tag_t asn_DEF_Choice3_tags_1[] = {
337         (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
338         (ASN_TAG_CLASS_CONTEXT | (2 << 2))
339 };
340 asn_TYPE_descriptor_t asn_DEF_Choice3 = {
341         "Choice3",
342         "Choice3",
343         &asn_OP_CHOICE,
344         asn_DEF_Choice3_tags_1,
345         sizeof(asn_DEF_Choice3_tags_1)
346                 /sizeof(asn_DEF_Choice3_tags_1[0]), /* 2 */
347         asn_DEF_Choice3_tags_1, /* Same as above */
348         sizeof(asn_DEF_Choice3_tags_1)
349                 /sizeof(asn_DEF_Choice3_tags_1[0]), /* 2 */
350         { 0, 0, CHOICE_constraint },
351         asn_MBR_Choice2_1,
352         4,      /* Elements count */
353         &asn_SPC_Choice2_specs_1        /* Additional specs */
354 };
355
356
357 /*** <<< INCLUDES [Choice4] >>> ***/
358
359 #include "Choice2.h"
360
361 /*** <<< TYPE-DECLS [Choice4] >>> ***/
362
363 typedef Choice2_t        Choice4_t;
364
365 /*** <<< FUNC-DECLS [Choice4] >>> ***/
366
367 extern asn_TYPE_descriptor_t asn_DEF_Choice4;
368 asn_struct_free_f Choice4_free;
369 asn_struct_print_f Choice4_print;
370 asn_constr_check_f Choice4_constraint;
371 ber_type_decoder_f Choice4_decode_ber;
372 der_type_encoder_f Choice4_encode_der;
373 xer_type_decoder_f Choice4_decode_xer;
374 xer_type_encoder_f Choice4_encode_xer;
375
376 /*** <<< CODE [Choice4] >>> ***/
377
378 /*
379  * This type is implemented using Choice2,
380  * so here we adjust the DEF accordingly.
381  */
382
383 /*** <<< STAT-DEFS [Choice4] >>> ***/
384
385 static const ber_tlv_tag_t asn_DEF_Choice4_tags_1[] = {
386         (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
387         (ASN_TAG_CLASS_CONTEXT | (2 << 2))
388 };
389 asn_TYPE_descriptor_t asn_DEF_Choice4 = {
390         "Choice4",
391         "Choice4",
392         &asn_OP_CHOICE,
393         asn_DEF_Choice4_tags_1,
394         sizeof(asn_DEF_Choice4_tags_1)
395                 /sizeof(asn_DEF_Choice4_tags_1[0]) - 1, /* 1 */
396         asn_DEF_Choice4_tags_1, /* Same as above */
397         sizeof(asn_DEF_Choice4_tags_1)
398                 /sizeof(asn_DEF_Choice4_tags_1[0]), /* 2 */
399         { 0, 0, CHOICE_constraint },
400         asn_MBR_Choice2_1,
401         4,      /* Elements count */
402         &asn_SPC_Choice2_specs_1        /* Additional specs */
403 };
404
405
406 /*** <<< INCLUDES [Choice5] >>> ***/
407
408 #include "Choice2.h"
409
410 /*** <<< TYPE-DECLS [Choice5] >>> ***/
411
412 typedef Choice2_t        Choice5_t;
413
414 /*** <<< FUNC-DECLS [Choice5] >>> ***/
415
416 extern asn_TYPE_descriptor_t asn_DEF_Choice5;
417 asn_struct_free_f Choice5_free;
418 asn_struct_print_f Choice5_print;
419 asn_constr_check_f Choice5_constraint;
420 ber_type_decoder_f Choice5_decode_ber;
421 der_type_encoder_f Choice5_encode_der;
422 xer_type_decoder_f Choice5_decode_xer;
423 xer_type_encoder_f Choice5_encode_xer;
424
425 /*** <<< CODE [Choice5] >>> ***/
426
427 /*
428  * This type is implemented using Choice2,
429  * so here we adjust the DEF accordingly.
430  */
431
432 /*** <<< STAT-DEFS [Choice5] >>> ***/
433
434 static const ber_tlv_tag_t asn_DEF_Choice5_tags_1[] = {
435         (ASN_TAG_CLASS_CONTEXT | (2 << 2))
436 };
437 asn_TYPE_descriptor_t asn_DEF_Choice5 = {
438         "Choice5",
439         "Choice5",
440         &asn_OP_CHOICE,
441         asn_DEF_Choice5_tags_1,
442         sizeof(asn_DEF_Choice5_tags_1)
443                 /sizeof(asn_DEF_Choice5_tags_1[0]), /* 1 */
444         asn_DEF_Choice5_tags_1, /* Same as above */
445         sizeof(asn_DEF_Choice5_tags_1)
446                 /sizeof(asn_DEF_Choice5_tags_1[0]), /* 1 */
447         { 0, 0, CHOICE_constraint },
448         asn_MBR_Choice2_1,
449         4,      /* Elements count */
450         &asn_SPC_Choice2_specs_1        /* Additional specs */
451 };
452
453
454 /*** <<< INCLUDES [Choice6] >>> ***/
455
456 #include "Choice1.h"
457
458 /*** <<< TYPE-DECLS [Choice6] >>> ***/
459
460 typedef Choice1_t        Choice6_t;
461
462 /*** <<< FUNC-DECLS [Choice6] >>> ***/
463
464 extern asn_TYPE_descriptor_t asn_DEF_Choice6;
465 asn_struct_free_f Choice6_free;
466 asn_struct_print_f Choice6_print;
467 asn_constr_check_f Choice6_constraint;
468 ber_type_decoder_f Choice6_decode_ber;
469 der_type_encoder_f Choice6_encode_der;
470 xer_type_decoder_f Choice6_decode_xer;
471 xer_type_encoder_f Choice6_encode_xer;
472
473 /*** <<< CODE [Choice6] >>> ***/
474
475 /*
476  * This type is implemented using Choice1,
477  * so here we adjust the DEF accordingly.
478  */
479
480 /*** <<< STAT-DEFS [Choice6] >>> ***/
481
482 asn_TYPE_descriptor_t asn_DEF_Choice6 = {
483         "Choice6",
484         "Choice6",
485         &asn_OP_CHOICE,
486         0,      /* No effective tags (pointer) */
487         0,      /* No effective tags (count) */
488         0,      /* No tags (pointer) */
489         0,      /* No tags (count) */
490         { 0, 0, CHOICE_constraint },
491         asn_MBR_Choice1_1,
492         2,      /* Elements count */
493         &asn_SPC_Choice1_specs_1        /* Additional specs */
494 };
495