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/125-bitstring-constraint-OK.asn1.-P b/tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1.-P
index f267409..b522fe2 100644
--- a/tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1.-P
+++ b/tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1.-P
@@ -47,8 +47,7 @@
}
/* Replace with underlying type checker */
- td->check_constraints = asn_DEF_BIT_STRING.check_constraints;
- return td->check_constraints(td, sptr, ctfailcb, app_key);
+ return td->op->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
@@ -64,17 +63,8 @@
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
- BIT_STRING_free,
- BIT_STRING_print,
- BIT_STRING_compare,
+ &asn_OP_BIT_STRING,
T_constraint,
- BIT_STRING_decode_ber,
- BIT_STRING_encode_der,
- BIT_STRING_decode_xer,
- BIT_STRING_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_T_tags_1,
sizeof(asn_DEF_T_tags_1)
/sizeof(asn_DEF_T_tags_1[0]), /* 1 */