Commit 3d76a039 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Add support of extension group inside CHOICE type

In LTE-RRC 36.331 15.3.0, there is :

    RLC-Config-NB-r13 ::= CHOICE {
        am    SEQUENCE {
            ul-AM-RLC-r13                UL-AM-RLC-NB-r13,
            dl-AM-RLC-r13                DL-AM-RLC-NB-r13
        },
        ...,
        [[  um-Bi-Directional-r15        NULL,
            um-Uni-Directional-UL-r15    NULL,
            um-Uni-Directional-DL-r15    NULL
        ]]
    }

that asn1c can not handle `[[` ... `]]` inside CHOICE type.

1. Modify asn1p_y.y and asn1p_y.c to mimic the approach for handling extension
   group inside SEQUENCE type.

2. Modify asn1c_C.c to use 'ext1', 'ext2' ... as extension groups names.
parent 995c5bd4
......@@ -971,6 +971,7 @@ asn1c_lang_C_type_CHOICE(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *v;
int saved_target = arg->target->target;
int ext_num = 1;
DEPENDENCIES;
......@@ -990,7 +991,15 @@ asn1c_lang_C_type_CHOICE(arg_t *arg) {
skipComma = 1;
continue;
}
OUT("%s", c_presence_name(arg, v));
if((v->expr_type == ASN_CONSTR_SEQUENCE) &&
(v->marker.flags & EM_OPTIONAL) &&
(v->Identifier == NULL)) {
char ext_name[20];
sprintf(ext_name, "ext%d", ext_num++);
v->Identifier = strdup(ext_name);
}
OUT("%s", c_presence_name(arg, v));
}
OUT("\n");
);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1076,6 +1076,13 @@ AlternativeTypeLists:
$$ = $1;
asn1p_expr_add($$, $3);
}
| AlternativeTypeLists ',' TOK_VBracketLeft AlternativeTypeLists TOK_VBracketRight {
$$ = $1;
$4->meta_type = AMT_TYPE;
$4->expr_type = ASN_CONSTR_SEQUENCE;
$4->marker.flags |= EM_OPTIONAL;
asn1p_expr_add($$, $4);
}
;
AlternativeType:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment