explain practical constraints too
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@215 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c
index 143cfdb..c90e966 100644
--- a/libasn1print/asn1print.c
+++ b/libasn1print/asn1print.c
@@ -366,14 +366,21 @@
}
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;
int as_char = (type==ACT_CT_FROM);
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->incompatible
+ || (strict_PER_visible && range->not_PER_visible)) {
+ asn1constraint_range_free(range);
+ return 0;
+ }
+
switch(type) {
case ACT_CT_FROM: printf("(FROM("); break;
case ACT_CT_SIZE: printf("(SIZE("); break;
@@ -410,13 +417,13 @@
static int
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(" ");
- asn1print_constraint_explain_type(expr_type, ct, ACT_CT_SIZE);
+ asn1print_constraint_explain_type(expr_type, ct, ACT_CT_SIZE, s_PV);
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;
}
@@ -564,10 +571,14 @@
top_parent = asn1f_find_terminal_type_ex(asn, mod, tc);
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): ",
top_parent->Identifier);
asn1print_constraint_explain(top_parent->expr_type,
- tc->combined_constraints);
+ tc->combined_constraints, 1);
}
printf("\n");
}