99f414aa7d00474ca125b8f5eea58013a4ee49ac
[com/asn1c.git] / tests / tests-asn1c-compiler / 66-ref-simple-OK.asn1.-Pfwide-types
1
2 /*** <<< INCLUDES [T] >>> ***/
3
4 #include "SimpleType.h"
5 #include <asn_SET_OF.h>
6 #include <constr_SET_OF.h>
7
8 /*** <<< TYPE-DECLS [T] >>> ***/
9
10 typedef struct T {
11         A_SET_OF(SimpleType_t) list;
12         
13         /* Context for parsing across buffer boundaries */
14         asn_struct_ctx_t _asn_ctx;
15 } T_t;
16
17 /*** <<< FUNC-DECLS [T] >>> ***/
18
19 extern asn_TYPE_descriptor_t asn_DEF_T;
20
21 /*** <<< STAT-DEFS [T] >>> ***/
22
23 static asn_TYPE_member_t asn_MBR_T_1[] = {
24         { ATF_POINTER, 0, 0,
25                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
26                 .tag_mode = 0,
27                 .type = &asn_DEF_SimpleType,
28                 .type_selector = 0,
29                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
30                 0, 0, /* No default value */
31                 .name = "named"
32                 },
33 };
34 static const ber_tlv_tag_t asn_DEF_T_tags_1[] = {
35         (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
36 };
37 static asn_SET_OF_specifics_t asn_SPC_T_specs_1 = {
38         sizeof(struct T),
39         offsetof(struct T, _asn_ctx),
40         1,      /* XER encoding is XMLValueList */
41 };
42 asn_TYPE_descriptor_t asn_DEF_T = {
43         "T",
44         "T",
45         &asn_OP_SET_OF,
46         asn_DEF_T_tags_1,
47         sizeof(asn_DEF_T_tags_1)
48                 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
49         asn_DEF_T_tags_1,       /* Same as above */
50         sizeof(asn_DEF_T_tags_1)
51                 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
52         { 0, 0, SET_OF_constraint },
53         asn_MBR_T_1,
54         1,      /* Single element */
55         &asn_SPC_T_specs_1      /* Additional specs */
56 };
57
58
59 /*** <<< INCLUDES [SimpleType] >>> ***/
60
61 #include <ENUMERATED.h>
62
63 /*** <<< DEPS [SimpleType] >>> ***/
64
65 typedef enum SimpleType {
66         SimpleType_one  = 0,
67         SimpleType_two  = 1,
68         SimpleType_three        = 2
69 } e_SimpleType;
70
71 /*** <<< TYPE-DECLS [SimpleType] >>> ***/
72
73 typedef ENUMERATED_t     SimpleType_t;
74
75 /*** <<< FUNC-DECLS [SimpleType] >>> ***/
76
77 extern asn_TYPE_descriptor_t asn_DEF_SimpleType;
78 extern const asn_INTEGER_specifics_t asn_SPC_SimpleType_specs_1;
79 asn_struct_free_f SimpleType_free;
80 asn_struct_print_f SimpleType_print;
81 asn_constr_check_f SimpleType_constraint;
82 ber_type_decoder_f SimpleType_decode_ber;
83 der_type_encoder_f SimpleType_encode_der;
84 xer_type_decoder_f SimpleType_decode_xer;
85 xer_type_encoder_f SimpleType_encode_xer;
86
87 /*** <<< CODE [SimpleType] >>> ***/
88
89 /*
90  * This type is implemented using ENUMERATED,
91  * so here we adjust the DEF accordingly.
92  */
93
94 /*** <<< STAT-DEFS [SimpleType] >>> ***/
95
96 static const asn_INTEGER_enum_map_t asn_MAP_SimpleType_value2enum_1[] = {
97         { 0,    3,      "one" },
98         { 1,    3,      "two" },
99         { 2,    5,      "three" }
100 };
101 static const unsigned int asn_MAP_SimpleType_enum2value_1[] = {
102         0,      /* one(0) */
103         2,      /* three(2) */
104         1       /* two(1) */
105 };
106 const asn_INTEGER_specifics_t asn_SPC_SimpleType_specs_1 = {
107         asn_MAP_SimpleType_value2enum_1,        /* "tag" => N; sorted by tag */
108         asn_MAP_SimpleType_enum2value_1,        /* N => "tag"; sorted by N */
109         3,      /* Number of elements in the maps */
110         0,      /* Enumeration is not extensible */
111         1,      /* Strict enumeration */
112         0,      /* Native long size */
113         0
114 };
115 static const ber_tlv_tag_t asn_DEF_SimpleType_tags_1[] = {
116         (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
117 };
118 asn_TYPE_descriptor_t asn_DEF_SimpleType = {
119         "SimpleType",
120         "SimpleType",
121         &asn_OP_ENUMERATED,
122         asn_DEF_SimpleType_tags_1,
123         sizeof(asn_DEF_SimpleType_tags_1)
124                 /sizeof(asn_DEF_SimpleType_tags_1[0]), /* 1 */
125         asn_DEF_SimpleType_tags_1,      /* Same as above */
126         sizeof(asn_DEF_SimpleType_tags_1)
127                 /sizeof(asn_DEF_SimpleType_tags_1[0]), /* 1 */
128         { 0, 0, ENUMERATED_constraint },
129         0, 0,   /* Defined elsewhere */
130         &asn_SPC_SimpleType_specs_1     /* Additional specs */
131 };
132