16122b8ab7135651ddf0a700f78fddc3e6303a66
[com/asn1c.git] / tests / tests-asn1c-compiler / 59-choice-extended-OK.asn1.-Pfwide-types
1
2 /*** <<< INCLUDES [Choice] >>> ***/
3
4 #include <INTEGER.h>
5 #include <constr_CHOICE.h>
6
7 /*** <<< DEPS [Choice] >>> ***/
8
9 typedef enum Choice_PR {
10         Choice_PR_NOTHING,      /* No components present */
11         Choice_PR_a,
12         /* Extensions may appear below */
13         Choice_PR_b,
14         Choice_PR_c
15 } Choice_PR;
16
17 /*** <<< FWD-DECLS [Choice] >>> ***/
18
19 struct Choice;
20
21 /*** <<< TYPE-DECLS [Choice] >>> ***/
22
23 typedef struct Choice {
24         Choice_PR present;
25         union Choice_u {
26                 INTEGER_t        a;
27                 /*
28                  * This type is extensible,
29                  * possible extensions are below.
30                  */
31                 INTEGER_t        b;
32                 struct Choice   *c;
33         } choice;
34         
35         /* Context for parsing across buffer boundaries */
36         asn_struct_ctx_t _asn_ctx;
37 } Choice_t;
38
39 /*** <<< FUNC-DECLS [Choice] >>> ***/
40
41 extern asn_TYPE_descriptor_t asn_DEF_Choice;
42 extern asn_CHOICE_specifics_t asn_SPC_Choice_specs_1;
43 extern asn_TYPE_member_t asn_MBR_Choice_1[3];
44
45 /*** <<< POST-INCLUDE [Choice] >>> ***/
46
47 #include "Choice.h"
48
49 /*** <<< STAT-DEFS [Choice] >>> ***/
50
51 asn_TYPE_member_t asn_MBR_Choice_1[] = {
52         { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.a),
53                 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
54                 .tag_mode = -1, /* IMPLICIT tag at current level */
55                 .type = &asn_DEF_INTEGER,
56                 .type_selector = 0,
57                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
58                 0, 0, /* No default value */
59                 .name = "a"
60                 },
61         { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.b),
62                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
63                 .tag_mode = -1, /* IMPLICIT tag at current level */
64                 .type = &asn_DEF_INTEGER,
65                 .type_selector = 0,
66                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
67                 0, 0, /* No default value */
68                 .name = "b"
69                 },
70         { ATF_POINTER, 0, offsetof(struct Choice, choice.c),
71                 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
72                 .tag_mode = -1, /* IMPLICIT tag at current level */
73                 .type = &asn_DEF_Choice,
74                 .type_selector = 0,
75                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
76                 0, 0, /* No default value */
77                 .name = "c"
78                 },
79 };
80 static const ber_tlv_tag_t asn_DEF_Choice_tags_1[] = {
81         (ASN_TAG_CLASS_CONTEXT | (123 << 2))
82 };
83 static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = {
84     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */
85     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* b */
86     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* c */
87 };
88 asn_CHOICE_specifics_t asn_SPC_Choice_specs_1 = {
89         sizeof(struct Choice),
90         offsetof(struct Choice, _asn_ctx),
91         offsetof(struct Choice, present),
92         sizeof(((struct Choice *)0)->present),
93         .tag2el = asn_MAP_Choice_tag2el_1,
94         .tag2el_count = 3,      /* Count of tags in the map */
95         0, 0,
96         .first_extension = 1    /* Extensions start */
97 };
98 asn_TYPE_descriptor_t asn_DEF_Choice = {
99         "Choice",
100         "Choice",
101         &asn_OP_CHOICE,
102         asn_DEF_Choice_tags_1,
103         sizeof(asn_DEF_Choice_tags_1)
104                 /sizeof(asn_DEF_Choice_tags_1[0]), /* 1 */
105         asn_DEF_Choice_tags_1,  /* Same as above */
106         sizeof(asn_DEF_Choice_tags_1)
107                 /sizeof(asn_DEF_Choice_tags_1[0]), /* 1 */
108         { 0, 0, CHOICE_constraint },
109         asn_MBR_Choice_1,
110         3,      /* Elements count */
111         &asn_SPC_Choice_specs_1 /* Additional specs */
112 };
113