mirror of https://gerrit.osmocom.org/asn1c
Support for some CharsDefn
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@830 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
parent
2566daf39c
commit
e1e6ed87ee
|
@ -1,11 +1,13 @@
|
|||
|
||||
0.9.13: 2005-Mar-20
|
||||
0.9.13: 2005-Mar-24
|
||||
|
||||
* Added extra const qualifiers into the support code.
|
||||
* More RFC variations supported in crfc2asn1.pl.
|
||||
* Refined string values compatibility. (Test cases 77, 78).
|
||||
* Support for ContainedSubtype constraints. (Test case 16).
|
||||
* Parsing support for CONSTRAINED BY. (Test case 79).
|
||||
* Support for CharsDefn (Quadruple and Tuple, most used in
|
||||
ASN1-CHARACTER-MODULE) (Test case 80).
|
||||
|
||||
0.9.12: 2005-Mar-10
|
||||
|
||||
|
|
|
@ -321,6 +321,11 @@ static int _range_fill(asn1p_value_t *val, const asn1cnst_range_t *minmax, asn1c
|
|||
edge->type = ARE_VALUE;
|
||||
edge->value = (val->type==ATV_TRUE);
|
||||
return 0;
|
||||
case ATV_TUPLE:
|
||||
case ATV_QUADRUPLE:
|
||||
edge->type = ARE_VALUE;
|
||||
edge->value = val->value.v_integer;
|
||||
return 0;
|
||||
case ATV_STRING:
|
||||
if(type != ACT_CT_FROM)
|
||||
return 0;
|
||||
|
|
|
@ -35,6 +35,7 @@ typedef struct asn1p_constraint_s {
|
|||
ACT_CA_UNI, /* UNION (|) */
|
||||
ACT_CA_INT, /* INTERSECTION (^) */
|
||||
ACT_CA_EXC, /* EXCEPT */
|
||||
ACT_CA_AEX, /* ALL EXCEPT */
|
||||
} type;
|
||||
|
||||
enum asn1p_constr_pres_e {
|
||||
|
|
|
@ -123,6 +123,8 @@ asn1p_value_clone(asn1p_value_t *v) {
|
|||
case ATV_MAX:
|
||||
case ATV_FALSE:
|
||||
case ATV_TRUE:
|
||||
case ATV_TUPLE:
|
||||
case ATV_QUADRUPLE:
|
||||
clone = asn1p_value_fromint(v->value.v_integer);
|
||||
if(clone) clone->type = v->type;
|
||||
return clone;
|
||||
|
@ -174,6 +176,8 @@ asn1p_value_free(asn1p_value_t *v) {
|
|||
case ATV_MAX:
|
||||
case ATV_FALSE:
|
||||
case ATV_TRUE:
|
||||
case ATV_TUPLE:
|
||||
case ATV_QUADRUPLE:
|
||||
/* No freeing necessary */
|
||||
break;
|
||||
case ATV_STRING:
|
||||
|
|
|
@ -20,7 +20,9 @@ typedef struct asn1p_value_s {
|
|||
ATV_MIN,
|
||||
ATV_TRUE,
|
||||
ATV_FALSE,
|
||||
ATV_STRING,
|
||||
ATV_TUPLE, /* { 1, 15 } */
|
||||
ATV_QUADRUPLE, /* { 0, 14, 0, 255 } */
|
||||
ATV_STRING, /* "abcdef" */
|
||||
ATV_UNPARSED,
|
||||
ATV_BITVECTOR,
|
||||
ATV_REFERENCED, /* Reference to a value defined elsewhere */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -286,6 +286,7 @@ static asn1p_value_t *
|
|||
%type <a_value> ContainedSubtype
|
||||
%type <a_ctype> ConstraintSpec
|
||||
%type <a_ctype> ConstraintRangeSpec
|
||||
%type <a_value> RestrictedCharacterStringValue
|
||||
%type <a_wsynt> optWithSyntax
|
||||
%type <a_wsynt> WithSyntax
|
||||
%type <a_wsynt> WithSyntaxFormat
|
||||
|
@ -1346,9 +1347,8 @@ Value:
|
|||
$$ = _convert_bitstring2binary($1, 'H');
|
||||
checkmem($$);
|
||||
}
|
||||
| TOK_cstring {
|
||||
$$ = asn1p_value_frombuf($1.buf, $1.len, 0);
|
||||
checkmem($$);
|
||||
| RestrictedCharacterStringValue {
|
||||
$$ = $$;
|
||||
}
|
||||
| SignedNumber {
|
||||
$$ = $1;
|
||||
|
@ -1386,6 +1386,38 @@ DefinedValue:
|
|||
}
|
||||
;
|
||||
|
||||
|
||||
RestrictedCharacterStringValue:
|
||||
TOK_cstring {
|
||||
$$ = asn1p_value_frombuf($1.buf, $1.len, 0);
|
||||
checkmem($$);
|
||||
}
|
||||
| '{' TOK_number ',' TOK_number '}' {
|
||||
asn1c_integer_t v = ($2 << 4) + $4;
|
||||
if($2 > 7) return yyerror("X.680:2003, #37.14 "
|
||||
"mandates 0..7 range for Tuple's TableColumn");
|
||||
if($4 > 15) return yyerror("X.680:2003, #37.14 "
|
||||
"mandates 0..15 range for Tuple's TableRow");
|
||||
$$ = asn1p_value_fromint(v);
|
||||
checkmem($$);
|
||||
$$->type = ATV_TUPLE;
|
||||
}
|
||||
| '{' TOK_number ',' TOK_number ',' TOK_number ',' TOK_number '}' {
|
||||
asn1c_integer_t v = ($2 << 24) | ($4 << 16) | ($6 << 8) | $8;
|
||||
if($2 > 127) return yyerror("X.680:2003, #37.12 "
|
||||
"mandates 0..127 range for Quadruple's Group");
|
||||
if($4 > 255) return yyerror("X.680:2003, #37.12 "
|
||||
"mandates 0..255 range for Quadruple's Plane");
|
||||
if($6 > 255) return yyerror("X.680:2003, #37.12 "
|
||||
"mandates 0..255 range for Quadruple's Row");
|
||||
if($8 > 255) return yyerror("X.680:2003, #37.12 "
|
||||
"mandates 0..255 range for Quadruple's Cell");
|
||||
$$ = asn1p_value_fromint(v);
|
||||
checkmem($$);
|
||||
$$->type = ATV_QUADRUPLE;
|
||||
}
|
||||
;
|
||||
|
||||
Opaque:
|
||||
TOK_opaque {
|
||||
$$.len = $1.len + 1;
|
||||
|
@ -1544,6 +1576,9 @@ ElementSetSpec:
|
|||
ConstraintSubtypeElement {
|
||||
$$ = $1;
|
||||
}
|
||||
| TOK_ALL TOK_EXCEPT ConstraintSubtypeElement {
|
||||
CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0);
|
||||
}
|
||||
| ElementSetSpec Union ConstraintSubtypeElement {
|
||||
CONSTRAINT_INSERT($$, ACT_CA_UNI, $1, $3);
|
||||
}
|
||||
|
@ -1663,9 +1698,8 @@ SingleValue:
|
|||
| SignedNumber {
|
||||
$$ = $1;
|
||||
}
|
||||
| TOK_cstring {
|
||||
$$ = asn1p_value_frombuf($1.buf, $1.len, 0);
|
||||
checkmem($$);
|
||||
| RestrictedCharacterStringValue {
|
||||
$$ = $1;
|
||||
}
|
||||
| Identifier {
|
||||
asn1p_ref_t *ref;
|
||||
|
|
|
@ -215,6 +215,19 @@ asn1print_value(asn1p_value_t *val, enum asn1print_flags flags) {
|
|||
case ATV_MAX: printf("MAX"); return 0;
|
||||
case ATV_FALSE: printf("FALSE"); return 0;
|
||||
case ATV_TRUE: printf("TRUE"); return 0;
|
||||
case ATV_TUPLE:
|
||||
printf("{%d, %d}",
|
||||
(int)(val->value.v_integer >> 4),
|
||||
(int)(val->value.v_integer & 0x0f));
|
||||
return 0;
|
||||
case ATV_QUADRUPLE:
|
||||
printf("{%d, %d, %d, %d}",
|
||||
(int)((val->value.v_integer >> 24) & 0xff),
|
||||
(int)((val->value.v_integer >> 16) & 0xff),
|
||||
(int)((val->value.v_integer >> 8) & 0xff),
|
||||
(int)((val->value.v_integer >> 0) & 0xff)
|
||||
);
|
||||
return 0;
|
||||
case ATV_STRING:
|
||||
{
|
||||
char *p = val->value.string.buf;
|
||||
|
@ -339,10 +352,9 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
|
|||
"", "(" };
|
||||
unsigned int i;
|
||||
for(i = 0; i < ct->el_count; i++) {
|
||||
enum asn1print_flags nflags = flags;
|
||||
if(i) fputs(symtable[symno], stdout);
|
||||
if(ct->type == ACT_CA_CRC) fputs("{", stdout);
|
||||
asn1print_constraint(ct->elements[i], nflags);
|
||||
asn1print_constraint(ct->elements[i], flags);
|
||||
if(ct->type == ACT_CA_CRC) fputs("}", stdout);
|
||||
if(i+1 < ct->el_count
|
||||
&& ct->type == ACT_CA_SET)
|
||||
|
@ -350,6 +362,11 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case ACT_CA_AEX:
|
||||
assert(ct->el_count == 1);
|
||||
printf("ALL EXCEPT ");
|
||||
asn1print_constraint(ct->elements[0], flags);
|
||||
break;
|
||||
case ACT_INVALID:
|
||||
assert(ct->type != ACT_INVALID);
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
-- OK: Everything is fine
|
||||
|
||||
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
|
||||
-- .spelio.software.asn1c.test (9363.1.5.1)
|
||||
-- .80
|
||||
|
||||
ModuleCharacterDefinitions
|
||||
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
|
||||
spelio(9363) software(1) asn1c(5) test(1) 80 }
|
||||
DEFINITIONS ::=
|
||||
BEGIN
|
||||
-- Elements taken from ASN1-CHARACTER-MODULE (X.680:07/2002)
|
||||
-- { joint-iso-itu-t asn1(1) specification(0) modules(0) iso10646(0) }
|
||||
nul IA5String ::= {0, 0}
|
||||
null BMPString ::= {0, 0, 0, 0}
|
||||
space BMPString ::= {0, 0, 0, 32}
|
||||
tilde BMPString ::= {0, 0, 0, 126}
|
||||
|
||||
BasicLatin ::= BMPString(FROM (space..tilde))
|
||||
BasicGreek ::= BMPString(FROM ({0, 0, 3, 112}..{0, 0, 3, 207}))
|
||||
|
||||
NotSpace ::= BMPString (FROM(ALL EXCEPT space))
|
||||
|
||||
END
|
Loading…
Reference in New Issue