From 112d69e0403965119973ec293c00ca7ab25c81e5 Mon Sep 17 00:00:00 2001 From: Lev Walkin <vlm@lionet.info> Date: Wed, 9 Mar 2005 20:52:15 +0000 Subject: [PATCH] 1. Finer support for BOOLEAN 2. Small refactoring --- libasn1print/asn1print.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c index 45738aec..7ec4ca2e 100644 --- a/libasn1print/asn1print.c +++ b/libasn1print/asn1print.c @@ -49,6 +49,12 @@ asn1print(asn1p_t *asn, enum asn1print_flags flags) { asn1print_module(asn, mod, flags); } + if(flags & APF_PRINT_XML_DTD) { + /* Values for BOOLEAN */ + printf("<!ELEMENT true EMPTY>\n"); + printf("<!ELEMENT false EMPTY>\n"); + } + return 0; } @@ -670,15 +676,6 @@ asn1print_expr_dtd(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, enum a if(!expr->Identifier) return 0; - if(expr->expr_type == ASN_CONSTR_CHOICE - || expr->expr_type == ASN_CONSTR_SEQUENCE_OF - || expr->expr_type == ASN_CONSTR_SET_OF - || expr->expr_type == ASN_CONSTR_SET - || expr->expr_type == ASN_BASIC_INTEGER - || expr->expr_type == ASN_BASIC_ENUMERATED) { - expr_unordered = 1; - } - if(flags & APF_LINE_COMMENTS) INDENT("<!-- #line %d -->\n", expr->_lineno); INDENT("<!ELEMENT %s", expr->Identifier); @@ -693,6 +690,12 @@ asn1print_expr_dtd(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, enum a dont_involve_children = 1; } + if((expr->expr_type & ASN_CONSTR_MASK) + || expr->expr_type == ASN_BASIC_INTEGER + || expr->expr_type == ASN_BASIC_ENUMERATED) { + expr_unordered = 1; + } + if(TQ_FIRST(&expr->members)) { int extensible = 0; printf(" ("); @@ -738,7 +741,7 @@ asn1print_expr_dtd(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, enum a } else switch(expr->expr_type) { case ASN_BASIC_BOOLEAN: - printf("(true|false)"); + printf(" (true|false)"); break; case ASN_CONSTR_CHOICE: case ASN_CONSTR_SET: -- GitLab