WITH COMPONENT[S] pretty-printing

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@839 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2005-03-28 15:01:27 +00:00
parent 3b94853606
commit 7bbdc9f651
4 changed files with 422 additions and 381 deletions

View File

@ -1,5 +1,5 @@
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

File diff suppressed because it is too large Load Diff

View File

@ -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);
}
;

View File

@ -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 ");