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/72-same-names-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/72-same-names-OK.asn1.-Pfwide-types
index 468ecfc..138e561 100644
--- a/tests/tests-asn1c-compiler/72-same-names-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/72-same-names-OK.asn1.-Pfwide-types
@@ -77,17 +77,8 @@
asn_TYPE_descriptor_t asn_DEF_Member_2 = {
"SEQUENCE",
"SEQUENCE",
- SEQUENCE_free,
- SEQUENCE_print,
- SEQUENCE_compare,
+ &asn_OP_SEQUENCE,
SEQUENCE_constraint,
- SEQUENCE_decode_ber,
- SEQUENCE_encode_der,
- SEQUENCE_decode_xer,
- SEQUENCE_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_Member_tags_2,
sizeof(asn_DEF_Member_tags_2)
/sizeof(asn_DEF_Member_tags_2[0]), /* 1 */
@@ -125,17 +116,8 @@
asn_TYPE_descriptor_t asn_DEF_Type = {
"Type",
"Type",
- SET_OF_free,
- SET_OF_print,
- SET_OF_compare,
+ &asn_OP_SET_OF,
SET_OF_constraint,
- SET_OF_decode_ber,
- SET_OF_encode_der,
- SET_OF_decode_xer,
- SET_OF_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_Type_tags_1,
sizeof(asn_DEF_Type_tags_1)
/sizeof(asn_DEF_Type_tags_1[0]), /* 1 */
@@ -238,17 +220,8 @@
asn_TYPE_descriptor_t asn_DEF_another_name_3 = {
"another-name",
"another-name",
- SEQUENCE_free,
- SEQUENCE_print,
- SEQUENCE_compare,
+ &asn_OP_SEQUENCE,
SEQUENCE_constraint,
- SEQUENCE_decode_ber,
- SEQUENCE_encode_der,
- SEQUENCE_decode_xer,
- SEQUENCE_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_another_name_tags_3,
sizeof(asn_DEF_another_name_tags_3)
/sizeof(asn_DEF_another_name_tags_3[0]), /* 1 */
@@ -292,17 +265,8 @@
asn_TYPE_descriptor_t asn_DEF_one_name_2 = {
"one-name",
"one-name",
- CHOICE_free,
- CHOICE_print,
- CHOICE_compare,
+ &asn_OP_CHOICE,
CHOICE_constraint,
- CHOICE_decode_ber,
- CHOICE_encode_der,
- CHOICE_decode_xer,
- CHOICE_encode_xer,
- 0, 0, /* No OER support, use "-gen-OER" to enable */
- 0, 0, /* No PER support, use "-gen-PER" to enable */
- CHOICE_outmost_tag,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
@@ -345,17 +309,8 @@
asn_TYPE_descriptor_t asn_DEF_Type1 = {
"Type1",
"Type1",
- SEQUENCE_free,
- SEQUENCE_print,
- SEQUENCE_compare,
+ &asn_OP_SEQUENCE,
SEQUENCE_constraint,
- SEQUENCE_decode_ber,
- SEQUENCE_encode_der,
- SEQUENCE_decode_xer,
- SEQUENCE_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_Type1_tags_1,
sizeof(asn_DEF_Type1_tags_1)
/sizeof(asn_DEF_Type1_tags_1[0]), /* 1 */
@@ -555,17 +510,8 @@
asn_TYPE_descriptor_t asn_DEF_another_name_3 = {
"another-name",
"another-name",
- SEQUENCE_free,
- SEQUENCE_print,
- SEQUENCE_compare,
+ &asn_OP_SEQUENCE,
SEQUENCE_constraint,
- SEQUENCE_decode_ber,
- SEQUENCE_encode_der,
- SEQUENCE_decode_xer,
- SEQUENCE_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_another_name_tags_3,
sizeof(asn_DEF_another_name_tags_3)
/sizeof(asn_DEF_another_name_tags_3[0]), /* 1 */
@@ -611,17 +557,8 @@
asn_TYPE_descriptor_t asn_DEF_one_name_2 = {
"one-name",
"one-name",
- SEQUENCE_free,
- SEQUENCE_print,
- SEQUENCE_compare,
+ &asn_OP_SEQUENCE,
SEQUENCE_constraint,
- SEQUENCE_decode_ber,
- SEQUENCE_encode_der,
- SEQUENCE_decode_xer,
- SEQUENCE_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_one_name_tags_2,
sizeof(asn_DEF_one_name_tags_2)
/sizeof(asn_DEF_one_name_tags_2[0]), /* 1 */
@@ -679,17 +616,8 @@
asn_TYPE_descriptor_t asn_DEF_another_name_8 = {
"another-name",
"another-name",
- SEQUENCE_free,
- SEQUENCE_print,
- SEQUENCE_compare,
+ &asn_OP_SEQUENCE,
SEQUENCE_constraint,
- SEQUENCE_decode_ber,
- SEQUENCE_encode_der,
- SEQUENCE_decode_xer,
- SEQUENCE_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_another_name_tags_8,
sizeof(asn_DEF_another_name_tags_8)
/sizeof(asn_DEF_another_name_tags_8[0]), /* 1 */
@@ -741,17 +669,8 @@
asn_TYPE_descriptor_t asn_DEF_two_name_7 = {
"two-name",
"two-name",
- SET_free,
- SET_print,
- SET_compare,
+ &asn_OP_SET,
SET_constraint,
- SET_decode_ber,
- SET_encode_der,
- SET_decode_xer,
- SET_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_two_name_tags_7,
sizeof(asn_DEF_two_name_tags_7)
/sizeof(asn_DEF_two_name_tags_7[0]), /* 1 */
@@ -806,17 +725,8 @@
asn_TYPE_descriptor_t asn_DEF_Type2 = {
"Type2",
"Type2",
- CHOICE_free,
- CHOICE_print,
- CHOICE_compare,
+ &asn_OP_CHOICE,
CHOICE_constraint,
- CHOICE_decode_ber,
- CHOICE_encode_der,
- CHOICE_decode_xer,
- CHOICE_encode_xer,
- 0, 0, /* No OER support, use "-gen-OER" to enable */
- 0, 0, /* No PER support, use "-gen-PER" to enable */
- CHOICE_outmost_tag,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */