aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1print
diff options
context:
space:
mode:
Diffstat (limited to 'libasn1print')
-rw-r--r--libasn1print/asn1print.c43
-rw-r--r--libasn1print/asn1print.h7
2 files changed, 42 insertions, 8 deletions
diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c
index 865d90b1..ced31db3 100644
--- a/libasn1print/asn1print.c
+++ b/libasn1print/asn1print.c
@@ -106,7 +106,7 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags)
TQ_FOR(tc, &(mod->members), next) {
asn1print_expr(asn, mod, tc, flags, 0);
- if(flags & APF_DEBUG_CONSTRAINTS)
+ if(flags & APF_PRINT_CONSTRAINTS)
printf("\n");
else
printf("\n\n");
@@ -416,11 +416,9 @@ asn1print_with_syntax(asn1p_wsyntx_t *wx, enum asn1print_flags flags) {
switch(wc->type) {
case WC_LITERAL:
case WC_WHITESPACE:
+ case WC_FIELD:
printf("%s", wc->content.token);
break;
- case WC_REFERENCE:
- asn1print_ref(wc->content.ref, flags);
- break;
case WC_OPTIONALGROUP:
printf("[");
asn1print_with_syntax(wc->content.syntax,flags);
@@ -690,7 +688,7 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
/*
* The following section exists entirely for debugging.
*/
- if(flags & APF_DEBUG_CONSTRAINTS
+ if(flags & APF_PRINT_CONSTRAINTS
&& tc->expr_type != A1TC_EXTENSIBLE) {
asn1p_expr_t *top_parent;
@@ -713,6 +711,41 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
printf("\n");
}
+ if(flags & APF_PRINT_CLASS_MATRIX
+ && tc->expr_type == A1TC_CLASSDEF) do {
+ int r, col, maxidlen;
+ if(tc->object_class_matrix.rows == 0) {
+ printf("\n-- Class matrix is empty");
+ break;
+ }
+ printf("\n-- Class matrix has %d entr%s:\n",
+ tc->object_class_matrix.rows,
+ tc->object_class_matrix.rows==1 ? "y" : "ies");
+ maxidlen = tc->object_class_matrix.max_identifier_length;
+ for(r = -1; r < tc->object_class_matrix.rows; r++) {
+ struct asn1p_ioc_row_s *row;
+ row = tc->object_class_matrix.row[r<0?0:r];
+ if(r < 0) printf("-- %s", r > 9 ? " " : "");
+ else printf("-- [%*d]", r > 9 ? 2 : 1, r+1);
+ for(col = 0; col < row->columns; col++) {
+ struct asn1p_ioc_cell_s *cell;
+ cell = &row->column[col];
+ if(r < 0) {
+ printf("[%*s]", maxidlen,
+ cell->field->Identifier);
+ continue;
+ }
+ if(!cell->value) {
+ printf(" %*s ", maxidlen, "<no entry>");
+ continue;
+ }
+ printf(" %*s ", maxidlen,
+ cell->value->Identifier);
+ }
+ printf("\n");
+ }
+ } while(0);
+
return 0;
}
diff --git a/libasn1print/asn1print.h b/libasn1print/asn1print.h
index 336ba1eb..c24fa0cb 100644
--- a/libasn1print/asn1print.h
+++ b/libasn1print/asn1print.h
@@ -3,10 +3,11 @@
enum asn1print_flags {
APF_NOFLAGS,
- APF_LINE_COMMENTS = 0x01, /* Include line comments */
- APF_DEBUG_CONSTRAINTS = 0x02, /* Explain constraints */
+ APF_NOINDENT = 0x01, /* Disable indentation */
+ APF_LINE_COMMENTS = 0x02, /* Include line comments */
APF_PRINT_XML_DTD = 0x04, /* Generate XML DTD */
- APF_NOINDENT = 0x08, /* Disable indentation */
+ APF_PRINT_CONSTRAINTS = 0x08, /* Explain constraints */
+ APF_PRINT_CLASS_MATRIX = 0x10, /* Dump class matrix */
};
/*