diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 8a16b5b60..3ab89c9d0 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1304,7 +1304,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { } } else { - GEN_INCLUDE(asn1c_type_name(arg, expr, TNF_INCLUDE)); + GEN_POS_INCLUDE_BASE(OT_INCLUDES, expr); REDIR(OT_TYPE_DECLS); @@ -3236,13 +3236,8 @@ emit_include_dependencies(arg_t *arg) { if((!(memb->expr_type & ASN_CONSTR_MASK) && memb->expr_type > ASN_CONSTR_MASK) || memb->meta_type == AMT_TYPEREF) { - if(memb->marker.flags & EM_UNRECURSE) { - GEN_POSTINCLUDE(asn1c_type_name(arg, - memb, TNF_INCLUDE)); - } else { - GEN_INCLUDE(asn1c_type_name(arg, - memb, TNF_INCLUDE)); - } + GEN_POS_INCLUDE_BASE((memb->marker.flags & EM_UNRECURSE) ? + OT_POST_INCLUDE : OT_INCLUDES, memb); } } diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index 8cfafc0e0..5bdee167a 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -297,6 +297,20 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { _format = TNF_CTYPE; stdname = 1; typename = ASN_EXPR_TYPE2STR(expr->expr_type); + if(_format == TNF_INCLUDE) { + if(expr->expr_type == ASN_CONSTR_SEQUENCE) + typename = "constr_SEQUENCE"; + else if(expr->expr_type == ASN_CONSTR_CHOICE) + typename = "constr_CHOICE"; + else if(expr->expr_type == ASN_CONSTR_SET) + typename = "constr_SET"; + else if(expr->expr_type == ASN_CONSTR_SEQUENCE_OF) + typename = "constr_SEQUENCE_OF"; + else if(expr->expr_type == ASN_CONSTR_SET_OF) + typename = "constr_SET_OF"; + else if(expr->expr_type == ASN_CONSTR_OPEN_TYPE) + typename = "OPEN_TYPE"; + } } else { _format = TNF_RSAFE; typename = expr->Identifier; diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h index 7ce9d94ea..6d71cdb72 100644 --- a/libasn1compiler/asn1c_out.h +++ b/libasn1compiler/asn1c_out.h @@ -90,24 +90,31 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...); } while(0) /* Generate #include line */ -#define GEN_INCLUDE_STD(typename) do { \ - if((arg->flags & A1C_INCLUDES_QUOTED)) { \ +#define GEN_INCLUDE_STD(typename) do { \ + if((arg->flags & A1C_INCLUDES_QUOTED)) { \ GEN_INCLUDE("\"" typename ".h\""); \ } else { \ GEN_INCLUDE("<" typename ".h>"); \ } } while(0) -#define GEN_INCLUDE(filename) do { \ +#define GEN_INCLUDE(filename) \ + GEN_POS_INCLUDE(OT_INCLUDES, filename) +#define GEN_POSTINCLUDE(filename) \ + GEN_POS_INCLUDE(OT_POST_INCLUDE, filename) +#define GEN_POS_INCLUDE(pos, filename) do { \ int saved_target = arg->target->target; \ if(!filename) break; \ - REDIR(OT_INCLUDES); \ + REDIR(pos); \ OUT_NOINDENT("#include %s\n", filename); \ REDIR(saved_target); \ } while(0) -#define GEN_POSTINCLUDE(filename) do { \ +#define GEN_POS_INCLUDE_BASE(pos, expr) do { \ + asn1p_expr_t *rhs_pspecs = expr->rhs_pspecs; \ + expr->rhs_pspecs = (asn1p_expr_t *)0; \ int saved_target = arg->target->target; \ - if(!filename) break; \ - REDIR(OT_POST_INCLUDE); \ - OUT_NOINDENT("#include %s\n", filename); \ + REDIR(pos); \ + OUT_NOINDENT("#include %s\n", \ + asn1c_type_name(arg, expr, TNF_INCLUDE)); \ + expr->rhs_pspecs = rhs_pspecs; \ REDIR(saved_target); \ } while(0) diff --git a/libasn1fix/asn1fix_param.c b/libasn1fix/asn1fix_param.c index 77daba130..b4c194edf 100644 --- a/libasn1fix/asn1fix_param.c +++ b/libasn1fix/asn1fix_param.c @@ -6,6 +6,7 @@ typedef struct resolver_arg { asn1p_expr_t *original_expr; asn1p_paramlist_t *lhs_params; asn1p_expr_t *rhs_pspecs; + char *resolved_name; } resolver_arg_t; static asn1p_expr_t *resolve_expr(asn1p_expr_t *, void *resolver_arg); @@ -52,8 +53,13 @@ asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_ps rarg.original_expr = expr; rarg.lhs_params = expr->lhs_params; rarg.rhs_pspecs = rhs_pspecs; + rarg.resolved_name = NULL; exc = asn1p_expr_clone_with_resolver(expr, resolve_expr, &rarg); if(!exc) return NULL; + if(rarg.resolved_name) { + free(exc->Identifier); + exc->Identifier = strdup(rarg.resolved_name); + } rpc = asn1p_expr_clone(rhs_pspecs, 0); assert(rpc); @@ -138,6 +144,16 @@ resolve_expr(asn1p_expr_t *expr_to_resolve, void *resolver_arg) { free(nex->Identifier); nex->Identifier = expr_to_resolve->Identifier ? strdup(expr_to_resolve->Identifier) : 0; + if(expr->meta_type == AMT_TYPEREF) { + asn1p_ref_t *ref = expr->reference; + rarg->resolved_name = ref->components[ref->comp_count - 1].name; + } else if(expr->meta_type == AMT_VALUESET) { + asn1p_constraint_t *ct = expr->constraints; + if(ct->type == ACT_EL_TYPE) { + asn1p_ref_t *ref = ct->containedSubtype->value.v_type->reference; + rarg->resolved_name = ref->components[ref->comp_count - 1].name; + } + } return nex; } else { FATAL("Feature not implemented for %s (%d/%x), " diff --git a/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P b/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P index 23b35276b..02c5cf2df 100644 --- a/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P +++ b/tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P @@ -7,7 +7,7 @@ /*** <<< TYPE-DECLS [Message] >>> ***/ typedef struct Message { - SpecializedContent_30P0_t content; + RegionalExtension_30P0_t content; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; @@ -23,7 +23,7 @@ static asn_TYPE_member_t asn_MBR_Message_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Message, content), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, - .type = &asn_DEF_SpecializedContent_30P0, + .type = &asn_DEF_RegionalExtension_30P0, .type_selector = 0, { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 }, 0, 0, /* No default value */ @@ -81,11 +81,11 @@ typedef enum value_PR { /*** <<< TYPE-DECLS [SpecializedContent] >>> ***/ -typedef struct SpecializedContent_30P0 { +typedef struct RegionalExtension_30P0 { long id; struct value { value_PR present; - union SpecializedContent_30P0__value_u { + union RegionalExtension_30P0__value_u { long INTEGER; BOOLEAN_t BOOLEAN; } choice; @@ -96,13 +96,13 @@ typedef struct SpecializedContent_30P0 { /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; -} SpecializedContent_30P0_t; +} RegionalExtension_30P0_t; /*** <<< FUNC-DECLS [SpecializedContent] >>> ***/ -extern asn_TYPE_descriptor_t asn_DEF_SpecializedContent_30P0; -extern asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_30P0_specs_1; -extern asn_TYPE_member_t asn_MBR_SpecializedContent_30P0_1[2]; +extern asn_TYPE_descriptor_t asn_DEF_RegionalExtension_30P0; +extern asn_SEQUENCE_specifics_t asn_SPC_RegionalExtension_30P0_specs_1; +extern asn_TYPE_member_t asn_MBR_RegionalExtension_30P0_1[2]; /*** <<< IOC-TABLES [SpecializedContent] >>> ***/ @@ -140,13 +140,13 @@ memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, } static asn_type_selector_result_t -select_SpecializedContent_30P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { +select_RegionalExtension_30P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { asn_type_selector_result_t result = {0, 0}; const asn_ioc_set_t *itable = asn_IOS_RegionalExtension_1; size_t constraining_column = 0; /* &id */ size_t for_column = 1; /* &Type */ size_t row; - const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct SpecializedContent_30P0, id)); + const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct RegionalExtension_30P0, id)); for(row=0; row < itable->rows_count; row++) { const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column]; @@ -233,8 +233,8 @@ asn_TYPE_descriptor_t asn_DEF_value_3 = { &asn_SPC_value_specs_3 /* Additional specs */ }; -asn_TYPE_member_t asn_MBR_SpecializedContent_30P0_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_30P0, id), +asn_TYPE_member_t asn_MBR_RegionalExtension_30P0_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct RegionalExtension_30P0, id), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_NativeInteger, @@ -243,43 +243,43 @@ asn_TYPE_member_t asn_MBR_SpecializedContent_30P0_1[] = { 0, 0, /* No default value */ .name = "id" }, - { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_30P0, value), + { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct RegionalExtension_30P0, value), .tag = -1 /* Ambiguous tag (ANY?) */, .tag_mode = 0, .type = &asn_DEF_value_3, - .type_selector = select_SpecializedContent_30P0_value_type, + .type_selector = select_RegionalExtension_30P0_value_type, { .oer_constraints = 0, .per_constraints = 0, .general_constraints = memb_value_constraint_1 }, 0, 0, /* No default value */ .name = "value" }, }; -static const ber_tlv_tag_t asn_DEF_SpecializedContent_30P0_tags_1[] = { +static const ber_tlv_tag_t asn_DEF_RegionalExtension_30P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; -static const asn_TYPE_tag2member_t asn_MAP_SpecializedContent_30P0_tag2el_1[] = { +static const asn_TYPE_tag2member_t asn_MAP_RegionalExtension_30P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* id */ }; -asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_30P0_specs_1 = { - sizeof(struct SpecializedContent_30P0), - offsetof(struct SpecializedContent_30P0, _asn_ctx), - .tag2el = asn_MAP_SpecializedContent_30P0_tag2el_1, +asn_SEQUENCE_specifics_t asn_SPC_RegionalExtension_30P0_specs_1 = { + sizeof(struct RegionalExtension_30P0), + offsetof(struct RegionalExtension_30P0, _asn_ctx), + .tag2el = asn_MAP_RegionalExtension_30P0_tag2el_1, .tag2el_count = 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; -asn_TYPE_descriptor_t asn_DEF_SpecializedContent_30P0 = { - "SpecializedContent", - "SpecializedContent", +asn_TYPE_descriptor_t asn_DEF_RegionalExtension_30P0 = { + "RegionalExtension", + "RegionalExtension", &asn_OP_SEQUENCE, - asn_DEF_SpecializedContent_30P0_tags_1, - sizeof(asn_DEF_SpecializedContent_30P0_tags_1) - /sizeof(asn_DEF_SpecializedContent_30P0_tags_1[0]), /* 1 */ - asn_DEF_SpecializedContent_30P0_tags_1, /* Same as above */ - sizeof(asn_DEF_SpecializedContent_30P0_tags_1) - /sizeof(asn_DEF_SpecializedContent_30P0_tags_1[0]), /* 1 */ + asn_DEF_RegionalExtension_30P0_tags_1, + sizeof(asn_DEF_RegionalExtension_30P0_tags_1) + /sizeof(asn_DEF_RegionalExtension_30P0_tags_1[0]), /* 1 */ + asn_DEF_RegionalExtension_30P0_tags_1, /* Same as above */ + sizeof(asn_DEF_RegionalExtension_30P0_tags_1) + /sizeof(asn_DEF_RegionalExtension_30P0_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, - asn_MBR_SpecializedContent_30P0_1, + asn_MBR_RegionalExtension_30P0_1, 2, /* Elements count */ - &asn_SPC_SpecializedContent_30P0_specs_1 /* Additional specs */ + &asn_SPC_RegionalExtension_30P0_specs_1 /* Additional specs */ }; diff --git a/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER index e73249a82..6d9fdd35f 100644 --- a/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER +++ b/tests/tests-asn1c-compiler/146-ios-parameterization-per-OK.asn1.-Pgen-PER @@ -7,7 +7,7 @@ /*** <<< TYPE-DECLS [Message] >>> ***/ typedef struct Message { - SpecializedContent_30P0_t content; + RegionalExtension_30P0_t content; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; @@ -23,7 +23,7 @@ static asn_TYPE_member_t asn_MBR_Message_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Message, content), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, - .type = &asn_DEF_SpecializedContent_30P0, + .type = &asn_DEF_RegionalExtension_30P0, .type_selector = 0, { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 }, 0, 0, /* No default value */ @@ -81,11 +81,11 @@ typedef enum value_PR { /*** <<< TYPE-DECLS [SpecializedContent] >>> ***/ -typedef struct SpecializedContent_30P0 { +typedef struct RegionalExtension_30P0 { long id; struct value { value_PR present; - union SpecializedContent_30P0__value_u { + union RegionalExtension_30P0__value_u { long INTEGER; BOOLEAN_t BOOLEAN; } choice; @@ -96,13 +96,13 @@ typedef struct SpecializedContent_30P0 { /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; -} SpecializedContent_30P0_t; +} RegionalExtension_30P0_t; /*** <<< FUNC-DECLS [SpecializedContent] >>> ***/ -extern asn_TYPE_descriptor_t asn_DEF_SpecializedContent_30P0; -extern asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_30P0_specs_1; -extern asn_TYPE_member_t asn_MBR_SpecializedContent_30P0_1[2]; +extern asn_TYPE_descriptor_t asn_DEF_RegionalExtension_30P0; +extern asn_SEQUENCE_specifics_t asn_SPC_RegionalExtension_30P0_specs_1; +extern asn_TYPE_member_t asn_MBR_RegionalExtension_30P0_1[2]; /*** <<< IOC-TABLES [SpecializedContent] >>> ***/ @@ -140,13 +140,13 @@ memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, } static asn_type_selector_result_t -select_SpecializedContent_30P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { +select_RegionalExtension_30P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { asn_type_selector_result_t result = {0, 0}; const asn_ioc_set_t *itable = asn_IOS_RegionalExtension_1; size_t constraining_column = 0; /* &id */ size_t for_column = 1; /* &Type */ size_t row; - const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct SpecializedContent_30P0, id)); + const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct RegionalExtension_30P0, id)); for(row=0; row < itable->rows_count; row++) { const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column]; @@ -249,8 +249,8 @@ asn_TYPE_descriptor_t asn_DEF_value_3 = { &asn_SPC_value_specs_3 /* Additional specs */ }; -asn_TYPE_member_t asn_MBR_SpecializedContent_30P0_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_30P0, id), +asn_TYPE_member_t asn_MBR_RegionalExtension_30P0_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct RegionalExtension_30P0, id), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_NativeInteger, @@ -259,43 +259,43 @@ asn_TYPE_member_t asn_MBR_SpecializedContent_30P0_1[] = { 0, 0, /* No default value */ .name = "id" }, - { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_30P0, value), + { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct RegionalExtension_30P0, value), .tag = -1 /* Ambiguous tag (ANY?) */, .tag_mode = 0, .type = &asn_DEF_value_3, - .type_selector = select_SpecializedContent_30P0_value_type, + .type_selector = select_RegionalExtension_30P0_value_type, { .oer_constraints = 0, .per_constraints = &asn_PER_memb_value_constr_3, .general_constraints = memb_value_constraint_1 }, 0, 0, /* No default value */ .name = "value" }, }; -static const ber_tlv_tag_t asn_DEF_SpecializedContent_30P0_tags_1[] = { +static const ber_tlv_tag_t asn_DEF_RegionalExtension_30P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; -static const asn_TYPE_tag2member_t asn_MAP_SpecializedContent_30P0_tag2el_1[] = { +static const asn_TYPE_tag2member_t asn_MAP_RegionalExtension_30P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* id */ }; -asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_30P0_specs_1 = { - sizeof(struct SpecializedContent_30P0), - offsetof(struct SpecializedContent_30P0, _asn_ctx), - .tag2el = asn_MAP_SpecializedContent_30P0_tag2el_1, +asn_SEQUENCE_specifics_t asn_SPC_RegionalExtension_30P0_specs_1 = { + sizeof(struct RegionalExtension_30P0), + offsetof(struct RegionalExtension_30P0, _asn_ctx), + .tag2el = asn_MAP_RegionalExtension_30P0_tag2el_1, .tag2el_count = 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; -asn_TYPE_descriptor_t asn_DEF_SpecializedContent_30P0 = { - "SpecializedContent", - "SpecializedContent", +asn_TYPE_descriptor_t asn_DEF_RegionalExtension_30P0 = { + "RegionalExtension", + "RegionalExtension", &asn_OP_SEQUENCE, - asn_DEF_SpecializedContent_30P0_tags_1, - sizeof(asn_DEF_SpecializedContent_30P0_tags_1) - /sizeof(asn_DEF_SpecializedContent_30P0_tags_1[0]), /* 1 */ - asn_DEF_SpecializedContent_30P0_tags_1, /* Same as above */ - sizeof(asn_DEF_SpecializedContent_30P0_tags_1) - /sizeof(asn_DEF_SpecializedContent_30P0_tags_1[0]), /* 1 */ + asn_DEF_RegionalExtension_30P0_tags_1, + sizeof(asn_DEF_RegionalExtension_30P0_tags_1) + /sizeof(asn_DEF_RegionalExtension_30P0_tags_1[0]), /* 1 */ + asn_DEF_RegionalExtension_30P0_tags_1, /* Same as above */ + sizeof(asn_DEF_RegionalExtension_30P0_tags_1) + /sizeof(asn_DEF_RegionalExtension_30P0_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, - asn_MBR_SpecializedContent_30P0_1, + asn_MBR_RegionalExtension_30P0_1, 2, /* Elements count */ - &asn_SPC_SpecializedContent_30P0_specs_1 /* Additional specs */ + &asn_SPC_RegionalExtension_30P0_specs_1 /* Additional specs */ }; diff --git a/tests/tests-asn1c-compiler/155-parameterization-more-than-two-level-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/155-parameterization-more-than-two-level-OK.asn1.-Pgen-PER index ab4a7ca55..487518838 100644 --- a/tests/tests-asn1c-compiler/155-parameterization-more-than-two-level-OK.asn1.-Pgen-PER +++ b/tests/tests-asn1c-compiler/155-parameterization-more-than-two-level-OK.asn1.-Pgen-PER @@ -501,7 +501,7 @@ asn_TYPE_descriptor_t asn_DEF_LowerLayer_List_45P0 = { /*** <<< TYPE-DECLS [SinglePacket] >>> ***/ -typedef Packet_51P0_t SinglePacket_48P0_t; +typedef ClassItem_51P0_t SinglePacket_48P0_t; /*** <<< FUNC-DECLS [SinglePacket] >>> ***/ @@ -519,7 +519,7 @@ per_type_encoder_f SinglePacket_48P0_encode_uper; /*** <<< CODE [SinglePacket] >>> ***/ /* - * This type is implemented using Packet_51P0, + * This type is implemented using ClassItem_51P0, * so here we adjust the DEF accordingly. */ @@ -539,9 +539,9 @@ asn_TYPE_descriptor_t asn_DEF_SinglePacket_48P0 = { sizeof(asn_DEF_SinglePacket_48P0_tags_1) /sizeof(asn_DEF_SinglePacket_48P0_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, - asn_MBR_Packet_51P0_1, + asn_MBR_ClassItem_51P0_1, 3, /* Elements count */ - &asn_SPC_Packet_51P0_specs_1 /* Additional specs */ + &asn_SPC_ClassItem_51P0_specs_1 /* Additional specs */ }; @@ -566,12 +566,12 @@ typedef enum value_PR { /*** <<< TYPE-DECLS [Packet] >>> ***/ -typedef struct Packet_51P0 { +typedef struct ClassItem_51P0 { PacketId_t id; Color_t color; struct value { value_PR present; - union Packet_51P0__value_u { + union ClassItem_51P0__value_u { OCTET_STRING_t OCTET_STRING; } choice; @@ -581,13 +581,13 @@ typedef struct Packet_51P0 { /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; -} Packet_51P0_t; +} ClassItem_51P0_t; /*** <<< FUNC-DECLS [Packet] >>> ***/ -extern asn_TYPE_descriptor_t asn_DEF_Packet_51P0; -extern asn_SEQUENCE_specifics_t asn_SPC_Packet_51P0_specs_1; -extern asn_TYPE_member_t asn_MBR_Packet_51P0_1[3]; +extern asn_TYPE_descriptor_t asn_DEF_ClassItem_51P0; +extern asn_SEQUENCE_specifics_t asn_SPC_ClassItem_51P0_specs_1; +extern asn_TYPE_member_t asn_MBR_ClassItem_51P0_1[3]; /*** <<< IOC-TABLES [Packet] >>> ***/ @@ -632,13 +632,13 @@ memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, } static asn_type_selector_result_t -select_Packet_51P0_color_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { +select_ClassItem_51P0_color_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { asn_type_selector_result_t result = {0, 0}; const asn_ioc_set_t *itable = asn_IOS_ClassItem_1; size_t constraining_column = 0; /* &id */ size_t for_column = 1; /* &color */ size_t row; - const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct Packet_51P0, id)); + const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct ClassItem_51P0, id)); for(row=0; row < itable->rows_count; row++) { const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column]; @@ -674,13 +674,13 @@ memb_color_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, } static asn_type_selector_result_t -select_Packet_51P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { +select_ClassItem_51P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { asn_type_selector_result_t result = {0, 0}; const asn_ioc_set_t *itable = asn_IOS_ClassItem_1; size_t constraining_column = 0; /* &id */ size_t for_column = 2; /* &Value */ size_t row; - const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct Packet_51P0, id)); + const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct ClassItem_51P0, id)); for(row=0; row < itable->rows_count; row++) { const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column]; @@ -775,8 +775,8 @@ asn_TYPE_descriptor_t asn_DEF_value_4 = { &asn_SPC_value_specs_4 /* Additional specs */ }; -asn_TYPE_member_t asn_MBR_Packet_51P0_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Packet_51P0, id), +asn_TYPE_member_t asn_MBR_ClassItem_51P0_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ClassItem_51P0, id), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_PacketId, @@ -785,53 +785,53 @@ asn_TYPE_member_t asn_MBR_Packet_51P0_1[] = { 0, 0, /* No default value */ .name = "id" }, - { ATF_NOFLAGS, 0, offsetof(struct Packet_51P0, color), + { ATF_NOFLAGS, 0, offsetof(struct ClassItem_51P0, color), .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_Color, - .type_selector = select_Packet_51P0_color_type, + .type_selector = select_ClassItem_51P0_color_type, { .oer_constraints = 0, .per_constraints = &asn_PER_memb_color_constr_3, .general_constraints = memb_color_constraint_1 }, 0, 0, /* No default value */ .name = "color" }, - { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Packet_51P0, value), + { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct ClassItem_51P0, value), .tag = -1 /* Ambiguous tag (ANY?) */, .tag_mode = 0, .type = &asn_DEF_value_4, - .type_selector = select_Packet_51P0_value_type, + .type_selector = select_ClassItem_51P0_value_type, { .oer_constraints = 0, .per_constraints = &asn_PER_memb_value_constr_4, .general_constraints = memb_value_constraint_1 }, 0, 0, /* No default value */ .name = "value" }, }; -static const ber_tlv_tag_t asn_DEF_Packet_51P0_tags_1[] = { +static const ber_tlv_tag_t asn_DEF_ClassItem_51P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; -static const asn_TYPE_tag2member_t asn_MAP_Packet_51P0_tag2el_1[] = { +static const asn_TYPE_tag2member_t asn_MAP_ClassItem_51P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* id */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 } /* color */ }; -asn_SEQUENCE_specifics_t asn_SPC_Packet_51P0_specs_1 = { - sizeof(struct Packet_51P0), - offsetof(struct Packet_51P0, _asn_ctx), - .tag2el = asn_MAP_Packet_51P0_tag2el_1, +asn_SEQUENCE_specifics_t asn_SPC_ClassItem_51P0_specs_1 = { + sizeof(struct ClassItem_51P0), + offsetof(struct ClassItem_51P0, _asn_ctx), + .tag2el = asn_MAP_ClassItem_51P0_tag2el_1, .tag2el_count = 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; -asn_TYPE_descriptor_t asn_DEF_Packet_51P0 = { - "Packet", - "Packet", +asn_TYPE_descriptor_t asn_DEF_ClassItem_51P0 = { + "ClassItem", + "ClassItem", &asn_OP_SEQUENCE, - asn_DEF_Packet_51P0_tags_1, - sizeof(asn_DEF_Packet_51P0_tags_1) - /sizeof(asn_DEF_Packet_51P0_tags_1[0]), /* 1 */ - asn_DEF_Packet_51P0_tags_1, /* Same as above */ - sizeof(asn_DEF_Packet_51P0_tags_1) - /sizeof(asn_DEF_Packet_51P0_tags_1[0]), /* 1 */ + asn_DEF_ClassItem_51P0_tags_1, + sizeof(asn_DEF_ClassItem_51P0_tags_1) + /sizeof(asn_DEF_ClassItem_51P0_tags_1[0]), /* 1 */ + asn_DEF_ClassItem_51P0_tags_1, /* Same as above */ + sizeof(asn_DEF_ClassItem_51P0_tags_1) + /sizeof(asn_DEF_ClassItem_51P0_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, - asn_MBR_Packet_51P0_1, + asn_MBR_ClassItem_51P0_1, 3, /* Elements count */ - &asn_SPC_Packet_51P0_specs_1 /* Additional specs */ + &asn_SPC_ClassItem_51P0_specs_1 /* Additional specs */ }; diff --git a/tests/tests-asn1c-compiler/156-union-ios-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/156-union-ios-OK.asn1.-Pgen-PER index 525541f63..16cfde8ab 100644 --- a/tests/tests-asn1c-compiler/156-union-ios-OK.asn1.-Pgen-PER +++ b/tests/tests-asn1c-compiler/156-union-ios-OK.asn1.-Pgen-PER @@ -7,7 +7,7 @@ /*** <<< TYPE-DECLS [Message] >>> ***/ typedef struct Message { - SpecializedContent_42P0_t content; + TotalRegionExtension_42P0_t content; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; @@ -23,7 +23,7 @@ static asn_TYPE_member_t asn_MBR_Message_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Message, content), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, - .type = &asn_DEF_SpecializedContent_42P0, + .type = &asn_DEF_TotalRegionExtension_42P0, .type_selector = 0, { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 }, 0, 0, /* No default value */ @@ -83,11 +83,11 @@ typedef enum value_PR { /*** <<< TYPE-DECLS [SpecializedContent] >>> ***/ -typedef struct SpecializedContent_42P0 { +typedef struct TotalRegionExtension_42P0 { long id; struct value { value_PR present; - union SpecializedContent_42P0__value_u { + union TotalRegionExtension_42P0__value_u { long INTEGER; BOOLEAN_t BOOLEAN; OCTET_STRING_t OCTET_STRING; @@ -99,13 +99,13 @@ typedef struct SpecializedContent_42P0 { /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; -} SpecializedContent_42P0_t; +} TotalRegionExtension_42P0_t; /*** <<< FUNC-DECLS [SpecializedContent] >>> ***/ -extern asn_TYPE_descriptor_t asn_DEF_SpecializedContent_42P0; -extern asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_42P0_specs_1; -extern asn_TYPE_member_t asn_MBR_SpecializedContent_42P0_1[2]; +extern asn_TYPE_descriptor_t asn_DEF_TotalRegionExtension_42P0; +extern asn_SEQUENCE_specifics_t asn_SPC_TotalRegionExtension_42P0_specs_1; +extern asn_TYPE_member_t asn_MBR_TotalRegionExtension_42P0_1[2]; /*** <<< IOC-TABLES [SpecializedContent] >>> ***/ @@ -155,13 +155,13 @@ memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, } static asn_type_selector_result_t -select_SpecializedContent_42P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { +select_TotalRegionExtension_42P0_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) { asn_type_selector_result_t result = {0, 0}; const asn_ioc_set_t *itable = asn_IOS_TotalRegionExtension_1; size_t constraining_column = 0; /* &id */ size_t for_column = 1; /* &Type */ size_t row; - const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct SpecializedContent_42P0, id)); + const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct TotalRegionExtension_42P0, id)); for(row=0; row < itable->rows_count; row++) { const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column]; @@ -274,8 +274,8 @@ asn_TYPE_descriptor_t asn_DEF_value_3 = { &asn_SPC_value_specs_3 /* Additional specs */ }; -asn_TYPE_member_t asn_MBR_SpecializedContent_42P0_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_42P0, id), +asn_TYPE_member_t asn_MBR_TotalRegionExtension_42P0_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct TotalRegionExtension_42P0, id), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_NativeInteger, @@ -284,43 +284,43 @@ asn_TYPE_member_t asn_MBR_SpecializedContent_42P0_1[] = { 0, 0, /* No default value */ .name = "id" }, - { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct SpecializedContent_42P0, value), + { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct TotalRegionExtension_42P0, value), .tag = -1 /* Ambiguous tag (ANY?) */, .tag_mode = 0, .type = &asn_DEF_value_3, - .type_selector = select_SpecializedContent_42P0_value_type, + .type_selector = select_TotalRegionExtension_42P0_value_type, { .oer_constraints = 0, .per_constraints = &asn_PER_memb_value_constr_3, .general_constraints = memb_value_constraint_1 }, 0, 0, /* No default value */ .name = "value" }, }; -static const ber_tlv_tag_t asn_DEF_SpecializedContent_42P0_tags_1[] = { +static const ber_tlv_tag_t asn_DEF_TotalRegionExtension_42P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; -static const asn_TYPE_tag2member_t asn_MAP_SpecializedContent_42P0_tag2el_1[] = { +static const asn_TYPE_tag2member_t asn_MAP_TotalRegionExtension_42P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* id */ }; -asn_SEQUENCE_specifics_t asn_SPC_SpecializedContent_42P0_specs_1 = { - sizeof(struct SpecializedContent_42P0), - offsetof(struct SpecializedContent_42P0, _asn_ctx), - .tag2el = asn_MAP_SpecializedContent_42P0_tag2el_1, +asn_SEQUENCE_specifics_t asn_SPC_TotalRegionExtension_42P0_specs_1 = { + sizeof(struct TotalRegionExtension_42P0), + offsetof(struct TotalRegionExtension_42P0, _asn_ctx), + .tag2el = asn_MAP_TotalRegionExtension_42P0_tag2el_1, .tag2el_count = 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; -asn_TYPE_descriptor_t asn_DEF_SpecializedContent_42P0 = { - "SpecializedContent", - "SpecializedContent", +asn_TYPE_descriptor_t asn_DEF_TotalRegionExtension_42P0 = { + "TotalRegionExtension", + "TotalRegionExtension", &asn_OP_SEQUENCE, - asn_DEF_SpecializedContent_42P0_tags_1, - sizeof(asn_DEF_SpecializedContent_42P0_tags_1) - /sizeof(asn_DEF_SpecializedContent_42P0_tags_1[0]), /* 1 */ - asn_DEF_SpecializedContent_42P0_tags_1, /* Same as above */ - sizeof(asn_DEF_SpecializedContent_42P0_tags_1) - /sizeof(asn_DEF_SpecializedContent_42P0_tags_1[0]), /* 1 */ + asn_DEF_TotalRegionExtension_42P0_tags_1, + sizeof(asn_DEF_TotalRegionExtension_42P0_tags_1) + /sizeof(asn_DEF_TotalRegionExtension_42P0_tags_1[0]), /* 1 */ + asn_DEF_TotalRegionExtension_42P0_tags_1, /* Same as above */ + sizeof(asn_DEF_TotalRegionExtension_42P0_tags_1) + /sizeof(asn_DEF_TotalRegionExtension_42P0_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, - asn_MBR_SpecializedContent_42P0_1, + asn_MBR_TotalRegionExtension_42P0_1, 2, /* Elements count */ - &asn_SPC_SpecializedContent_42P0_specs_1 /* Additional specs */ + &asn_SPC_TotalRegionExtension_42P0_specs_1 /* Additional specs */ };