NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / tests / tests-asn1c-compiler / 93-asn1c-controls-OK.asn1.-Pfwide-types
1
2 /*** <<< INCLUDES [Sequence] >>> ***/
3
4 #include <INTEGER.h>
5 #include <constr_SEQUENCE.h>
6
7 /*** <<< TYPE-DECLS [Sequence] >>> ***/
8
9 typedef struct Sequence {
10         INTEGER_t        ainl;
11         INTEGER_t       *aptr;
12         
13         /* Context for parsing across buffer boundaries */
14         asn_struct_ctx_t _asn_ctx;
15 } Sequence_t;
16
17 /*** <<< FUNC-DECLS [Sequence] >>> ***/
18
19 extern asn_TYPE_descriptor_t asn_DEF_Sequence;
20 extern asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1;
21 extern asn_TYPE_member_t asn_MBR_Sequence_1[2];
22
23 /*** <<< STAT-DEFS [Sequence] >>> ***/
24
25 asn_TYPE_member_t asn_MBR_Sequence_1[] = {
26         { ATF_NOFLAGS, 0, offsetof(struct Sequence, ainl),
27                 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
28                 .tag_mode = -1, /* IMPLICIT tag at current level */
29                 .type = &asn_DEF_INTEGER,
30                 .type_selector = 0,
31                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
32                 0, 0, /* No default value */
33                 .name = "ainl"
34                 },
35         { ATF_POINTER, 0, offsetof(struct Sequence, aptr),
36                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
37                 .tag_mode = -1, /* IMPLICIT tag at current level */
38                 .type = &asn_DEF_INTEGER,
39                 .type_selector = 0,
40                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
41                 0, 0, /* No default value */
42                 .name = "aptr"
43                 },
44 };
45 static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = {
46         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
47 };
48 static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = {
49     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ainl */
50     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* aptr */
51 };
52 asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = {
53         sizeof(struct Sequence),
54         offsetof(struct Sequence, _asn_ctx),
55         .tag2el = asn_MAP_Sequence_tag2el_1,
56         .tag2el_count = 2,      /* Count of tags in the map */
57         0, 0, 0,        /* Optional elements (not needed) */
58         -1,     /* First extension addition */
59 };
60 asn_TYPE_descriptor_t asn_DEF_Sequence = {
61         "Sequence",
62         "Sequence",
63         &asn_OP_SEQUENCE,
64         asn_DEF_Sequence_tags_1,
65         sizeof(asn_DEF_Sequence_tags_1)
66                 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
67         asn_DEF_Sequence_tags_1,        /* Same as above */
68         sizeof(asn_DEF_Sequence_tags_1)
69                 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
70         { 0, 0, SEQUENCE_constraint },
71         asn_MBR_Sequence_1,
72         2,      /* Elements count */
73         &asn_SPC_Sequence_specs_1       /* Additional specs */
74 };
75
76
77 /*** <<< INCLUDES [Set] >>> ***/
78
79 #include "Sequence.h"
80 #include <constr_SET.h>
81
82 /*** <<< DEPS [Set] >>> ***/
83
84
85 /*
86  * Method of determining the components presence
87  */
88 typedef enum Set_PR {
89         Set_PR_ainl,    /* Member ainl is present */
90         Set_PR_aptr,    /* Member aptr is present */
91 } Set_PR;
92
93 /*** <<< FWD-DECLS [Set] >>> ***/
94
95 struct Sequence;
96
97 /*** <<< TYPE-DECLS [Set] >>> ***/
98
99 typedef struct Set {
100         Sequence_t       ainl;
101         struct Sequence *aptr;
102         
103         /* Presence bitmask: ASN_SET_ISPRESENT(pSet, Set_PR_x) */
104         unsigned int _presence_map
105                 [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
106         
107         /* Context for parsing across buffer boundaries */
108         asn_struct_ctx_t _asn_ctx;
109 } Set_t;
110
111 /*** <<< FUNC-DECLS [Set] >>> ***/
112
113 extern asn_TYPE_descriptor_t asn_DEF_Set;
114
115 /*** <<< POST-INCLUDE [Set] >>> ***/
116
117 #include "Sequence.h"
118
119 /*** <<< STAT-DEFS [Set] >>> ***/
120
121 static asn_TYPE_member_t asn_MBR_Set_1[] = {
122         { ATF_NOFLAGS, 0, offsetof(struct Set, ainl),
123                 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
124                 .tag_mode = -1, /* IMPLICIT tag at current level */
125                 .type = &asn_DEF_Sequence,
126                 .type_selector = 0,
127                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
128                 0, 0, /* No default value */
129                 .name = "ainl"
130                 },
131         { ATF_POINTER, 0, offsetof(struct Set, aptr),
132                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
133                 .tag_mode = -1, /* IMPLICIT tag at current level */
134                 .type = &asn_DEF_Sequence,
135                 .type_selector = 0,
136                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
137                 0, 0, /* No default value */
138                 .name = "aptr"
139                 },
140 };
141 static const ber_tlv_tag_t asn_DEF_Set_tags_1[] = {
142         (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
143 };
144 static const asn_TYPE_tag2member_t asn_MAP_Set_tag2el_1[] = {
145     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ainl */
146     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* aptr */
147 };
148 static const uint8_t asn_MAP_Set_mmap_1[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = {
149         (1 << 7) | (1 << 6)
150 };
151 static 
152 asn_SET_specifics_t asn_SPC_Set_specs_1 = {
153         sizeof(struct Set),
154         offsetof(struct Set, _asn_ctx),
155         offsetof(struct Set, _presence_map),
156         .tag2el = asn_MAP_Set_tag2el_1,
157         .tag2el_count = 2,      /* Count of tags in the map */
158         asn_MAP_Set_tag2el_1,   /* Same as above */
159         2,      /* Count of tags in the CXER map */
160         0,      /* Whether extensible */
161         (const unsigned int *)asn_MAP_Set_mmap_1        /* Mandatory elements map */
162 };
163 asn_TYPE_descriptor_t asn_DEF_Set = {
164         "Set",
165         "Set",
166         &asn_OP_SET,
167         asn_DEF_Set_tags_1,
168         sizeof(asn_DEF_Set_tags_1)
169                 /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */
170         asn_DEF_Set_tags_1,     /* Same as above */
171         sizeof(asn_DEF_Set_tags_1)
172                 /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */
173         { 0, 0, SET_constraint },
174         asn_MBR_Set_1,
175         2,      /* Elements count */
176         &asn_SPC_Set_specs_1    /* Additional specs */
177 };
178
179
180 /*** <<< INCLUDES [Choice] >>> ***/
181
182 #include "Sequence.h"
183 #include <INTEGER.h>
184 #include <asn_SET_OF.h>
185 #include <constr_SET_OF.h>
186 #include <constr_CHOICE.h>
187
188 /*** <<< DEPS [Choice] >>> ***/
189
190 typedef enum Choice_PR {
191         Choice_PR_NOTHING,      /* No components present */
192         Choice_PR_setof,
193         Choice_PR_aptr,
194         Choice_PR_ainl
195 } Choice_PR;
196
197 /*** <<< FWD-DECLS [Choice] >>> ***/
198
199 struct Sequence;
200
201 /*** <<< TYPE-DECLS [Choice] >>> ***/
202
203 typedef struct Choice {
204         Choice_PR present;
205         union Choice_u {
206                 struct setof {
207                         A_SET_OF(INTEGER_t) list;
208                         
209                         /* Context for parsing across buffer boundaries */
210                         asn_struct_ctx_t _asn_ctx;
211                 } *setof;
212                 struct Sequence *aptr;
213                 Sequence_t       ainl;
214         } choice;
215         
216         /* Context for parsing across buffer boundaries */
217         asn_struct_ctx_t _asn_ctx;
218 } Choice_t;
219
220 /*** <<< FUNC-DECLS [Choice] >>> ***/
221
222 extern asn_TYPE_descriptor_t asn_DEF_Choice;
223
224 /*** <<< POST-INCLUDE [Choice] >>> ***/
225
226 #include "Sequence.h"
227
228 /*** <<< STAT-DEFS [Choice] >>> ***/
229
230 static asn_TYPE_member_t asn_MBR_setof_2[] = {
231         { ATF_POINTER, 0, 0,
232                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
233                 .tag_mode = 0,
234                 .type = &asn_DEF_INTEGER,
235                 .type_selector = 0,
236                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
237                 0, 0, /* No default value */
238                 .name = ""
239                 },
240 };
241 static const ber_tlv_tag_t asn_DEF_setof_tags_2[] = {
242         (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
243         (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
244 };
245 static asn_SET_OF_specifics_t asn_SPC_setof_specs_2 = {
246         sizeof(struct setof),
247         offsetof(struct setof, _asn_ctx),
248         0,      /* XER encoding is XMLDelimitedItemList */
249 };
250 static /* Use -fall-defs-global to expose */
251 asn_TYPE_descriptor_t asn_DEF_setof_2 = {
252         "setof",
253         "setof",
254         &asn_OP_SET_OF,
255         asn_DEF_setof_tags_2,
256         sizeof(asn_DEF_setof_tags_2)
257                 /sizeof(asn_DEF_setof_tags_2[0]) - 1, /* 1 */
258         asn_DEF_setof_tags_2,   /* Same as above */
259         sizeof(asn_DEF_setof_tags_2)
260                 /sizeof(asn_DEF_setof_tags_2[0]), /* 2 */
261         { 0, 0, SET_OF_constraint },
262         asn_MBR_setof_2,
263         1,      /* Single element */
264         &asn_SPC_setof_specs_2  /* Additional specs */
265 };
266
267 static asn_TYPE_member_t asn_MBR_Choice_1[] = {
268         { ATF_POINTER, 0, offsetof(struct Choice, choice.setof),
269                 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
270                 .tag_mode = 0,
271                 .type = &asn_DEF_setof_2,
272                 .type_selector = 0,
273                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
274                 0, 0, /* No default value */
275                 .name = "setof"
276                 },
277         { ATF_POINTER, 0, offsetof(struct Choice, choice.aptr),
278                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
279                 .tag_mode = -1, /* IMPLICIT tag at current level */
280                 .type = &asn_DEF_Sequence,
281                 .type_selector = 0,
282                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
283                 0, 0, /* No default value */
284                 .name = "aptr"
285                 },
286         { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ainl),
287                 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
288                 .tag_mode = -1, /* IMPLICIT tag at current level */
289                 .type = &asn_DEF_Sequence,
290                 .type_selector = 0,
291                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
292                 0, 0, /* No default value */
293                 .name = "ainl"
294                 },
295 };
296 static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = {
297     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* setof */
298     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* aptr */
299     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ainl */
300 };
301 static asn_CHOICE_specifics_t asn_SPC_Choice_specs_1 = {
302         sizeof(struct Choice),
303         offsetof(struct Choice, _asn_ctx),
304         offsetof(struct Choice, present),
305         sizeof(((struct Choice *)0)->present),
306         .tag2el = asn_MAP_Choice_tag2el_1,
307         .tag2el_count = 3,      /* Count of tags in the map */
308         0, 0,
309         .first_extension = -1   /* Extensions start */
310 };
311 asn_TYPE_descriptor_t asn_DEF_Choice = {
312         "Choice",
313         "Choice",
314         &asn_OP_CHOICE,
315         0,      /* No effective tags (pointer) */
316         0,      /* No effective tags (count) */
317         0,      /* No tags (pointer) */
318         0,      /* No tags (count) */
319         { 0, 0, CHOICE_constraint },
320         asn_MBR_Choice_1,
321         3,      /* Elements count */
322         &asn_SPC_Choice_specs_1 /* Additional specs */
323 };
324