Commit e8e87f14 authored by Lev Walkin's avatar Lev Walkin

explain practical constraints too

parent e422e68b
...@@ -366,14 +366,21 @@ asn1print_crange_value(asn1cnst_edge_t *edge, int as_char) { ...@@ -366,14 +366,21 @@ asn1print_crange_value(asn1cnst_edge_t *edge, int as_char) {
} }
static int static int
asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_t *ct, enum asn1p_constraint_type_e type) { asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, int strict_PER_visible) {
asn1cnst_range_t *range; asn1cnst_range_t *range;
int as_char = (type==ACT_CT_FROM); int as_char = (type==ACT_CT_FROM);
int i; int i;
range = asn1constraint_compute_PER_range(expr_type, ct, type, 0, 0); range = asn1constraint_compute_PER_range(expr_type, ct, type,
0, 0, strict_PER_visible);
if(!range) return -1; if(!range) return -1;
if(range->incompatible
|| (strict_PER_visible && range->not_PER_visible)) {
asn1constraint_range_free(range);
return 0;
}
switch(type) { switch(type) {
case ACT_CT_FROM: printf("(FROM("); break; case ACT_CT_FROM: printf("(FROM("); break;
case ACT_CT_SIZE: printf("(SIZE("); break; case ACT_CT_SIZE: printf("(SIZE("); break;
...@@ -410,13 +417,13 @@ asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_ ...@@ -410,13 +417,13 @@ asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_
static int static int
asn1print_constraint_explain(asn1p_expr_type_e expr_type, asn1print_constraint_explain(asn1p_expr_type_e expr_type,
asn1p_constraint_t *ct) { asn1p_constraint_t *ct, int s_PV) {
asn1print_constraint_explain_type(expr_type, ct, ACT_EL_RANGE); asn1print_constraint_explain_type(expr_type, ct, ACT_EL_RANGE, s_PV);
printf(" "); printf(" ");
asn1print_constraint_explain_type(expr_type, ct, ACT_CT_SIZE); asn1print_constraint_explain_type(expr_type, ct, ACT_CT_SIZE, s_PV);
printf(" "); printf(" ");
asn1print_constraint_explain_type(expr_type, ct, ACT_CT_FROM); asn1print_constraint_explain_type(expr_type, ct, ACT_CT_FROM, s_PV);
return 0; return 0;
} }
...@@ -564,10 +571,14 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri ...@@ -564,10 +571,14 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
top_parent = asn1f_find_terminal_type_ex(asn, mod, tc); top_parent = asn1f_find_terminal_type_ex(asn, mod, tc);
if(top_parent) { if(top_parent) {
printf("\n-- Practical constraints (%s): ",
top_parent->Identifier);
asn1print_constraint_explain(top_parent->expr_type,
tc->combined_constraints, 0);
printf("\n-- PER-visible constraints (%s): ", printf("\n-- PER-visible constraints (%s): ",
top_parent->Identifier); top_parent->Identifier);
asn1print_constraint_explain(top_parent->expr_type, asn1print_constraint_explain(top_parent->expr_type,
tc->combined_constraints); tc->combined_constraints, 1);
} }
printf("\n"); printf("\n");
} }
......
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