NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / tests / tests-asn1c-compiler / 157-per-canonical-order-OK.asn1.-Pgen-PER
1
2 /*** <<< INCLUDES [T] >>> ***/
3
4 #include <NULL.h>
5 #include <constr_CHOICE.h>
6
7 /*** <<< DEPS [T] >>> ***/
8
9 typedef enum T_PR {
10         T_PR_NOTHING,   /* No components present */
11         T_PR_one,
12         T_PR_two,
13         T_PR_three,
14         T_PR_four
15 } T_PR;
16
17 /*** <<< TYPE-DECLS [T] >>> ***/
18
19 typedef struct T {
20         T_PR present;
21         union T_u {
22                 NULL_t   one;
23                 NULL_t   two;
24                 NULL_t   three;
25                 NULL_t   four;
26         } choice;
27         
28         /* Context for parsing across buffer boundaries */
29         asn_struct_ctx_t _asn_ctx;
30 } T_t;
31
32 /*** <<< FUNC-DECLS [T] >>> ***/
33
34 extern asn_TYPE_descriptor_t asn_DEF_T;
35
36 /*** <<< CTDEFS [T] >>> ***/
37
38 static asn_per_constraints_t asn_PER_type_T_constr_1 CC_NOTUSED = {
39         { APC_CONSTRAINED,       2,  2,  0,  3 }        /* (0..3) */,
40         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
41         0, 0    /* No PER value map */
42 };
43
44 /*** <<< STAT-DEFS [T] >>> ***/
45
46 static asn_TYPE_member_t asn_MBR_T_1[] = {
47         { ATF_NOFLAGS, 0, offsetof(struct T, choice.one),
48                 .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
49                 .tag_mode = +1, /* EXPLICIT tag at current level */
50                 .type = &asn_DEF_NULL,
51                 .type_selector = 0,
52                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
53                 0, 0, /* No default value */
54                 .name = "one"
55                 },
56         { ATF_NOFLAGS, 0, offsetof(struct T, choice.two),
57                 .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
58                 .tag_mode = +1, /* EXPLICIT tag at current level */
59                 .type = &asn_DEF_NULL,
60                 .type_selector = 0,
61                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
62                 0, 0, /* No default value */
63                 .name = "two"
64                 },
65         { ATF_NOFLAGS, 0, offsetof(struct T, choice.three),
66                 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
67                 .tag_mode = +1, /* EXPLICIT tag at current level */
68                 .type = &asn_DEF_NULL,
69                 .type_selector = 0,
70                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
71                 0, 0, /* No default value */
72                 .name = "three"
73                 },
74         { ATF_NOFLAGS, 0, offsetof(struct T, choice.four),
75                 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
76                 .tag_mode = +1, /* EXPLICIT tag at current level */
77                 .type = &asn_DEF_NULL,
78                 .type_selector = 0,
79                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
80                 0, 0, /* No default value */
81                 .name = "four"
82                 },
83 };
84 static const unsigned asn_MAP_T_to_canonical_1[] = { 2, 3, 1, 0 };
85 static const unsigned asn_MAP_T_from_canonical_1[] = { 3, 2, 0, 1 };
86 static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = {
87     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 }, /* three */
88     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 }, /* four */
89     { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* two */
90     { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 0, 0, 0 } /* one */
91 };
92 static asn_CHOICE_specifics_t asn_SPC_T_specs_1 = {
93         sizeof(struct T),
94         offsetof(struct T, _asn_ctx),
95         offsetof(struct T, present),
96         sizeof(((struct T *)0)->present),
97         .tag2el = asn_MAP_T_tag2el_1,
98         .tag2el_count = 4,      /* Count of tags in the map */
99         .to_canonical_order = asn_MAP_T_to_canonical_1,
100         .from_canonical_order = asn_MAP_T_from_canonical_1,
101         .first_extension = -1   /* Extensions start */
102 };
103 asn_TYPE_descriptor_t asn_DEF_T = {
104         "T",
105         "T",
106         &asn_OP_CHOICE,
107         0,      /* No effective tags (pointer) */
108         0,      /* No effective tags (count) */
109         0,      /* No tags (pointer) */
110         0,      /* No tags (count) */
111         { 0, &asn_PER_type_T_constr_1, CHOICE_constraint },
112         asn_MBR_T_1,
113         4,      /* Elements count */
114         &asn_SPC_T_specs_1      /* Additional specs */
115 };
116