refactored tagging support

diff --git a/tests/65-multi-tag-OK.asn1.-P b/tests/65-multi-tag-OK.asn1.-P
new file mode 100644
index 0000000..fec7c9c
--- /dev/null
+++ b/tests/65-multi-tag-OK.asn1.-P
@@ -0,0 +1,774 @@
+
+/*** <<< INCLUDES [T1] >>> ***/
+
+#include <T2.h>
+
+/*** <<< TYPE-DECLS [T1] >>> ***/
+
+
+typedef T2_t	 T1_t;
+
+/*** <<< FUNC-DECLS [T1] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_T1;
+asn_constr_check_f T1_constraint;
+ber_type_decoder_f T1_decode_ber;
+der_type_encoder_f T1_encode_der;
+asn_struct_print_f T1_print;
+asn_struct_free_f T1_free;
+
+/*** <<< CODE [T1] >>> ***/
+
+int
+T1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_consume_bytes_f *app_errlog, void *app_key) {
+	
+	/* Make the underlying type checker permanent */
+	td->check_constraints = asn1_DEF_T2.check_constraints;
+	return td->check_constraints
+		(td, sptr, app_errlog, app_key);
+}
+
+/*
+ * This type is implemented using T2,
+ * so adjust the DEF appropriately.
+ */
+static void
+T1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
+	td->ber_decoder    = asn1_DEF_T2.ber_decoder;
+	td->der_encoder    = asn1_DEF_T2.der_encoder;
+	td->free_struct    = asn1_DEF_T2.free_struct;
+	td->print_struct   = asn1_DEF_T2.print_struct;
+	td->last_tag_form  = asn1_DEF_T2.last_tag_form;
+	td->elements       = asn1_DEF_T2.elements;
+	td->elements_count = asn1_DEF_T2.elements_count;
+	td->specifics      = asn1_DEF_T2.specifics;
+}
+
+ber_dec_rval_t
+T1_decode_ber(asn1_TYPE_descriptor_t *td,
+		void **structure, void *bufptr, size_t size, int tag_mode) {
+	T1_inherit_TYPE_descriptor(td);
+	return td->ber_decoder(td, structure, bufptr, size, tag_mode);
+}
+
+der_enc_rval_t
+T1_encode_der(asn1_TYPE_descriptor_t *td,
+		void *structure, int tag_mode, ber_tlv_tag_t tag,
+		asn_app_consume_bytes_f *cb, void *app_key) {
+	T1_inherit_TYPE_descriptor(td);
+	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
+}
+
+int
+T1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
+		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+	T1_inherit_TYPE_descriptor(td);
+	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
+}
+
+void
+T1_free(asn1_TYPE_descriptor_t *td,
+		void *struct_ptr, int contents_only) {
+	T1_inherit_TYPE_descriptor(td);
+	td->free_struct(td, struct_ptr, contents_only);
+}
+
+
+/*** <<< STAT-DEFS [T1] >>> ***/
+
+static ber_tlv_tag_t asn1_DEF_T1_tags[] = {
+	(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
+	(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
+	(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
+	(ASN_TAG_CLASS_CONTEXT | (6 << 2))
+};
+asn1_TYPE_descriptor_t asn1_DEF_T1 = {
+	"T1",
+	T1_constraint,
+	T1_decode_ber,
+	T1_encode_der,
+	T1_print,
+	T1_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_T1_tags,
+	sizeof(asn1_DEF_T1_tags)
+		/sizeof(asn1_DEF_T1_tags[0]), /* 4 */
+	-0,	/* Unknown yet */
+	0, 0,	/* No members */
+	0	/* No specifics */
+};
+
+
+/*** <<< INCLUDES [T2] >>> ***/
+
+#include <T3.h>
+
+/*** <<< TYPE-DECLS [T2] >>> ***/
+
+
+typedef T3_t	 T2_t;
+
+/*** <<< FUNC-DECLS [T2] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_T2;
+asn_constr_check_f T2_constraint;
+ber_type_decoder_f T2_decode_ber;
+der_type_encoder_f T2_encode_der;
+asn_struct_print_f T2_print;
+asn_struct_free_f T2_free;
+
+/*** <<< CODE [T2] >>> ***/
+
+int
+T2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_consume_bytes_f *app_errlog, void *app_key) {
+	
+	/* Make the underlying type checker permanent */
+	td->check_constraints = asn1_DEF_T3.check_constraints;
+	return td->check_constraints
+		(td, sptr, app_errlog, app_key);
+}
+
+/*
+ * This type is implemented using T3,
+ * so adjust the DEF appropriately.
+ */
+static void
+T2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
+	td->ber_decoder    = asn1_DEF_T3.ber_decoder;
+	td->der_encoder    = asn1_DEF_T3.der_encoder;
+	td->free_struct    = asn1_DEF_T3.free_struct;
+	td->print_struct   = asn1_DEF_T3.print_struct;
+	td->last_tag_form  = asn1_DEF_T3.last_tag_form;
+	td->elements       = asn1_DEF_T3.elements;
+	td->elements_count = asn1_DEF_T3.elements_count;
+	td->specifics      = asn1_DEF_T3.specifics;
+}
+
+ber_dec_rval_t
+T2_decode_ber(asn1_TYPE_descriptor_t *td,
+		void **structure, void *bufptr, size_t size, int tag_mode) {
+	T2_inherit_TYPE_descriptor(td);
+	return td->ber_decoder(td, structure, bufptr, size, tag_mode);
+}
+
+der_enc_rval_t
+T2_encode_der(asn1_TYPE_descriptor_t *td,
+		void *structure, int tag_mode, ber_tlv_tag_t tag,
+		asn_app_consume_bytes_f *cb, void *app_key) {
+	T2_inherit_TYPE_descriptor(td);
+	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
+}
+
+int
+T2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
+		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+	T2_inherit_TYPE_descriptor(td);
+	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
+}
+
+void
+T2_free(asn1_TYPE_descriptor_t *td,
+		void *struct_ptr, int contents_only) {
+	T2_inherit_TYPE_descriptor(td);
+	td->free_struct(td, struct_ptr, contents_only);
+}
+
+
+/*** <<< STAT-DEFS [T2] >>> ***/
+
+static ber_tlv_tag_t asn1_DEF_T2_tags[] = {
+	(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
+	(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
+	(ASN_TAG_CLASS_CONTEXT | (6 << 2))
+};
+asn1_TYPE_descriptor_t asn1_DEF_T2 = {
+	"T2",
+	T2_constraint,
+	T2_decode_ber,
+	T2_encode_der,
+	T2_print,
+	T2_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_T2_tags,
+	sizeof(asn1_DEF_T2_tags)
+		/sizeof(asn1_DEF_T2_tags[0]), /* 3 */
+	-0,	/* Unknown yet */
+	0, 0,	/* No members */
+	0	/* No specifics */
+};
+
+
+/*** <<< INCLUDES [T3] >>> ***/
+
+#include <T4.h>
+
+/*** <<< TYPE-DECLS [T3] >>> ***/
+
+
+typedef T4_t	 T3_t;
+
+/*** <<< FUNC-DECLS [T3] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_T3;
+asn_constr_check_f T3_constraint;
+ber_type_decoder_f T3_decode_ber;
+der_type_encoder_f T3_encode_der;
+asn_struct_print_f T3_print;
+asn_struct_free_f T3_free;
+
+/*** <<< CODE [T3] >>> ***/
+
+int
+T3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_consume_bytes_f *app_errlog, void *app_key) {
+	
+	/* Make the underlying type checker permanent */
+	td->check_constraints = asn1_DEF_T4.check_constraints;
+	return td->check_constraints
+		(td, sptr, app_errlog, app_key);
+}
+
+/*
+ * This type is implemented using T4,
+ * so adjust the DEF appropriately.
+ */
+static void
+T3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
+	td->ber_decoder    = asn1_DEF_T4.ber_decoder;
+	td->der_encoder    = asn1_DEF_T4.der_encoder;
+	td->free_struct    = asn1_DEF_T4.free_struct;
+	td->print_struct   = asn1_DEF_T4.print_struct;
+	td->last_tag_form  = asn1_DEF_T4.last_tag_form;
+	td->elements       = asn1_DEF_T4.elements;
+	td->elements_count = asn1_DEF_T4.elements_count;
+	td->specifics      = asn1_DEF_T4.specifics;
+}
+
+ber_dec_rval_t
+T3_decode_ber(asn1_TYPE_descriptor_t *td,
+		void **structure, void *bufptr, size_t size, int tag_mode) {
+	T3_inherit_TYPE_descriptor(td);
+	return td->ber_decoder(td, structure, bufptr, size, tag_mode);
+}
+
+der_enc_rval_t
+T3_encode_der(asn1_TYPE_descriptor_t *td,
+		void *structure, int tag_mode, ber_tlv_tag_t tag,
+		asn_app_consume_bytes_f *cb, void *app_key) {
+	T3_inherit_TYPE_descriptor(td);
+	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
+}
+
+int
+T3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
+		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+	T3_inherit_TYPE_descriptor(td);
+	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
+}
+
+void
+T3_free(asn1_TYPE_descriptor_t *td,
+		void *struct_ptr, int contents_only) {
+	T3_inherit_TYPE_descriptor(td);
+	td->free_struct(td, struct_ptr, contents_only);
+}
+
+
+/*** <<< STAT-DEFS [T3] >>> ***/
+
+static ber_tlv_tag_t asn1_DEF_T3_tags[] = {
+	(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
+	(ASN_TAG_CLASS_CONTEXT | (6 << 2))
+};
+asn1_TYPE_descriptor_t asn1_DEF_T3 = {
+	"T3",
+	T3_constraint,
+	T3_decode_ber,
+	T3_encode_der,
+	T3_print,
+	T3_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_T3_tags,
+	sizeof(asn1_DEF_T3_tags)
+		/sizeof(asn1_DEF_T3_tags[0]), /* 2 */
+	-0,	/* Unknown yet */
+	0, 0,	/* No members */
+	0	/* No specifics */
+};
+
+
+/*** <<< INCLUDES [T4] >>> ***/
+
+#include <T5.h>
+
+/*** <<< TYPE-DECLS [T4] >>> ***/
+
+
+typedef T5_t	 T4_t;
+
+/*** <<< FUNC-DECLS [T4] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_T4;
+asn_constr_check_f T4_constraint;
+ber_type_decoder_f T4_decode_ber;
+der_type_encoder_f T4_encode_der;
+asn_struct_print_f T4_print;
+asn_struct_free_f T4_free;
+
+/*** <<< CODE [T4] >>> ***/
+
+int
+T4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_consume_bytes_f *app_errlog, void *app_key) {
+	
+	/* Make the underlying type checker permanent */
+	td->check_constraints = asn1_DEF_T5.check_constraints;
+	return td->check_constraints
+		(td, sptr, app_errlog, app_key);
+}
+
+/*
+ * This type is implemented using T5,
+ * so adjust the DEF appropriately.
+ */
+static void
+T4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
+	td->ber_decoder    = asn1_DEF_T5.ber_decoder;
+	td->der_encoder    = asn1_DEF_T5.der_encoder;
+	td->free_struct    = asn1_DEF_T5.free_struct;
+	td->print_struct   = asn1_DEF_T5.print_struct;
+	td->last_tag_form  = asn1_DEF_T5.last_tag_form;
+	td->elements       = asn1_DEF_T5.elements;
+	td->elements_count = asn1_DEF_T5.elements_count;
+	td->specifics      = asn1_DEF_T5.specifics;
+}
+
+ber_dec_rval_t
+T4_decode_ber(asn1_TYPE_descriptor_t *td,
+		void **structure, void *bufptr, size_t size, int tag_mode) {
+	T4_inherit_TYPE_descriptor(td);
+	return td->ber_decoder(td, structure, bufptr, size, tag_mode);
+}
+
+der_enc_rval_t
+T4_encode_der(asn1_TYPE_descriptor_t *td,
+		void *structure, int tag_mode, ber_tlv_tag_t tag,
+		asn_app_consume_bytes_f *cb, void *app_key) {
+	T4_inherit_TYPE_descriptor(td);
+	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
+}
+
+int
+T4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
+		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+	T4_inherit_TYPE_descriptor(td);
+	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
+}
+
+void
+T4_free(asn1_TYPE_descriptor_t *td,
+		void *struct_ptr, int contents_only) {
+	T4_inherit_TYPE_descriptor(td);
+	td->free_struct(td, struct_ptr, contents_only);
+}
+
+
+/*** <<< STAT-DEFS [T4] >>> ***/
+
+static ber_tlv_tag_t asn1_DEF_T4_tags[] = {
+	(ASN_TAG_CLASS_CONTEXT | (5 << 2)),
+	(ASN_TAG_CLASS_CONTEXT | (6 << 2))
+};
+asn1_TYPE_descriptor_t asn1_DEF_T4 = {
+	"T4",
+	T4_constraint,
+	T4_decode_ber,
+	T4_encode_der,
+	T4_print,
+	T4_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_T4_tags,
+	sizeof(asn1_DEF_T4_tags)
+		/sizeof(asn1_DEF_T4_tags[0]), /* 2 */
+	-0,	/* Unknown yet */
+	0, 0,	/* No members */
+	0	/* No specifics */
+};
+
+
+/*** <<< INCLUDES [T5] >>> ***/
+
+#include <T6.h>
+
+/*** <<< TYPE-DECLS [T5] >>> ***/
+
+
+typedef T6_t	 T5_t;
+
+/*** <<< FUNC-DECLS [T5] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_T5;
+asn_constr_check_f T5_constraint;
+ber_type_decoder_f T5_decode_ber;
+der_type_encoder_f T5_encode_der;
+asn_struct_print_f T5_print;
+asn_struct_free_f T5_free;
+
+/*** <<< CODE [T5] >>> ***/
+
+int
+T5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_consume_bytes_f *app_errlog, void *app_key) {
+	
+	/* Make the underlying type checker permanent */
+	td->check_constraints = asn1_DEF_T6.check_constraints;
+	return td->check_constraints
+		(td, sptr, app_errlog, app_key);
+}
+
+/*
+ * This type is implemented using T6,
+ * so adjust the DEF appropriately.
+ */
+static void
+T5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
+	td->ber_decoder    = asn1_DEF_T6.ber_decoder;
+	td->der_encoder    = asn1_DEF_T6.der_encoder;
+	td->free_struct    = asn1_DEF_T6.free_struct;
+	td->print_struct   = asn1_DEF_T6.print_struct;
+	td->last_tag_form  = asn1_DEF_T6.last_tag_form;
+	td->elements       = asn1_DEF_T6.elements;
+	td->elements_count = asn1_DEF_T6.elements_count;
+	td->specifics      = asn1_DEF_T6.specifics;
+}
+
+ber_dec_rval_t
+T5_decode_ber(asn1_TYPE_descriptor_t *td,
+		void **structure, void *bufptr, size_t size, int tag_mode) {
+	T5_inherit_TYPE_descriptor(td);
+	return td->ber_decoder(td, structure, bufptr, size, tag_mode);
+}
+
+der_enc_rval_t
+T5_encode_der(asn1_TYPE_descriptor_t *td,
+		void *structure, int tag_mode, ber_tlv_tag_t tag,
+		asn_app_consume_bytes_f *cb, void *app_key) {
+	T5_inherit_TYPE_descriptor(td);
+	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
+}
+
+int
+T5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
+		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+	T5_inherit_TYPE_descriptor(td);
+	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
+}
+
+void
+T5_free(asn1_TYPE_descriptor_t *td,
+		void *struct_ptr, int contents_only) {
+	T5_inherit_TYPE_descriptor(td);
+	td->free_struct(td, struct_ptr, contents_only);
+}
+
+
+/*** <<< STAT-DEFS [T5] >>> ***/
+
+static ber_tlv_tag_t asn1_DEF_T5_tags[] = {
+	(ASN_TAG_CLASS_CONTEXT | (6 << 2))
+};
+asn1_TYPE_descriptor_t asn1_DEF_T5 = {
+	"T5",
+	T5_constraint,
+	T5_decode_ber,
+	T5_encode_der,
+	T5_print,
+	T5_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_T5_tags,
+	sizeof(asn1_DEF_T5_tags)
+		/sizeof(asn1_DEF_T5_tags[0]), /* 1 */
+	-0,	/* Unknown yet */
+	0, 0,	/* No members */
+	0	/* No specifics */
+};
+
+
+/*** <<< INCLUDES [T6] >>> ***/
+
+#include <INTEGER.h>
+
+/*** <<< TYPE-DECLS [T6] >>> ***/
+
+
+typedef INTEGER_t	 T6_t;
+
+/*** <<< FUNC-DECLS [T6] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_T6;
+asn_constr_check_f T6_constraint;
+ber_type_decoder_f T6_decode_ber;
+der_type_encoder_f T6_encode_der;
+asn_struct_print_f T6_print;
+asn_struct_free_f T6_free;
+
+/*** <<< CODE [T6] >>> ***/
+
+int
+T6_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_consume_bytes_f *app_errlog, void *app_key) {
+	
+	/* Make the underlying type checker permanent */
+	td->check_constraints = asn1_DEF_INTEGER.check_constraints;
+	return td->check_constraints
+		(td, sptr, app_errlog, app_key);
+}
+
+/*
+ * This type is implemented using INTEGER,
+ * so adjust the DEF appropriately.
+ */
+static void
+T6_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
+	td->ber_decoder    = asn1_DEF_INTEGER.ber_decoder;
+	td->der_encoder    = asn1_DEF_INTEGER.der_encoder;
+	td->free_struct    = asn1_DEF_INTEGER.free_struct;
+	td->print_struct   = asn1_DEF_INTEGER.print_struct;
+	td->last_tag_form  = asn1_DEF_INTEGER.last_tag_form;
+	td->elements       = asn1_DEF_INTEGER.elements;
+	td->elements_count = asn1_DEF_INTEGER.elements_count;
+	td->specifics      = asn1_DEF_INTEGER.specifics;
+}
+
+ber_dec_rval_t
+T6_decode_ber(asn1_TYPE_descriptor_t *td,
+		void **structure, void *bufptr, size_t size, int tag_mode) {
+	T6_inherit_TYPE_descriptor(td);
+	return td->ber_decoder(td, structure, bufptr, size, tag_mode);
+}
+
+der_enc_rval_t
+T6_encode_der(asn1_TYPE_descriptor_t *td,
+		void *structure, int tag_mode, ber_tlv_tag_t tag,
+		asn_app_consume_bytes_f *cb, void *app_key) {
+	T6_inherit_TYPE_descriptor(td);
+	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
+}
+
+int
+T6_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
+		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+	T6_inherit_TYPE_descriptor(td);
+	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
+}
+
+void
+T6_free(asn1_TYPE_descriptor_t *td,
+		void *struct_ptr, int contents_only) {
+	T6_inherit_TYPE_descriptor(td);
+	td->free_struct(td, struct_ptr, contents_only);
+}
+
+
+/*** <<< STAT-DEFS [T6] >>> ***/
+
+static ber_tlv_tag_t asn1_DEF_T6_tags[] = {
+	(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
+};
+asn1_TYPE_descriptor_t asn1_DEF_T6 = {
+	"T6",
+	T6_constraint,
+	T6_decode_ber,
+	T6_encode_der,
+	T6_print,
+	T6_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_T6_tags,
+	sizeof(asn1_DEF_T6_tags)
+		/sizeof(asn1_DEF_T6_tags[0]), /* 1 */
+	-0,	/* Unknown yet */
+	0, 0,	/* No members */
+	0	/* No specifics */
+};
+
+
+/*** <<< INCLUDES [T] >>> ***/
+
+#include <Ts.h>
+
+/*** <<< TYPE-DECLS [T] >>> ***/
+
+
+typedef Ts_t	 T_t;
+
+/*** <<< FUNC-DECLS [T] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_T;
+asn_constr_check_f T_constraint;
+ber_type_decoder_f T_decode_ber;
+der_type_encoder_f T_encode_der;
+asn_struct_print_f T_print;
+asn_struct_free_f T_free;
+
+/*** <<< CODE [T] >>> ***/
+
+int
+T_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_consume_bytes_f *app_errlog, void *app_key) {
+	
+	/* Make the underlying type checker permanent */
+	td->check_constraints = asn1_DEF_Ts.check_constraints;
+	return td->check_constraints
+		(td, sptr, app_errlog, app_key);
+}
+
+/*
+ * This type is implemented using Ts,
+ * so adjust the DEF appropriately.
+ */
+static void
+T_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
+	td->ber_decoder    = asn1_DEF_Ts.ber_decoder;
+	td->der_encoder    = asn1_DEF_Ts.der_encoder;
+	td->free_struct    = asn1_DEF_Ts.free_struct;
+	td->print_struct   = asn1_DEF_Ts.print_struct;
+	td->last_tag_form  = asn1_DEF_Ts.last_tag_form;
+	td->elements       = asn1_DEF_Ts.elements;
+	td->elements_count = asn1_DEF_Ts.elements_count;
+	td->specifics      = asn1_DEF_Ts.specifics;
+}
+
+ber_dec_rval_t
+T_decode_ber(asn1_TYPE_descriptor_t *td,
+		void **structure, void *bufptr, size_t size, int tag_mode) {
+	T_inherit_TYPE_descriptor(td);
+	return td->ber_decoder(td, structure, bufptr, size, tag_mode);
+}
+
+der_enc_rval_t
+T_encode_der(asn1_TYPE_descriptor_t *td,
+		void *structure, int tag_mode, ber_tlv_tag_t tag,
+		asn_app_consume_bytes_f *cb, void *app_key) {
+	T_inherit_TYPE_descriptor(td);
+	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
+}
+
+int
+T_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
+		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
+	T_inherit_TYPE_descriptor(td);
+	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
+}
+
+void
+T_free(asn1_TYPE_descriptor_t *td,
+		void *struct_ptr, int contents_only) {
+	T_inherit_TYPE_descriptor(td);
+	td->free_struct(td, struct_ptr, contents_only);
+}
+
+
+/*** <<< STAT-DEFS [T] >>> ***/
+
+static ber_tlv_tag_t asn1_DEF_T_tags[] = {
+	(ASN_TAG_CLASS_CONTEXT | (0 << 2))
+};
+asn1_TYPE_descriptor_t asn1_DEF_T = {
+	"T",
+	T_constraint,
+	T_decode_ber,
+	T_encode_der,
+	T_print,
+	T_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_T_tags,
+	sizeof(asn1_DEF_T_tags)
+		/sizeof(asn1_DEF_T_tags[0]), /* 1 */
+	-0,	/* Unknown yet */
+	0, 0,	/* Defined elsewhere */
+	0	/* No specifics */
+};
+
+
+/*** <<< INCLUDES [Ts] >>> ***/
+
+#include <T2.h>
+#include <T3.h>
+#include <constr_SEQUENCE.h>
+
+/*** <<< DEPS [Ts] >>> ***/
+
+extern asn1_TYPE_descriptor_t asn1_DEF_Ts;
+
+/*** <<< TYPE-DECLS [Ts] >>> ***/
+
+
+typedef struct Ts {
+	T2_t	 m1;
+	T3_t	*m2	/* OPTIONAL */;
+	T3_t	 m3;
+	
+	/* Context for parsing across buffer boundaries */
+	ber_dec_ctx_t _ber_dec_ctx;
+} Ts_t;
+
+/*** <<< STAT-DEFS [Ts] >>> ***/
+
+static asn1_TYPE_member_t asn1_MBR_Ts[] = {
+	{ ATF_NOFLAGS, 0, offsetof(struct Ts, m1),
+		.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
+		.tag_mode = -1,	/* IMPLICIT tag at current level */
+		.type = (void *)&asn1_DEF_T2,
+		.memb_constraints = 0,	/* Defer to actual type */
+		.name = "m1"
+		},
+	{ ATF_POINTER, 1, offsetof(struct Ts, m2),
+		.tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
+		.tag_mode = +1,	/* EXPLICIT tag at current level */
+		.type = (void *)&asn1_DEF_T3,
+		.memb_constraints = 0,	/* Defer to actual type */
+		.name = "m2"
+		},
+	{ ATF_NOFLAGS, 0, offsetof(struct Ts, m3),
+		.tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
+		.tag_mode = -1,	/* IMPLICIT tag at current level */
+		.type = (void *)&asn1_DEF_T3,
+		.memb_constraints = 0,	/* Defer to actual type */
+		.name = "m3"
+		},
+};
+static ber_tlv_tag_t asn1_DEF_Ts_tags[] = {
+	(ASN_TAG_CLASS_CONTEXT | (123 << 2))
+};
+static asn1_TYPE_tag2member_t asn1_DEF_Ts_tag2el[] = {
+    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* m1 at 24 */
+    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* m2 at 25 */
+    { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 }, /* m3 at 27 */
+};
+static asn1_SEQUENCE_specifics_t asn1_DEF_Ts_specs = {
+	sizeof(struct Ts),
+	offsetof(struct Ts, _ber_dec_ctx),
+	asn1_DEF_Ts_tag2el,
+	3,	/* Count of tags in the map */
+	-1,	/* Start extensions */
+	-1	/* Stop extensions */
+};
+asn1_TYPE_descriptor_t asn1_DEF_Ts = {
+	"Ts",
+	SEQUENCE_constraint,
+	SEQUENCE_decode_ber,
+	SEQUENCE_encode_der,
+	SEQUENCE_print,
+	SEQUENCE_free,
+	0,	/* Use generic outmost tag fetcher */
+	asn1_DEF_Ts_tags,
+	sizeof(asn1_DEF_Ts_tags)
+		/sizeof(asn1_DEF_Ts_tags[0]), /* 1 */
+	1,	/* Whether CONSTRUCTED */
+	asn1_MBR_Ts,
+	3,	/* Elements count */
+	&asn1_DEF_Ts_specs	/* Additional specs */
+};
+