support for a class of circular references
diff --git a/ChangeLog b/ChangeLog
index 6fd8a44..fc03b75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
* X.693:8.3.4 prohibits anything but SignedNumber; fixed XER codec.
* Fixed ENUMERATED identifier to value conversion in XER.
Reported by <jacque.celaire@caramail.com>.
+ * Compiler is taught to produce compilable code for yet another class
+ of circular ASN.1 type references.
* If the compiled file contents are the same as in already existing
file (left from previous compilation), the old file is retained.
This prevents thrashing `make` dependencies if amount of changes in
diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c
index 41ad21e..b8a7428 100644
--- a/libasn1compiler/asn1c_C.c
+++ b/libasn1compiler/asn1c_C.c
@@ -35,6 +35,7 @@
static int expr_elements_count(arg_t *arg, asn1p_expr_t *expr);
static int emit_member_table(arg_t *arg, asn1p_expr_t *expr);
static int emit_tag2member_map(arg_t *arg, tag2el_t *tag2el, int tag2el_count, const char *opt_modifier);
+static int emit_include_dependencies(arg_t *arg);
static int out_name_chain(arg_t *arg, int check_reserved_keywords);
enum tvm_compat {
@@ -59,16 +60,9 @@
OUT("/* Context for parsing across buffer boundaries */\n"); \
OUT("asn_struct_ctx_t _asn_ctx;\n"));
+
#define DEPENDENCIES do { \
- asn1p_expr_t *__m; \
- TQ_FOR(__m, &(expr->members), next) { \
- if((!(__m->expr_type & ASN_CONSTR_MASK) \
- && __m->expr_type > ASN_CONSTR_MASK) \
- || __m->meta_type == AMT_TYPEREF) { \
- GEN_INCLUDE(asn1c_type_name(arg, \
- __m, TNF_INCLUDE)); \
- } \
- } \
+ emit_include_dependencies(arg); \
if(expr->expr_type == ASN_CONSTR_SET_OF) \
GEN_INCLUDE("asn_SET_OF"); \
if(expr->expr_type == ASN_CONSTR_SEQUENCE_OF) \
@@ -81,7 +75,6 @@
int
asn1c_lang_C_type_REAL(arg_t *arg) {
- REDIR(OT_DEPS);
return asn1c_lang_C_type_SIMPLE_TYPE(arg);
}
@@ -245,7 +238,7 @@
}
PCTX_DEF;
- OUT("} %s%s%s", expr->marker.flags?"*":"",
+ OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
expr->_anonymous_type ? "" : MKID(expr->Identifier),
arg->embed ? "" : "_t");
@@ -406,7 +399,7 @@
);
PCTX_DEF;
- OUT("} %s%s%s", expr->marker.flags?"*":"",
+ OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
expr->_anonymous_type ? "" : MKID(expr->Identifier),
arg->embed ? "" : "_t");
@@ -567,7 +560,7 @@
int
asn1c_lang_C_type_SEx_OF(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
- asn1p_expr_t *memb;
+ asn1p_expr_t *memb = TQ_FIRST(&expr->members);
DEPENDENCIES;
@@ -579,8 +572,6 @@
OUT("typedef struct %s {\n", MKID(expr->Identifier));
}
- memb = TQ_FIRST(&expr->members);
-
INDENT(+1);
OUT("A_%s_OF(",
(arg->expr->expr_type == ASN_CONSTR_SET_OF)
@@ -611,13 +602,13 @@
arg->embed--;
assert(arg->target->target == OT_TYPE_DECLS);
} else {
- OUT("%s", asn1c_type_name(arg, memb, TNF_CTYPE | TNF_CHECK));
+ OUT("%s", asn1c_type_name(arg, memb, TNF_RSAFE));
}
OUT(") list;\n");
INDENT(-1);
PCTX_DEF;
- OUT("} %s%s%s", expr->marker.flags?"*":"",
+ OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
expr->_anonymous_type ? "" : MKID(expr->Identifier),
arg->embed ? "" : "_t");
@@ -752,7 +743,7 @@
);
PCTX_DEF;
- OUT("} %s%s%s", expr->marker.flags?"*":"",
+ OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
expr->_anonymous_type ? "" : MKID(expr->Identifier),
arg->embed ? "" : "_t");
@@ -918,24 +909,23 @@
* refer it using "struct X" convention,
* as it may recursively include the current structure.
*/
- if(expr->marker.flags) {
+ if(expr->marker.flags & (EM_INDIRECT | EM_UNRECURSE)) {
asn1p_expr_t *terminal;
terminal = asn1f_find_terminal_type_ex(arg->asn, expr);
if(terminal
&& (terminal->expr_type & ASN_CONSTR_MASK)) {
- REDIR(OT_DEPS);
- tnfmt = TNF_RSAFE;
- OUT("\n");
+ tnfmt = TNF_RSAFE;
+ REDIR(OT_FWD_DECLS);
OUT("%s;\t/* Forward declaration */\n",
- asn1c_type_name(arg, arg->expr, tnfmt | TNF_CHECK));
+ asn1c_type_name(arg, arg->expr, tnfmt));
}
}
REDIR(OT_TYPE_DECLS);
- OUT("%s", asn1c_type_name(arg, arg->expr, tnfmt | TNF_CHECK));
+ OUT("%s", asn1c_type_name(arg, arg->expr, tnfmt));
if(!expr->_anonymous_type) {
- OUT("%s", expr->marker.flags?"\t*":"\t ");
+ OUT("%s", (expr->marker.flags&EM_INDIRECT)?"\t*":"\t ");
OUT("%s", MKID(expr->Identifier));
if((expr->marker.flags & EM_DEFAULT) == EM_DEFAULT)
OUT("\t/* DEFAULT %s */",
@@ -951,11 +941,10 @@
REDIR(OT_TYPE_DECLS);
OUT("typedef %s\t",
- asn1c_type_name(arg, arg->expr, TNF_CTYPE | TNF_CHECK));
+ asn1c_type_name(arg, arg->expr, TNF_CTYPE));
OUT("%s%s_t",
- expr->marker.flags?"*":" ",
- MKID(expr->Identifier));
- OUT_DEBUG("\t/* %s:%d */", __FILE__, __LINE__);
+ (expr->marker.flags & EM_INDIRECT)?"*":" ",
+ MKID_nc(expr->Identifier));
}
if((expr->expr_type == ASN_BASIC_ENUMERATED)
@@ -1557,6 +1546,47 @@
}
static int
+emit_include_dependencies(arg_t *arg) {
+ asn1p_expr_t *expr = arg->expr;
+ asn1p_expr_t *memb;
+
+ TQ_FOR(memb, &(expr->members), next) {
+
+ if((memb->meta_type == AMT_TYPEREF
+ && (memb->marker.flags & EM_INDIRECT))
+ || expr->expr_type == ASN_CONSTR_SET_OF
+ || expr->expr_type == ASN_CONSTR_SEQUENCE_OF
+ ) {
+ asn1p_expr_t *terminal;
+ terminal = asn1f_find_terminal_type_ex(arg->asn, memb);
+ if(terminal && !terminal->parent_expr
+ && (terminal->expr_type & ASN_CONSTR_MASK)) {
+ int saved_target = arg->target->target;
+ REDIR(OT_FWD_DECLS);
+ OUT("%s;\t/* Forward declaration */\n",
+ asn1c_type_name(arg, memb, TNF_RSAFE));
+ REDIR(saved_target);
+ memb->marker.flags |= EM_UNRECURSE;
+ }
+ }
+
+ if((!(memb->expr_type & ASN_CONSTR_MASK)
+ && memb->expr_type > ASN_CONSTR_MASK)
+ || memb->meta_type == AMT_TYPEREF) {
+ if(memb->marker.flags & EM_UNRECURSE) {
+ GEN_POSTINCLUDE(asn1c_type_name(arg,
+ memb, TNF_INCLUDE));
+ } else {
+ GEN_INCLUDE(asn1c_type_name(arg,
+ memb, TNF_INCLUDE));
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int
emit_member_table(arg_t *arg, asn1p_expr_t *expr) {
int save_target;
arg_t tmp_arg;
@@ -1576,7 +1606,8 @@
if(outmost_tag && outmost_tag->tag_value == -1)
OUT("ATF_OPEN_TYPE | ");
- OUT("%s, ", expr->marker.flags?"ATF_POINTER":"ATF_NOFLAGS");
+ OUT("%s, ",
+ (expr->marker.flags & EM_INDIRECT)?"ATF_POINTER":"ATF_NOFLAGS");
if((expr->marker.flags & EM_OPTIONAL) == EM_OPTIONAL) {
asn1p_expr_t *tv;
int opts = 0;
diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index 94e4a63..8c5bb62 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -124,9 +124,6 @@
asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
asn1p_expr_t *top_parent;
char *typename;
- enum ami_flags_e ami_flags = (_format & TNF_CHECK)
- ? AMI_CHECK_RESERVED : 0;
- _format &= ~TNF_CHECK;
/* Rewind to the topmost parent expression */
if((top_parent = expr->parent_expr))
@@ -152,10 +149,18 @@
return asn1c_type_name(&tmp, tmp.expr, _format);
}
+ if(_format == TNF_RSAFE) {
+ asn1p_expr_t *terminal;
+ terminal = asn1f_find_terminal_type_ex(arg->asn, expr);
+ if(terminal && terminal->expr_type & ASN_CONSTR_MASK) {
+ typename = terminal->Identifier;
+ }
+ }
+
if(_format == TNF_CTYPE) {
/*
* If the component references the type itself,
- * switch to a recursion safe type representation
+ * switch to a recursion-safe type naming
* ("struct foo" instead of "foo_t").
*/
asn1p_expr_t *terminal;
@@ -220,19 +225,14 @@
switch(_format) {
case TNF_UNMODIFIED:
case TNF_INCLUDE:
- assert(ami_flags == 0); /* (TNF_INCLUDE | TNF_CHECK)?! */
- ami_flags |= AMI_MASK_ONLY_SPACES;
- return asn1c_make_identifier(ami_flags, typename, 0);
+ return asn1c_make_identifier(AMI_MASK_ONLY_SPACES, typename, 0);
case TNF_SAFE:
- return asn1c_make_identifier(ami_flags, typename, 0);
- case TNF_CTYPE:
- return asn1c_make_identifier(ami_flags, typename, "t", 0);
- case TNF_RSAFE:
- return asn1c_make_identifier(ami_flags, "struct", " ", typename, 0);
- case TNF_NORCHECK:
- case TNF_CHECK:
- assert(_format != TNF_NORCHECK);
- assert(_format != TNF_CHECK);
+ return asn1c_make_identifier(0, typename, 0);
+ case TNF_CTYPE: /* C type */
+ return asn1c_make_identifier(0, typename, "t", 0);
+ case TNF_RSAFE: /* Recursion-safe type */
+ return asn1c_make_identifier(AMI_CHECK_RESERVED,
+ "struct", " ", typename, 0);
}
assert(!"unreachable");
diff --git a/libasn1compiler/asn1c_misc.h b/libasn1compiler/asn1c_misc.h
index c653fa8..eab7567 100644
--- a/libasn1compiler/asn1c_misc.h
+++ b/libasn1compiler/asn1c_misc.h
@@ -16,8 +16,6 @@
* Return the type name of the specified expression.
*/
enum tnfmt {
- TNF_NORCHECK = 0x00,
- TNF_CHECK = 0x01,
TNF_UNMODIFIED = 0x10, /* Return unmodified type name */
TNF_INCLUDE = 0x20, /* Format for #include <> */
TNF_CTYPE = 0x30, /* Format as normal C-ish type (append "_t") */
diff --git a/libasn1compiler/asn1c_out.c b/libasn1compiler/asn1c_out.c
index 14b1f18..46029f7 100644
--- a/libasn1compiler/asn1c_out.c
+++ b/libasn1compiler/asn1c_out.c
@@ -72,7 +72,9 @@
m->len = ret;
- if(arg->target->target == OT_INCLUDES) {
+ if(arg->target->target == OT_INCLUDES
+ || arg->target->target == OT_FWD_DECLS
+ || arg->target->target == OT_POST_INCLUDE) {
out_chunk_t *v;
TQ_FOR(v, &dst->chunks, next) {
if(m->len == v->len
diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h
index 5a0a1f2..e500a54 100644
--- a/libasn1compiler/asn1c_out.h
+++ b/libasn1compiler/asn1c_out.h
@@ -16,8 +16,10 @@
OT_IGNORE, /* Ignore this output */
OT_INCLUDES, /* #include files */
OT_DEPS, /* Dependencies (other than #includes) */
+ OT_FWD_DECLS, /* Forward declarations */
OT_TYPE_DECLS, /* Type declarations */
OT_FUNC_DECLS, /* Function declarations */
+ OT_POST_INCLUDE,/* #include after type definition */
OT_CTABLES, /* Constraint tables */
OT_CODE, /* Some code */
OT_STAT_DEFS, /* Static definitions */
@@ -32,7 +34,7 @@
} compiler_streams_t;
static char *_compiler_stream2str[] __attribute__ ((unused))
- = { "IGNORE", "INCLUDES", "DEPS", "TYPE-DECLS", "FUNC-DECLS", "CTABLES", "CODE", "STAT-DEFS" };
+ = { "IGNORE", "INCLUDES", "DEPS", "FWD-DECLS", "TYPE-DECLS", "FUNC-DECLS", "POST-INCLUDE", "CTABLES", "CODE", "STAT-DEFS" };
int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
@@ -86,14 +88,20 @@
OUT_NOINDENT("#include <%s.h>\n", filename); \
REDIR(saved_target); \
} while(0)
+#define GEN_POSTINCLUDE(filename) do { \
+ int saved_target = arg->target->target; \
+ REDIR(OT_POST_INCLUDE); \
+ OUT_NOINDENT("#include <%s.h>\n", filename); \
+ REDIR(saved_target); \
+} while(0)
/* Generate ASN.1 type declaration */
#define GEN_DECLARE(expr) do { \
int saved_target = arg->target->target; \
- REDIR(OT_DEPS); \
+ REDIR(OT_FUNC_DECLS); \
OUT_NOINDENT("extern asn_TYPE_descriptor_t " \
"asn_DEF_%s;\n", \
- MKID(expr->Identifier)); \
+ MKID_nc(expr->Identifier)); \
REDIR(saved_target); \
} while(0)
diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c
index 2d0410f..0f3ed04 100644
--- a/libasn1compiler/asn1c_save.c
+++ b/libasn1compiler/asn1c_save.c
@@ -222,21 +222,23 @@
fprintf(fp_h, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
- fprintf(fp_h, "#include <asn_application.h>\n\n");
+ fprintf(fp_h, "#include <asn_application.h>\n");
- TQ_FOR(ot, &(cs->destination[OT_INCLUDES].chunks), next) {
- asn1c_activate_dependency(deps, 0, ot->buf);
- fwrite(ot->buf, ot->len, 1, fp_h);
- }
- fprintf(fp_h, "\n");
- TQ_FOR(ot, &(cs->destination[OT_DEPS].chunks), next)
- fwrite(ot->buf, ot->len, 1, fp_h);
- fprintf(fp_h, "\n");
- TQ_FOR(ot, &(cs->destination[OT_TYPE_DECLS].chunks), next)
- fwrite(ot->buf, ot->len, 1, fp_h);
- fprintf(fp_h, "\n");
- TQ_FOR(ot, &(cs->destination[OT_FUNC_DECLS].chunks), next)
- fwrite(ot->buf, ot->len, 1, fp_h);
+#define SAVE_STREAM(idx, msg, actdep) do { \
+ if(TQ_FIRST(&(cs->destination[idx].chunks))) \
+ fprintf(fp_h, "\n/* %s */\n", msg); \
+ TQ_FOR(ot, &(cs->destination[idx].chunks), next) { \
+ if(actdep) asn1c_activate_dependency(deps, 0, ot->buf); \
+ fwrite(ot->buf, ot->len, 1, fp_h); \
+ } \
+} while(0)
+
+ SAVE_STREAM(OT_INCLUDES, "Including external dependencies", 1);
+ SAVE_STREAM(OT_DEPS, "Dependencies", 0);
+ SAVE_STREAM(OT_FWD_DECLS, "Forward declarations", 0);
+ SAVE_STREAM(OT_TYPE_DECLS, expr->Identifier, 0);
+ SAVE_STREAM(OT_FUNC_DECLS, "Implementation", 0);
+ SAVE_STREAM(OT_POST_INCLUDE, "Referred external types", 1);
fprintf(fp_h, "\n#ifdef __cplusplus\n}\n#endif\n\n"
"#endif\t/* _%s_H_ */\n",
@@ -251,7 +253,7 @@
TQ_FOR(ot, &(cs->destination[OT_STAT_DEFS].chunks), next)
fwrite(ot->buf, ot->len, 1, fp_c);
- assert(OT_MAX == 8);
+ assert(OT_MAX == 10); /* Protection from reckless changes */
fclose(fp_c);
fclose(fp_h);
diff --git a/libasn1compiler/asn1compiler.c b/libasn1compiler/asn1compiler.c
index 0159da1..107303d 100644
--- a/libasn1compiler/asn1compiler.c
+++ b/libasn1compiler/asn1compiler.c
@@ -76,9 +76,6 @@
type_cb = asn1_lang_map[expr->meta_type][expr->expr_type].type_cb;
if(type_cb) {
- if(arg->target->destination[OT_TYPE_DECLS].indent_level == 0)
- OUT("\n");
-
DEBUG("Compiling %s at line %d",
expr->Identifier,
expr->_lineno);
diff --git a/libasn1parser/asn1p_expr.h b/libasn1parser/asn1p_expr.h
index cc39dfc..c215c3f 100644
--- a/libasn1parser/asn1p_expr.h
+++ b/libasn1parser/asn1p_expr.h
@@ -178,6 +178,7 @@
EM_INDIRECT = 0x01, /* 0001: Represent as pointer */
EM_OPTIONAL = 0x03, /* 0011: Optional member */
EM_DEFAULT = 0x07, /* 0111: default_value */
+ EM_UNRECURSE = 0x08, /* 1000: Use safe naming */
} flags;
asn1p_value_t *default_value; /* For EM_DEFAULT case */
} marker;
diff --git a/tests/19-param-OK.asn1.-P b/tests/19-param-OK.asn1.-P
index 6103812..868d595 100644
--- a/tests/19-param-OK.asn1.-P
+++ b/tests/19-param-OK.asn1.-P
@@ -7,13 +7,8 @@
#include <Name.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [Certificate] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_Certificate;
-
/*** <<< TYPE-DECLS [Certificate] >>> ***/
-
typedef struct Certificate {
struct toBeSigned {
INTEGER_t version;
@@ -30,6 +25,10 @@
asn_struct_ctx_t _asn_ctx;
} Certificate_t;
+/*** <<< FUNC-DECLS [Certificate] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Certificate;
+
/*** <<< CODE [Certificate] >>> ***/
static int
@@ -192,24 +191,30 @@
/*** <<< INCLUDES [Name] >>> ***/
-#include <RelativeDistinguishedName.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
-/*** <<< DEPS [Name] >>> ***/
+/*** <<< FWD-DECLS [Name] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_Name;
+struct RelativeDistinguishedName; /* Forward declaration */
/*** <<< TYPE-DECLS [Name] >>> ***/
-
typedef struct Name {
- A_SEQUENCE_OF(RelativeDistinguishedName_t) list;
+ A_SEQUENCE_OF(struct RelativeDistinguishedName) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Name_t;
+/*** <<< FUNC-DECLS [Name] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Name;
+
+/*** <<< POST-INCLUDE [Name] >>> ***/
+
+#include <RelativeDistinguishedName.h>
+
/*** <<< STAT-DEFS [Name] >>> ***/
static asn_TYPE_member_t asn_MBR_Name_1[] = {
@@ -258,13 +263,8 @@
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
-/*** <<< DEPS [RelativeDistinguishedName] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName;
-
/*** <<< TYPE-DECLS [RelativeDistinguishedName] >>> ***/
-
typedef struct RelativeDistinguishedName {
A_SET_OF(IA5String_t) list;
@@ -272,6 +272,10 @@
asn_struct_ctx_t _asn_ctx;
} RelativeDistinguishedName_t;
+/*** <<< FUNC-DECLS [RelativeDistinguishedName] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName;
+
/*** <<< CTABLES [RelativeDistinguishedName] >>> ***/
static int permitted_alphabet_table_1[256] = {
diff --git a/tests/30-set-OK.asn1.-P b/tests/30-set-OK.asn1.-P
index 849e9a9..129ef3d 100644
--- a/tests/30-set-OK.asn1.-P
+++ b/tests/30-set-OK.asn1.-P
@@ -17,11 +17,9 @@
T_PR_s, /* Member s is present */
T_PR_b, /* Member b is present */
} T_PR;
-extern asn_TYPE_descriptor_t asn_DEF_T;
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef struct T {
INTEGER_t i;
IA5String_t s;
@@ -39,6 +37,10 @@
asn_struct_ctx_t _asn_ctx;
} T_t;
+/*** <<< FUNC-DECLS [T] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T;
+
/*** <<< STAT-DEFS [T] >>> ***/
static asn_TYPE_member_t asn_MBR_T_1[] = {
diff --git a/tests/31-set-of-OK.asn1.-P b/tests/31-set-of-OK.asn1.-P
index 2bd3b12..b1bdd78 100644
--- a/tests/31-set-of-OK.asn1.-P
+++ b/tests/31-set-of-OK.asn1.-P
@@ -1,24 +1,30 @@
/*** <<< INCLUDES [Forest] >>> ***/
-#include <Tree.h>
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
-/*** <<< DEPS [Forest] >>> ***/
+/*** <<< FWD-DECLS [Forest] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_Forest;
+struct Tree; /* Forward declaration */
/*** <<< TYPE-DECLS [Forest] >>> ***/
-
typedef struct Forest {
- A_SET_OF(Tree_t) list;
+ A_SET_OF(struct Tree) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Forest_t;
+/*** <<< FUNC-DECLS [Forest] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Forest;
+
+/*** <<< POST-INCLUDE [Forest] >>> ***/
+
+#include <Tree.h>
+
/*** <<< STAT-DEFS [Forest] >>> ***/
static asn_TYPE_member_t asn_MBR_Forest_1[] = {
@@ -66,13 +72,8 @@
#include <INTEGER.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [Tree] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_Tree;
-
/*** <<< TYPE-DECLS [Tree] >>> ***/
-
typedef struct Tree {
INTEGER_t height;
INTEGER_t width;
@@ -81,6 +82,10 @@
asn_struct_ctx_t _asn_ctx;
} Tree_t;
+/*** <<< FUNC-DECLS [Tree] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Tree;
+
/*** <<< STAT-DEFS [Tree] >>> ***/
static asn_TYPE_member_t asn_MBR_Tree_1[] = {
@@ -139,7 +144,6 @@
/*** <<< INCLUDES [Stuff] >>> ***/
-#include <Forest.h>
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
#include <BIT_STRING.h>
@@ -164,14 +168,16 @@
other_PR_a,
other_PR_b,
} other_PR;
-extern asn_TYPE_descriptor_t asn_DEF_Stuff;
+
+/*** <<< FWD-DECLS [Stuff] >>> ***/
+
+struct Forest; /* Forward declaration */
/*** <<< TYPE-DECLS [Stuff] >>> ***/
-
typedef struct Stuff {
struct trees {
- A_SET_OF(Forest_t) list;
+ A_SET_OF(struct Forest) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
@@ -214,6 +220,14 @@
asn_struct_ctx_t _asn_ctx;
} Stuff_t;
+/*** <<< FUNC-DECLS [Stuff] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Stuff;
+
+/*** <<< POST-INCLUDE [Stuff] >>> ***/
+
+#include <Forest.h>
+
/*** <<< STAT-DEFS [Stuff] >>> ***/
static asn_TYPE_member_t asn_MBR_trees_2[] = {
diff --git a/tests/32-sequence-of-OK.asn1.-P b/tests/32-sequence-of-OK.asn1.-P
index 1a579de..0c77d8b 100644
--- a/tests/32-sequence-of-OK.asn1.-P
+++ b/tests/32-sequence-of-OK.asn1.-P
@@ -1,24 +1,30 @@
/*** <<< INCLUDES [Programming] >>> ***/
-#include <Fault.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
-/*** <<< DEPS [Programming] >>> ***/
+/*** <<< FWD-DECLS [Programming] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_Programming;
+struct Fault; /* Forward declaration */
/*** <<< TYPE-DECLS [Programming] >>> ***/
-
typedef struct Programming {
- A_SEQUENCE_OF(Fault_t) list;
+ A_SEQUENCE_OF(struct Fault) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Programming_t;
+/*** <<< FUNC-DECLS [Programming] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Programming;
+
+/*** <<< POST-INCLUDE [Programming] >>> ***/
+
+#include <Fault.h>
+
/*** <<< STAT-DEFS [Programming] >>> ***/
static asn_TYPE_member_t asn_MBR_Programming_1[] = {
@@ -63,24 +69,30 @@
/*** <<< INCLUDES [Fault] >>> ***/
-#include <Error.h>
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
-/*** <<< DEPS [Fault] >>> ***/
+/*** <<< FWD-DECLS [Fault] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_Fault;
+struct Error; /* Forward declaration */
/*** <<< TYPE-DECLS [Fault] >>> ***/
-
typedef struct Fault {
- A_SET_OF(Error_t) list;
+ A_SET_OF(struct Error) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Fault_t;
+/*** <<< FUNC-DECLS [Fault] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Fault;
+
+/*** <<< POST-INCLUDE [Fault] >>> ***/
+
+#include <Error.h>
+
/*** <<< STAT-DEFS [Fault] >>> ***/
static asn_TYPE_member_t asn_MBR_Fault_1[] = {
@@ -127,13 +139,8 @@
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [Error] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_Error;
-
/*** <<< TYPE-DECLS [Error] >>> ***/
-
typedef struct Error {
/*
* This type is extensible,
@@ -144,6 +151,10 @@
asn_struct_ctx_t _asn_ctx;
} Error_t;
+/*** <<< FUNC-DECLS [Error] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Error;
+
/*** <<< STAT-DEFS [Error] >>> ***/
static ber_tlv_tag_t asn_DEF_Error_1_tags[] = {
diff --git a/tests/39-sequence-of-OK.asn1.-P b/tests/39-sequence-of-OK.asn1.-P
index 351e01b..f564b2e 100644
--- a/tests/39-sequence-of-OK.asn1.-P
+++ b/tests/39-sequence-of-OK.asn1.-P
@@ -2,22 +2,20 @@
/*** <<< INCLUDES [T] >>> ***/
#include <INTEGER.h>
-#include <T2.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [T] >>> ***/
+/*** <<< FWD-DECLS [T] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_T;
+struct T2; /* Forward declaration */
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef struct T {
INTEGER_t Int;
struct collection {
- A_SEQUENCE_OF(T2_t) list;
+ A_SEQUENCE_OF(struct T2) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
@@ -27,6 +25,14 @@
asn_struct_ctx_t _asn_ctx;
} T_t;
+/*** <<< FUNC-DECLS [T] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T;
+
+/*** <<< POST-INCLUDE [T] >>> ***/
+
+#include <T2.h>
+
/*** <<< STAT-DEFS [T] >>> ***/
static asn_TYPE_member_t asn_MBR_collection_2[] = {
@@ -129,13 +135,8 @@
#include <UTF8String.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [T2] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_T2;
-
/*** <<< TYPE-DECLS [T2] >>> ***/
-
typedef struct T2 {
BOOLEAN_t flag;
UTF8String_t str;
@@ -144,6 +145,10 @@
asn_struct_ctx_t _asn_ctx;
} T2_t;
+/*** <<< FUNC-DECLS [T2] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T2;
+
/*** <<< STAT-DEFS [T2] >>> ***/
static asn_TYPE_member_t asn_MBR_T2_1[] = {
diff --git a/tests/42-real-life-OK.asn1.-PR b/tests/42-real-life-OK.asn1.-PR
index 6394912..7dfb845 100644
--- a/tests/42-real-life-OK.asn1.-PR
+++ b/tests/42-real-life-OK.asn1.-PR
@@ -2,22 +2,20 @@
/*** <<< INCLUDES [LogLine] >>> ***/
#include <IA5String.h>
-#include <VariablePartSet.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [LogLine] >>> ***/
+/*** <<< FWD-DECLS [LogLine] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_LogLine;
+struct VariablePartSet; /* Forward declaration */
/*** <<< TYPE-DECLS [LogLine] >>> ***/
-
typedef struct LogLine {
IA5String_t line_digest;
struct varsets {
- A_SEQUENCE_OF(VariablePartSet_t) list;
+ A_SEQUENCE_OF(struct VariablePartSet) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
@@ -31,6 +29,14 @@
asn_struct_ctx_t _asn_ctx;
} LogLine_t;
+/*** <<< FUNC-DECLS [LogLine] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_LogLine;
+
+/*** <<< POST-INCLUDE [LogLine] >>> ***/
+
+#include <VariablePartSet.h>
+
/*** <<< CODE [LogLine] >>> ***/
static int
@@ -162,21 +168,19 @@
/*** <<< INCLUDES [VariablePartSet] >>> ***/
#include <ActionItem.h>
-#include <VariablePart.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [VariablePartSet] >>> ***/
+/*** <<< FWD-DECLS [VariablePartSet] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_VariablePartSet;
+struct VariablePart; /* Forward declaration */
/*** <<< TYPE-DECLS [VariablePartSet] >>> ***/
-
typedef struct VariablePartSet {
struct vparts {
- A_SEQUENCE_OF(VariablePart_t) list;
+ A_SEQUENCE_OF(struct VariablePart) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
@@ -191,6 +195,14 @@
asn_struct_ctx_t _asn_ctx;
} VariablePartSet_t;
+/*** <<< FUNC-DECLS [VariablePartSet] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_VariablePartSet;
+
+/*** <<< POST-INCLUDE [VariablePartSet] >>> ***/
+
+#include <VariablePart.h>
+
/*** <<< CODE [VariablePartSet] >>> ***/
static int
@@ -325,11 +337,9 @@
VariablePart_PR_vrange,
/* Extensions may appear below */
} VariablePart_PR;
-extern asn_TYPE_descriptor_t asn_DEF_VariablePart;
/*** <<< TYPE-DECLS [VariablePart] >>> ***/
-
typedef struct VariablePart {
VariablePart_PR present;
union {
@@ -360,6 +370,10 @@
asn_struct_ctx_t _asn_ctx;
} VariablePart_t;
+/*** <<< FUNC-DECLS [VariablePart] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_VariablePart;
+
/*** <<< CODE [VariablePart] >>> ***/
static int
@@ -557,11 +571,9 @@
* Enumeration is extensible
*/
} accept_as_e;
-extern asn_TYPE_descriptor_t asn_DEF_ActionItem;
/*** <<< TYPE-DECLS [ActionItem] >>> ***/
-
typedef struct ActionItem {
ENUMERATED_t accept_as;
struct notify {
@@ -592,6 +604,7 @@
/*** <<< FUNC-DECLS [ActionItem] >>> ***/
/* extern asn_TYPE_descriptor_t asn_DEF_accept_as_2; // (Use -fall-defs-global to expose) */
+extern asn_TYPE_descriptor_t asn_DEF_ActionItem;
/*** <<< CODE [ActionItem] >>> ***/
diff --git a/tests/43-recursion-OK.asn1.-P b/tests/43-recursion-OK.asn1.-P
index de35638..747d962 100644
--- a/tests/43-recursion-OK.asn1.-P
+++ b/tests/43-recursion-OK.asn1.-P
@@ -1,7 +1,6 @@
/*** <<< INCLUDES [Test-structure-1] >>> ***/
-#include <Test-structure-1.h>
#include <INTEGER.h>
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
@@ -9,15 +8,12 @@
#include <constr_SEQUENCE_OF.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [Test-structure-1] >>> ***/
-
+/*** <<< FWD-DECLS [Test-structure-1] >>> ***/
struct Test_structure_1; /* Forward declaration */
-extern asn_TYPE_descriptor_t asn_DEF_Test_structure_1;
/*** <<< TYPE-DECLS [Test-structure-1] >>> ***/
-
typedef struct Test_structure_1 {
struct t_member1 {
A_SET_OF(struct Test_structure_1) list;
@@ -38,6 +34,14 @@
asn_struct_ctx_t _asn_ctx;
} Test_structure_1_t;
+/*** <<< FUNC-DECLS [Test-structure-1] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Test_structure_1;
+
+/*** <<< POST-INCLUDE [Test-structure-1] >>> ***/
+
+#include <Test-structure-1.h>
+
/*** <<< STAT-DEFS [Test-structure-1] >>> ***/
static asn_TYPE_member_t asn_MBR_t_member1_2[] = {
@@ -208,14 +212,12 @@
Choice_1_PR_other,
} Choice_1_PR;
-struct Choice_1; /* Forward declaration */
+/*** <<< FWD-DECLS [Choice-1] >>> ***/
struct Choice_1; /* Forward declaration */
-extern asn_TYPE_descriptor_t asn_DEF_Choice_1;
/*** <<< TYPE-DECLS [Choice-1] >>> ***/
-
typedef struct Choice_1 {
Choice_1_PR present;
union {
@@ -234,6 +236,14 @@
asn_struct_ctx_t _asn_ctx;
} Choice_1_t;
+/*** <<< FUNC-DECLS [Choice-1] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Choice_1;
+
+/*** <<< POST-INCLUDE [Choice-1] >>> ***/
+
+#include <Choice-1.h>
+
/*** <<< STAT-DEFS [Choice-1] >>> ***/
static asn_TYPE_member_t asn_MBR_or_2[] = {
@@ -345,7 +355,6 @@
/*** <<< INCLUDES [Test-structure-2] >>> ***/
-#include <Test-structure-3.h>
#include <constr_SET.h>
/*** <<< DEPS [Test-structure-2] >>> ***/
@@ -358,12 +367,12 @@
Test_structure_2_PR_m1, /* Member m1 is present */
} Test_structure_2_PR;
+/*** <<< FWD-DECLS [Test-structure-2] >>> ***/
+
struct Test_structure_3; /* Forward declaration */
-extern asn_TYPE_descriptor_t asn_DEF_Test_structure_2;
/*** <<< TYPE-DECLS [Test-structure-2] >>> ***/
-
typedef struct Test_structure_2 {
struct Test_structure_3 *m1 /* OPTIONAL */;
@@ -375,6 +384,14 @@
asn_struct_ctx_t _asn_ctx;
} Test_structure_2_t;
+/*** <<< FUNC-DECLS [Test-structure-2] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Test_structure_2;
+
+/*** <<< POST-INCLUDE [Test-structure-2] >>> ***/
+
+#include <Test-structure-3.h>
+
/*** <<< STAT-DEFS [Test-structure-2] >>> ***/
static asn_TYPE_member_t asn_MBR_Test_structure_2_1[] = {
@@ -431,7 +448,6 @@
/*** <<< INCLUDES [Test-structure-3] >>> ***/
-#include <Test-structure-2.h>
#include <constr_SET.h>
/*** <<< DEPS [Test-structure-3] >>> ***/
@@ -444,12 +460,12 @@
Test_structure_3_PR_m1, /* Member m1 is present */
} Test_structure_3_PR;
+/*** <<< FWD-DECLS [Test-structure-3] >>> ***/
+
struct Test_structure_2; /* Forward declaration */
-extern asn_TYPE_descriptor_t asn_DEF_Test_structure_3;
/*** <<< TYPE-DECLS [Test-structure-3] >>> ***/
-
typedef struct Test_structure_3 {
struct Test_structure_2 *m1 /* OPTIONAL */;
@@ -461,6 +477,14 @@
asn_struct_ctx_t _asn_ctx;
} Test_structure_3_t;
+/*** <<< FUNC-DECLS [Test-structure-3] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Test_structure_3;
+
+/*** <<< POST-INCLUDE [Test-structure-3] >>> ***/
+
+#include <Test-structure-2.h>
+
/*** <<< STAT-DEFS [Test-structure-3] >>> ***/
static asn_TYPE_member_t asn_MBR_Test_structure_3_1[] = {
diff --git a/tests/44-choice-in-sequence-OK.asn1.-P b/tests/44-choice-in-sequence-OK.asn1.-P
index 7deb2df..e8559c8 100644
--- a/tests/44-choice-in-sequence-OK.asn1.-P
+++ b/tests/44-choice-in-sequence-OK.asn1.-P
@@ -24,11 +24,9 @@
h_PR_i,
h_PR_j,
} h_PR;
-extern asn_TYPE_descriptor_t asn_DEF_T;
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef struct T {
NULL_t a;
struct b {
@@ -66,6 +64,10 @@
asn_struct_ctx_t _asn_ctx;
} T_t;
+/*** <<< FUNC-DECLS [T] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T;
+
/*** <<< STAT-DEFS [T] >>> ***/
static asn_TYPE_member_t asn_MBR_e_3[] = {
diff --git a/tests/46-redefine-OK.asn1.-PR b/tests/46-redefine-OK.asn1.-PR
index 7a2b69b..139fd6a 100644
--- a/tests/46-redefine-OK.asn1.-PR
+++ b/tests/46-redefine-OK.asn1.-PR
@@ -5,7 +5,6 @@
/*** <<< TYPE-DECLS [PrimitiveType] >>> ***/
-
typedef OCTET_STRING_t PrimitiveType_t;
/*** <<< FUNC-DECLS [PrimitiveType] >>> ***/
@@ -23,13 +22,8 @@
#include <PrimitiveType.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [ConstructedType] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_ConstructedType;
-
/*** <<< TYPE-DECLS [ConstructedType] >>> ***/
-
typedef struct ConstructedType {
PrimitiveType_t field;
@@ -37,6 +31,10 @@
asn_struct_ctx_t _asn_ctx;
} ConstructedType_t;
+/*** <<< FUNC-DECLS [ConstructedType] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_ConstructedType;
+
/*** <<< STAT-DEFS [ConstructedType] >>> ***/
static asn_TYPE_member_t asn_MBR_ConstructedType_1[] = {
@@ -91,7 +89,6 @@
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef ConstructedType_t T_t;
/*** <<< FUNC-DECLS [T] >>> ***/
diff --git a/tests/47-set-ext-OK.asn1.-P b/tests/47-set-ext-OK.asn1.-P
index e91110d..660048b 100644
--- a/tests/47-set-ext-OK.asn1.-P
+++ b/tests/47-set-ext-OK.asn1.-P
@@ -13,11 +13,9 @@
typedef enum T1_PR {
T1_PR_i, /* Member i is present */
} T1_PR;
-extern asn_TYPE_descriptor_t asn_DEF_T1;
/*** <<< TYPE-DECLS [T1] >>> ***/
-
typedef struct T1 {
INTEGER_t i;
/*
@@ -33,6 +31,10 @@
asn_struct_ctx_t _asn_ctx;
} T1_t;
+/*** <<< FUNC-DECLS [T1] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T1;
+
/*** <<< STAT-DEFS [T1] >>> ***/
static asn_TYPE_member_t asn_MBR_T1_1[] = {
@@ -101,11 +103,9 @@
typedef enum T2_PR {
T2_PR_i, /* Member i is present */
} T2_PR;
-extern asn_TYPE_descriptor_t asn_DEF_T2;
/*** <<< TYPE-DECLS [T2] >>> ***/
-
typedef struct T2 {
INTEGER_t i;
/*
@@ -121,6 +121,10 @@
asn_struct_ctx_t _asn_ctx;
} T2_t;
+/*** <<< FUNC-DECLS [T2] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T2;
+
/*** <<< STAT-DEFS [T2] >>> ***/
static asn_TYPE_member_t asn_MBR_T2_1[] = {
@@ -187,11 +191,9 @@
T3_PR_i,
/* Extensions may appear below */
} T3_PR;
-extern asn_TYPE_descriptor_t asn_DEF_T3;
/*** <<< TYPE-DECLS [T3] >>> ***/
-
typedef struct T3 {
T3_PR present;
union {
@@ -206,6 +208,10 @@
asn_struct_ctx_t _asn_ctx;
} T3_t;
+/*** <<< FUNC-DECLS [T3] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T3;
+
/*** <<< STAT-DEFS [T3] >>> ***/
static asn_TYPE_member_t asn_MBR_T3_1[] = {
@@ -262,11 +268,9 @@
T4_PR_i,
/* Extensions may appear below */
} T4_PR;
-extern asn_TYPE_descriptor_t asn_DEF_T4;
/*** <<< TYPE-DECLS [T4] >>> ***/
-
typedef struct T4 {
T4_PR present;
union {
@@ -281,6 +285,10 @@
asn_struct_ctx_t _asn_ctx;
} T4_t;
+/*** <<< FUNC-DECLS [T4] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T4;
+
/*** <<< STAT-DEFS [T4] >>> ***/
static asn_TYPE_member_t asn_MBR_T4_1[] = {
diff --git a/tests/50-constraint-OK.asn1.-P b/tests/50-constraint-OK.asn1.-P
index 01131bf..47d84e6 100644
--- a/tests/50-constraint-OK.asn1.-P
+++ b/tests/50-constraint-OK.asn1.-P
@@ -5,7 +5,6 @@
/*** <<< TYPE-DECLS [Int1] >>> ***/
-
typedef INTEGER_t Int1_t;
/*** <<< FUNC-DECLS [Int1] >>> ***/
@@ -24,7 +23,6 @@
/*** <<< TYPE-DECLS [Int2] >>> ***/
-
typedef Int1_t Int2_t;
/*** <<< FUNC-DECLS [Int2] >>> ***/
@@ -162,7 +160,6 @@
/*** <<< TYPE-DECLS [Int3] >>> ***/
-
typedef Int2_t Int3_t;
/*** <<< FUNC-DECLS [Int3] >>> ***/
@@ -304,7 +301,6 @@
/*** <<< TYPE-DECLS [Int4] >>> ***/
-
typedef Int3_t Int4_t;
/*** <<< FUNC-DECLS [Int4] >>> ***/
@@ -446,7 +442,6 @@
/*** <<< TYPE-DECLS [Int5] >>> ***/
-
typedef Int4_t Int5_t;
/*** <<< FUNC-DECLS [Int5] >>> ***/
@@ -588,7 +583,6 @@
/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
-
typedef INTEGER_t ExtensibleExtensions_t;
/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
@@ -730,7 +724,6 @@
/*** <<< TYPE-DECLS [Str1] >>> ***/
-
typedef IA5String_t Str1_t;
/*** <<< FUNC-DECLS [Str1] >>> ***/
@@ -749,7 +742,6 @@
/*** <<< TYPE-DECLS [Str2] >>> ***/
-
typedef Str1_t Str2_t;
/*** <<< FUNC-DECLS [Str2] >>> ***/
@@ -903,7 +895,6 @@
/*** <<< TYPE-DECLS [Str3] >>> ***/
-
typedef Str2_t Str3_t;
/*** <<< FUNC-DECLS [Str3] >>> ***/
@@ -1068,7 +1059,6 @@
/*** <<< TYPE-DECLS [Str4] >>> ***/
-
typedef IA5String_t Str4_t;
/*** <<< FUNC-DECLS [Str4] >>> ***/
@@ -1219,7 +1209,6 @@
/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
-
typedef IA5String_t PER_Visible_t;
/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
@@ -1370,7 +1359,6 @@
/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
-
typedef PER_Visible_t PER_Visible_2_t;
/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
@@ -1521,7 +1509,6 @@
/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
-
typedef PER_Visible_t Not_PER_Visible_1_t;
/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
@@ -1672,7 +1659,6 @@
/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
-
typedef PER_Visible_t Not_PER_Visible_2_t;
/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
@@ -1823,7 +1809,6 @@
/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
-
typedef PER_Visible_t Not_PER_Visible_3_t;
/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
@@ -1974,7 +1959,6 @@
/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
-
typedef PER_Visible_t SIZE_but_not_FROM_t;
/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
@@ -2128,7 +2112,6 @@
/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
-
typedef PER_Visible_t SIZE_and_FROM_t;
/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
@@ -2282,7 +2265,6 @@
/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
-
typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
@@ -2433,7 +2415,6 @@
/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
-
typedef UTF8String_t Utf8_4_t;
/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
@@ -2578,7 +2559,6 @@
/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
-
typedef Utf8_2_t Utf8_3_t;
/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
@@ -2751,7 +2731,6 @@
/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
-
typedef Utf8_1_t Utf8_2_t;
/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
@@ -2894,7 +2873,6 @@
/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
-
typedef UTF8String_t Utf8_1_t;
/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
@@ -2913,7 +2891,6 @@
/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
-
typedef Identifier_t VisibleIdentifier_t;
/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
@@ -2932,7 +2909,6 @@
/*** <<< TYPE-DECLS [Identifier] >>> ***/
-
typedef VisibleString_t Identifier_t;
/*** <<< FUNC-DECLS [Identifier] >>> ***/
diff --git a/tests/59-choice-extended-OK.asn1.-P b/tests/59-choice-extended-OK.asn1.-P
index 5de4095..12f7be4 100644
--- a/tests/59-choice-extended-OK.asn1.-P
+++ b/tests/59-choice-extended-OK.asn1.-P
@@ -15,12 +15,12 @@
Choice_PR_c,
} Choice_PR;
+/*** <<< FWD-DECLS [Choice] >>> ***/
+
struct Choice; /* Forward declaration */
-extern asn_TYPE_descriptor_t asn_DEF_Choice;
/*** <<< TYPE-DECLS [Choice] >>> ***/
-
typedef struct Choice {
Choice_PR present;
union {
@@ -37,6 +37,10 @@
asn_struct_ctx_t _asn_ctx;
} Choice_t;
+/*** <<< FUNC-DECLS [Choice] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Choice;
+
/*** <<< STAT-DEFS [Choice] >>> ***/
static asn_TYPE_member_t asn_MBR_Choice_1[] = {
diff --git a/tests/60-any-OK.asn1.-P b/tests/60-any-OK.asn1.-P
index f52ad81..ed23340 100644
--- a/tests/60-any-OK.asn1.-P
+++ b/tests/60-any-OK.asn1.-P
@@ -5,13 +5,8 @@
#include <ANY.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [T1] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_T1;
-
/*** <<< TYPE-DECLS [T1] >>> ***/
-
typedef struct T1 {
INTEGER_t i;
ANY_t any;
@@ -20,6 +15,10 @@
asn_struct_ctx_t _asn_ctx;
} T1_t;
+/*** <<< FUNC-DECLS [T1] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T1;
+
/*** <<< STAT-DEFS [T1] >>> ***/
static asn_TYPE_member_t asn_MBR_T1_1[] = {
@@ -81,13 +80,8 @@
#include <ANY.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [T2] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_T2;
-
/*** <<< TYPE-DECLS [T2] >>> ***/
-
typedef struct T2 {
INTEGER_t i;
ANY_t *any /* OPTIONAL */;
@@ -96,6 +90,10 @@
asn_struct_ctx_t _asn_ctx;
} T2_t;
+/*** <<< FUNC-DECLS [T2] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T2;
+
/*** <<< STAT-DEFS [T2] >>> ***/
static asn_TYPE_member_t asn_MBR_T2_1[] = {
diff --git a/tests/65-multi-tag-OK.asn1.-P b/tests/65-multi-tag-OK.asn1.-P
index 39a145b..a85fc18 100644
--- a/tests/65-multi-tag-OK.asn1.-P
+++ b/tests/65-multi-tag-OK.asn1.-P
@@ -5,7 +5,6 @@
/*** <<< TYPE-DECLS [T1] >>> ***/
-
typedef T2_t T1_t;
/*** <<< FUNC-DECLS [T1] >>> ***/
@@ -135,7 +134,6 @@
/*** <<< TYPE-DECLS [T2] >>> ***/
-
typedef T3_t T2_t;
/*** <<< FUNC-DECLS [T2] >>> ***/
@@ -263,7 +261,6 @@
/*** <<< TYPE-DECLS [T3] >>> ***/
-
typedef T4_t T3_t;
/*** <<< FUNC-DECLS [T3] >>> ***/
@@ -389,7 +386,6 @@
/*** <<< TYPE-DECLS [T4] >>> ***/
-
typedef T5_t T4_t;
/*** <<< FUNC-DECLS [T4] >>> ***/
@@ -510,7 +506,6 @@
/*** <<< TYPE-DECLS [T5] >>> ***/
-
typedef T6_t T5_t;
/*** <<< FUNC-DECLS [T5] >>> ***/
@@ -630,7 +625,6 @@
/*** <<< TYPE-DECLS [T6] >>> ***/
-
typedef REAL_t T6_t;
/*** <<< FUNC-DECLS [T6] >>> ***/
@@ -649,7 +643,6 @@
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef Ts_t T_t;
/*** <<< FUNC-DECLS [T] >>> ***/
@@ -770,13 +763,8 @@
#include <T3.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [Ts] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_Ts;
-
/*** <<< TYPE-DECLS [Ts] >>> ***/
-
typedef struct Ts {
T2_t m1;
T3_t *m2 /* OPTIONAL */;
@@ -786,6 +774,10 @@
asn_struct_ctx_t _asn_ctx;
} Ts_t;
+/*** <<< FUNC-DECLS [Ts] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Ts;
+
/*** <<< STAT-DEFS [Ts] >>> ***/
static asn_TYPE_member_t asn_MBR_Ts_1[] = {
diff --git a/tests/65-multi-tag-OK.asn1.-Pfnative-types b/tests/65-multi-tag-OK.asn1.-Pfnative-types
index 30e0173..6a35789 100644
--- a/tests/65-multi-tag-OK.asn1.-Pfnative-types
+++ b/tests/65-multi-tag-OK.asn1.-Pfnative-types
@@ -5,7 +5,6 @@
/*** <<< TYPE-DECLS [T1] >>> ***/
-
typedef T2_t T1_t;
/*** <<< FUNC-DECLS [T1] >>> ***/
@@ -135,7 +134,6 @@
/*** <<< TYPE-DECLS [T2] >>> ***/
-
typedef T3_t T2_t;
/*** <<< FUNC-DECLS [T2] >>> ***/
@@ -263,7 +261,6 @@
/*** <<< TYPE-DECLS [T3] >>> ***/
-
typedef T4_t T3_t;
/*** <<< FUNC-DECLS [T3] >>> ***/
@@ -389,7 +386,6 @@
/*** <<< TYPE-DECLS [T4] >>> ***/
-
typedef T5_t T4_t;
/*** <<< FUNC-DECLS [T4] >>> ***/
@@ -510,7 +506,6 @@
/*** <<< TYPE-DECLS [T5] >>> ***/
-
typedef T6_t T5_t;
/*** <<< FUNC-DECLS [T5] >>> ***/
@@ -630,7 +625,6 @@
/*** <<< TYPE-DECLS [T6] >>> ***/
-
typedef double T6_t;
/*** <<< FUNC-DECLS [T6] >>> ***/
@@ -649,7 +643,6 @@
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef Ts_t T_t;
/*** <<< FUNC-DECLS [T] >>> ***/
@@ -770,13 +763,8 @@
#include <T3.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [Ts] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_Ts;
-
/*** <<< TYPE-DECLS [Ts] >>> ***/
-
typedef struct Ts {
T2_t m1;
T3_t *m2 /* OPTIONAL */;
@@ -786,6 +774,10 @@
asn_struct_ctx_t _asn_ctx;
} Ts_t;
+/*** <<< FUNC-DECLS [Ts] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Ts;
+
/*** <<< STAT-DEFS [Ts] >>> ***/
static asn_TYPE_member_t asn_MBR_Ts_1[] = {
diff --git a/tests/66-ref-simple-OK.asn1.-P b/tests/66-ref-simple-OK.asn1.-P
index 5112e53..2479536 100644
--- a/tests/66-ref-simple-OK.asn1.-P
+++ b/tests/66-ref-simple-OK.asn1.-P
@@ -5,20 +5,19 @@
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
-/*** <<< DEPS [T] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_T;
-
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef struct T {
- A_SET_OF(SimpleType_t) list;
+ A_SET_OF(struct SimpleType) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} T_t;
+/*** <<< FUNC-DECLS [T] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T;
+
/*** <<< STAT-DEFS [T] >>> ***/
static asn_TYPE_member_t asn_MBR_T_1[] = {
@@ -75,7 +74,6 @@
/*** <<< TYPE-DECLS [SimpleType] >>> ***/
-
typedef ENUMERATED_t SimpleType_t;
/*** <<< FUNC-DECLS [SimpleType] >>> ***/
diff --git a/tests/69-reserved-words-OK.asn1.-P b/tests/69-reserved-words-OK.asn1.-P
index 78d035b..9f222eb 100644
--- a/tests/69-reserved-words-OK.asn1.-P
+++ b/tests/69-reserved-words-OK.asn1.-P
@@ -15,11 +15,9 @@
*/
typedef enum class_PR {
} class_PR;
-extern asn_TYPE_descriptor_t asn_DEF_T;
/*** <<< TYPE-DECLS [T] >>> ***/
-
typedef struct T {
INTEGER_t Int;
OCTET_STRING_t Char;
@@ -42,6 +40,10 @@
asn_struct_ctx_t _asn_ctx;
} T_t;
+/*** <<< FUNC-DECLS [T] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_T;
+
/*** <<< CODE [T] >>> ***/
static int
diff --git a/tests/70-xer-test-OK.asn1.-P b/tests/70-xer-test-OK.asn1.-P
index 2c356b9..e84e9f7 100644
--- a/tests/70-xer-test-OK.asn1.-P
+++ b/tests/70-xer-test-OK.asn1.-P
@@ -27,11 +27,9 @@
PDU_PR_seqOfZuka,
/* Extensions may appear below */
} PDU_PR;
-extern asn_TYPE_descriptor_t asn_DEF_PDU;
/*** <<< TYPE-DECLS [PDU] >>> ***/
-
typedef struct PDU {
PDU_PR present;
union {
@@ -54,6 +52,10 @@
asn_struct_ctx_t _asn_ctx;
} PDU_t;
+/*** <<< FUNC-DECLS [PDU] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_PDU;
+
/*** <<< STAT-DEFS [PDU] >>> ***/
static asn_TYPE_member_t asn_MBR_PDU_1[] = {
@@ -165,20 +167,16 @@
/*** <<< INCLUDES [Sequence] >>> ***/
#include <INTEGER.h>
-#include <Sequence.h>
#include <BIT_STRING.h>
#include <UTF8String.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [Sequence] >>> ***/
-
+/*** <<< FWD-DECLS [Sequence] >>> ***/
struct Sequence; /* Forward declaration */
-extern asn_TYPE_descriptor_t asn_DEF_Sequence;
/*** <<< TYPE-DECLS [Sequence] >>> ***/
-
typedef struct Sequence {
INTEGER_t integer;
struct Sequence *sequence /* OPTIONAL */;
@@ -189,6 +187,14 @@
asn_struct_ctx_t _asn_ctx;
} Sequence_t;
+/*** <<< FUNC-DECLS [Sequence] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Sequence;
+
+/*** <<< POST-INCLUDE [Sequence] >>> ***/
+
+#include <Sequence.h>
+
/*** <<< STAT-DEFS [Sequence] >>> ***/
static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
@@ -277,11 +283,9 @@
Set_PR_roid, /* Member roid is present */
Set_PR_opaque, /* Member opaque is present */
} Set_PR;
-extern asn_TYPE_descriptor_t asn_DEF_Set;
/*** <<< TYPE-DECLS [Set] >>> ***/
-
typedef struct Set {
RELATIVE_OID_t roid;
OCTET_STRING_t *opaque /* OPTIONAL */;
@@ -294,6 +298,10 @@
asn_struct_ctx_t _asn_ctx;
} Set_t;
+/*** <<< FUNC-DECLS [Set] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Set;
+
/*** <<< STAT-DEFS [Set] >>> ***/
static asn_TYPE_member_t asn_MBR_Set_1[] = {
@@ -370,11 +378,9 @@
typedef enum ExtensibleSet_PR {
ExtensibleSet_PR_string, /* Member string is present */
} ExtensibleSet_PR;
-extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSet;
/*** <<< TYPE-DECLS [ExtensibleSet] >>> ***/
-
typedef struct ExtensibleSet {
UTF8String_t *string /* OPTIONAL */;
/*
@@ -390,6 +396,10 @@
asn_struct_ctx_t _asn_ctx;
} ExtensibleSet_t;
+/*** <<< FUNC-DECLS [ExtensibleSet] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSet;
+
/*** <<< STAT-DEFS [ExtensibleSet] >>> ***/
static asn_TYPE_member_t asn_MBR_ExtensibleSet_1[] = {
@@ -450,13 +460,8 @@
#include <INTEGER.h>
#include <constr_SEQUENCE.h>
-/*** <<< DEPS [ExtensibleSequence] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence;
-
/*** <<< TYPE-DECLS [ExtensibleSequence] >>> ***/
-
typedef struct ExtensibleSequence {
UTF8String_t *string /* OPTIONAL */;
/*
@@ -469,6 +474,10 @@
asn_struct_ctx_t _asn_ctx;
} ExtensibleSequence_t;
+/*** <<< FUNC-DECLS [ExtensibleSequence] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence;
+
/*** <<< STAT-DEFS [ExtensibleSequence] >>> ***/
static asn_TYPE_member_t asn_MBR_ExtensibleSequence_1[] = {
@@ -531,13 +540,8 @@
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
-/*** <<< DEPS [SetOf] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_SetOf;
-
/*** <<< TYPE-DECLS [SetOf] >>> ***/
-
typedef struct SetOf {
A_SET_OF(REAL_t) list;
@@ -545,6 +549,10 @@
asn_struct_ctx_t _asn_ctx;
} SetOf_t;
+/*** <<< FUNC-DECLS [SetOf] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_SetOf;
+
/*** <<< STAT-DEFS [SetOf] >>> ***/
static asn_TYPE_member_t asn_MBR_SetOf_1[] = {
@@ -593,13 +601,8 @@
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
-/*** <<< DEPS [SetOfNULL] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_SetOfNULL;
-
/*** <<< TYPE-DECLS [SetOfNULL] >>> ***/
-
typedef struct SetOfNULL {
A_SET_OF(NULL_t) list;
@@ -607,6 +610,10 @@
asn_struct_ctx_t _asn_ctx;
} SetOfNULL_t;
+/*** <<< FUNC-DECLS [SetOfNULL] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_SetOfNULL;
+
/*** <<< STAT-DEFS [SetOfNULL] >>> ***/
static asn_TYPE_member_t asn_MBR_SetOfNULL_1[] = {
@@ -661,11 +668,9 @@
Member_one = 0,
Member_oneMore = 1
} Member_e;
-extern asn_TYPE_descriptor_t asn_DEF_SetOfEnums;
/*** <<< TYPE-DECLS [SetOfEnums] >>> ***/
-
typedef struct SetOfEnums {
A_SET_OF(ENUMERATED_t) list;
@@ -676,6 +681,7 @@
/*** <<< FUNC-DECLS [SetOfEnums] >>> ***/
/* extern asn_TYPE_descriptor_t asn_DEF_Member_2; // (Use -fall-defs-global to expose) */
+extern asn_TYPE_descriptor_t asn_DEF_SetOfEnums;
/*** <<< CODE [SetOfEnums] >>> ***/
@@ -837,13 +843,8 @@
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
-/*** <<< DEPS [SequenceOf] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_SequenceOf;
-
/*** <<< TYPE-DECLS [SequenceOf] >>> ***/
-
typedef struct SequenceOf {
A_SEQUENCE_OF(INTEGER_t) list;
@@ -851,6 +852,10 @@
asn_struct_ctx_t _asn_ctx;
} SequenceOf_t;
+/*** <<< FUNC-DECLS [SequenceOf] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_SequenceOf;
+
/*** <<< STAT-DEFS [SequenceOf] >>> ***/
static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = {
@@ -899,13 +904,8 @@
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
-/*** <<< DEPS [SeqOfZuka] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_SeqOfZuka;
-
/*** <<< TYPE-DECLS [SeqOfZuka] >>> ***/
-
typedef struct SeqOfZuka {
A_SEQUENCE_OF(NULL_t) list;
@@ -913,6 +913,10 @@
asn_struct_ctx_t _asn_ctx;
} SeqOfZuka_t;
+/*** <<< FUNC-DECLS [SeqOfZuka] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_SeqOfZuka;
+
/*** <<< STAT-DEFS [SeqOfZuka] >>> ***/
static asn_TYPE_member_t asn_MBR_SeqOfZuka_1[] = {
diff --git a/tests/72-same-names-OK.asn1.-P b/tests/72-same-names-OK.asn1.-P
index 3dc4418..a359a74 100644
--- a/tests/72-same-names-OK.asn1.-P
+++ b/tests/72-same-names-OK.asn1.-P
@@ -7,13 +7,8 @@
#include <constr_SEQUENCE.h>
#include <constr_SET_OF.h>
-/*** <<< DEPS [Type] >>> ***/
-
-extern asn_TYPE_descriptor_t asn_DEF_Type;
-
/*** <<< TYPE-DECLS [Type] >>> ***/
-
typedef struct Type {
A_SET_OF(struct Member {
Type1_t t1;
@@ -27,6 +22,10 @@
asn_struct_ctx_t _asn_ctx;
} Type_t;
+/*** <<< FUNC-DECLS [Type] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Type;
+
/*** <<< STAT-DEFS [Type] >>> ***/
static asn_TYPE_member_t asn_MBR_Member_2[] = {
@@ -136,11 +135,9 @@
one_name_PR_NOTHING, /* No components present */
one_name_PR_another_name,
} one_name_PR;
-extern asn_TYPE_descriptor_t asn_DEF_Type1;
/*** <<< TYPE-DECLS [Type1] >>> ***/
-
typedef struct Type1 {
struct one_name {
one_name_PR present;
@@ -162,6 +159,10 @@
asn_struct_ctx_t _asn_ctx;
} Type1_t;
+/*** <<< FUNC-DECLS [Type1] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Type1;
+
/*** <<< STAT-DEFS [Type1] >>> ***/
static asn_TYPE_member_t asn_MBR_another_name_3[] = {
@@ -328,11 +329,9 @@
typedef enum two_name_PR {
two_name_PR_another_name, /* Member another_name is present */
} two_name_PR;
-extern asn_TYPE_descriptor_t asn_DEF_Type2;
/*** <<< TYPE-DECLS [Type2] >>> ***/
-
typedef struct Type2 {
Type2_PR present;
union {
@@ -370,6 +369,10 @@
asn_struct_ctx_t _asn_ctx;
} Type2_t;
+/*** <<< FUNC-DECLS [Type2] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Type2;
+
/*** <<< CODE [Type2] >>> ***/
static int
diff --git a/tests/73-circular-OK.asn1 b/tests/73-circular-OK.asn1
new file mode 100644
index 0000000..33ed04b
--- /dev/null
+++ b/tests/73-circular-OK.asn1
@@ -0,0 +1,31 @@
+
+-- OK: Everything is Fine
+
+-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
+-- .spelio.software.asn1c.test (9363.1.5.1)
+-- .73
+
+ModuleTestCircularReferences
+ { iso org(3) dod(6) internet(1) private(4) enterprise(1)
+ spelio(9363) software(1) asn1c(5) test(1) 73 }
+ DEFINITIONS ::=
+BEGIN
+
+ Type ::= SEQUENCE {
+ data SEQUENCE OF Epyt
+ }
+
+ -- EpytRef ::= Epyt
+
+ Epyt ::= SEQUENCE {
+ stype SET OF Type,
+ type Type OPTIONAL,
+ ypet Ypet OPTIONAL
+ }
+
+ Ypet ::= SET {
+ epyt Epyt,
+ plain INTEGER DEFAULT 7
+ }
+
+END
diff --git a/tests/73-circular-OK.asn1.-P b/tests/73-circular-OK.asn1.-P
new file mode 100644
index 0000000..6298a94
--- /dev/null
+++ b/tests/73-circular-OK.asn1.-P
@@ -0,0 +1,357 @@
+
+/*** <<< INCLUDES [Type] >>> ***/
+
+#include <asn_SEQUENCE_OF.h>
+#include <constr_SEQUENCE_OF.h>
+#include <constr_SEQUENCE.h>
+
+/*** <<< FWD-DECLS [Type] >>> ***/
+
+struct Epyt; /* Forward declaration */
+
+/*** <<< TYPE-DECLS [Type] >>> ***/
+
+typedef struct Type {
+ struct data {
+ A_SEQUENCE_OF(struct Epyt) list;
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+ } data;
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} Type_t;
+
+/*** <<< FUNC-DECLS [Type] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Type;
+
+/*** <<< POST-INCLUDE [Type] >>> ***/
+
+#include <Epyt.h>
+
+/*** <<< STAT-DEFS [Type] >>> ***/
+
+static asn_TYPE_member_t asn_MBR_data_2[] = {
+ { ATF_NOFLAGS, 0, 0,
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_Epyt,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = ""
+ },
+};
+static ber_tlv_tag_t asn_DEF_data_2_tags[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static asn_SET_OF_specifics_t asn_SPC_data_2_specs = {
+ sizeof(struct data),
+ offsetof(struct data, _asn_ctx),
+ 0, /* XER encoding is XMLDelimitedItemList */
+};
+static /* Use -fall-defs-global to expose */
+asn_TYPE_descriptor_t asn_DEF_data_2 = {
+ "data",
+ "data",
+ SEQUENCE_OF_free,
+ SEQUENCE_OF_print,
+ SEQUENCE_OF_constraint,
+ SEQUENCE_OF_decode_ber,
+ SEQUENCE_OF_encode_der,
+ SEQUENCE_OF_decode_xer,
+ SEQUENCE_OF_encode_xer,
+ 0, /* Use generic outmost tag fetcher */
+ asn_DEF_data_2_tags,
+ sizeof(asn_DEF_data_2_tags)
+ /sizeof(asn_DEF_data_2_tags[0]), /* 1 */
+ asn_DEF_data_2_tags, /* Same as above */
+ sizeof(asn_DEF_data_2_tags)
+ /sizeof(asn_DEF_data_2_tags[0]), /* 1 */
+ asn_MBR_data_2,
+ 1, /* Single element */
+ &asn_SPC_data_2_specs /* Additional specs */
+};
+
+static asn_TYPE_member_t asn_MBR_Type_1[] = {
+ { ATF_NOFLAGS, 0, offsetof(struct Type, data),
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_data_2,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = "data"
+ },
+};
+static ber_tlv_tag_t asn_DEF_Type_1_tags[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static asn_TYPE_tag2member_t asn_MAP_Type_1_tag2el[] = {
+ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* data at 16 */
+};
+static asn_SEQUENCE_specifics_t asn_SPC_Type_1_specs = {
+ sizeof(struct Type),
+ offsetof(struct Type, _asn_ctx),
+ asn_MAP_Type_1_tag2el,
+ 1, /* Count of tags in the map */
+ -1, /* Start extensions */
+ -1 /* Stop extensions */
+};
+asn_TYPE_descriptor_t asn_DEF_Type = {
+ "Type",
+ "Type",
+ SEQUENCE_free,
+ SEQUENCE_print,
+ SEQUENCE_constraint,
+ SEQUENCE_decode_ber,
+ SEQUENCE_encode_der,
+ SEQUENCE_decode_xer,
+ SEQUENCE_encode_xer,
+ 0, /* Use generic outmost tag fetcher */
+ asn_DEF_Type_1_tags,
+ sizeof(asn_DEF_Type_1_tags)
+ /sizeof(asn_DEF_Type_1_tags[0]), /* 1 */
+ asn_DEF_Type_1_tags, /* Same as above */
+ sizeof(asn_DEF_Type_1_tags)
+ /sizeof(asn_DEF_Type_1_tags[0]), /* 1 */
+ asn_MBR_Type_1,
+ 1, /* Elements count */
+ &asn_SPC_Type_1_specs /* Additional specs */
+};
+
+
+/*** <<< INCLUDES [Epyt] >>> ***/
+
+#include <asn_SET_OF.h>
+#include <constr_SET_OF.h>
+#include <constr_SEQUENCE.h>
+
+/*** <<< FWD-DECLS [Epyt] >>> ***/
+
+struct Type; /* Forward declaration */
+struct Ypet; /* Forward declaration */
+
+/*** <<< TYPE-DECLS [Epyt] >>> ***/
+
+typedef struct Epyt {
+ struct stype {
+ A_SET_OF(struct Type) list;
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+ } stype;
+ struct Type *type /* OPTIONAL */;
+ struct Ypet *ypet /* OPTIONAL */;
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} Epyt_t;
+
+/*** <<< FUNC-DECLS [Epyt] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Epyt;
+
+/*** <<< POST-INCLUDE [Epyt] >>> ***/
+
+#include <Type.h>
+#include <Ypet.h>
+
+/*** <<< STAT-DEFS [Epyt] >>> ***/
+
+static asn_TYPE_member_t asn_MBR_stype_2[] = {
+ { ATF_NOFLAGS, 0, 0,
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_Type,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = ""
+ },
+};
+static ber_tlv_tag_t asn_DEF_stype_2_tags[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
+};
+static asn_SET_OF_specifics_t asn_SPC_stype_2_specs = {
+ sizeof(struct stype),
+ offsetof(struct stype, _asn_ctx),
+ 0, /* XER encoding is XMLDelimitedItemList */
+};
+static /* Use -fall-defs-global to expose */
+asn_TYPE_descriptor_t asn_DEF_stype_2 = {
+ "stype",
+ "stype",
+ SET_OF_free,
+ SET_OF_print,
+ SET_OF_constraint,
+ SET_OF_decode_ber,
+ SET_OF_encode_der,
+ SET_OF_decode_xer,
+ SET_OF_encode_xer,
+ 0, /* Use generic outmost tag fetcher */
+ asn_DEF_stype_2_tags,
+ sizeof(asn_DEF_stype_2_tags)
+ /sizeof(asn_DEF_stype_2_tags[0]), /* 1 */
+ asn_DEF_stype_2_tags, /* Same as above */
+ sizeof(asn_DEF_stype_2_tags)
+ /sizeof(asn_DEF_stype_2_tags[0]), /* 1 */
+ asn_MBR_stype_2,
+ 1, /* Single element */
+ &asn_SPC_stype_2_specs /* Additional specs */
+};
+
+static asn_TYPE_member_t asn_MBR_Epyt_1[] = {
+ { ATF_NOFLAGS, 0, offsetof(struct Epyt, stype),
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_stype_2,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = "stype"
+ },
+ { ATF_POINTER, 2, offsetof(struct Epyt, type),
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_Type,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = "type"
+ },
+ { ATF_POINTER, 1, offsetof(struct Epyt, ypet),
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_Ypet,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = "ypet"
+ },
+};
+static ber_tlv_tag_t asn_DEF_Epyt_1_tags[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static asn_TYPE_tag2member_t asn_MAP_Epyt_1_tag2el[] = {
+ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* type at 22 */
+ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 1 }, /* stype at 21 */
+ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, -1, 0 } /* ypet at 23 */
+};
+static asn_SEQUENCE_specifics_t asn_SPC_Epyt_1_specs = {
+ sizeof(struct Epyt),
+ offsetof(struct Epyt, _asn_ctx),
+ asn_MAP_Epyt_1_tag2el,
+ 3, /* Count of tags in the map */
+ -1, /* Start extensions */
+ -1 /* Stop extensions */
+};
+asn_TYPE_descriptor_t asn_DEF_Epyt = {
+ "Epyt",
+ "Epyt",
+ SEQUENCE_free,
+ SEQUENCE_print,
+ SEQUENCE_constraint,
+ SEQUENCE_decode_ber,
+ SEQUENCE_encode_der,
+ SEQUENCE_decode_xer,
+ SEQUENCE_encode_xer,
+ 0, /* Use generic outmost tag fetcher */
+ asn_DEF_Epyt_1_tags,
+ sizeof(asn_DEF_Epyt_1_tags)
+ /sizeof(asn_DEF_Epyt_1_tags[0]), /* 1 */
+ asn_DEF_Epyt_1_tags, /* Same as above */
+ sizeof(asn_DEF_Epyt_1_tags)
+ /sizeof(asn_DEF_Epyt_1_tags[0]), /* 1 */
+ asn_MBR_Epyt_1,
+ 3, /* Elements count */
+ &asn_SPC_Epyt_1_specs /* Additional specs */
+};
+
+
+/*** <<< INCLUDES [Ypet] >>> ***/
+
+#include <Epyt.h>
+#include <INTEGER.h>
+#include <constr_SET.h>
+
+/*** <<< DEPS [Ypet] >>> ***/
+
+
+/*
+ * Method of determining the components presence
+ */
+typedef enum Ypet_PR {
+ Ypet_PR_epyt, /* Member epyt is present */
+ Ypet_PR_plain, /* Member plain is present */
+} Ypet_PR;
+
+/*** <<< TYPE-DECLS [Ypet] >>> ***/
+
+typedef struct Ypet {
+ Epyt_t epyt;
+ INTEGER_t *plain /* DEFAULT 7 */;
+
+ /* Presence bitmask: ASN_SET_ISPRESENT(pYpet, Ypet_PR_x) */
+ unsigned int _presence_map
+ [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} Ypet_t;
+
+/*** <<< FUNC-DECLS [Ypet] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_Ypet;
+
+/*** <<< STAT-DEFS [Ypet] >>> ***/
+
+static asn_TYPE_member_t asn_MBR_Ypet_1[] = {
+ { ATF_NOFLAGS, 0, offsetof(struct Ypet, epyt),
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_Epyt,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = "epyt"
+ },
+ { ATF_POINTER, 1, offsetof(struct Ypet, plain),
+ .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
+ .tag_mode = 0,
+ .type = (void *)&asn_DEF_INTEGER,
+ .memb_constraints = 0, /* Defer constraints checking to the member type */
+ .name = "plain"
+ },
+};
+static ber_tlv_tag_t asn_DEF_Ypet_1_tags[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
+};
+static asn_TYPE_tag2member_t asn_MAP_Ypet_1_tag2el[] = {
+ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* plain at 28 */
+ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* epyt at 27 */
+};
+static uint8_t asn_MAP_Ypet_1_mmap[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = {
+ (1 << 7) | (0 << 6)
+};
+static asn_SET_specifics_t asn_SPC_Ypet_1_specs = {
+ sizeof(struct Ypet),
+ offsetof(struct Ypet, _asn_ctx),
+ offsetof(struct Ypet, _presence_map),
+ asn_MAP_Ypet_1_tag2el,
+ 2, /* Count of tags in the map */
+ asn_MAP_Ypet_1_tag2el, /* Same as above */
+ 2, /* Count of tags in the CXER map */
+ 0, /* Whether extensible */
+ (unsigned int *)asn_MAP_Ypet_1_mmap /* Mandatory elements map */
+};
+asn_TYPE_descriptor_t asn_DEF_Ypet = {
+ "Ypet",
+ "Ypet",
+ SET_free,
+ SET_print,
+ SET_constraint,
+ SET_decode_ber,
+ SET_encode_der,
+ SET_decode_xer,
+ SET_encode_xer,
+ 0, /* Use generic outmost tag fetcher */
+ asn_DEF_Ypet_1_tags,
+ sizeof(asn_DEF_Ypet_1_tags)
+ /sizeof(asn_DEF_Ypet_1_tags[0]), /* 1 */
+ asn_DEF_Ypet_1_tags, /* Same as above */
+ sizeof(asn_DEF_Ypet_1_tags)
+ /sizeof(asn_DEF_Ypet_1_tags[0]), /* 1 */
+ asn_MBR_Ypet_1,
+ 2, /* Elements count */
+ &asn_SPC_Ypet_1_specs /* Additional specs */
+};
+