NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / tests / tests-asn1c-compiler / 95-choice-per-order-OK.asn1.-Pfwide-types
1
2 /*** <<< INCLUDES [Choice] >>> ***/
3
4 #include <RELATIVE-OID.h>
5 #include <BIT_STRING.h>
6 #include <BOOLEAN.h>
7 #include <NULL.h>
8 #include <INTEGER.h>
9 #include <constr_CHOICE.h>
10
11 /*** <<< DEPS [Choice] >>> ***/
12
13 typedef enum Choice_PR {
14         Choice_PR_NOTHING,      /* No components present */
15         Choice_PR_roid,
16         Choice_PR_bitstr,
17         Choice_PR_ch,
18         /* Extensions may appear below */
19         Choice_PR_bool
20 } Choice_PR;
21 typedef enum ch_PR {
22         ch_PR_NOTHING,  /* No components present */
23         ch_PR_null,
24         ch_PR_int
25 } ch_PR;
26
27 /*** <<< TYPE-DECLS [Choice] >>> ***/
28
29 typedef struct Choice {
30         Choice_PR present;
31         union Choice_u {
32                 RELATIVE_OID_t   roid;
33                 BIT_STRING_t     bitstr;
34                 struct ch {
35                         ch_PR present;
36                         union Choice__ch_u {
37                                 NULL_t   null;
38                                 INTEGER_t        Int;
39                         } choice;
40                         
41                         /* Context for parsing across buffer boundaries */
42                         asn_struct_ctx_t _asn_ctx;
43                 } ch;
44                 /*
45                  * This type is extensible,
46                  * possible extensions are below.
47                  */
48                 BOOLEAN_t        Bool;
49         } choice;
50         
51         /* Context for parsing across buffer boundaries */
52         asn_struct_ctx_t _asn_ctx;
53 } Choice_t;
54
55 /*** <<< FUNC-DECLS [Choice] >>> ***/
56
57 extern asn_TYPE_descriptor_t asn_DEF_Choice;
58
59 /*** <<< STAT-DEFS [Choice] >>> ***/
60
61 static asn_TYPE_member_t asn_MBR_ch_4[] = {
62         { ATF_NOFLAGS, 0, offsetof(struct ch, choice.null),
63                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)),
64                 .tag_mode = 0,
65                 .type = &asn_DEF_NULL,
66                 .type_selector = 0,
67                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
68                 0, 0, /* No default value */
69                 .name = "null"
70                 },
71         { ATF_NOFLAGS, 0, offsetof(struct ch, choice.Int),
72                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
73                 .tag_mode = 0,
74                 .type = &asn_DEF_INTEGER,
75                 .type_selector = 0,
76                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
77                 0, 0, /* No default value */
78                 .name = "int"
79                 },
80 };
81 static const asn_TYPE_tag2member_t asn_MAP_ch_tag2el_4[] = {
82     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* int */
83     { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 0, 0, 0 } /* null */
84 };
85 static asn_CHOICE_specifics_t asn_SPC_ch_specs_4 = {
86         sizeof(struct ch),
87         offsetof(struct ch, _asn_ctx),
88         offsetof(struct ch, present),
89         sizeof(((struct ch *)0)->present),
90         .tag2el = asn_MAP_ch_tag2el_4,
91         .tag2el_count = 2,      /* Count of tags in the map */
92         0, 0,
93         .first_extension = -1   /* Extensions start */
94 };
95 static /* Use -fall-defs-global to expose */
96 asn_TYPE_descriptor_t asn_DEF_ch_4 = {
97         "ch",
98         "ch",
99         &asn_OP_CHOICE,
100         0,      /* No effective tags (pointer) */
101         0,      /* No effective tags (count) */
102         0,      /* No tags (pointer) */
103         0,      /* No tags (count) */
104         { 0, 0, CHOICE_constraint },
105         asn_MBR_ch_4,
106         2,      /* Elements count */
107         &asn_SPC_ch_specs_4     /* Additional specs */
108 };
109
110 static asn_TYPE_member_t asn_MBR_Choice_1[] = {
111         { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.roid),
112                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)),
113                 .tag_mode = 0,
114                 .type = &asn_DEF_RELATIVE_OID,
115                 .type_selector = 0,
116                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
117                 0, 0, /* No default value */
118                 .name = "roid"
119                 },
120         { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.bitstr),
121                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)),
122                 .tag_mode = 0,
123                 .type = &asn_DEF_BIT_STRING,
124                 .type_selector = 0,
125                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
126                 0, 0, /* No default value */
127                 .name = "bitstr"
128                 },
129         { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ch),
130                 .tag = -1 /* Ambiguous tag (CHOICE?) */,
131                 .tag_mode = 0,
132                 .type = &asn_DEF_ch_4,
133                 .type_selector = 0,
134                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
135                 0, 0, /* No default value */
136                 .name = "ch"
137                 },
138         { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.Bool),
139                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
140                 .tag_mode = 0,
141                 .type = &asn_DEF_BOOLEAN,
142                 .type_selector = 0,
143                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
144                 0, 0, /* No default value */
145                 .name = "bool"
146                 },
147 };
148 static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = {
149     { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */
150     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, 0, 0 }, /* int */
151     { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 1, 0, 0 }, /* bitstr */
152     { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 2, 0, 0 }, /* null */
153     { (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), 0, 0, 0 } /* roid */
154 };
155 static asn_CHOICE_specifics_t asn_SPC_Choice_specs_1 = {
156         sizeof(struct Choice),
157         offsetof(struct Choice, _asn_ctx),
158         offsetof(struct Choice, present),
159         sizeof(((struct Choice *)0)->present),
160         .tag2el = asn_MAP_Choice_tag2el_1,
161         .tag2el_count = 5,      /* Count of tags in the map */
162         0, 0,
163         .first_extension = 3    /* Extensions start */
164 };
165 asn_TYPE_descriptor_t asn_DEF_Choice = {
166         "Choice",
167         "Choice",
168         &asn_OP_CHOICE,
169         0,      /* No effective tags (pointer) */
170         0,      /* No effective tags (count) */
171         0,      /* No tags (pointer) */
172         0,      /* No tags (count) */
173         { 0, 0, CHOICE_constraint },
174         asn_MBR_Choice_1,
175         4,      /* Elements count */
176         &asn_SPC_Choice_specs_1 /* Additional specs */
177 };
178
179
180 /*** <<< INCLUDES [Choice2] >>> ***/
181
182 #include <BIT_STRING.h>
183 #include <RELATIVE-OID.h>
184 #include <constr_CHOICE.h>
185
186 /*** <<< DEPS [Choice2] >>> ***/
187
188 typedef enum Choice2_PR {
189         Choice2_PR_NOTHING,     /* No components present */
190         Choice2_PR_bitstr,
191         Choice2_PR_roid
192 } Choice2_PR;
193
194 /*** <<< TYPE-DECLS [Choice2] >>> ***/
195
196 typedef struct Choice2 {
197         Choice2_PR present;
198         union Choice2_u {
199                 BIT_STRING_t     bitstr;
200                 RELATIVE_OID_t   roid;
201         } choice;
202         
203         /* Context for parsing across buffer boundaries */
204         asn_struct_ctx_t _asn_ctx;
205 } Choice2_t;
206
207 /*** <<< FUNC-DECLS [Choice2] >>> ***/
208
209 extern asn_TYPE_descriptor_t asn_DEF_Choice2;
210
211 /*** <<< STAT-DEFS [Choice2] >>> ***/
212
213 static asn_TYPE_member_t asn_MBR_Choice2_1[] = {
214         { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.bitstr),
215                 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
216                 .tag_mode = +1, /* EXPLICIT tag at current level */
217                 .type = &asn_DEF_BIT_STRING,
218                 .type_selector = 0,
219                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
220                 0, 0, /* No default value */
221                 .name = "bitstr"
222                 },
223         { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.roid),
224                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
225                 .tag_mode = +1, /* EXPLICIT tag at current level */
226                 .type = &asn_DEF_RELATIVE_OID,
227                 .type_selector = 0,
228                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
229                 0, 0, /* No default value */
230                 .name = "roid"
231                 },
232 };
233 static const asn_TYPE_tag2member_t asn_MAP_Choice2_tag2el_1[] = {
234     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bitstr */
235     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* roid */
236 };
237 static asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = {
238         sizeof(struct Choice2),
239         offsetof(struct Choice2, _asn_ctx),
240         offsetof(struct Choice2, present),
241         sizeof(((struct Choice2 *)0)->present),
242         .tag2el = asn_MAP_Choice2_tag2el_1,
243         .tag2el_count = 2,      /* Count of tags in the map */
244         0, 0,
245         .first_extension = -1   /* Extensions start */
246 };
247 asn_TYPE_descriptor_t asn_DEF_Choice2 = {
248         "Choice2",
249         "Choice2",
250         &asn_OP_CHOICE,
251         0,      /* No effective tags (pointer) */
252         0,      /* No effective tags (count) */
253         0,      /* No tags (pointer) */
254         0,      /* No tags (count) */
255         { 0, 0, CHOICE_constraint },
256         asn_MBR_Choice2_1,
257         2,      /* Elements count */
258         &asn_SPC_Choice2_specs_1        /* Additional specs */
259 };
260