539d9d816028c8c9dd17d45b37c11a943966f4ca
[com/asn1c.git] / tests / tests-asn1c-compiler / 144-ios-parameterization-OK.asn1.-P
1
2 /*** <<< INCLUDES [Message] >>> ***/
3
4 #include "SpecializedContent.h"
5 #include <constr_SEQUENCE.h>
6
7 /*** <<< TYPE-DECLS [Message] >>> ***/
8
9 typedef struct Message {
10         RegionalExtension_t      content;
11         
12         /* Context for parsing across buffer boundaries */
13         asn_struct_ctx_t _asn_ctx;
14 } Message_t;
15
16 /*** <<< FUNC-DECLS [Message] >>> ***/
17
18 extern asn_TYPE_descriptor_t asn_DEF_Message;
19
20 /*** <<< STAT-DEFS [Message] >>> ***/
21
22 static asn_TYPE_member_t asn_MBR_Message_1[] = {
23         { ATF_NOFLAGS, 0, offsetof(struct Message, content),
24                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
25                 .tag_mode = 0,
26                 .type = &asn_DEF_RegionalExtension,
27                 .type_selector = 0,
28                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
29                 0, 0, /* No default value */
30                 .name = "content"
31                 },
32 };
33 static const ber_tlv_tag_t asn_DEF_Message_tags_1[] = {
34         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
35 };
36 static const asn_TYPE_tag2member_t asn_MAP_Message_tag2el_1[] = {
37     { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* content */
38 };
39 static asn_SEQUENCE_specifics_t asn_SPC_Message_specs_1 = {
40         sizeof(struct Message),
41         offsetof(struct Message, _asn_ctx),
42         .tag2el = asn_MAP_Message_tag2el_1,
43         .tag2el_count = 1,      /* Count of tags in the map */
44         0, 0, 0,        /* Optional elements (not needed) */
45         -1,     /* First extension addition */
46 };
47 asn_TYPE_descriptor_t asn_DEF_Message = {
48         "Message",
49         "Message",
50         &asn_OP_SEQUENCE,
51         asn_DEF_Message_tags_1,
52         sizeof(asn_DEF_Message_tags_1)
53                 /sizeof(asn_DEF_Message_tags_1[0]), /* 1 */
54         asn_DEF_Message_tags_1, /* Same as above */
55         sizeof(asn_DEF_Message_tags_1)
56                 /sizeof(asn_DEF_Message_tags_1[0]), /* 1 */
57         { 0, 0, SEQUENCE_constraint },
58         asn_MBR_Message_1,
59         1,      /* Elements count */
60         &asn_SPC_Message_specs_1        /* Additional specs */
61 };
62
63
64 /*** <<< INCLUDES [SpecializedContent] >>> ***/
65
66 #include <NativeInteger.h>
67 #include <ANY.h>
68 #include <asn_ioc.h>
69 #include <BOOLEAN.h>
70 #include <OPEN_TYPE.h>
71 #include <constr_CHOICE.h>
72 #include <constr_SEQUENCE.h>
73
74 /*** <<< DEPS [SpecializedContent] >>> ***/
75
76 typedef enum value_PR {
77         value_PR_NOTHING,       /* No components present */
78         value_PR_INTEGER,
79         value_PR_BOOLEAN
80 } value_PR;
81
82 /*** <<< TYPE-DECLS [SpecializedContent] >>> ***/
83
84 typedef struct RegionalExtension {
85         long     id;
86         struct value {
87                 value_PR present;
88                 union RegionalExtension__value_u {
89                         long     INTEGER;
90                         BOOLEAN_t        BOOLEAN;
91                 } choice;
92                 
93                 /* Context for parsing across buffer boundaries */
94                 asn_struct_ctx_t _asn_ctx;
95         } value;
96         
97         /* Context for parsing across buffer boundaries */
98         asn_struct_ctx_t _asn_ctx;
99 } RegionalExtension_t;
100
101 /*** <<< FUNC-DECLS [SpecializedContent] >>> ***/
102
103 extern asn_TYPE_descriptor_t asn_DEF_RegionalExtension;
104 extern asn_SEQUENCE_specifics_t asn_SPC_RegionalExtension_specs_1;
105 extern asn_TYPE_member_t asn_MBR_RegionalExtension_1[2];
106
107 /*** <<< IOC-TABLES [SpecializedContent] >>> ***/
108
109 static const long asn_VAL_1_1 = 1;
110 static const long asn_VAL_2_2 = 2;
111 static const asn_ioc_cell_t asn_IOS_RegionalExtension_1_rows[] = {
112         { "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_1_1 },
113         { "&Type", aioc__type, &asn_DEF_NativeInteger },
114         { "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_2_2 },
115         { "&Type", aioc__type, &asn_DEF_BOOLEAN }
116 };
117 static const asn_ioc_set_t asn_IOS_RegionalExtension_1[] = {
118         { 2, 2, asn_IOS_RegionalExtension_1_rows }
119 };
120
121 /*** <<< CODE [SpecializedContent] >>> ***/
122
123 static int
124 memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
125                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
126         
127         if(!sptr) {
128                 ASN__CTFAIL(app_key, td, sptr,
129                         "%s: value not given (%s:%d)",
130                         td->name, __FILE__, __LINE__);
131                 return -1;
132         }
133         
134         
135         if(1 /* No applicable constraints whatsoever */) {
136                 /* Nothing is here. See below */
137         }
138         
139         return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
140 }
141
142 static asn_type_selector_result_t
143 select_RegionalExtension_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) {
144         asn_type_selector_result_t result = {0, 0};
145         const asn_ioc_set_t *itable = asn_IOS_RegionalExtension_1;
146         size_t constraining_column = 0; /* &id */
147         size_t for_column = 1; /* &Type */
148         size_t row, presence_index = 0;
149         const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct RegionalExtension, id));
150         
151         for(row=0; row < itable->rows_count; row++) {
152             const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column];
153             const asn_ioc_cell_t *type_cell = &itable->rows[row * itable->columns_count + for_column];
154         
155             if(type_cell->cell_kind == aioc__undefined)
156                 continue;
157         
158             presence_index++;
159             if(constraining_cell->type_descriptor->op->compare_struct(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {
160                 result.type_descriptor = type_cell->type_descriptor;
161                 result.presence_index = presence_index;
162                 break;
163             }
164         }
165         
166         return result;
167 }
168
169 static int
170 memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
171                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
172         
173         if(!sptr) {
174                 ASN__CTFAIL(app_key, td, sptr,
175                         "%s: value not given (%s:%d)",
176                         td->name, __FILE__, __LINE__);
177                 return -1;
178         }
179         
180         
181         if(1 /* No applicable constraints whatsoever */) {
182                 /* Nothing is here. See below */
183         }
184         
185         return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
186 }
187
188
189 /*** <<< STAT-DEFS [SpecializedContent] >>> ***/
190
191 static asn_TYPE_member_t asn_MBR_value_3[] = {
192         { ATF_NOFLAGS, 0, offsetof(struct value, choice.INTEGER),
193                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
194                 .tag_mode = 0,
195                 .type = &asn_DEF_NativeInteger,
196                 .type_selector = 0,
197                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
198                 0, 0, /* No default value */
199                 .name = "INTEGER"
200                 },
201         { ATF_NOFLAGS, 0, offsetof(struct value, choice.BOOLEAN),
202                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
203                 .tag_mode = 0,
204                 .type = &asn_DEF_BOOLEAN,
205                 .type_selector = 0,
206                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
207                 0, 0, /* No default value */
208                 .name = "BOOLEAN"
209                 },
210 };
211 static const asn_TYPE_tag2member_t asn_MAP_value_tag2el_3[] = {
212     { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 1, 0, 0 }, /* BOOLEAN */
213     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* INTEGER */
214 };
215 static asn_CHOICE_specifics_t asn_SPC_value_specs_3 = {
216         sizeof(struct value),
217         offsetof(struct value, _asn_ctx),
218         offsetof(struct value, present),
219         sizeof(((struct value *)0)->present),
220         .tag2el = asn_MAP_value_tag2el_3,
221         .tag2el_count = 2,      /* Count of tags in the map */
222         0, 0,
223         .first_extension = -1   /* Extensions start */
224 };
225 static /* Use -fall-defs-global to expose */
226 asn_TYPE_descriptor_t asn_DEF_value_3 = {
227         "value",
228         "value",
229         &asn_OP_OPEN_TYPE,
230         0,      /* No effective tags (pointer) */
231         0,      /* No effective tags (count) */
232         0,      /* No tags (pointer) */
233         0,      /* No tags (count) */
234         { 0, 0, OPEN_TYPE_constraint },
235         asn_MBR_value_3,
236         2,      /* Elements count */
237         &asn_SPC_value_specs_3  /* Additional specs */
238 };
239
240 asn_TYPE_member_t asn_MBR_RegionalExtension_1[] = {
241         { ATF_NOFLAGS, 0, offsetof(struct RegionalExtension, id),
242                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
243                 .tag_mode = 0,
244                 .type = &asn_DEF_NativeInteger,
245                 .type_selector = 0,
246                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_id_constraint_1 },
247                 0, 0, /* No default value */
248                 .name = "id"
249                 },
250         { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct RegionalExtension, value),
251                 .tag = -1 /* Ambiguous tag (ANY?) */,
252                 .tag_mode = 0,
253                 .type = &asn_DEF_value_3,
254                 .type_selector = select_RegionalExtension_value_type,
255                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_value_constraint_1 },
256                 0, 0, /* No default value */
257                 .name = "value"
258                 },
259 };
260 static const ber_tlv_tag_t asn_DEF_RegionalExtension_tags_1[] = {
261         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
262 };
263 static const asn_TYPE_tag2member_t asn_MAP_RegionalExtension_tag2el_1[] = {
264     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* id */
265 };
266 asn_SEQUENCE_specifics_t asn_SPC_RegionalExtension_specs_1 = {
267         sizeof(struct RegionalExtension),
268         offsetof(struct RegionalExtension, _asn_ctx),
269         .tag2el = asn_MAP_RegionalExtension_tag2el_1,
270         .tag2el_count = 1,      /* Count of tags in the map */
271         0, 0, 0,        /* Optional elements (not needed) */
272         -1,     /* First extension addition */
273 };
274 asn_TYPE_descriptor_t asn_DEF_RegionalExtension = {
275         "RegionalExtension",
276         "RegionalExtension",
277         &asn_OP_SEQUENCE,
278         asn_DEF_RegionalExtension_tags_1,
279         sizeof(asn_DEF_RegionalExtension_tags_1)
280                 /sizeof(asn_DEF_RegionalExtension_tags_1[0]), /* 1 */
281         asn_DEF_RegionalExtension_tags_1,       /* Same as above */
282         sizeof(asn_DEF_RegionalExtension_tags_1)
283                 /sizeof(asn_DEF_RegionalExtension_tags_1[0]), /* 1 */
284         { 0, 0, SEQUENCE_constraint },
285         asn_MBR_RegionalExtension_1,
286         2,      /* Elements count */
287         &asn_SPC_RegionalExtension_specs_1      /* Additional specs */
288 };
289