Commit aa8c06f9 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Compare constraints field in asn1p_expr_compare()

With this modification, asn1f_parameterization_fork() will fork
parameterization if rhs_pspecs and stored rhs_pspecs have different
constraints, e.g. expressions parameterized by different
VALUESET references. Associated information object tables will be
generated accordingly.
parent 4cc779fd
...@@ -24,10 +24,18 @@ asn1p_constraint_set_source(asn1p_constraint_t *ct, ...@@ -24,10 +24,18 @@ asn1p_constraint_set_source(asn1p_constraint_t *ct,
int asn1p_constraint_compare(const asn1p_constraint_t *a, int asn1p_constraint_compare(const asn1p_constraint_t *a,
const asn1p_constraint_t *b) { const asn1p_constraint_t *b) {
(void)a; assert((a && b));
(void)b;
assert(!"Constraint comparison is not implemented"); if(a->type != b->type)
return -1; return -1;
/* Currently we only check VALUESET as a reference */
if(a->type == ACT_EL_TYPE) {
return strcmp(a->containedSubtype->value.v_type->reference->components[0].name,
b->containedSubtype->value.v_type->reference->components[0].name);
}
return 0;
} }
asn1p_constraint_t * asn1p_constraint_t *
......
...@@ -57,6 +57,12 @@ asn1p_expr_compare(const asn1p_expr_t *a, const asn1p_expr_t *b) { ...@@ -57,6 +57,12 @@ asn1p_expr_compare(const asn1p_expr_t *a, const asn1p_expr_t *b) {
return -1; return -1;
} }
if((!a->constraints && b->constraints) || (a->constraints && !b->constraints)) {
return -1;
} else if(a->constraints && asn1p_constraint_compare(a->constraints, b->constraints)) {
return -1;
}
if((a->tag.tag_class != b->tag.tag_class) if((a->tag.tag_class != b->tag.tag_class)
|| (a->tag.tag_mode != b->tag.tag_mode) || (a->tag.tag_mode != b->tag.tag_mode)
|| (a->tag.tag_value != b->tag.tag_value)) { || (a->tag.tag_value != b->tag.tag_value)) {
......
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