fc39f3312adefddf1301b7db3fb915106e00e04d
[com/asn1c.git] / tests / tests-asn1c-compiler / 31-set-of-OK.asn1.-Pfcompound-names
1
2 /*** <<< INCLUDES [Forest] >>> ***/
3
4 #include <asn_SET_OF.h>
5 #include <constr_SET_OF.h>
6
7 /*** <<< FWD-DECLS [Forest] >>> ***/
8
9 struct Tree;
10
11 /*** <<< TYPE-DECLS [Forest] >>> ***/
12
13 typedef struct Forest {
14         A_SET_OF(struct Tree) list;
15         
16         /* Context for parsing across buffer boundaries */
17         asn_struct_ctx_t _asn_ctx;
18 } Forest_t;
19
20 /*** <<< FUNC-DECLS [Forest] >>> ***/
21
22 extern asn_TYPE_descriptor_t asn_DEF_Forest;
23 extern asn_SET_OF_specifics_t asn_SPC_Forest_specs_1;
24 extern asn_TYPE_member_t asn_MBR_Forest_1[1];
25
26 /*** <<< POST-INCLUDE [Forest] >>> ***/
27
28 #include "Tree.h"
29
30 /*** <<< STAT-DEFS [Forest] >>> ***/
31
32 asn_TYPE_member_t asn_MBR_Forest_1[] = {
33         { ATF_POINTER, 0, 0,
34                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
35                 .tag_mode = 0,
36                 .type = &asn_DEF_Tree,
37                 .type_selector = 0,
38                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
39                 0, 0, /* No default value */
40                 .name = ""
41                 },
42 };
43 static const ber_tlv_tag_t asn_DEF_Forest_tags_1[] = {
44         (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
45 };
46 asn_SET_OF_specifics_t asn_SPC_Forest_specs_1 = {
47         sizeof(struct Forest),
48         offsetof(struct Forest, _asn_ctx),
49         0,      /* XER encoding is XMLDelimitedItemList */
50 };
51 asn_TYPE_descriptor_t asn_DEF_Forest = {
52         "Forest",
53         "Forest",
54         &asn_OP_SET_OF,
55         asn_DEF_Forest_tags_1,
56         sizeof(asn_DEF_Forest_tags_1)
57                 /sizeof(asn_DEF_Forest_tags_1[0]), /* 1 */
58         asn_DEF_Forest_tags_1,  /* Same as above */
59         sizeof(asn_DEF_Forest_tags_1)
60                 /sizeof(asn_DEF_Forest_tags_1[0]), /* 1 */
61         { 0, 0, SET_OF_constraint },
62         asn_MBR_Forest_1,
63         1,      /* Single element */
64         &asn_SPC_Forest_specs_1 /* Additional specs */
65 };
66
67
68 /*** <<< INCLUDES [Tree] >>> ***/
69
70 #include <NativeInteger.h>
71 #include <constr_SEQUENCE.h>
72
73 /*** <<< TYPE-DECLS [Tree] >>> ***/
74
75 typedef struct Tree {
76         long     height;
77         long     width;
78         
79         /* Context for parsing across buffer boundaries */
80         asn_struct_ctx_t _asn_ctx;
81 } Tree_t;
82
83 /*** <<< FUNC-DECLS [Tree] >>> ***/
84
85 extern asn_TYPE_descriptor_t asn_DEF_Tree;
86 extern asn_SEQUENCE_specifics_t asn_SPC_Tree_specs_1;
87 extern asn_TYPE_member_t asn_MBR_Tree_1[2];
88
89 /*** <<< STAT-DEFS [Tree] >>> ***/
90
91 asn_TYPE_member_t asn_MBR_Tree_1[] = {
92         { ATF_NOFLAGS, 0, offsetof(struct Tree, height),
93                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
94                 .tag_mode = 0,
95                 .type = &asn_DEF_NativeInteger,
96                 .type_selector = 0,
97                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
98                 0, 0, /* No default value */
99                 .name = "height"
100                 },
101         { ATF_NOFLAGS, 0, offsetof(struct Tree, width),
102                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
103                 .tag_mode = 0,
104                 .type = &asn_DEF_NativeInteger,
105                 .type_selector = 0,
106                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
107                 0, 0, /* No default value */
108                 .name = "width"
109                 },
110 };
111 static const ber_tlv_tag_t asn_DEF_Tree_tags_1[] = {
112         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
113 };
114 static const asn_TYPE_tag2member_t asn_MAP_Tree_tag2el_1[] = {
115     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* height */
116     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* width */
117 };
118 asn_SEQUENCE_specifics_t asn_SPC_Tree_specs_1 = {
119         sizeof(struct Tree),
120         offsetof(struct Tree, _asn_ctx),
121         .tag2el = asn_MAP_Tree_tag2el_1,
122         .tag2el_count = 2,      /* Count of tags in the map */
123         0, 0, 0,        /* Optional elements (not needed) */
124         -1,     /* First extension addition */
125 };
126 asn_TYPE_descriptor_t asn_DEF_Tree = {
127         "Tree",
128         "Tree",
129         &asn_OP_SEQUENCE,
130         asn_DEF_Tree_tags_1,
131         sizeof(asn_DEF_Tree_tags_1)
132                 /sizeof(asn_DEF_Tree_tags_1[0]), /* 1 */
133         asn_DEF_Tree_tags_1,    /* Same as above */
134         sizeof(asn_DEF_Tree_tags_1)
135                 /sizeof(asn_DEF_Tree_tags_1[0]), /* 1 */
136         { 0, 0, SEQUENCE_constraint },
137         asn_MBR_Tree_1,
138         2,      /* Elements count */
139         &asn_SPC_Tree_specs_1   /* Additional specs */
140 };
141
142
143 /*** <<< INCLUDES [Stuff] >>> ***/
144
145 #include <asn_SET_OF.h>
146 #include <constr_SET_OF.h>
147 #include <BIT_STRING.h>
148 #include <constr_SEQUENCE.h>
149 #include <NativeInteger.h>
150 #include <constr_CHOICE.h>
151 #include <constr_SET.h>
152
153 /*** <<< DEPS [Stuff] >>> ***/
154
155
156 /*
157  * Method of determining the components presence
158  */
159 typedef enum Stuff_PR {
160         Stuff_PR_trees, /* Member trees is present */
161         Stuff_PR_anything,      /* Member anything is present */
162         Stuff_PR_other, /* Member other is present */
163 } Stuff_PR;
164 typedef enum Stuff__other_PR {
165         Stuff__other_PR_NOTHING,        /* No components present */
166         Stuff__other_PR_a,
167         Stuff__other_PR_b
168 } Stuff__other_PR;
169
170 /*** <<< FWD-DECLS [Stuff] >>> ***/
171
172 struct Forest;
173
174 /*** <<< FWD-DEFS [Stuff] >>> ***/
175
176 typedef struct Stuff__anything__Member {
177         BIT_STRING_t     cup_of_coffee;
178         /*
179          * This type is extensible,
180          * possible extensions are below.
181          */
182         
183         /* Context for parsing across buffer boundaries */
184         asn_struct_ctx_t _asn_ctx;
185 } Stuff__anything__Member;
186
187 /*** <<< TYPE-DECLS [Stuff] >>> ***/
188
189 typedef struct Stuff {
190         struct Stuff__trees {
191                 A_SET_OF(struct Forest) list;
192                 
193                 /* Context for parsing across buffer boundaries */
194                 asn_struct_ctx_t _asn_ctx;
195         } *trees;
196         struct Stuff__anything {
197                 A_SET_OF(Stuff__anything__Member) list;
198                 
199                 /* Context for parsing across buffer boundaries */
200                 asn_struct_ctx_t _asn_ctx;
201         } *anything;
202         /*
203          * This type is extensible,
204          * possible extensions are below.
205          */
206         struct Stuff__other {
207                 Stuff__other_PR present;
208                 union Stuff__other_u {
209                         long     a;
210                         long     b;
211                 } choice;
212                 
213                 /* Context for parsing across buffer boundaries */
214                 asn_struct_ctx_t _asn_ctx;
215         } *other;
216         
217         /* Presence bitmask: ASN_SET_ISPRESENT(pStuff, Stuff_PR_x) */
218         unsigned int _presence_map
219                 [((3+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
220         
221         /* Context for parsing across buffer boundaries */
222         asn_struct_ctx_t _asn_ctx;
223 } Stuff_t;
224
225 /*** <<< FUNC-DECLS [Stuff] >>> ***/
226
227 extern asn_TYPE_descriptor_t asn_DEF_Stuff;
228
229 /*** <<< POST-INCLUDE [Stuff] >>> ***/
230
231 #include "Forest.h"
232
233 /*** <<< STAT-DEFS [Stuff] >>> ***/
234
235 static asn_TYPE_member_t asn_MBR_trees_2[] = {
236         { ATF_POINTER, 0, 0,
237                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
238                 .tag_mode = 0,
239                 .type = &asn_DEF_Forest,
240                 .type_selector = 0,
241                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
242                 0, 0, /* No default value */
243                 .name = ""
244                 },
245 };
246 static const ber_tlv_tag_t asn_DEF_trees_tags_2[] = {
247         (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
248         (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
249 };
250 static asn_SET_OF_specifics_t asn_SPC_trees_specs_2 = {
251         sizeof(struct Stuff__trees),
252         offsetof(struct Stuff__trees, _asn_ctx),
253         0,      /* XER encoding is XMLDelimitedItemList */
254 };
255 static /* Use -fall-defs-global to expose */
256 asn_TYPE_descriptor_t asn_DEF_trees_2 = {
257         "trees",
258         "trees",
259         &asn_OP_SET_OF,
260         asn_DEF_trees_tags_2,
261         sizeof(asn_DEF_trees_tags_2)
262                 /sizeof(asn_DEF_trees_tags_2[0]) - 1, /* 1 */
263         asn_DEF_trees_tags_2,   /* Same as above */
264         sizeof(asn_DEF_trees_tags_2)
265                 /sizeof(asn_DEF_trees_tags_2[0]), /* 2 */
266         { 0, 0, SET_OF_constraint },
267         asn_MBR_trees_2,
268         1,      /* Single element */
269         &asn_SPC_trees_specs_2  /* Additional specs */
270 };
271
272 static asn_TYPE_member_t asn_MBR_Member_5[] = {
273         { ATF_NOFLAGS, 0, offsetof(struct Stuff__anything__Member, cup_of_coffee),
274                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)),
275                 .tag_mode = 0,
276                 .type = &asn_DEF_BIT_STRING,
277                 .type_selector = 0,
278                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
279                 0, 0, /* No default value */
280                 .name = "cup-of-coffee"
281                 },
282 };
283 static const ber_tlv_tag_t asn_DEF_Member_tags_5[] = {
284         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
285 };
286 static const asn_TYPE_tag2member_t asn_MAP_Member_tag2el_5[] = {
287     { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* cup-of-coffee */
288 };
289 static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_5 = {
290         sizeof(struct Stuff__anything__Member),
291         offsetof(struct Stuff__anything__Member, _asn_ctx),
292         .tag2el = asn_MAP_Member_tag2el_5,
293         .tag2el_count = 1,      /* Count of tags in the map */
294         0, 0, 0,        /* Optional elements (not needed) */
295         1,      /* First extension addition */
296 };
297 static /* Use -fall-defs-global to expose */
298 asn_TYPE_descriptor_t asn_DEF_Member_5 = {
299         "SEQUENCE",
300         "SEQUENCE",
301         &asn_OP_SEQUENCE,
302         asn_DEF_Member_tags_5,
303         sizeof(asn_DEF_Member_tags_5)
304                 /sizeof(asn_DEF_Member_tags_5[0]), /* 1 */
305         asn_DEF_Member_tags_5,  /* Same as above */
306         sizeof(asn_DEF_Member_tags_5)
307                 /sizeof(asn_DEF_Member_tags_5[0]), /* 1 */
308         { 0, 0, SEQUENCE_constraint },
309         asn_MBR_Member_5,
310         1,      /* Elements count */
311         &asn_SPC_Member_specs_5 /* Additional specs */
312 };
313
314 static asn_TYPE_member_t asn_MBR_anything_4[] = {
315         { ATF_POINTER, 0, 0,
316                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
317                 .tag_mode = 0,
318                 .type = &asn_DEF_Member_5,
319                 .type_selector = 0,
320                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
321                 0, 0, /* No default value */
322                 .name = ""
323                 },
324 };
325 static const ber_tlv_tag_t asn_DEF_anything_tags_4[] = {
326         (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
327         (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
328 };
329 static asn_SET_OF_specifics_t asn_SPC_anything_specs_4 = {
330         sizeof(struct Stuff__anything),
331         offsetof(struct Stuff__anything, _asn_ctx),
332         0,      /* XER encoding is XMLDelimitedItemList */
333 };
334 static /* Use -fall-defs-global to expose */
335 asn_TYPE_descriptor_t asn_DEF_anything_4 = {
336         "anything",
337         "anything",
338         &asn_OP_SET_OF,
339         asn_DEF_anything_tags_4,
340         sizeof(asn_DEF_anything_tags_4)
341                 /sizeof(asn_DEF_anything_tags_4[0]) - 1, /* 1 */
342         asn_DEF_anything_tags_4,        /* Same as above */
343         sizeof(asn_DEF_anything_tags_4)
344                 /sizeof(asn_DEF_anything_tags_4[0]), /* 2 */
345         { 0, 0, SET_OF_constraint },
346         asn_MBR_anything_4,
347         1,      /* Single element */
348         &asn_SPC_anything_specs_4       /* Additional specs */
349 };
350
351 static asn_TYPE_member_t asn_MBR_other_9[] = {
352         { ATF_NOFLAGS, 0, offsetof(struct Stuff__other, choice.a),
353                 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
354                 .tag_mode = -1, /* IMPLICIT tag at current level */
355                 .type = &asn_DEF_NativeInteger,
356                 .type_selector = 0,
357                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
358                 0, 0, /* No default value */
359                 .name = "a"
360                 },
361         { ATF_NOFLAGS, 0, offsetof(struct Stuff__other, choice.b),
362                 .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
363                 .tag_mode = -1, /* IMPLICIT tag at current level */
364                 .type = &asn_DEF_NativeInteger,
365                 .type_selector = 0,
366                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
367                 0, 0, /* No default value */
368                 .name = "b"
369                 },
370 };
371 static const asn_TYPE_tag2member_t asn_MAP_other_tag2el_9[] = {
372     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */
373     { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 } /* b */
374 };
375 static asn_CHOICE_specifics_t asn_SPC_other_specs_9 = {
376         sizeof(struct Stuff__other),
377         offsetof(struct Stuff__other, _asn_ctx),
378         offsetof(struct Stuff__other, present),
379         sizeof(((struct Stuff__other *)0)->present),
380         .tag2el = asn_MAP_other_tag2el_9,
381         .tag2el_count = 2,      /* Count of tags in the map */
382         0, 0,
383         .first_extension = -1   /* Extensions start */
384 };
385 static /* Use -fall-defs-global to expose */
386 asn_TYPE_descriptor_t asn_DEF_other_9 = {
387         "other",
388         "other",
389         &asn_OP_CHOICE,
390         0,      /* No effective tags (pointer) */
391         0,      /* No effective tags (count) */
392         0,      /* No tags (pointer) */
393         0,      /* No tags (count) */
394         { 0, 0, CHOICE_constraint },
395         asn_MBR_other_9,
396         2,      /* Elements count */
397         &asn_SPC_other_specs_9  /* Additional specs */
398 };
399
400 static asn_TYPE_member_t asn_MBR_Stuff_1[] = {
401         { ATF_POINTER, 3, offsetof(struct Stuff, trees),
402                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
403                 .tag_mode = 0,
404                 .type = &asn_DEF_trees_2,
405                 .type_selector = 0,
406                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
407                 0, 0, /* No default value */
408                 .name = "trees"
409                 },
410         { ATF_POINTER, 2, offsetof(struct Stuff, anything),
411                 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
412                 .tag_mode = 0,
413                 .type = &asn_DEF_anything_4,
414                 .type_selector = 0,
415                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
416                 0, 0, /* No default value */
417                 .name = "anything"
418                 },
419         { ATF_POINTER, 1, offsetof(struct Stuff, other),
420                 .tag = -1 /* Ambiguous tag (CHOICE?) */,
421                 .tag_mode = 0,
422                 .type = &asn_DEF_other_9,
423                 .type_selector = 0,
424                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
425                 0, 0, /* No default value */
426                 .name = "other"
427                 },
428 };
429 static const ber_tlv_tag_t asn_DEF_Stuff_tags_1[] = {
430         (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
431 };
432 static const asn_TYPE_tag2member_t asn_MAP_Stuff_tag2el_1[] = {
433     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* a */
434     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* trees */
435     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* anything */
436     { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 } /* b */
437 };
438 static const asn_TYPE_tag2member_t asn_MAP_Stuff_tag2el_cxer_1[] = {
439     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* trees */
440     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* anything */
441     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 } /* a */
442 };
443 static const uint8_t asn_MAP_Stuff_mmap_1[(3 + (8 * sizeof(unsigned int)) - 1) / 8] = {
444         (0 << 7) | (0 << 6) | (0 << 5)
445 };
446 static 
447 asn_SET_specifics_t asn_SPC_Stuff_specs_1 = {
448         sizeof(struct Stuff),
449         offsetof(struct Stuff, _asn_ctx),
450         offsetof(struct Stuff, _presence_map),
451         .tag2el = asn_MAP_Stuff_tag2el_1,
452         .tag2el_count = 4,      /* Count of tags in the map */
453         asn_MAP_Stuff_tag2el_cxer_1,
454         3,      /* Count of tags in the CXER map */
455         1,      /* Whether extensible */
456         (const unsigned int *)asn_MAP_Stuff_mmap_1      /* Mandatory elements map */
457 };
458 asn_TYPE_descriptor_t asn_DEF_Stuff = {
459         "Stuff",
460         "Stuff",
461         &asn_OP_SET,
462         asn_DEF_Stuff_tags_1,
463         sizeof(asn_DEF_Stuff_tags_1)
464                 /sizeof(asn_DEF_Stuff_tags_1[0]), /* 1 */
465         asn_DEF_Stuff_tags_1,   /* Same as above */
466         sizeof(asn_DEF_Stuff_tags_1)
467                 /sizeof(asn_DEF_Stuff_tags_1[0]), /* 1 */
468         { 0, 0, SET_constraint },
469         asn_MBR_Stuff_1,
470         3,      /* Elements count */
471         &asn_SPC_Stuff_specs_1  /* Additional specs */
472 };
473