aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2006-03-16 11:04:55 +0000
committerLev Walkin <vlm@lionet.info>2006-03-16 11:04:55 +0000
commitdc4376dc2f05d3922b93afe1ae19ba7fb63673ac (patch)
tree7c2029d8c38b4c923f9904c59b46882018c7edf9
parentd370e9f57ecc00836b18bee44af026421bd9d63a (diff)
more advanced stuff with defaults
-rw-r--r--libasn1fix/asn1fix_cws.c7
-rw-r--r--libasn1fix/asn1fix_derefv.c13
-rw-r--r--libasn1fix/asn1fix_retrieve.c3
-rw-r--r--tests/99-class-sample-OK.asn142
4 files changed, 60 insertions, 5 deletions
diff --git a/libasn1fix/asn1fix_cws.c b/libasn1fix/asn1fix_cws.c
index 3d7b8aa7..e19071d9 100644
--- a/libasn1fix/asn1fix_cws.c
+++ b/libasn1fix/asn1fix_cws.c
@@ -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;
}
}
diff --git a/libasn1fix/asn1fix_derefv.c b/libasn1fix/asn1fix_derefv.c
index 76f49a39..5436d58b 100644
--- a/libasn1fix/asn1fix_derefv.c
+++ b/libasn1fix/asn1fix_derefv.c
@@ -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;
diff --git a/libasn1fix/asn1fix_retrieve.c b/libasn1fix/asn1fix_retrieve.c
index 161e0da1..ae3042d9 100644
--- a/libasn1fix/asn1fix_retrieve.c
+++ b/libasn1fix/asn1fix_retrieve.c
@@ -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 "
diff --git a/tests/99-class-sample-OK.asn1 b/tests/99-class-sample-OK.asn1
new file mode 100644
index 00000000..aa9d5947
--- /dev/null
+++ b/tests/99-class-sample-OK.asn1
@@ -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