Commit e596bf05 authored by Lev Walkin's avatar Lev Walkin
Browse files

WITH COMPONENT[S] pretty-printing

parent 8638f0d6
0.9.13: 2005-Mar-24
0.9.13: 2005-Mar-28
* Added extra const qualifiers into the support code.
* More RFC variations supported in crfc2asn1.pl.
......@@ -8,6 +8,7 @@
* Parsing support for CONSTRAINED BY. (Test case 79).
* Support for CharsDefn (Quadruple and Tuple, most used in
ASN1-CHARACTER-MODULE) (Test case 80).
* Pretty-printing support for WITH COMPONENT[S]. (Test case 82).
0.9.12: 2005-Mar-10
......
This diff is collapsed.
......@@ -278,7 +278,7 @@ static asn1p_value_t *
%type <a_constr> ConstraintSubtypeElement /* 1..2 */
%type <a_constr> SimpleTableConstraint
%type <a_constr> TableConstraint
%type <a_constr> WithComponents
%type <a_constr> InnerTypeConstraint
%type <a_constr> WithComponentsList
%type <a_constr> WithComponentsElement
%type <a_constr> ComponentRelationConstraint
......@@ -1668,7 +1668,7 @@ ConstraintSubtypeElement:
| TableConstraint {
$$ = $1;
}
| WithComponents {
| InnerTypeConstraint {
$$ = $1;
}
| TOK_CONSTRAINED TOK_BY '{'
......@@ -1742,8 +1742,11 @@ ContainedSubtype:
}
;
WithComponents:
TOK_WITH TOK_COMPONENTS '{' WithComponentsList '}' {
InnerTypeConstraint:
TOK_WITH TOK_COMPONENT SetOfConstraints {
CONSTRAINT_INSERT($$, ACT_CT_WCOMP, $3, 0);
}
| TOK_WITH TOK_COMPONENTS '{' WithComponentsList '}' {
CONSTRAINT_INSERT($$, ACT_CT_WCOMPS, $4, 0);
}
;
......@@ -1762,6 +1765,7 @@ WithComponentsElement:
$$ = asn1p_constraint_new(yylineno);
checkmem($$);
$$->type = ACT_EL_EXT;
$$->value = asn1p_value_frombuf("...", 3, 0);
}
| Identifier optConstraints optPresenceConstraint {
$$ = asn1p_constraint_new(yylineno);
......@@ -1769,6 +1773,7 @@ WithComponentsElement:
$$->type = ACT_EL_VALUE;
$$->value = asn1p_value_frombuf($1, strlen($1), 0);
$$->presence = $3;
if($2) asn1p_constraint_insert($$, $2);
}
;
......
......@@ -333,10 +333,36 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
printf(")");
break;
case ACT_CT_WCOMP:
printf("WITH COMPONENT ???");
assert(ct->el_count != 0);
assert(ct->el_count == 1);
printf("WITH COMPONENT (");
asn1print_constraint(ct->elements[0], flags);
printf(")");
break;
case ACT_CT_WCOMPS:
printf("WITH COMPONENTS { ??? }");
case ACT_CT_WCOMPS: {
unsigned int i;
printf("WITH COMPONENTS { ");
for(i = 0; i < ct->el_count; i++) {
asn1p_constraint_t *cel = ct->elements[i];
if(i) printf(", ");
fwrite(cel->value->value.string.buf,
1, cel->value->value.string.size,
stdout);
if(cel->el_count) {
assert(cel->el_count == 1);
printf(" ");
asn1print_constraint(cel->elements[0],
flags);
}
switch(cel->presence) {
case ACPRES_DEFAULT: break;
case ACPRES_PRESENT: printf(" PRESENT"); break;
case ACPRES_ABSENT: printf(" ABSENT"); break;
case ACPRES_OPTIONAL: printf(" OPTIONAL");break;
}
}
printf(" }");
}
break;
case ACT_CT_CTDBY:
printf("CONSTRAINED BY ");
......
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