mirror of https://gerrit.osmocom.org/asn1c
more advanced stuff with defaults
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1075 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
parent
a6a84d7160
commit
d938e0b22f
|
@ -138,11 +138,9 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass,
|
|||
chunk->content.token,
|
||||
buf, p - buf);
|
||||
ret = _asn1f_assign_cell_value(arg, row, cell, buf, p);
|
||||
if(ret) {
|
||||
if(newpos) *newpos = buf;
|
||||
return ret;
|
||||
}
|
||||
if(ret) return ret;
|
||||
buf = p;
|
||||
if(newpos) *newpos = buf;
|
||||
} break;
|
||||
case WC_OPTIONALGROUP: {
|
||||
uint8_t *np = 0;
|
||||
|
@ -152,6 +150,7 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass,
|
|||
if(newpos) *newpos = np;
|
||||
if(ret && np != buf)
|
||||
return ret;
|
||||
buf = np;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,19 @@ asn1f_fix_dereference_defaults(arg_t *arg) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
if(expr->expr_type == A1TC_CLASSFIELD_FTVFS) {
|
||||
asn1p_expr_t *child = TQ_FIRST(&expr->members);
|
||||
int ret;
|
||||
assert(child);
|
||||
assert(child->marker.default_value == 0);
|
||||
tmparg.expr = child;
|
||||
child->marker.default_value=expr->marker.default_value;
|
||||
ret = asn1f_fix_dereference_defaults(&tmparg);
|
||||
expr->marker.default_value = child->marker.default_value;
|
||||
if(ret == 0) return 0; /* Finished */
|
||||
}
|
||||
|
||||
tmparg.expr = &tmpexpr;
|
||||
tmpexpr.meta_type = AMT_VALUE;
|
||||
tmpexpr.marker.default_value = 0;
|
||||
|
|
|
@ -248,7 +248,8 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
|
|||
}
|
||||
|
||||
expr = asn1f_lookup_symbol(arg, imports_from, &tmpref);
|
||||
if(!expr && !(arg->expr->_mark & TM_BROKEN)) {
|
||||
if(!expr && !(arg->expr->_mark & TM_BROKEN)
|
||||
&& !(imports_from->_tags & MT_STANDARD_MODULE)) {
|
||||
arg->expr->_mark |= TM_BROKEN;
|
||||
if(modulename) {
|
||||
FATAL("Module %s referred by %s in module %s "
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
-- OK: Everything is fine
|
||||
|
||||
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
|
||||
-- .spelio.software.asn1c.test (9363.1.5.1)
|
||||
-- .99
|
||||
|
||||
ModuleClassSample
|
||||
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
|
||||
spelio(9363) software(1) asn1c(5) test(1) 99 }
|
||||
DEFINITIONS ::=
|
||||
BEGIN
|
||||
|
||||
SAMPLE-CLASS ::= CLASS {
|
||||
&id RELATIVE-OID UNIQUE,
|
||||
&code ENUMERATED { request, response, status }
|
||||
DEFAULT request,
|
||||
&Type OPTIONAL
|
||||
} WITH SYNTAX { [TYPE &Type] [WITH CODE &code] IDENTIFIED BY &id }
|
||||
|
||||
request-Whatever SAMPLE-CLASS
|
||||
::= { IDENTIFIED BY request-whatever }
|
||||
|
||||
respond-Stuff SAMPLE-CLASS
|
||||
::= { WITH CODE 1 IDENTIFIED BY response-stuff }
|
||||
|
||||
request-Status SAMPLE-CLASS
|
||||
::= { TYPE SampleType WITH CODE 2 IDENTIFIED BY request-id }
|
||||
|
||||
request-Salt SAMPLE-CLASS
|
||||
::= { TYPE Salt IDENTIFIED BY request-salt }
|
||||
|
||||
request-id RELATIVE-OID ::= { 1 1 1 }
|
||||
request-salt RELATIVE-OID ::= { 1 1 1 }
|
||||
request-whatever RELATIVE-OID ::= { 1 1 5 }
|
||||
response-stuff RELATIVE-OID ::= { 2 0 1 }
|
||||
|
||||
|
||||
SampleType ::= SEQUENCE { ... }
|
||||
Salt ::= SET { ... }
|
||||
|
||||
END
|
Loading…
Reference in New Issue