moved -DASN_PDU_COLLECTION into compiler

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1200 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2006-09-17 04:52:50 +00:00
parent 70c232de00
commit 43c8ac5bf2
21 changed files with 1469 additions and 1388 deletions

View File

@ -23,8 +23,6 @@ if test -z "$ASN1PDU" \
exit exit
fi fi
ASN1DEFPDU=`echo "$ASN1PDU" | tr - _`
../../asn1c/asn1c -S ../../skeletons ${ASN1CMDOPTS} ${ASN1MODULES} || exit $? ../../asn1c/asn1c -S ../../skeletons ${ASN1CMDOPTS} ${ASN1MODULES} || exit $?
if test ! -f Makefile.am.sample ; then if test ! -f Makefile.am.sample ; then
@ -32,20 +30,15 @@ if test ! -f Makefile.am.sample ; then
exit 1 exit 1
fi fi
CFLAGS="" ASN1DEFPDU=`echo "$ASN1PDU" | tr - _`
CFLAGS="-DPDU=${ASN1DEFPDU}"
if test -f config.h ; then if test -f config.h ; then
CFLAGS="$CFLAGS -DHAVE_CONFIG_H" CFLAGS="-DHAVE_CONFIG_H $CFLAGS"
fi
FIXEDPDU=`echo "[$ASN1CMDOPTS]" | sed -e "s/.*-pdu=auto.*//"`
if test ! "$FIXEDPDU" ; then
CFLAGS="$CFLAGS -DASN_PDU_COLLECTION"
fi fi
set -x set -x
cat Makefile.am.sample \ cat Makefile.am.sample \
| sed -e "s/^CFLAGS.*/CFLAGS +=$CFLAGS -DPDU=${ASN1DEFPDU} -I./" \ | sed -e "s/^CFLAGS += /CFLAGS += ${CFLAGS} /" \
| sed -e "s/^all: /all: ${ASN1PDU}.c /" \ | sed -e "s/^all: /all: ${ASN1PDU}.c /" \
| sed -e "s/progname/${PROGNAME}/" \ | sed -e "s/progname/${PROGNAME}/" \
> Makefile.$$ > Makefile.$$

View File

@ -4740,7 +4740,7 @@ libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS)
# This file may be used as an input for make(3) # This file may be used as an input for make(3)
# Remove the lines below to convert it into a pure .am file # Remove the lines below to convert it into a pure .am file
TARGET = rrc-dump TARGET = rrc-dump
CFLAGS += -DHAVE_CONFIG_H -DASN_PDU_COLLECTION -DPDU=DL_DCCH_Message -I. CFLAGS += -DHAVE_CONFIG_H -DPDU=DL_DCCH_Message -DASN_PDU_COLLECTION -I.
OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}
all: DL-DCCH-Message.c $(TARGET) all: DL-DCCH-Message.c $(TARGET)

View File

@ -135,7 +135,7 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir,
"# This file may be used as an input for make(3)\n" "# This file may be used as an input for make(3)\n"
"# Remove the lines below to convert it into a pure .am file\n" "# Remove the lines below to convert it into a pure .am file\n"
"TARGET = progname\n" "TARGET = progname\n"
"CFLAGS += -I.\n" "CFLAGS +=%s -I.\n"
"OBJS=${ASN_MODULE_SOURCES:.c=.o}" "OBJS=${ASN_MODULE_SOURCES:.c=.o}"
" ${ASN_CONVERTER_SOURCES:.c=.o}\n" " ${ASN_CONVERTER_SOURCES:.c=.o}\n"
"\nall: $(TARGET)\n" "\nall: $(TARGET)\n"
@ -150,6 +150,7 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir,
"\n\trm -f $(OBJS)\n" "\n\trm -f $(OBJS)\n"
"\nregen: regenerate-from-asn1-source\n" "\nregen: regenerate-from-asn1-source\n"
"\nregenerate-from-asn1-source:\n\t" "\nregenerate-from-asn1-source:\n\t"
, (arg->flags & A1C_PDU_AUTO) ? " -DASN_PDU_COLLECTION" : ""
); );
for(i = 0; i < argc; i++) for(i = 0; i < argc; i++)

View File

@ -65,7 +65,7 @@ asn1f_class_access(arg_t *arg, asn1p_module_t *mod, asn1p_expr_t *rhs_pspecs, as
if(TQ_FIRST(&classfield->members)) { if(TQ_FIRST(&classfield->members)) {
/* Already have something */ /* Already have something */
} else { } else {
expr = asn1p_expr_new(classfield->_lineno); expr = asn1p_expr_new(classfield->_lineno, mod);
expr->expr_type = ASN_TYPE_ANY; expr->expr_type = ASN_TYPE_ANY;
expr->meta_type = AMT_TYPE; expr->meta_type = AMT_TYPE;
asn1p_expr_add(classfield, expr); asn1p_expr_add(classfield, expr);

View File

@ -152,7 +152,7 @@ asn1f_fix_constr_ext(arg_t *arg) {
if(arg->mod->module_flags & MSF_EXTENSIBILITY_IMPLIED if(arg->mod->module_flags & MSF_EXTENSIBILITY_IMPLIED
&& ext_count == 0) { && ext_count == 0) {
v = asn1p_expr_new(0); v = asn1p_expr_new(0, arg->mod);
if(v) { if(v) {
v->Identifier = strdup("..."); v->Identifier = strdup("...");
v->expr_type = A1TC_EXTENSIBLE; v->expr_type = A1TC_EXTENSIBLE;

View File

@ -87,6 +87,14 @@ asn1constraint_compatible(asn1p_expr_type_e expr_type,
return 0; return 0;
case ACT_CT_CTDBY: case ACT_CT_CTDBY:
return 1; return 1;
case ACT_CT_CTNG: /* X.682, #11 */
switch(expr_type) {
case ASN_BASIC_OCTET_STRING:
case ASN_BASIC_BIT_STRING:
return 1;
default:
return 0;
}
case ACT_CA_SET: case ACT_CA_SET:
case ACT_CA_CRC: case ACT_CA_CRC:
case ACT_CA_CSV: case ACT_CA_CSV:

View File

@ -192,7 +192,7 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, struct asn1p_i
FATAL("Value %s at line %d is too large for this compiler! Contact the asn1c author.\n", p, arg->expr->_lineno); FATAL("Value %s at line %d is too large for this compiler! Contact the asn1c author.\n", p, arg->expr->_lineno);
return -1; return -1;
} }
expr = asn1p_expr_new(arg->expr->_lineno); expr = asn1p_expr_new(arg->expr->_lineno, arg->expr->module);
expr->Identifier = p; expr->Identifier = p;
expr->meta_type = AMT_VALUE; expr->meta_type = AMT_VALUE;
expr->expr_type = ASN_BASIC_INTEGER; expr->expr_type = ASN_BASIC_INTEGER;

View File

@ -81,6 +81,8 @@ asn1f_printable_value(asn1p_value_t *v) {
/* Buffer is guaranteed to be null-terminated */ /* Buffer is guaranteed to be null-terminated */
assert(v->value.string.buf[v->value.string.size] == '\0'); assert(v->value.string.buf[v->value.string.size] == '\0');
return (char *)v->value.string.buf; return (char *)v->value.string.buf;
case ATV_TYPE:
return "<Type>";
case ATV_BITVECTOR: case ATV_BITVECTOR:
{ {
uint8_t *bitvector; uint8_t *bitvector;

View File

@ -169,6 +169,8 @@ asn1p_constraint_type2str(enum asn1p_constraint_type_e type) {
return "MultipleTypeConstraints"; return "MultipleTypeConstraints";
case ACT_CT_CTDBY: case ACT_CT_CTDBY:
return "UserDefinedConstraint"; return "UserDefinedConstraint";
case ACT_CT_CTNG:
return "ContentsConstraint";
case ACT_CA_SET: case ACT_CA_SET:
return "SET"; return "SET";
case ACT_CA_CRC: case ACT_CA_CRC:

View File

@ -26,11 +26,12 @@ typedef struct asn1p_constraint_s {
ACT_CT_WCOMP, /* WITH COMPONENT */ ACT_CT_WCOMP, /* WITH COMPONENT */
ACT_CT_WCOMPS, /* WITH COMPONENTS */ ACT_CT_WCOMPS, /* WITH COMPONENTS */
ACT_CT_CTDBY, /* CONSTRAINED BY */ ACT_CT_CTDBY, /* CONSTRAINED BY */
ACT_CT_CTNG, /* CONTAINING Type */
/* /*
* Arrays of constraints. * Arrays of constraints.
*/ */
ACT_CA_SET, /* A set of constraints: (c1)(c2) */ ACT_CA_SET, /* A set of constraints: (c1)(c2) */
ACT_CA_CRC, /* Comp. relation c-t: ({a})({@b}) */ ACT_CA_CRC, /* Comp. relation c-t: ({a}{@b}) */
ACT_CA_CSV, /* Comma-separated constraints array */ ACT_CA_CSV, /* Comma-separated constraints array */
ACT_CA_UNI, /* UNION (|) */ ACT_CA_UNI, /* UNION (|) */
ACT_CA_INT, /* INTERSECTION (^) */ ACT_CA_INT, /* INTERSECTION (^) */

View File

@ -13,13 +13,14 @@ static asn1p_value_t *value_resolver(asn1p_value_t *, void *arg);
* Construct a new empty types collection. * Construct a new empty types collection.
*/ */
asn1p_expr_t * asn1p_expr_t *
asn1p_expr_new(int _lineno) { asn1p_expr_new(int _lineno, asn1p_module_t *mod) {
asn1p_expr_t *expr; asn1p_expr_t *expr;
expr = calloc(1, sizeof *expr); expr = calloc(1, sizeof *expr);
if(expr) { if(expr) {
TQ_INIT(&(expr->members)); TQ_INIT(&(expr->members));
expr->spec_index = -1; expr->spec_index = -1;
expr->module = mod;
expr->_lineno = _lineno; expr->_lineno = _lineno;
} }
@ -96,7 +97,7 @@ asn1p_expr_clone_impl(asn1p_expr_t *expr, int skip_extensions, asn1p_expr_t *(*r
return NULL; /* Hard error */ return NULL; /* Hard error */
} }
} }
if(!clone) clone = asn1p_expr_new(expr->_lineno); if(!clone) clone = asn1p_expr_new(expr->_lineno, expr->module);
if(!clone) return NULL; if(!clone) return NULL;
/* /*
@ -106,7 +107,6 @@ asn1p_expr_clone_impl(asn1p_expr_t *expr, int skip_extensions, asn1p_expr_t *(*r
CLCOPY(expr_type); CLCOPY(expr_type);
CLCOPY(tag); CLCOPY(tag);
CLCOPY(marker.flags); /* OPTIONAL/DEFAULT */ CLCOPY(marker.flags); /* OPTIONAL/DEFAULT */
CLCOPY(module);
CLCOPY(_mark); CLCOPY(_mark);
clone->data = 0; /* Do not clone this */ clone->data = 0; /* Do not clone this */
@ -165,7 +165,7 @@ value_resolver(asn1p_value_t *value, void *rarg) {
} }
ref = value->value.reference; ref = value->value.reference;
tmpexpr = asn1p_expr_new(ref->_lineno); tmpexpr = asn1p_expr_new(ref->_lineno, 0);
tmpexpr->meta_type = AMT_TYPEREF; tmpexpr->meta_type = AMT_TYPEREF;
tmpexpr->expr_type = A1TC_REFERENCE; tmpexpr->expr_type = A1TC_REFERENCE;
tmpexpr->reference = ref; tmpexpr->reference = ref;

View File

@ -271,7 +271,7 @@ typedef struct asn1p_expr_s {
/* /*
* Constructor and destructor. * Constructor and destructor.
*/ */
asn1p_expr_t *asn1p_expr_new(int _lineno); asn1p_expr_t *asn1p_expr_new(int _lineno, struct asn1p_module_s *);
asn1p_expr_t *asn1p_expr_clone(asn1p_expr_t *, int skip_extensions); asn1p_expr_t *asn1p_expr_clone(asn1p_expr_t *, int skip_extensions);
asn1p_expr_t *asn1p_expr_clone_with_resolver(asn1p_expr_t *, asn1p_expr_t *asn1p_expr_clone_with_resolver(asn1p_expr_t *,
asn1p_expr_t *(*resolver)(asn1p_expr_t *to_resolve, void *resolver_arg), asn1p_expr_t *(*resolver)(asn1p_expr_t *to_resolve, void *resolver_arg),

View File

@ -12,8 +12,8 @@ asn1p_module_new() {
mod = calloc(1, sizeof *mod); mod = calloc(1, sizeof *mod);
if(mod) { if(mod) {
TQ_INIT(&(mod->imports));
TQ_INIT(&(mod->exports)); TQ_INIT(&(mod->exports));
TQ_INIT(&(mod->imports));
TQ_INIT(&(mod->members)); TQ_INIT(&(mod->members));
} }
return mod; return mod;

View File

@ -4,6 +4,18 @@
#ifndef ASN1_PARSER_MODULE_H #ifndef ASN1_PARSER_MODULE_H
#define ASN1_PARSER_MODULE_H #define ASN1_PARSER_MODULE_H
struct asn1p_module_s;
/*
* A simple container for several modules.
*/
typedef struct asn1p_s {
TQ_HEAD(struct asn1p_module_s) modules;
} asn1p_t;
asn1p_t *asn1p_new(void);
void asn1p_delete(asn1p_t *asn);
/* /*
* Flags specific to a module. * Flags specific to a module.
*/ */
@ -71,6 +83,9 @@ typedef struct asn1p_module_s {
TQ_ENTRY(struct asn1p_module_s) TQ_ENTRY(struct asn1p_module_s)
mod_next; mod_next;
/* All modules */
asn1p_t *asn1p;
/* /*
* Internally useful properties. * Internally useful properties.
*/ */
@ -85,15 +100,4 @@ typedef struct asn1p_module_s {
asn1p_module_t *asn1p_module_new(void); asn1p_module_t *asn1p_module_new(void);
void asn1p_module_free(asn1p_module_t *mod); void asn1p_module_free(asn1p_module_t *mod);
/*
* No more than a container for several modules.
*/
typedef struct asn1p_s {
TQ_HEAD(struct asn1p_module_s) modules;
} asn1p_t;
asn1p_t *asn1p_new(void);
void asn1p_delete(asn1p_t *asn);
#endif /* ASN1_PARSER_MODULE_H */ #endif /* ASN1_PARSER_MODULE_H */

View File

@ -132,6 +132,16 @@ asn1p_value_fromint(asn1c_integer_t i) {
return v; return v;
} }
asn1p_value_t *
asn1p_value_fromtype(asn1p_expr_t *expr) {
asn1p_value_t *v = calloc(1, sizeof *v);
if(v) {
v->value.v_type = expr;
v->type = ATV_TYPE;
}
return v;
}
asn1p_value_t * asn1p_value_t *
asn1p_value_clone(asn1p_value_t *v) { asn1p_value_clone(asn1p_value_t *v) {
return asn1p_value_clone_with_resolver(v, 0, 0); return asn1p_value_clone_with_resolver(v, 0, 0);
@ -149,6 +159,8 @@ asn1p_value_clone_with_resolver(asn1p_value_t *v,
return calloc(1, sizeof(*clone)); return calloc(1, sizeof(*clone));
case ATV_REAL: case ATV_REAL:
return asn1p_value_fromdouble(v->value.v_double); return asn1p_value_fromdouble(v->value.v_double);
case ATV_TYPE:
return asn1p_value_fromtype(v->value.v_type);
case ATV_INTEGER: case ATV_INTEGER:
case ATV_MIN: case ATV_MIN:
case ATV_MAX: case ATV_MAX:
@ -213,6 +225,9 @@ asn1p_value_free(asn1p_value_t *v) {
case ATV_NOVALUE: case ATV_NOVALUE:
case ATV_NULL: case ATV_NULL:
break; break;
case ATV_TYPE:
asn1p_expr_free(v->value.v_type);
break;
case ATV_REAL: case ATV_REAL:
case ATV_INTEGER: case ATV_INTEGER:
case ATV_MIN: case ATV_MIN:

View File

@ -5,6 +5,7 @@
#define ASN1_PARSER_VALUE_H #define ASN1_PARSER_VALUE_H
struct asn1p_constraint_s; /* Forward declaration */ struct asn1p_constraint_s; /* Forward declaration */
struct asn1p_expr_s;
/* /*
* A wrapper around various kinds of values. * A wrapper around various kinds of values.
@ -15,6 +16,7 @@ typedef struct asn1p_value_s {
*/ */
enum { enum {
ATV_NOVALUE, ATV_NOVALUE,
ATV_TYPE, /* A type (as in CONTAINING Type) */
ATV_NULL, /* A "NULL" value of type NULL. */ ATV_NULL, /* A "NULL" value of type NULL. */
ATV_REAL, /* A constant floating-point value */ ATV_REAL, /* A constant floating-point value */
ATV_INTEGER, /* An integer constant */ ATV_INTEGER, /* An integer constant */
@ -34,6 +36,7 @@ typedef struct asn1p_value_s {
union { union {
struct asn1p_constraint_s *constraint; /* ValueSet */ struct asn1p_constraint_s *constraint; /* ValueSet */
struct asn1p_expr_s *v_type; /* Type */
asn1p_ref_t *reference; asn1p_ref_t *reference;
asn1c_integer_t v_integer; asn1c_integer_t v_integer;
double v_double; double v_double;
@ -68,6 +71,7 @@ asn1p_value_t *asn1p_value_frombits(uint8_t *bits, int size_in_bits, int dc);
asn1p_value_t *asn1p_value_frombuf(char *buffer, int size, int do_copy); asn1p_value_t *asn1p_value_frombuf(char *buffer, int size, int do_copy);
asn1p_value_t *asn1p_value_fromdouble(double); asn1p_value_t *asn1p_value_fromdouble(double);
asn1p_value_t *asn1p_value_fromint(asn1c_integer_t); asn1p_value_t *asn1p_value_fromint(asn1c_integer_t);
asn1p_value_t *asn1p_value_fromtype(struct asn1p_expr_s *);
asn1p_value_t *asn1p_value_clone(asn1p_value_t *); asn1p_value_t *asn1p_value_clone(asn1p_value_t *);
asn1p_value_t *asn1p_value_clone_with_resolver(asn1p_value_t *, asn1p_value_t *asn1p_value_clone_with_resolver(asn1p_value_t *,
asn1p_value_t *(*resolver)(asn1p_value_t *, void *rarg), asn1p_value_t *(*resolver)(asn1p_value_t *, void *rarg),

File diff suppressed because it is too large Load Diff

View File

@ -245,7 +245,7 @@
#ifndef YYSTYPE #ifndef YYSTYPE
#line 85 "asn1p_y.y" #line 88 "asn1p_y.y"
typedef union { typedef union {
asn1p_t *a_grammar; asn1p_t *a_grammar;
asn1p_module_flags_e a_module_flags; asn1p_module_flags_e a_module_flags;

View File

@ -37,6 +37,9 @@ static struct AssignedIdentifier *saved_aid;
static asn1p_value_t *_convert_bitstring2binary(char *str, int base); static asn1p_value_t *_convert_bitstring2binary(char *str, int base);
static void _fixup_anonymous_identifier(asn1p_expr_t *expr); static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
static asn1p_module_t *currentModule;
#define NEW_EXPR() (asn1p_expr_new(yylineno, currentModule))
#define checkmem(ptr) do { \ #define checkmem(ptr) do { \
if(!(ptr)) \ if(!(ptr)) \
return yyerror("Memory failure"); \ return yyerror("Memory failure"); \
@ -255,6 +258,7 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
%type <a_expr> ImportsElement %type <a_expr> ImportsElement
%type <a_expr> ExportsElement %type <a_expr> ExportsElement
%type <a_expr> ExtensionAndException %type <a_expr> ExtensionAndException
%type <a_expr> Type
%type <a_expr> TypeDeclaration %type <a_expr> TypeDeclaration
%type <a_expr> TypeDeclarationSet %type <a_expr> TypeDeclarationSet
%type <a_ref> ComplexTypeReference %type <a_ref> ComplexTypeReference
@ -266,7 +270,6 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
%type <a_ref> DefinedObjectClass %type <a_ref> DefinedObjectClass
%type <a_expr> ClassField %type <a_expr> ClassField
%type <a_expr> ObjectClass %type <a_expr> ObjectClass
%type <a_expr> Type
%type <a_expr> DataTypeReference /* Type1 ::= Type2 */ %type <a_expr> DataTypeReference /* Type1 ::= Type2 */
%type <a_expr> DefinedType %type <a_expr> DefinedType
%type <a_constr> ValueSet /* {a|b|c}*/ %type <a_constr> ValueSet /* {a|b|c}*/
@ -307,13 +310,17 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
%type <a_tag> TagClass TagTypeValue TagPlicit %type <a_tag> TagClass TagTypeValue TagPlicit
%type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */ %type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */
%type <a_constr> optConstraints %type <a_constr> optConstraints
%type <a_constr> Constraints %type <a_constr> Constraint
%type <a_constr> SubtypeConstraint
%type <a_constr> GeneralConstraint
%type <a_constr> SetOfConstraints %type <a_constr> SetOfConstraints
%type <a_constr> ElementSetSpecs /* 1..2,...,3 */ %type <a_constr> ElementSetSpecs /* 1..2,...,3 */
%type <a_constr> ElementSetSpec /* 1..2,...,3 */ %type <a_constr> ElementSetSpec /* 1..2,...,3 */
%type <a_constr> ConstraintSubtypeElement /* 1..2 */ %type <a_constr> ConstraintSubtypeElement /* 1..2 */
%type <a_constr> SimpleTableConstraint %type <a_constr> SimpleTableConstraint
%type <a_constr> UserDefinedConstraint
%type <a_constr> TableConstraint %type <a_constr> TableConstraint
%type <a_constr> ContentsConstraint
%type <a_constr> InnerTypeConstraint %type <a_constr> InnerTypeConstraint
%type <a_constr> WithComponentsList %type <a_constr> WithComponentsList
%type <a_constr> WithComponentsElement %type <a_constr> WithComponentsElement
@ -368,23 +375,27 @@ ModuleList:
*/ */
ModuleDefinition: ModuleDefinition:
TypeRefName optObjectIdentifier TOK_DEFINITIONS TypeRefName { currentModule = asn1p_module_new(); }
optObjectIdentifier TOK_DEFINITIONS
optModuleDefinitionFlags optModuleDefinitionFlags
TOK_PPEQ TOK_BEGIN TOK_PPEQ TOK_BEGIN
optModuleBody optModuleBody
TOK_END { TOK_END {
if($7) { $$ = currentModule;
$$ = $7;
if($8) {
asn1p_module_t tmp = *($$);
*($$) = *($8);
*($8) = tmp;
asn1p_module_free($8);
} else { } else {
/* There's a chance that a module is just plain empty */ /* There's a chance that a module is just plain empty */
$$ = asn1p_module_new();
} }
checkmem($$);
$$->ModuleName = $1; $$->ModuleName = $1;
$$->module_oid = $2; $$->module_oid = $3;
$$->module_flags = $4; $$->module_flags = $5;
} }
; ;
@ -649,19 +660,19 @@ ImportsList:
ImportsElement: ImportsElement:
TypeRefName { TypeRefName {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->expr_type = A1TC_REFERENCE; $$->expr_type = A1TC_REFERENCE;
} }
| TypeRefName '{' '}' { /* Completely equivalent to above */ | TypeRefName '{' '}' { /* Completely equivalent to above */
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->expr_type = A1TC_REFERENCE; $$->expr_type = A1TC_REFERENCE;
} }
| Identifier { | Identifier {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->expr_type = A1TC_REFERENCE; $$->expr_type = A1TC_REFERENCE;
@ -710,19 +721,19 @@ ExportsBody:
ExportsElement: ExportsElement:
TypeRefName { TypeRefName {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->expr_type = A1TC_EXPORTVAR; $$->expr_type = A1TC_EXPORTVAR;
} }
| TypeRefName '{' '}' { | TypeRefName '{' '}' {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->expr_type = A1TC_EXPORTVAR; $$->expr_type = A1TC_EXPORTVAR;
} }
| Identifier { | Identifier {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->expr_type = A1TC_EXPORTVAR; $$->expr_type = A1TC_EXPORTVAR;
@ -757,7 +768,7 @@ DefinedType:
* "Type" * "Type"
*/ */
| ComplexTypeReference { | ComplexTypeReference {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->reference = $1; $$->reference = $1;
$$->expr_type = A1TC_REFERENCE; $$->expr_type = A1TC_REFERENCE;
@ -767,7 +778,7 @@ DefinedType:
* A parameterized assignment. * A parameterized assignment.
*/ */
| ComplexTypeReference '{' ActualParameterList '}' { | ComplexTypeReference '{' ActualParameterList '}' {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->reference = $1; $$->reference = $1;
$$->rhs_pspecs = $3; $$->rhs_pspecs = $3;
@ -880,7 +891,7 @@ ParameterArgumentName:
ActualParameterList: ActualParameterList:
ActualParameter { ActualParameter {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
asn1p_expr_add($$, $1); asn1p_expr_add($$, $1);
} }
@ -895,7 +906,7 @@ ActualParameter:
$$ = $1; $$ = $1;
} }
| SimpleValue { | SimpleValue {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = "?"; $$->Identifier = "?";
$$->expr_type = A1TC_REFERENCE; $$->expr_type = A1TC_REFERENCE;
@ -904,7 +915,7 @@ ActualParameter:
} }
| Identifier { | Identifier {
asn1p_ref_t *ref; asn1p_ref_t *ref;
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->expr_type = A1TC_REFERENCE; $$->expr_type = A1TC_REFERENCE;
@ -914,7 +925,7 @@ ActualParameter:
$$->value = asn1p_value_fromref(ref, 0); $$->value = asn1p_value_fromref(ref, 0);
} }
| ValueSet { | ValueSet {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
$$->expr_type = A1TC_VALUESET; $$->expr_type = A1TC_VALUESET;
$$->meta_type = AMT_VALUESET; $$->meta_type = AMT_VALUESET;
$$->constraints = $1; $$->constraints = $1;
@ -923,7 +934,7 @@ ActualParameter:
/* /*
| '{' ActualParameter '}' { | '{' ActualParameter '}' {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
asn1p_expr_add($$, $2); asn1p_expr_add($$, $2);
$$->expr_type = A1TC_PARAMETRIZED; $$->expr_type = A1TC_PARAMETRIZED;
@ -936,12 +947,12 @@ ActualParameter:
* A collection of constructed data type members. * A collection of constructed data type members.
*/ */
optComponentTypeLists: optComponentTypeLists:
{ $$ = asn1p_expr_new(yylineno); } { $$ = NEW_EXPR(); }
| ComponentTypeLists { $$ = $1; }; | ComponentTypeLists { $$ = $1; };
ComponentTypeLists: ComponentTypeLists:
ComponentType { ComponentType {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
asn1p_expr_add($$, $1); asn1p_expr_add($$, $1);
} }
@ -966,7 +977,7 @@ ComponentType:
_fixup_anonymous_identifier($$); _fixup_anonymous_identifier($$);
} }
| TOK_COMPONENTS TOK_OF Type { | TOK_COMPONENTS TOK_OF Type {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->meta_type = $3->meta_type; $$->meta_type = $3->meta_type;
$$->expr_type = A1TC_COMPONENTS_OF; $$->expr_type = A1TC_COMPONENTS_OF;
@ -979,7 +990,7 @@ ComponentType:
AlternativeTypeLists: AlternativeTypeLists:
AlternativeType { AlternativeType {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
asn1p_expr_add($$, $1); asn1p_expr_add($$, $1);
} }
@ -1021,7 +1032,7 @@ optUnique:
FieldSpec: FieldSpec:
ClassField { ClassField {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->expr_type = A1TC_CLASSDEF; $$->expr_type = A1TC_CLASSDEF;
$$->meta_type = AMT_OBJECTCLASS; $$->meta_type = AMT_OBJECTCLASS;
@ -1038,7 +1049,7 @@ ClassField:
/* TypeFieldSpec ::= typefieldreference TypeOptionalitySpec? */ /* TypeFieldSpec ::= typefieldreference TypeOptionalitySpec? */
TOK_typefieldreference optMarker { TOK_typefieldreference optMarker {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->meta_type = AMT_OBJECTFIELD; $$->meta_type = AMT_OBJECTFIELD;
@ -1048,7 +1059,7 @@ ClassField:
/* FixedTypeValueFieldSpec ::= valuefieldreference Type UNIQUE ? ValueOptionalitySpec ? */ /* FixedTypeValueFieldSpec ::= valuefieldreference Type UNIQUE ? ValueOptionalitySpec ? */
| TOK_valuefieldreference Type optUnique optMarker { | TOK_valuefieldreference Type optUnique optMarker {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
$$->Identifier = $1; $$->Identifier = $1;
$$->meta_type = AMT_OBJECTFIELD; $$->meta_type = AMT_OBJECTFIELD;
$$->expr_type = A1TC_CLASSFIELD_FTVFS; /* FixedTypeValueFieldSpec */ $$->expr_type = A1TC_CLASSFIELD_FTVFS; /* FixedTypeValueFieldSpec */
@ -1059,7 +1070,7 @@ ClassField:
/* VariableTypeValueFieldSpec ::= valuefieldreference FieldName ValueOptionalitySpec ? */ /* VariableTypeValueFieldSpec ::= valuefieldreference FieldName ValueOptionalitySpec ? */
| TOK_valuefieldreference FieldName optMarker { | TOK_valuefieldreference FieldName optMarker {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
$$->Identifier = $1; $$->Identifier = $1;
$$->meta_type = AMT_OBJECTFIELD; $$->meta_type = AMT_OBJECTFIELD;
$$->expr_type = A1TC_CLASSFIELD_VTVFS; $$->expr_type = A1TC_CLASSFIELD_VTVFS;
@ -1069,7 +1080,7 @@ ClassField:
/* ObjectFieldSpec ::= objectfieldreference DefinedObjectClass ObjectOptionalitySpec ? */ /* ObjectFieldSpec ::= objectfieldreference DefinedObjectClass ObjectOptionalitySpec ? */
| TOK_valuefieldreference DefinedObjectClass optMarker { | TOK_valuefieldreference DefinedObjectClass optMarker {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->reference = $2; $$->reference = $2;
@ -1080,7 +1091,7 @@ ClassField:
/* VariableTypeValueSetFieldSpec ::= valuesetfieldreference FieldName ValueOptionalitySpec ? */ /* VariableTypeValueSetFieldSpec ::= valuesetfieldreference FieldName ValueOptionalitySpec ? */
| TOK_typefieldreference FieldName optMarker { | TOK_typefieldreference FieldName optMarker {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
$$->Identifier = $1; $$->Identifier = $1;
$$->meta_type = AMT_OBJECTFIELD; $$->meta_type = AMT_OBJECTFIELD;
$$->expr_type = A1TC_CLASSFIELD_VTVSFS; $$->expr_type = A1TC_CLASSFIELD_VTVSFS;
@ -1090,7 +1101,7 @@ ClassField:
/* FixedTypeValueSetFieldSpec ::= valuesetfieldreference Type ValueSetOptionalitySpec ? */ /* FixedTypeValueSetFieldSpec ::= valuesetfieldreference Type ValueSetOptionalitySpec ? */
| TOK_typefieldreference Type optMarker { | TOK_typefieldreference Type optMarker {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->meta_type = AMT_OBJECTFIELD; $$->meta_type = AMT_OBJECTFIELD;
@ -1101,7 +1112,7 @@ ClassField:
/* ObjectSetFieldSpec ::= objectsetfieldreference DefinedObjectClass ObjectOptionalitySpec ? */ /* ObjectSetFieldSpec ::= objectsetfieldreference DefinedObjectClass ObjectOptionalitySpec ? */
| TOK_typefieldreference DefinedObjectClass optMarker { | TOK_typefieldreference DefinedObjectClass optMarker {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = $1;
$$->reference = $2; $$->reference = $2;
@ -1157,7 +1168,7 @@ WithSyntaxToken:
ExtensionAndException: ExtensionAndException:
TOK_ThreeDots { TOK_ThreeDots {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = strdup("..."); $$->Identifier = strdup("...");
checkmem($$->Identifier); checkmem($$->Identifier);
@ -1165,7 +1176,7 @@ ExtensionAndException:
$$->meta_type = AMT_TYPE; $$->meta_type = AMT_TYPE;
} }
| TOK_ThreeDots '!' DefinedValue { | TOK_ThreeDots '!' DefinedValue {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = strdup("..."); $$->Identifier = strdup("...");
checkmem($$->Identifier); checkmem($$->Identifier);
@ -1174,7 +1185,7 @@ ExtensionAndException:
$$->meta_type = AMT_TYPE; $$->meta_type = AMT_TYPE;
} }
| TOK_ThreeDots '!' SignedNumber { | TOK_ThreeDots '!' SignedNumber {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = strdup("..."); $$->Identifier = strdup("...");
$$->value = $3; $$->value = $3;
@ -1255,7 +1266,7 @@ TypeDeclarationSet:
$$->meta_type = AMT_TYPE; $$->meta_type = AMT_TYPE;
} }
| TOK_SEQUENCE optConstraints TOK_OF optIdentifier optTag TypeDeclaration { | TOK_SEQUENCE optConstraints TOK_OF optIdentifier optTag TypeDeclaration {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->constraints = $2; $$->constraints = $2;
$$->expr_type = ASN_CONSTR_SEQUENCE_OF; $$->expr_type = ASN_CONSTR_SEQUENCE_OF;
@ -1265,7 +1276,7 @@ TypeDeclarationSet:
asn1p_expr_add($$, $6); asn1p_expr_add($$, $6);
} }
| TOK_SET optConstraints TOK_OF optIdentifier optTag TypeDeclaration { | TOK_SET optConstraints TOK_OF optIdentifier optTag TypeDeclaration {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->constraints = $2; $$->constraints = $2;
$$->expr_type = ASN_CONSTR_SET_OF; $$->expr_type = ASN_CONSTR_SET_OF;
@ -1275,14 +1286,14 @@ TypeDeclarationSet:
asn1p_expr_add($$, $6); asn1p_expr_add($$, $6);
} }
| TOK_ANY { | TOK_ANY {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->expr_type = ASN_TYPE_ANY; $$->expr_type = ASN_TYPE_ANY;
$$->meta_type = AMT_TYPE; $$->meta_type = AMT_TYPE;
} }
| TOK_ANY TOK_DEFINED TOK_BY Identifier { | TOK_ANY TOK_DEFINED TOK_BY Identifier {
int ret; int ret;
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->reference = asn1p_ref_new(yylineno); $$->reference = asn1p_ref_new(yylineno);
ret = asn1p_ref_add_component($$->reference, ret = asn1p_ref_add_component($$->reference,
@ -1292,7 +1303,7 @@ TypeDeclarationSet:
$$->meta_type = AMT_TYPE; $$->meta_type = AMT_TYPE;
} }
| TOK_INSTANCE TOK_OF ComplexTypeReference { | TOK_INSTANCE TOK_OF ComplexTypeReference {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->reference = $3; $$->reference = $3;
$$->expr_type = A1TC_INSTANCE; $$->expr_type = A1TC_INSTANCE;
@ -1625,7 +1636,7 @@ BasicTypeId_UniverationCompatible:
BasicType: BasicType:
BasicTypeId { BasicTypeId {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->expr_type = $1; $$->expr_type = $1;
$$->meta_type = AMT_TYPE; $$->meta_type = AMT_TYPE;
@ -1634,7 +1645,7 @@ BasicType:
if($2) { if($2) {
$$ = $2; $$ = $2;
} else { } else {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
} }
$$->expr_type = $1; $$->expr_type = $1;
@ -1681,12 +1692,19 @@ Except: TOK_EXCEPT;
optConstraints: optConstraints:
{ $$ = 0; } { $$ = 0; }
| Constraints { | Constraint {
$$ = $1; $$ = $1;
} }
; ;
Constraints: Constraint:
SubtypeConstraint
| '(' GeneralConstraint ')' {
$$ = $2;
}
;
SubtypeConstraint:
SetOfConstraints { SetOfConstraints {
CONSTRAINT_INSERT($$, ACT_CA_SET, $1, 0); CONSTRAINT_INSERT($$, ACT_CA_SET, $1, 0);
} }
@ -1811,28 +1829,9 @@ ConstraintSubtypeElement:
$$->range_start->type = ATV_MIN; $$->range_start->type = ATV_MIN;
$$->range_stop->type = ATV_MAX; $$->range_stop->type = ATV_MAX;
} }
| TableConstraint {
$$ = $1;
}
| InnerTypeConstraint { | InnerTypeConstraint {
$$ = $1; $$ = $1;
} }
| TOK_CONSTRAINED TOK_BY '{'
{ asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ {
$$ = asn1p_constraint_new(yylineno);
checkmem($$);
$$->type = ACT_CT_CTDBY;
$$->value = asn1p_value_frombuf($5.buf, $5.len, 0);
checkmem($$->value);
$$->value->type = ATV_UNPARSED;
}
;
ConstraintRangeSpec:
TOK_TwoDots { $$ = ACT_EL_RANGE; }
| TOK_TwoDots '<' { $$ = ACT_EL_RLRANGE; }
| '<' TOK_TwoDots { $$ = ACT_EL_LLRANGE; }
| '<' TOK_TwoDots '<' { $$ = ACT_EL_ULRANGE; }
; ;
ConstraintSpec: ConstraintSpec:
@ -1939,6 +1938,40 @@ PresenceConstraint:
} }
; ;
/* X.682 */
GeneralConstraint:
UserDefinedConstraint
| TableConstraint
| ContentsConstraint
;
UserDefinedConstraint:
TOK_CONSTRAINED TOK_BY '{'
{ asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ {
$$ = asn1p_constraint_new(yylineno);
checkmem($$);
$$->type = ACT_CT_CTDBY;
$$->value = asn1p_value_frombuf($5.buf, $5.len, 0);
checkmem($$->value);
$$->value->type = ATV_UNPARSED;
}
;
ContentsConstraint:
TOK_CONTAINING Type {
$$ = asn1p_constraint_new(yylineno);
$$->type = ACT_CT_CTNG;
$$->value = asn1p_value_fromtype($2);
}
;
ConstraintRangeSpec:
TOK_TwoDots { $$ = ACT_EL_RANGE; }
| TOK_TwoDots '<' { $$ = ACT_EL_RLRANGE; }
| '<' TOK_TwoDots { $$ = ACT_EL_LLRANGE; }
| '<' TOK_TwoDots '<' { $$ = ACT_EL_ULRANGE; }
;
TableConstraint: TableConstraint:
SimpleTableConstraint { SimpleTableConstraint {
$$ = $1; $$ = $1;
@ -2077,7 +2110,7 @@ optUniverationDefinition:
UniverationDefinition: UniverationDefinition:
'{' '}' { '{' '}' {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
} }
| '{' UniverationList '}' { | '{' UniverationList '}' {
@ -2087,7 +2120,7 @@ UniverationDefinition:
UniverationList: UniverationList:
UniverationElement { UniverationElement {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
asn1p_expr_add($$, $1); asn1p_expr_add($$, $1);
} }
@ -2099,14 +2132,14 @@ UniverationList:
UniverationElement: UniverationElement:
Identifier { Identifier {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->expr_type = A1TC_UNIVERVAL; $$->expr_type = A1TC_UNIVERVAL;
$$->meta_type = AMT_VALUE; $$->meta_type = AMT_VALUE;
$$->Identifier = $1; $$->Identifier = $1;
} }
| Identifier '(' SignedNumber ')' { | Identifier '(' SignedNumber ')' {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->expr_type = A1TC_UNIVERVAL; $$->expr_type = A1TC_UNIVERVAL;
$$->meta_type = AMT_VALUE; $$->meta_type = AMT_VALUE;
@ -2114,7 +2147,7 @@ UniverationElement:
$$->value = $3; $$->value = $3;
} }
| Identifier '(' DefinedValue ')' { | Identifier '(' DefinedValue ')' {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->expr_type = A1TC_UNIVERVAL; $$->expr_type = A1TC_UNIVERVAL;
$$->meta_type = AMT_VALUE; $$->meta_type = AMT_VALUE;
@ -2122,14 +2155,14 @@ UniverationElement:
$$->value = $3; $$->value = $3;
} }
| SignedNumber { | SignedNumber {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->expr_type = A1TC_UNIVERVAL; $$->expr_type = A1TC_UNIVERVAL;
$$->meta_type = AMT_VALUE; $$->meta_type = AMT_VALUE;
$$->value = $1; $$->value = $1;
} }
| TOK_ThreeDots { | TOK_ThreeDots {
$$ = asn1p_expr_new(yylineno); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = strdup("..."); $$->Identifier = strdup("...");
checkmem($$->Identifier); checkmem($$->Identifier);

View File

@ -150,45 +150,14 @@ _asn1p_set_flags(enum asn1p_flags flags) {
return 0; return 0;
} }
/*
* Perform last touches.
*/
static void
_asn1p_apply_module2expr(asn1p_expr_t *expr, asn1p_module_t *mod) {
asn1p_expr_t *e;
expr->module = mod; /* This is a useful thing */
/*
* Do it to children also.
*/
TQ_FOR(e, &(expr->members), next) {
_asn1p_apply_module2expr(e, mod);
}
/*
* Do to parameterization.
*/
if(expr->rhs_pspecs) {
TQ_FOR(e, &(expr->rhs_pspecs->members), next) {
_asn1p_apply_module2expr(e, mod);
}
}
}
static int static int
_asn1p_fix_modules(asn1p_t *a, const char *fname) { _asn1p_fix_modules(asn1p_t *a, const char *fname) {
asn1p_module_t *mod; asn1p_module_t *mod;
TQ_FOR(mod, &(a->modules), mod_next) { TQ_FOR(mod, &(a->modules), mod_next) {
asn1p_expr_t *expr;
mod->source_file_name = strdup(fname); mod->source_file_name = strdup(fname);
if(mod->source_file_name == NULL) if(mod->source_file_name == NULL)
return -1; return -1;
mod->asn1p = a;
TQ_FOR(expr, &(mod->members), next) {
_asn1p_apply_module2expr(expr, mod);
}
} }
return 0; return 0;
} }

View File

@ -190,6 +190,11 @@ asn1print_value(asn1p_value_t *val, enum asn1print_flags flags) {
case ATV_REAL: case ATV_REAL:
printf("%f", val->value.v_double); printf("%f", val->value.v_double);
return 0; return 0;
case ATV_TYPE:
asn1print_expr(val->value.v_type->module->asn1p,
val->value.v_type->module,
val->value.v_type, flags, 0);
return 0;
case ATV_INTEGER: case ATV_INTEGER:
printf("%" PRIdASN, val->value.v_integer); printf("%" PRIdASN, val->value.v_integer);
return 0; return 0;
@ -349,10 +354,19 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
} }
break; break;
case ACT_CT_CTDBY: case ACT_CT_CTDBY:
printf("CONSTRAINED BY "); printf("(CONSTRAINED BY ");
assert(ct->value->type == ATV_UNPARSED); assert(ct->value->type == ATV_UNPARSED);
fwrite(ct->value->value.string.buf, fwrite(ct->value->value.string.buf,
1, ct->value->value.string.size, stdout); 1, ct->value->value.string.size, stdout);
printf(")");
break;
case ACT_CT_CTNG:
printf("(CONTAINING ");
asn1print_expr(ct->value->value.v_type->module->asn1p,
ct->value->value.v_type->module,
ct->value->value.v_type,
flags, 1);
printf(")");
break; break;
case ACT_CA_SET: symno++; case ACT_CA_SET: symno++;
case ACT_CA_CRC: symno++; case ACT_CA_CRC: symno++;
@ -364,6 +378,7 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",", char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",",
"", "(" }; "", "(" };
unsigned int i; unsigned int i;
if(ct->type == ACT_CA_CRC) fputs("(", stdout);
for(i = 0; i < ct->el_count; i++) { for(i = 0; i < ct->el_count; i++) {
if(i) fputs(symtable[symno], stdout); if(i) fputs(symtable[symno], stdout);
if(ct->type == ACT_CA_CRC) fputs("{", stdout); if(ct->type == ACT_CA_CRC) fputs("{", stdout);
@ -373,6 +388,7 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
&& ct->type == ACT_CA_SET) && ct->type == ACT_CA_SET)
fputs(")", stdout); fputs(")", stdout);
} }
if(ct->type == ACT_CA_CRC) fputs(")", stdout);
} }
break; break;
case ACT_CA_AEX: case ACT_CA_AEX: