NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / tests / tests-asn1c-compiler / 143-inner-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         SpecializedContent_21P0_t        content13;
11         SpecializedContent_21P1_t        content42;
12         
13         /* Context for parsing across buffer boundaries */
14         asn_struct_ctx_t _asn_ctx;
15 } Message_t;
16
17 /*** <<< FUNC-DECLS [Message] >>> ***/
18
19 extern asn_TYPE_descriptor_t asn_DEF_Message;
20
21 /*** <<< STAT-DEFS [Message] >>> ***/
22
23 static asn_TYPE_member_t asn_MBR_Message_1[] = {
24         { ATF_NOFLAGS, 0, offsetof(struct Message, content13),
25                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
26                 .tag_mode = 0,
27                 .type = &asn_DEF_SpecializedContent_21P0,
28                 .type_selector = 0,
29                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
30                 0, 0, /* No default value */
31                 .name = "content13"
32                 },
33         { ATF_NOFLAGS, 0, offsetof(struct Message, content42),
34                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
35                 .tag_mode = 0,
36                 .type = &asn_DEF_SpecializedContent_21P1,
37                 .type_selector = 0,
38                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
39                 0, 0, /* No default value */
40                 .name = "content42"
41                 },
42 };
43 static const ber_tlv_tag_t asn_DEF_Message_tags_1[] = {
44         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
45 };
46 static const asn_TYPE_tag2member_t asn_MAP_Message_tag2el_1[] = {
47     { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* content13 */
48     { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* content42 */
49 };
50 static asn_SEQUENCE_specifics_t asn_SPC_Message_specs_1 = {
51         sizeof(struct Message),
52         offsetof(struct Message, _asn_ctx),
53         .tag2el = asn_MAP_Message_tag2el_1,
54         .tag2el_count = 2,      /* Count of tags in the map */
55         0, 0, 0,        /* Optional elements (not needed) */
56         -1,     /* First extension addition */
57 };
58 asn_TYPE_descriptor_t asn_DEF_Message = {
59         "Message",
60         "Message",
61         &asn_OP_SEQUENCE,
62         asn_DEF_Message_tags_1,
63         sizeof(asn_DEF_Message_tags_1)
64                 /sizeof(asn_DEF_Message_tags_1[0]), /* 1 */
65         asn_DEF_Message_tags_1, /* Same as above */
66         sizeof(asn_DEF_Message_tags_1)
67                 /sizeof(asn_DEF_Message_tags_1[0]), /* 1 */
68         { 0, 0, SEQUENCE_constraint },
69         asn_MBR_Message_1,
70         2,      /* Elements count */
71         &asn_SPC_Message_specs_1        /* Additional specs */
72 };
73
74
75 /*** <<< INCLUDES [SpecializedContent] >>> ***/
76
77 #include <NativeInteger.h>
78 #include <constr_SEQUENCE.h>
79
80 /*** <<< TYPE-DECLS [SpecializedContent] >>> ***/
81
82 typedef struct SpecializedContent_21P0 {
83         long     id;
84         
85         /* Context for parsing across buffer boundaries */
86         asn_struct_ctx_t _asn_ctx;
87 } SpecializedContent_21P0_t;
88 typedef struct SpecializedContent_21P1 {
89         long     id;
90         
91         /* Context for parsing across buffer boundaries */
92         asn_struct_ctx_t _asn_ctx;
93 } SpecializedContent_21P1_t;
94
95 /*** <<< FUNC-DECLS [SpecializedContent] >>> ***/
96
97 extern asn_TYPE_descriptor_t asn_DEF_SpecializedContent_21P0;
98 extern asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_21P0_specs_1;
99 extern asn_TYPE_member_t asn_MBR_SpecializedContent_21P0_1[1];
100 extern asn_TYPE_descriptor_t asn_DEF_SpecializedContent_21P1;
101 extern asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_21P1_specs_3;
102 extern asn_TYPE_member_t asn_MBR_SpecializedContent_21P1_3[1];
103
104 /*** <<< CODE [SpecializedContent] >>> ***/
105
106 static int
107 memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
108                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
109         long value;
110         
111         if(!sptr) {
112                 ASN__CTFAIL(app_key, td, sptr,
113                         "%s: value not given (%s:%d)",
114                         td->name, __FILE__, __LINE__);
115                 return -1;
116         }
117         
118         value = *(const long *)sptr;
119         
120         if((value == 13)) {
121                 /* Constraint check succeeded */
122                 return 0;
123         } else {
124                 ASN__CTFAIL(app_key, td, sptr,
125                         "%s: constraint failed (%s:%d)",
126                         td->name, __FILE__, __LINE__);
127                 return -1;
128         }
129 }
130
131 static int
132 memb_id_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr,
133                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
134         long value;
135         
136         if(!sptr) {
137                 ASN__CTFAIL(app_key, td, sptr,
138                         "%s: value not given (%s:%d)",
139                         td->name, __FILE__, __LINE__);
140                 return -1;
141         }
142         
143         value = *(const long *)sptr;
144         
145         if((value == 42)) {
146                 /* Constraint check succeeded */
147                 return 0;
148         } else {
149                 ASN__CTFAIL(app_key, td, sptr,
150                         "%s: constraint failed (%s:%d)",
151                         td->name, __FILE__, __LINE__);
152                 return -1;
153         }
154 }
155
156
157 /*** <<< STAT-DEFS [SpecializedContent] >>> ***/
158
159 asn_TYPE_member_t asn_MBR_SpecializedContent_21P0_1[] = {
160         { ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_21P0, id),
161                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
162                 .tag_mode = 0,
163                 .type = &asn_DEF_NativeInteger,
164                 .type_selector = 0,
165                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_id_constraint_1 },
166                 0, 0, /* No default value */
167                 .name = "id"
168                 },
169 };
170 static const ber_tlv_tag_t asn_DEF_SpecializedContent_21P0_tags_1[] = {
171         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
172 };
173 static const asn_TYPE_tag2member_t asn_MAP_SpecializedContent_21P0_tag2el_1[] = {
174     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* id */
175 };
176 asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_21P0_specs_1 = {
177         sizeof(struct SpecializedContent_21P0),
178         offsetof(struct SpecializedContent_21P0, _asn_ctx),
179         .tag2el = asn_MAP_SpecializedContent_21P0_tag2el_1,
180         .tag2el_count = 1,      /* Count of tags in the map */
181         0, 0, 0,        /* Optional elements (not needed) */
182         -1,     /* First extension addition */
183 };
184 asn_TYPE_descriptor_t asn_DEF_SpecializedContent_21P0 = {
185         "SpecializedContent",
186         "SpecializedContent",
187         &asn_OP_SEQUENCE,
188         asn_DEF_SpecializedContent_21P0_tags_1,
189         sizeof(asn_DEF_SpecializedContent_21P0_tags_1)
190                 /sizeof(asn_DEF_SpecializedContent_21P0_tags_1[0]), /* 1 */
191         asn_DEF_SpecializedContent_21P0_tags_1, /* Same as above */
192         sizeof(asn_DEF_SpecializedContent_21P0_tags_1)
193                 /sizeof(asn_DEF_SpecializedContent_21P0_tags_1[0]), /* 1 */
194         { 0, 0, SEQUENCE_constraint },
195         asn_MBR_SpecializedContent_21P0_1,
196         1,      /* Elements count */
197         &asn_SPC_SpecializedContent_21P0_specs_1        /* Additional specs */
198 };
199
200 asn_TYPE_member_t asn_MBR_SpecializedContent_21P1_3[] = {
201         { ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_21P1, id),
202                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
203                 .tag_mode = 0,
204                 .type = &asn_DEF_NativeInteger,
205                 .type_selector = 0,
206                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_id_constraint_3 },
207                 0, 0, /* No default value */
208                 .name = "id"
209                 },
210 };
211 static const ber_tlv_tag_t asn_DEF_SpecializedContent_21P1_tags_3[] = {
212         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
213 };
214 static const asn_TYPE_tag2member_t asn_MAP_SpecializedContent_21P1_tag2el_3[] = {
215     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* id */
216 };
217 asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_21P1_specs_3 = {
218         sizeof(struct SpecializedContent_21P1),
219         offsetof(struct SpecializedContent_21P1, _asn_ctx),
220         .tag2el = asn_MAP_SpecializedContent_21P1_tag2el_3,
221         .tag2el_count = 1,      /* Count of tags in the map */
222         0, 0, 0,        /* Optional elements (not needed) */
223         -1,     /* First extension addition */
224 };
225 asn_TYPE_descriptor_t asn_DEF_SpecializedContent_21P1 = {
226         "SpecializedContent",
227         "SpecializedContent",
228         &asn_OP_SEQUENCE,
229         asn_DEF_SpecializedContent_21P1_tags_3,
230         sizeof(asn_DEF_SpecializedContent_21P1_tags_3)
231                 /sizeof(asn_DEF_SpecializedContent_21P1_tags_3[0]), /* 1 */
232         asn_DEF_SpecializedContent_21P1_tags_3, /* Same as above */
233         sizeof(asn_DEF_SpecializedContent_21P1_tags_3)
234                 /sizeof(asn_DEF_SpecializedContent_21P1_tags_3[0]), /* 1 */
235         { 0, 0, SEQUENCE_constraint },
236         asn_MBR_SpecializedContent_21P1_3,
237         1,      /* Elements count */
238         &asn_SPC_SpecializedContent_21P1_specs_3        /* Additional specs */
239 };
240