Move type operations to another structure
Every type has free, print, check_constraints, ber_decoder, der_encoder,
xer_decoder, xer_encoder, uper_decoder, uper_encoder and outmost_tag
operations. We move them out to a separate structure asn_TYPE_operation_t.
Combined with previous logic simplification, these operations are based
on ASN.1 basic types, constructed types and string types. So we can
reduce the space occupied by asn_TYPE_descriptor_t variables.
diff --git a/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE b/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE
index c504ce2..ba327b8 100644
--- a/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE
+++ b/tests/tests-asn1c-compiler/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE
@@ -37,8 +37,7 @@
}
/* Replace with underlying type checker */
- td->check_constraints = asn_DEF_NativeInteger.check_constraints;
- return td->check_constraints(td, sptr, ctfailcb, app_key);
+ return td->op->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
@@ -54,17 +53,8 @@
asn_TYPE_descriptor_t asn_DEF_OK_Integer1 = {
"OK-Integer1",
"OK-Integer1",
- NativeInteger_free,
- NativeInteger_print,
- NativeInteger_compare,
+ &asn_OP_NativeInteger,
OK_Integer1_constraint,
- NativeInteger_decode_ber,
- NativeInteger_encode_der,
- NativeInteger_decode_xer,
- NativeInteger_encode_xer,
- 0, 0, /* No OER support, use "-gen-OER" to enable */
- 0, 0, /* No PER support, use "-gen-PER" to enable */
- 0, /* Use generic outmost tag fetcher */
asn_DEF_OK_Integer1_tags_1,
sizeof(asn_DEF_OK_Integer1_tags_1)
/sizeof(asn_DEF_OK_Integer1_tags_1[0]), /* 1 */
@@ -116,8 +106,7 @@
}
/* Replace with underlying type checker */
- td->check_constraints = asn_DEF_NativeInteger.check_constraints;
- return td->check_constraints(td, sptr, ctfailcb, app_key);
+ return td->op->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
@@ -133,17 +122,8 @@
asn_TYPE_descriptor_t asn_DEF_OK_Integer2 = {
"OK-Integer2",
"OK-Integer2",
- NativeInteger_free,
- NativeInteger_print,
- NativeInteger_compare,
+ &asn_OP_NativeInteger,
OK_Integer2_constraint,
- NativeInteger_decode_ber,
- NativeInteger_encode_der,
- NativeInteger_decode_xer,
- NativeInteger_encode_xer,
- 0, 0, /* No OER support, use "-gen-OER" to enable */
- 0, 0, /* No PER support, use "-gen-PER" to enable */
- 0, /* Use generic outmost tag fetcher */
asn_DEF_OK_Integer2_tags_1,
sizeof(asn_DEF_OK_Integer2_tags_1)
/sizeof(asn_DEF_OK_Integer2_tags_1[0]), /* 1 */
@@ -195,8 +175,7 @@
}
/* Replace with underlying type checker */
- td->check_constraints = asn_DEF_NativeInteger.check_constraints;
- return td->check_constraints(td, sptr, ctfailcb, app_key);
+ return td->op->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
@@ -212,17 +191,8 @@
asn_TYPE_descriptor_t asn_DEF_OK_Integer3 = {
"OK-Integer3",
"OK-Integer3",
- NativeInteger_free,
- NativeInteger_print,
- NativeInteger_compare,
+ &asn_OP_NativeInteger,
OK_Integer3_constraint,
- NativeInteger_decode_ber,
- NativeInteger_encode_der,
- NativeInteger_decode_xer,
- NativeInteger_encode_xer,
- 0, 0, /* No OER support, use "-gen-OER" to enable */
- 0, 0, /* No PER support, use "-gen-PER" to enable */
- 0, /* Use generic outmost tag fetcher */
asn_DEF_OK_Integer3_tags_1,
sizeof(asn_DEF_OK_Integer3_tags_1)
/sizeof(asn_DEF_OK_Integer3_tags_1[0]), /* 1 */
@@ -274,8 +244,7 @@
}
/* Replace with underlying type checker */
- td->check_constraints = asn_DEF_NativeInteger.check_constraints;
- return td->check_constraints(td, sptr, ctfailcb, app_key);
+ return td->op->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
@@ -291,17 +260,8 @@
asn_TYPE_descriptor_t asn_DEF_OK_Integer4 = {
"OK-Integer4",
"OK-Integer4",
- NativeInteger_free,
- NativeInteger_print,
- NativeInteger_compare,
+ &asn_OP_NativeInteger,
OK_Integer4_constraint,
- NativeInteger_decode_ber,
- NativeInteger_encode_der,
- NativeInteger_decode_xer,
- NativeInteger_encode_xer,
- 0, 0, /* No OER support, use "-gen-OER" to enable */
- 0, 0, /* No PER support, use "-gen-PER" to enable */
- 0, /* Use generic outmost tag fetcher */
asn_DEF_OK_Integer4_tags_1,
sizeof(asn_DEF_OK_Integer4_tags_1)
/sizeof(asn_DEF_OK_Integer4_tags_1[0]), /* 1 */
@@ -353,8 +313,7 @@
}
/* Replace with underlying type checker */
- td->check_constraints = asn_DEF_NativeInteger.check_constraints;
- return td->check_constraints(td, sptr, ctfailcb, app_key);
+ return td->op->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
@@ -370,17 +329,8 @@
asn_TYPE_descriptor_t asn_DEF_NO_Integer5 = {
"NO-Integer5",
"NO-Integer5",
- NativeInteger_free,
- NativeInteger_print,
- NativeInteger_compare,
+ &asn_OP_NativeInteger,
NO_Integer5_constraint,
- NativeInteger_decode_ber,
- NativeInteger_encode_der,
- NativeInteger_decode_xer,
- NativeInteger_encode_xer,
- 0, 0, /* No OER support, use "-gen-OER" to enable */
- 0, 0, /* No PER support, use "-gen-PER" to enable */
- 0, /* Use generic outmost tag fetcher */
asn_DEF_NO_Integer5_tags_1,
sizeof(asn_DEF_NO_Integer5_tags_1)
/sizeof(asn_DEF_NO_Integer5_tags_1[0]), /* 1 */