Commit 59165cf2 authored by Lev Walkin's avatar Lev Walkin

reorganized parsing around constraints

parent 2701dc2a
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
#line 115 "asn1p_y.y" #line 116 "asn1p_y.y"
{ {
asn1p_t *a_grammar; asn1p_t *a_grammar;
asn1p_module_flags_e a_module_flags; asn1p_module_flags_e a_module_flags;
......
...@@ -38,7 +38,8 @@ prefixed_fprintf(FILE *f, const char *fmt, ...) { ...@@ -38,7 +38,8 @@ prefixed_fprintf(FILE *f, const char *fmt, ...) {
} }
int yylex(void); int yylex(void);
int yyerror(const char *msg); static int yyerror(const char *msg);
#ifdef YYBYACC #ifdef YYBYACC
int yyparse(void **param); /* byacc does not produce a prototype */ int yyparse(void **param); /* byacc does not produce a prototype */
#endif #endif
...@@ -294,8 +295,13 @@ static asn1p_module_t *currentModule; ...@@ -294,8 +295,13 @@ static asn1p_module_t *currentModule;
%type <a_expr> ExportsElement %type <a_expr> ExportsElement
%type <a_expr> ExtensionAndException %type <a_expr> ExtensionAndException
%type <a_expr> Type %type <a_expr> Type
%type <a_expr> TaggedType
%type <a_expr> MaybeIndirectTaggedType
%type <a_expr> UntaggedType
%type <a_expr> DefinedUntaggedType
%type <a_expr> ConcreteTypeDeclaration "concrete TypeDeclaration"
%type <a_expr> TypeDeclaration %type <a_expr> TypeDeclaration
%type <a_expr> TypeDeclarationSet %type <a_expr> MaybeIndirectTypeDeclaration
%type <a_ref> ComplexTypeReference %type <a_ref> ComplexTypeReference
%type <a_ref> ComplexTypeReferenceAmpList %type <a_ref> ComplexTypeReferenceAmpList
%type <a_refcomp> ComplexTypeReferenceElement %type <a_refcomp> ComplexTypeReferenceElement
...@@ -331,7 +337,6 @@ static asn1p_module_t *currentModule; ...@@ -331,7 +337,6 @@ static asn1p_module_t *currentModule;
%type <a_expr> IdentifierElement %type <a_expr> IdentifierElement
%type <a_expr> UniverationElement %type <a_expr> UniverationElement
%type <tv_str> TypeRefName %type <tv_str> TypeRefName
%type <tv_str> ObjectClassReference
%type <tv_str> Identifier %type <tv_str> Identifier
%type <a_ref> IdentifierAsReference %type <a_ref> IdentifierAsReference
%type <a_value> IdentifierAsValue %type <a_value> IdentifierAsValue
...@@ -345,7 +350,7 @@ static asn1p_module_t *currentModule; ...@@ -345,7 +350,7 @@ static asn1p_module_t *currentModule;
%type <a_oid> optObjectIdentifier /* Optional OID */ %type <a_oid> optObjectIdentifier /* Optional OID */
%type <a_oid> ObjectIdentifierBody %type <a_oid> ObjectIdentifierBody
%type <a_oid_arc> ObjectIdentifierElement %type <a_oid_arc> ObjectIdentifierElement
%type <a_expr> BasicType %type <a_expr> BuiltinType
%type <a_type> BasicTypeId %type <a_type> BasicTypeId
%type <a_type> BasicTypeId_UniverationCompatible %type <a_type> BasicTypeId_UniverationCompatible
%type <a_type> BasicString %type <a_type> BasicString
...@@ -399,7 +404,6 @@ static asn1p_module_t *currentModule; ...@@ -399,7 +404,6 @@ static asn1p_module_t *currentModule;
%type <a_wchunk> WithSyntaxToken %type <a_wchunk> WithSyntaxToken
%type <a_marker> optMarker Marker %type <a_marker> optMarker Marker
%type <a_int> optUNIQUE %type <a_int> optUNIQUE
%type <a_int> optINCLUDES
%type <a_pres> optPresenceConstraint PresenceConstraint %type <a_pres> optPresenceConstraint PresenceConstraint
%type <tv_str> ComponentIdList %type <tv_str> ComponentIdList
%type <a_int> NSTD_IndirectMarker %type <a_int> NSTD_IndirectMarker
...@@ -818,7 +822,7 @@ ExportsElement: ...@@ -818,7 +822,7 @@ ExportsElement:
ValueSet: '{' ElementSetSpecs '}' { $$ = $2; }; ValueSet: '{' ElementSetSpecs '}' { $$ = $2; };
ValueSetTypeAssignment: ValueSetTypeAssignment:
TypeRefName DefinedType TOK_PPEQ ValueSet { TypeRefName Type TOK_PPEQ ValueSet {
$$ = $2; $$ = $2;
assert($$->Identifier == 0); assert($$->Identifier == 0);
$$->Identifier = $1; $$->Identifier = $1;
...@@ -828,9 +832,6 @@ ValueSetTypeAssignment: ...@@ -828,9 +832,6 @@ ValueSetTypeAssignment:
; ;
DefinedType: DefinedType:
BasicType {
$$ = $1;
}
/* /*
* A DefinedType reference. * A DefinedType reference.
* "CLASS1.&id.&id2" * "CLASS1.&id.&id2"
...@@ -841,7 +842,7 @@ DefinedType: ...@@ -841,7 +842,7 @@ DefinedType:
* or * or
* "Type" * "Type"
*/ */
| ComplexTypeReference { ComplexTypeReference {
$$ = NEW_EXPR(); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->reference = $1; $$->reference = $1;
...@@ -978,9 +979,7 @@ ActualParameterList: ...@@ -978,9 +979,7 @@ ActualParameterList:
; ;
ActualParameter: ActualParameter:
Type { UntaggedType /* act. Type */
$$ = $1;
}
| SimpleValue { | SimpleValue {
$$ = NEW_EXPR(); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
...@@ -989,16 +988,13 @@ ActualParameter: ...@@ -989,16 +988,13 @@ ActualParameter:
$$->meta_type = AMT_VALUE; $$->meta_type = AMT_VALUE;
$$->value = $1; $$->value = $1;
} }
| Identifier { | DefinedValue {
asn1p_ref_t *ref;
$$ = NEW_EXPR(); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->Identifier = $1; $$->Identifier = strdup("?");
$$->expr_type = A1TC_REFERENCE; $$->expr_type = A1TC_REFERENCE;
$$->meta_type = AMT_VALUE; $$->meta_type = AMT_VALUE;
ref = asn1p_ref_new(yylineno, currentModule); $$->value = $1;
asn1p_ref_add_component(ref, $1, RLT_lowercase);
$$->value = asn1p_value_fromref(ref, 0);
} }
| ValueSet { | ValueSet {
$$ = NEW_EXPR(); $$ = NEW_EXPR();
...@@ -1044,20 +1040,20 @@ ComponentTypeLists: ...@@ -1044,20 +1040,20 @@ ComponentTypeLists:
; ;
ComponentType: ComponentType:
Identifier Type optMarker { Identifier MaybeIndirectTaggedType optMarker {
$$ = $2; $$ = $2;
assert($$->Identifier == 0); assert($$->Identifier == 0);
$$->Identifier = $1; $$->Identifier = $1;
$3.flags |= $$->marker.flags; $3.flags |= $$->marker.flags;
$$->marker = $3; $$->marker = $3;
} }
| Type optMarker { | MaybeIndirectTaggedType optMarker {
$$ = $1; $$ = $1;
$2.flags |= $$->marker.flags; $2.flags |= $$->marker.flags;
$$->marker = $2; $$->marker = $2;
_fixup_anonymous_identifier($$); _fixup_anonymous_identifier($$);
} }
| TOK_COMPONENTS TOK_OF Type { | TOK_COMPONENTS TOK_OF MaybeIndirectTaggedType {
$$ = NEW_EXPR(); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->meta_type = $3->meta_type; $$->meta_type = $3->meta_type;
...@@ -1082,7 +1078,7 @@ AlternativeTypeLists: ...@@ -1082,7 +1078,7 @@ AlternativeTypeLists:
; ;
AlternativeType: AlternativeType:
Identifier Type { Identifier MaybeIndirectTaggedType {
$$ = $2; $$ = $2;
assert($$->Identifier == 0); assert($$->Identifier == 0);
$$->Identifier = $1; $$->Identifier = $1;
...@@ -1090,7 +1086,7 @@ AlternativeType: ...@@ -1090,7 +1086,7 @@ AlternativeType:
| ExtensionAndException { | ExtensionAndException {
$$ = $1; $$ = $1;
} }
| Type { | MaybeIndirectTaggedType {
$$ = $1; $$ = $1;
_fixup_anonymous_identifier($$); _fixup_anonymous_identifier($$);
} }
...@@ -1276,8 +1272,63 @@ ExtensionAndException: ...@@ -1276,8 +1272,63 @@ ExtensionAndException:
} }
; ;
Type: Type: TaggedType;
optTag TypeDeclaration optManyConstraints {
TaggedType:
optTag UntaggedType {
$$ = $2;
$$->tag = $1;
}
;
DefinedUntaggedType:
DefinedType optManyConstraints {
$$ = $1;
/*
* Outer constraint for SEQUENCE OF and SET OF applies
* to the inner type.
*/
if($$->expr_type == ASN_CONSTR_SEQUENCE_OF
|| $$->expr_type == ASN_CONSTR_SET_OF) {
assert(!TQ_FIRST(&($$->members))->constraints);
TQ_FIRST(&($$->members))->constraints = $2;
} else {
if($$->constraints) {
assert(!$2);
/* Check this : optManyConstraints is not used ?! */
asn1p_constraint_free($2);
} else {
$$->constraints = $2;
}
}
}
;
UntaggedType:
TypeDeclaration optManyConstraints {
$$ = $1;
/*
* Outer constraint for SEQUENCE OF and SET OF applies
* to the inner type.
*/
if($$->expr_type == ASN_CONSTR_SEQUENCE_OF
|| $$->expr_type == ASN_CONSTR_SET_OF) {
assert(!TQ_FIRST(&($$->members))->constraints);
TQ_FIRST(&($$->members))->constraints = $2;
} else {
if($$->constraints) {
assert(!$2);
/* Check this : optManyConstraints is not used ?! */
asn1p_constraint_free($2);
} else {
$$->constraints = $2;
}
}
}
;
MaybeIndirectTaggedType:
optTag MaybeIndirectTypeDeclaration optManyConstraints {
$$ = $2; $$ = $2;
$$->tag = $1; $$->tag = $1;
/* /*
...@@ -1307,8 +1358,8 @@ NSTD_IndirectMarker: ...@@ -1307,8 +1358,8 @@ NSTD_IndirectMarker:
} }
; ;
TypeDeclaration: MaybeIndirectTypeDeclaration:
NSTD_IndirectMarker TypeDeclarationSet { NSTD_IndirectMarker TypeDeclaration {
$$ = $2; $$ = $2;
$$->marker.flags |= $1; $$->marker.flags |= $1;
...@@ -1326,10 +1377,12 @@ TypeDeclaration: ...@@ -1326,10 +1377,12 @@ TypeDeclaration:
} }
; ;
TypeDeclarationSet: TypeDeclaration:
DefinedType { ConcreteTypeDeclaration
$$ = $1; | DefinedType;
}
ConcreteTypeDeclaration:
BuiltinType
| TOK_CHOICE '{' AlternativeTypeLists '}' { | TOK_CHOICE '{' AlternativeTypeLists '}' {
$$ = $3; $$ = $3;
assert($$->expr_type == A1TC_INVALID); assert($$->expr_type == A1TC_INVALID);
...@@ -1348,7 +1401,7 @@ TypeDeclarationSet: ...@@ -1348,7 +1401,7 @@ TypeDeclarationSet:
$$->expr_type = ASN_CONSTR_SET; $$->expr_type = ASN_CONSTR_SET;
$$->meta_type = AMT_TYPE; $$->meta_type = AMT_TYPE;
} }
| TOK_SEQUENCE optSizeOrConstraint TOK_OF optIdentifier optTag TypeDeclaration { | TOK_SEQUENCE optSizeOrConstraint TOK_OF optIdentifier optTag MaybeIndirectTypeDeclaration {
$$ = NEW_EXPR(); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->constraints = $2; $$->constraints = $2;
...@@ -1358,7 +1411,7 @@ TypeDeclarationSet: ...@@ -1358,7 +1411,7 @@ TypeDeclarationSet:
$6->tag = $5; $6->tag = $5;
asn1p_expr_add($$, $6); asn1p_expr_add($$, $6);
} }
| TOK_SET optSizeOrConstraint TOK_OF optIdentifier optTag TypeDeclaration { | TOK_SET optSizeOrConstraint TOK_OF optIdentifier optTag MaybeIndirectTypeDeclaration {
$$ = NEW_EXPR(); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
$$->constraints = $2; $$->constraints = $2;
...@@ -1409,18 +1462,15 @@ ComplexTypeReference: ...@@ -1409,18 +1462,15 @@ ComplexTypeReference:
checkmem(ret == 0); checkmem(ret == 0);
free($1); free($1);
} }
| TOK_typereference '.' TypeRefName { | TOK_capitalreference {
int ret; int ret;
$$ = asn1p_ref_new(yylineno, currentModule); $$ = asn1p_ref_new(yylineno, currentModule);
checkmem($$); checkmem($$);
ret = asn1p_ref_add_component($$, $1, RLT_UNKNOWN); ret = asn1p_ref_add_component($$, $1, RLT_CAPITALS);
checkmem(ret == 0);
ret = asn1p_ref_add_component($$, $3, RLT_UNKNOWN);
checkmem(ret == 0);
free($1); free($1);
free($3); checkmem(ret == 0);
} }
| ObjectClassReference '.' TypeRefName { | TOK_typereference '.' TypeRefName {
int ret; int ret;
$$ = asn1p_ref_new(yylineno, currentModule); $$ = asn1p_ref_new(yylineno, currentModule);
checkmem($$); checkmem($$);
...@@ -1431,26 +1481,18 @@ ComplexTypeReference: ...@@ -1431,26 +1481,18 @@ ComplexTypeReference:
free($1); free($1);
free($3); free($3);
} }
| TOK_typereference '.' Identifier { | TOK_capitalreference '.' TypeRefName {
int ret; int ret;
$$ = asn1p_ref_new(yylineno, currentModule); $$ = asn1p_ref_new(yylineno, currentModule);
checkmem($$); checkmem($$);
ret = asn1p_ref_add_component($$, $1, RLT_UNKNOWN); ret = asn1p_ref_add_component($$, $1, RLT_UNKNOWN);
checkmem(ret == 0); checkmem(ret == 0);
ret = asn1p_ref_add_component($$, $3, RLT_lowercase); ret = asn1p_ref_add_component($$, $3, RLT_UNKNOWN);
checkmem(ret == 0); checkmem(ret == 0);
free($1); free($1);
free($3); free($3);
} }
| ObjectClassReference { | TOK_capitalreference '.' ComplexTypeReferenceAmpList {
int ret;
$$ = asn1p_ref_new(yylineno, currentModule);
checkmem($$);
ret = asn1p_ref_add_component($$, $1, RLT_CAPITALS);
free($1);
checkmem(ret == 0);
}
| ObjectClassReference '.' ComplexTypeReferenceAmpList {
int ret; int ret;
$$ = $3; $$ = $3;
ret = asn1p_ref_add_component($$, $1, RLT_CAPITALS); ret = asn1p_ref_add_component($$, $1, RLT_CAPITALS);
...@@ -1560,66 +1602,37 @@ ValueAssignment: ...@@ -1560,66 +1602,37 @@ ValueAssignment:
Value: Value:
SimpleValue SimpleValue
| DefinedValue | DefinedValue
| Identifier ':' Value {
$$ = asn1p_value_fromint(0);
checkmem($$);
$$->type = ATV_CHOICE_IDENTIFIER;
$$->value.choice_identifier.identifier = $1;
$$->value.choice_identifier.value = $3;
}
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque { | '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque {
$$ = asn1p_value_frombuf($3.buf, $3.len, 0); $$ = asn1p_value_frombuf($3.buf, $3.len, 0);
checkmem($$); checkmem($$);
$$->type = ATV_UNPARSED; $$->type = ATV_UNPARSED;
} }
| TOK_NULL { ;
SimpleValue:
TOK_NULL {
$$ = asn1p_value_fromint(0); $$ = asn1p_value_fromint(0);
checkmem($$); checkmem($$);
$$->type = ATV_NULL; $$->type = ATV_NULL;
} }
; | TOK_FALSE {
SimpleValue:
TOK_FALSE {
$$ = asn1p_value_fromint(0); $$ = asn1p_value_fromint(0);
checkmem($$); checkmem($$);
$$->type = ATV_FALSE; $$->type = ATV_FALSE;
} }
| TOK_TRUE { | TOK_TRUE {
$$ = asn1p_value_fromint(0); $$ = asn1p_value_fromint(1);
checkmem($$); checkmem($$);
$$->type = ATV_TRUE; $$->type = ATV_TRUE;
} }
| TOK_bstring { | SignedNumber
$$ = _convert_bitstring2binary($1, 'B'); | RealValue
checkmem($$); | RestrictedCharacterStringValue
free($1); | BitStringValue
}
| TOK_hstring {
$$ = _convert_bitstring2binary($1, 'H');
checkmem($$);
free($1);
}
| RestrictedCharacterStringValue {
$$ = $$;
}
| SignedNumber {
$$ = $1;
}
; ;
DefinedValue: DefinedValue:
Identifier { IdentifierAsValue
asn1p_ref_t *ref;
int ret;
ref = asn1p_ref_new(yylineno, currentModule);
checkmem(ref);
ret = asn1p_ref_add_component(ref, $1, RLT_lowercase);
checkmem(ret == 0);
$$ = asn1p_value_fromref(ref, 0);
checkmem($$);
free($1);
}
| TypeRefName '.' Identifier { | TypeRefName '.' Identifier {
asn1p_ref_t *ref; asn1p_ref_t *ref;
int ret; int ret;
...@@ -1710,7 +1723,7 @@ BasicTypeId_UniverationCompatible: ...@@ -1710,7 +1723,7 @@ BasicTypeId_UniverationCompatible:
| TOK_BIT TOK_STRING { $$ = ASN_BASIC_BIT_STRING; } | TOK_BIT TOK_STRING { $$ = ASN_BASIC_BIT_STRING; }
; ;
BasicType: BuiltinType:
BasicTypeId { BasicTypeId {
$$ = NEW_EXPR(); $$ = NEW_EXPR();
checkmem($$); checkmem($$);
...@@ -1901,13 +1914,6 @@ SubtypeElements: ...@@ -1901,13 +1914,6 @@ SubtypeElements:
| InnerTypeConstraints /* WITH COMPONENT[S] ... */ | InnerTypeConstraints /* WITH COMPONENT[S] ... */
| PatternConstraint /* PATTERN ... */ | PatternConstraint /* PATTERN ... */
| ValueRange | ValueRange
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = ACT_EL_VALUE;
$$->value = asn1p_value_frombuf($3.buf, $3.len, 0);
$$->value->type = ATV_UNPARSED;
}
; ;
...@@ -1961,32 +1967,7 @@ UpperEndValue: ...@@ -1961,32 +1967,7 @@ UpperEndValue:
$$->type = ATV_MAX; $$->type = ATV_MAX;
}; };
SingleValue: SingleValue: Value;
TOK_FALSE {
$$ = asn1p_value_fromint(0);
checkmem($$);
$$->type = ATV_FALSE;
}
| TOK_TRUE {
$$ = asn1p_value_fromint(1);
checkmem($$);
$$->type = ATV_TRUE;
}
| RealValue
| RestrictedCharacterStringValue
| BitStringValue
| Identifier {
asn1p_ref_t *ref;
int ret;
ref = asn1p_ref_new(yylineno, currentModule);
checkmem(ref);
ret = asn1p_ref_add_component(ref, $1, RLT_lowercase);
checkmem(ret == 0);
$$ = asn1p_value_fromref(ref, 0);
checkmem($$);
free($1);
}
;
BitStringValue: BitStringValue:
TOK_bstring { TOK_bstring {
...@@ -2002,15 +1983,15 @@ BitStringValue: ...@@ -2002,15 +1983,15 @@ BitStringValue:
; ;
ContainedSubtype: ContainedSubtype:
optINCLUDES Type { TOK_INCLUDES Type {
$$ = asn1p_value_fromtype($2); $$ = asn1p_value_fromtype($2);
checkmem($$); checkmem($$);
} }
; /* Can't put Type here because of conflicts. Simplified subset */
| DefinedUntaggedType {
optINCLUDES: $$ = asn1p_value_fromtype($1);
{ $$ = 0; } checkmem($$);
| TOK_INCLUDES { $$ = 1; } }
; ;
/* /*
...@@ -2403,8 +2384,7 @@ SignedNumber: ...@@ -2403,8 +2384,7 @@ SignedNumber:
; ;
RealValue: RealValue:
SignedNumber TOK_realnumber {
| TOK_realnumber {
$$ = asn1p_value_fromdouble($1); $$ = asn1p_value_fromdouble($1);
checkmem($$); checkmem($$);
} }
...@@ -2477,13 +2457,6 @@ TypeRefName: ...@@ -2477,13 +2457,6 @@ TypeRefName:
; ;
ObjectClassReference:
TOK_capitalreference {
checkmem($1);
$$ = $1;
}
;
optIdentifier: optIdentifier:
{ $$ = 0; } { $$ = 0; }
| Identifier { | Identifier {
...@@ -2648,7 +2621,7 @@ _fixup_anonymous_identifier(asn1p_expr_t *expr) { ...@@ -2648,7 +2621,7 @@ _fixup_anonymous_identifier(asn1p_expr_t *expr) {
expr->Identifier); expr->Identifier);
} }
int static int
yyerror(const char *msg) { yyerror(const char *msg) {
extern char *asn1p_text; extern char *asn1p_text;
fprintf(stderr, fprintf(stderr,
......
...@@ -7,41 +7,41 @@ ...@@ -7,41 +7,41 @@
/*** <<< DEPS [Flag] >>> ***/ /*** <<< DEPS [Flag] >>> ***/
typedef enum Flag_16P0__field { typedef enum Flag_15P0__field {
Flag_16P0__field_red = 0, Flag_15P0__field_red = 0,
Flag_16P0__field_green = 1, Flag_15P0__field_green = 1,
Flag_16P0__field_blue = 5 Flag_15P0__field_blue = 5
} e_Flag_16P0__field; } e_Flag_15P0__field;
typedef enum Flag_16P1__field { typedef enum Flag_15P1__field {
Flag_16P1__field_red = 3, Flag_15P1__field_red = 3,
Flag_16P1__field_green = 4, Flag_15P1__field_green = 4,
Flag_16P1__field_blue = 5 Flag_15P1__field_blue = 5
} e_Flag_16P1__field; } e_Flag_15P1__field;
/*** <<< TYPE-DECLS [Flag] >>> ***/ /*** <<< TYPE-DECLS [Flag] >>> ***/
typedef struct Flag_16P0 { typedef struct Flag_15P0 {
long *field /* DEFAULT 5 */; long *field /* DEFAULT 5 */;
/* Context for parsing across buffer boundaries */ /* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx; asn_struct_ctx_t _asn_ctx;
} Flag_16P0_t; } Flag_15P0_t;
typedef struct Flag_16P1 { typedef struct Flag_15P1 {
long *field /* DEFAULT 5 */; long *field /* DEFAULT 5 */;
/* Context for parsing across buffer boundaries */ /* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx; asn_struct_ctx_t _asn_ctx;
} Flag_16P1_t; } Flag_15P1_t;
/*** <<< FUNC-DECLS [Flag] >>> ***/ /*** <<< FUNC-DECLS [Flag] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_Flag_16P0; extern asn_TYPE_descriptor_t asn_DEF_Flag_15P0;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1; extern asn_SEQUENCE_specifics_t asn_SPC_Flag_15P0_specs_1;
extern asn_TYPE_member_t asn_MBR_Flag_16P0_1[1]; extern asn_TYPE_member_t asn_MBR_Flag_15P0_1[1];
/* extern asn_TYPE_descriptor_t asn_DEF_field_7; // (Use -fall-defs-global to expose) */ /* extern asn_TYPE_descriptor_t asn_DEF_field_7; // (Use -fall-defs-global to expose) */
extern asn_TYPE_descriptor_t asn_DEF_Flag_16P1; extern asn_TYPE_descriptor_t asn_DEF_Flag_15P1;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6; extern asn_SEQUENCE_specifics_t asn_SPC_Flag_15P1_specs_6;
extern asn_TYPE_member_t asn_MBR_Flag_16P1_6[1]; extern asn_TYPE_member_t asn_MBR_Flag_15P1_6[1];
/*** <<< CODE [Flag] >>> ***/ /*** <<< CODE [Flag] >>> ***/
...@@ -70,8 +70,8 @@ static int asn_DFL_2_set_5(int set_value, void **sptr) { ...@@ -70,8 +70,8 @@ static int asn_DFL_2_set_5(int set_value, void **sptr) {
return (*st == 5); return (*st == 5);
} }
} }
asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = { asn_TYPE_member_t asn_MBR_Flag_15P0_1[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_16P0, field), { ATF_POINTER, 1, offsetof(struct Flag_15P0, field),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
.tag_mode = 0, .tag_mode = 0,
.type = &asn_DEF_NativeInteger, .type = &asn_DEF_NativeInteger,
...@@ -83,37 +83,37 @@ asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = { ...@@ -83,37 +83,37 @@ asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = {
.name = "field" .name = "field"
}, },
}; };
static const ber_tlv_tag_t asn_DEF_Flag_16P0_tags_1[] = { static const ber_tlv_tag_t asn_DEF_Flag_15P0_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
}; };
static const asn_TYPE_tag2member_t asn_MAP_Flag_16P0_tag2el_1[] = { static const asn_TYPE_tag2member_t asn_MAP_Flag_15P0_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field */
}; };
asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1 = { asn_SEQUENCE_specifics_t asn_SPC_Flag_15P0_specs_1 = {
sizeof(struct Flag_16P0), sizeof(struct Flag_15P0),
offsetof(struct Flag_16P0, _asn_ctx), offsetof(struct Flag_15P0, _asn_ctx),
.tag2el = asn_MAP_Flag_16P0_tag2el_1, .tag2el = asn_MAP_Flag_15P0_tag2el_1,
.tag2el_count = 1, /* Count of tags in the map */ .tag2el_count = 1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */ -1, /* Start extensions */
-1 /* Stop extensions */ -1 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_Flag_16P0 = { asn_TYPE_descriptor_t asn_DEF_Flag_15P0 = {
"Flag", "Flag",
"Flag", "Flag",
&asn_OP_SEQUENCE, &asn_OP_SEQUENCE,
SEQUENCE_constraint, SEQUENCE_constraint,
asn_DEF_Flag_16P0_tags_1, asn_DEF_Flag_15P0_tags_1,
sizeof(asn_DEF_Flag_16P0_tags_1) sizeof(asn_DEF_Flag_15P0_tags_1)
/sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ /sizeof(asn_DEF_Flag_15P0_tags_1[0]), /* 1 */
asn_DEF_Flag_16P0_tags_1, /* Same as above */ asn_DEF_Flag_15P0_tags_1, /* Same as above */
sizeof(asn_DEF_Flag_16P0_tags_1) sizeof(asn_DEF_Flag_15P0_tags_1)
/sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ /sizeof(asn_DEF_Flag_15P0_tags_1[0]), /* 1 */
0, /* No OER visible constraints */ 0, /* No OER visible constraints */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Flag_16P0_1, asn_MBR_Flag_15P0_1,
1, /* Elements count */ 1, /* Elements count */
&asn_SPC_Flag_16P0_specs_1 /* Additional specs */ &asn_SPC_Flag_15P0_specs_1 /* Additional specs */
}; };
static int asn_DFL_7_set_5(int set_value, void **sptr) { static int asn_DFL_7_set_5(int set_value, void **sptr) {
...@@ -174,8 +174,8 @@ asn_TYPE_descriptor_t asn_DEF_field_7 = { ...@@ -174,8 +174,8 @@ asn_TYPE_descriptor_t asn_DEF_field_7 = {
&asn_SPC_field_specs_7 /* Additional specs */ &asn_SPC_field_specs_7 /* Additional specs */
}; };
asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = { asn_TYPE_member_t asn_MBR_Flag_15P1_6[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_16P1, field), { ATF_POINTER, 1, offsetof(struct Flag_15P1, field),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
.tag_mode = 0, .tag_mode = 0,
.type = &asn_DEF_field_7, .type = &asn_DEF_field_7,
...@@ -187,37 +187,37 @@ asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = { ...@@ -187,37 +187,37 @@ asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = {
.name = "field" .name = "field"
}, },
}; };
static const ber_tlv_tag_t asn_DEF_Flag_16P1_tags_6[] = { static const ber_tlv_tag_t asn_DEF_Flag_15P1_tags_6[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
}; };
static const asn_TYPE_tag2member_t asn_MAP_Flag_16P1_tag2el_6[] = { static const asn_TYPE_tag2member_t asn_MAP_Flag_15P1_tag2el_6[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field */
}; };
asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6 = { asn_SEQUENCE_specifics_t asn_SPC_Flag_15P1_specs_6 = {
sizeof(struct Flag_16P1), sizeof(struct Flag_15P1),
offsetof(struct Flag_16P1, _asn_ctx), offsetof(struct Flag_15P1, _asn_ctx),
.tag2el = asn_MAP_Flag_16P1_tag2el_6, .tag2el = asn_MAP_Flag_15P1_tag2el_6,
.tag2el_count = 1, /* Count of tags in the map */ .tag2el_count = 1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */ -1, /* Start extensions */
-1 /* Stop extensions */ -1 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = { asn_TYPE_descriptor_t asn_DEF_Flag_15P1 = {
"Flag", "Flag",
"Flag", "Flag",
&asn_OP_SEQUENCE, &asn_OP_SEQUENCE,
SEQUENCE_constraint, SEQUENCE_constraint,
asn_DEF_Flag_16P1_tags_6, asn_DEF_Flag_15P1_tags_6,
sizeof(asn_DEF_Flag_16P1_tags_6) sizeof(asn_DEF_Flag_15P1_tags_6)
/sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ /sizeof(asn_DEF_Flag_15P1_tags_6[0]), /* 1 */
asn_DEF_Flag_16P1_tags_6, /* Same as above */ asn_DEF_Flag_15P1_tags_6, /* Same as above */
sizeof(asn_DEF_Flag_16P1_tags_6) sizeof(asn_DEF_Flag_15P1_tags_6)
/sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ /sizeof(asn_DEF_Flag_15P1_tags_6[0]), /* 1 */
0, /* No OER visible constraints */ 0, /* No OER visible constraints */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Flag_16P1_6, asn_MBR_Flag_15P1_6,
1, /* Elements count */ 1, /* Elements count */
&asn_SPC_Flag_16P1_specs_6 /* Additional specs */ &asn_SPC_Flag_15P1_specs_6 /* Additional specs */
}; };
...@@ -227,7 +227,7 @@ asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = { ...@@ -227,7 +227,7 @@ asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = {
/*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/ /*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/
typedef Flag_16P0_t IntegerColorFlag_t; typedef Flag_15P0_t IntegerColorFlag_t;
/*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/ /*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/
...@@ -243,7 +243,7 @@ xer_type_encoder_f IntegerColorFlag_encode_xer; ...@@ -243,7 +243,7 @@ xer_type_encoder_f IntegerColorFlag_encode_xer;
/*** <<< CODE [IntegerColorFlag] >>> ***/ /*** <<< CODE [IntegerColorFlag] >>> ***/
/* /*
* This type is implemented using Flag_16P0, * This type is implemented using Flag_15P0,
* so here we adjust the DEF accordingly. * so here we adjust the DEF accordingly.
*/ */
...@@ -265,9 +265,9 @@ asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = { ...@@ -265,9 +265,9 @@ asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = {
/sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */ /sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */
0, /* No OER visible constraints */ 0, /* No OER visible constraints */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Flag_16P0_1, asn_MBR_Flag_15P0_1,
1, /* Elements count */ 1, /* Elements count */
&asn_SPC_Flag_16P0_specs_1 /* Additional specs */ &asn_SPC_Flag_15P0_specs_1 /* Additional specs */
}; };
...@@ -277,7 +277,7 @@ asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = { ...@@ -277,7 +277,7 @@ asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = {
/*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/ /*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/
typedef Flag_16P1_t EnumeratedColorFlag_t; typedef Flag_15P1_t EnumeratedColorFlag_t;
/*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/ /*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/
...@@ -293,7 +293,7 @@ xer_type_encoder_f EnumeratedColorFlag_encode_xer; ...@@ -293,7 +293,7 @@ xer_type_encoder_f EnumeratedColorFlag_encode_xer;
/*** <<< CODE [EnumeratedColorFlag] >>> ***/ /*** <<< CODE [EnumeratedColorFlag] >>> ***/
/* /*
* This type is implemented using Flag_16P1, * This type is implemented using Flag_15P1,
* so here we adjust the DEF accordingly. * so here we adjust the DEF accordingly.
*/ */
...@@ -315,8 +315,8 @@ asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = { ...@@ -315,8 +315,8 @@ asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = {
/sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */ /sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */
0, /* No OER visible constraints */ 0, /* No OER visible constraints */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Flag_16P1_6, asn_MBR_Flag_15P1_6,
1, /* Elements count */ 1, /* Elements count */
&asn_SPC_Flag_16P1_specs_6 /* Additional specs */ &asn_SPC_Flag_15P1_specs_6 /* Additional specs */
}; };
...@@ -7,6 +7,6 @@ Certificate ::= ExplicitCertificate (WITH COMPONENTS { ..., issuer (WITH COMPONE ...@@ -7,6 +7,6 @@ Certificate ::= ExplicitCertificate (WITH COMPONENTS { ..., issuer (WITH COMPONE
IdentifiedRegion ( WITH COMPONENTS { countryOnly(Canada) }), IdentifiedRegion ( WITH COMPONENTS { countryOnly(Canada) }),
IdentifiedRegion ( WITH COMPONENTS { countryOnly(Mexico) }), IdentifiedRegion ( WITH COMPONENTS { countryOnly(Mexico) }),
IdentifiedRegion ( WITH COMPONENTS { countryOnly(USA) }) IdentifiedRegion ( WITH COMPONENTS { countryOnly(USA) })
})) }), canRequestRollover ( NULL), encryptionKey ABSENT, verifyKeyIndicator (WITH COMPONENTS { verificationKey (WITH COMPONENTS { ecdsaNistP256 (WITH COMPONENTS { compressed-y-0, compressed-y-1 }) }) }) }) }) })) }), canRequestRollover (NULL), encryptionKey ABSENT, verifyKeyIndicator (WITH COMPONENTS { verificationKey (WITH COMPONENTS { ecdsaNistP256 (WITH COMPONENTS { compressed-y-0, compressed-y-1 }) }) }) }) })
END END
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .151
ModulePerEffectiveConstraint
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 151 }
DEFINITIONS ::= BEGIN
-- B.2.1.10
-- Effective constraint: SIZE(3..20) and FROM("A".."K")
B ::= VisibleString (SIZE (20) INTERSECTION FROM ("A".."F")
UNION SIZE (3) INTERSECTION FROM ("F".."K"))
END
ModulePerEffectiveConstraint { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 151 }
DEFINITIONS ::=
BEGIN
B ::= VisibleString (SIZE(20) ^ FROM("A".."F") | SIZE(3) ^ FROM("F".."K"))
-- Combined constraints: (SIZE(20) ^ FROM("A".."F") | SIZE(3) ^ FROM("F".."K"))
-- Practical constraints (B): (MIN..MAX) (SIZE(3 | 20)) (FROM("A".."K"))
-- OER-visible constraints (B): (MIN..MAX) (SIZE(3 | 20))
-- PER-visible constraints (B): (MIN..MAX) (SIZE(3 | 20)) (FROM("A".."K"))
END
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .152
ModuleValueAndTypeReferences
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 152 }
DEFINITIONS ::= BEGIN
value INTEGER ::= 3
valueAssignment3 INTEGER ::= value
valueAssignment4 INTEGER ::= MOD-CAPITALS.value4
Foo ::= Extension {{CAPS.SomeType}}
Bar ::= Extension {{Uppercase.SomeType}}
Extension {Foo} ::= SEQUENCE {
}
MTYPE ::= CLASS {
&id INTEGER UNIQUE,
&Type
} WITH SYNTAX {&Type IDENTIFIED BY &id}
MessageFrame ::= SEQUENCE {
messageIdE MTYPE.&id,
messageIdF MTYPE.&id({MessageTypes}),
valueE MTYPE.&Type,
valueF MTYPE.&Type({MessageTypes}{@.messageId})
}
END
MOD-CAPITALS
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 152 1 }
DEFINITIONS ::= BEGIN
value4 INTEGER ::= 4
END
ModuleValueAndTypeReferences { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 152 }
DEFINITIONS ::=
BEGIN
value INTEGER ::= 3
valueAssignment3 INTEGER ::= 3
valueAssignment4 INTEGER ::= 4
Foo ::= Extension{ { CAPS.SomeType}}
Bar ::= Extension{ { Uppercase.SomeType}}
Extension{Foo} ::= SEQUENCE { }
MTYPE ::= CLASS {
&id INTEGER UNIQUE,
&Type ANY
} WITH SYNTAX {&Type IDENTIFIED BY &id}
MessageFrame ::= SEQUENCE {
messageIdE MTYPE.&id,
messageIdF MTYPE.&id ({MessageTypes}),
valueE MTYPE.&Type,
valueF MTYPE.&Type ({MessageTypes}{@.messageId})
}
END
MOD-CAPITALS { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 152 1 }
DEFINITIONS ::=
BEGIN
value4 INTEGER ::= 4
END
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