asn1c/tests/tests-asn1c-compiler/110-param-3-OK.asn1.-Pfwide...

372 lines
10 KiB
Plaintext

/*** <<< INCLUDES [Flag] >>> ***/
#include <INTEGER.h>
#include <constr_SEQUENCE.h>
#include <ENUMERATED.h>
/*** <<< DEPS [Flag] >>> ***/
typedef enum field {
field_red = 0,
field_green = 1,
field_blue = 5
} e_field;
typedef enum field {
field_red = 3,
field_green = 4,
field_blue = 5
} e_field;
/*** <<< TYPE-DECLS [Flag] >>> ***/
typedef struct Flag_16P0 {
INTEGER_t *field /* DEFAULT 5 */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Flag_16P0_t;
typedef struct Flag_16P1 {
ENUMERATED_t *field /* DEFAULT 5 */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Flag_16P1_t;
/*** <<< FUNC-DECLS [Flag] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_Flag_16P0;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1;
extern asn_TYPE_member_t asn_MBR_Flag_16P0_1[1];
/* extern asn_TYPE_descriptor_t asn_DEF_field_7; // (Use -fall-defs-global to expose) */
extern asn_TYPE_descriptor_t asn_DEF_Flag_16P1;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6;
extern asn_TYPE_member_t asn_MBR_Flag_16P1_6[1];
/*** <<< CODE [Flag] >>> ***/
/*
* This type is implemented using ENUMERATED,
* so here we adjust the DEF accordingly.
*/
/*** <<< STAT-DEFS [Flag] >>> ***/
static int asn_DFL_2_set_5(int set_value, void **sptr) {
INTEGER_t *st = *sptr;
if(!st) {
if(!set_value) return -1; /* Not a default value */
st = (*sptr = CALLOC(1, sizeof(*st)));
if(!st) return -1;
}
if(set_value) {
/* Install default value 5 */
return asn_long2INTEGER(st, 5);
} else {
/* Test default value 5 */
long value;
if(asn_INTEGER2long(st, &value))
return -1;
return (value == 5);
}
}
asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_16P0, field),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
.tag_mode = 0,
.type = &asn_DEF_INTEGER,
.type_selector = 0,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.oer_constraints = 0, /* OER is not compiled, use -gen-OER */
.per_constraints = 0, /* PER is not compiled, use -gen-PER */
.default_value = asn_DFL_2_set_5, /* DEFAULT 5 */
.name = "field"
},
};
static const ber_tlv_tag_t asn_DEF_Flag_16P0_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_Flag_16P0_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field */
};
asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1 = {
sizeof(struct Flag_16P0),
offsetof(struct Flag_16P0, _asn_ctx),
asn_MAP_Flag_16P0_tag2el_1,
1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Flag_16P0 = {
"Flag",
"Flag",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_Flag_16P0_tags_1,
sizeof(asn_DEF_Flag_16P0_tags_1)
/sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */
asn_DEF_Flag_16P0_tags_1, /* Same as above */
sizeof(asn_DEF_Flag_16P0_tags_1)
/sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_16P0_1,
1, /* Elements count */
&asn_SPC_Flag_16P0_specs_1 /* Additional specs */
};
static int asn_DFL_7_set_5(int set_value, void **sptr) {
ENUMERATED_t *st = *sptr;
if(!st) {
if(!set_value) return -1; /* Not a default value */
st = (*sptr = CALLOC(1, sizeof(*st)));
if(!st) return -1;
}
if(set_value) {
/* Install default value 5 */
return asn_long2INTEGER(st, 5);
} else {
/* Test default value 5 */
long value;
if(asn_INTEGER2long(st, &value))
return -1;
return (value == 5);
}
}
static const asn_INTEGER_enum_map_t asn_MAP_field_value2enum_7[] = {
{ 3, 3, "red" },
{ 4, 5, "green" },
{ 5, 4, "blue" }
};
static const unsigned int asn_MAP_field_enum2value_7[] = {
2, /* blue(5) */
1, /* green(4) */
0 /* red(3) */
};
static const asn_INTEGER_specifics_t asn_SPC_field_specs_7 = {
asn_MAP_field_value2enum_7, /* "tag" => N; sorted by tag */
asn_MAP_field_enum2value_7, /* N => "tag"; sorted by N */
3, /* Number of elements in the maps */
0, /* Enumeration is not extensible */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_field_tags_7[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_field_7 = {
"field",
"field",
ENUMERATED_free,
ENUMERATED_print,
ENUMERATED_compare,
ENUMERATED_constraint,
ENUMERATED_decode_ber,
ENUMERATED_encode_der,
ENUMERATED_decode_xer,
ENUMERATED_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_field_tags_7,
sizeof(asn_DEF_field_tags_7)
/sizeof(asn_DEF_field_tags_7[0]), /* 1 */
asn_DEF_field_tags_7, /* Same as above */
sizeof(asn_DEF_field_tags_7)
/sizeof(asn_DEF_field_tags_7[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
0, 0, /* Defined elsewhere */
&asn_SPC_field_specs_7 /* Additional specs */
};
asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_16P1, field),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
.tag_mode = 0,
.type = &asn_DEF_field_7,
.type_selector = 0,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.oer_constraints = 0, /* OER is not compiled, use -gen-OER */
.per_constraints = 0, /* PER is not compiled, use -gen-PER */
.default_value = asn_DFL_7_set_5, /* DEFAULT 5 */
.name = "field"
},
};
static const ber_tlv_tag_t asn_DEF_Flag_16P1_tags_6[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_Flag_16P1_tag2el_6[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field */
};
asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6 = {
sizeof(struct Flag_16P1),
offsetof(struct Flag_16P1, _asn_ctx),
asn_MAP_Flag_16P1_tag2el_6,
1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = {
"Flag",
"Flag",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_Flag_16P1_tags_6,
sizeof(asn_DEF_Flag_16P1_tags_6)
/sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */
asn_DEF_Flag_16P1_tags_6, /* Same as above */
sizeof(asn_DEF_Flag_16P1_tags_6)
/sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_16P1_6,
1, /* Elements count */
&asn_SPC_Flag_16P1_specs_6 /* Additional specs */
};
/*** <<< INCLUDES [IntegerColorFlag] >>> ***/
#include "Flag.h"
/*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/
typedef Flag_16P0_t IntegerColorFlag_t;
/*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag;
asn_struct_free_f IntegerColorFlag_free;
asn_struct_print_f IntegerColorFlag_print;
asn_constr_check_f IntegerColorFlag_constraint;
ber_type_decoder_f IntegerColorFlag_decode_ber;
der_type_encoder_f IntegerColorFlag_encode_der;
xer_type_decoder_f IntegerColorFlag_decode_xer;
xer_type_encoder_f IntegerColorFlag_encode_xer;
/*** <<< CODE [IntegerColorFlag] >>> ***/
/*
* This type is implemented using Flag_16P0,
* so here we adjust the DEF accordingly.
*/
/*** <<< STAT-DEFS [IntegerColorFlag] >>> ***/
static const ber_tlv_tag_t asn_DEF_IntegerColorFlag_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = {
"IntegerColorFlag",
"IntegerColorFlag",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_IntegerColorFlag_tags_1,
sizeof(asn_DEF_IntegerColorFlag_tags_1)
/sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */
asn_DEF_IntegerColorFlag_tags_1, /* Same as above */
sizeof(asn_DEF_IntegerColorFlag_tags_1)
/sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_16P0_1,
1, /* Elements count */
&asn_SPC_Flag_16P0_specs_1 /* Additional specs */
};
/*** <<< INCLUDES [EnumeratedColorFlag] >>> ***/
#include "Flag.h"
/*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/
typedef Flag_16P1_t EnumeratedColorFlag_t;
/*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag;
asn_struct_free_f EnumeratedColorFlag_free;
asn_struct_print_f EnumeratedColorFlag_print;
asn_constr_check_f EnumeratedColorFlag_constraint;
ber_type_decoder_f EnumeratedColorFlag_decode_ber;
der_type_encoder_f EnumeratedColorFlag_encode_der;
xer_type_decoder_f EnumeratedColorFlag_decode_xer;
xer_type_encoder_f EnumeratedColorFlag_encode_xer;
/*** <<< CODE [EnumeratedColorFlag] >>> ***/
/*
* This type is implemented using Flag_16P1,
* so here we adjust the DEF accordingly.
*/
/*** <<< STAT-DEFS [EnumeratedColorFlag] >>> ***/
static const ber_tlv_tag_t asn_DEF_EnumeratedColorFlag_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = {
"EnumeratedColorFlag",
"EnumeratedColorFlag",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_EnumeratedColorFlag_tags_1,
sizeof(asn_DEF_EnumeratedColorFlag_tags_1)
/sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */
asn_DEF_EnumeratedColorFlag_tags_1, /* Same as above */
sizeof(asn_DEF_EnumeratedColorFlag_tags_1)
/sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_16P1_6,
1, /* Elements count */
&asn_SPC_Flag_16P1_specs_6 /* Additional specs */
};