Win32 portability fixes
diff --git a/ChangeLog b/ChangeLog
index d605eaf..59196e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
-0.8.17: 2004-Aug-10
+0.8.17: 2004-Aug-11
* Improved compiler output: duplicate #includes eliminated.
+ * Win32 portability fixes.
0.8.16: 2004-Jul-22
diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c
index 34594df..5b9bf7c 100644
--- a/libasn1compiler/asn1c_C.c
+++ b/libasn1compiler/asn1c_C.c
@@ -23,7 +23,7 @@
static int asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of);
static int _print_tag(arg_t *arg, asn1p_expr_t *expr, struct asn1p_type_tag_s *tag_p);
static int check_if_extensible(asn1p_expr_t *expr);
-static int emit_tags_vector(arg_t *arg, asn1p_expr_t *expr, int*tags_impl_skip);
+static int emit_tags_vector(arg_t *arg, asn1p_expr_t *expr, int *tags_impl_skip, int choice_mode);
static int emit_tag2member_map(arg_t *arg, tag2el_t *tag2el, int tag2el_count);
static int emit_constraint_checking_code(arg_t *arg);
static int emit_single_constraint_check(arg_t *arg, asn1p_constraint_t *ct, int mode);
@@ -165,6 +165,7 @@
int ext_stop = -1;
tag2el_t *tag2el = NULL;
int tag2el_count = 0;
+ int tags_count;
char *p;
/*
@@ -239,7 +240,7 @@
/*
* Print out asn1_DEF_<type>_tags[] vector.
*/
- emit_tags_vector(arg, expr, &tags_impl_skip);
+ tags_count = emit_tags_vector(arg, expr, &tags_impl_skip, 0);
/*
* Tags to elements map.
@@ -270,9 +271,15 @@
OUT("SEQUENCE_print,\n");
OUT("SEQUENCE_free,\n");
OUT("0,\t/* Use generic outmost tag fetcher */\n");
- OUT("asn1_DEF_%s_tags,\n", p);
- OUT("sizeof(asn1_DEF_%s_tags)\n", p);
- OUT("\t/sizeof(asn1_DEF_%s_tags[0]),\n", p);
+ if(tags_count) {
+ OUT("asn1_DEF_%s_tags,\n", p);
+ OUT("sizeof(asn1_DEF_%s_tags)\n", p);
+ OUT("\t/sizeof(asn1_DEF_%s_tags[0]), /* %d */\n",
+ p, tags_count);
+ } else {
+ OUT("0,\t/* No explicit tags (pointer) */\n");
+ OUT("0,\t/* No explicit tags (count) */\n");
+ }
OUT("%d,\t/* Tags to skip */\n", tags_impl_skip);
OUT("%d,\t/* Whether CONSTRUCTED */\n", 1);
OUT("&asn1_DEF_%s_specs\t/* Additional specs */\n", p);
@@ -330,7 +337,7 @@
OUT(" * Method of determining the components presence\n");
OUT(" */\n");
mcount = 0;
- OUT("enum %s_PR_e {\n", MKID(expr->Identifier));
+ OUT("typedef enum %s_PR {\n", MKID(expr->Identifier));
TQ_FOR(v, &(expr->members), next) {
if(v->expr_type == A1TC_EXTENSIBLE) continue;
INDENTED(
@@ -342,14 +349,15 @@
);
mcount++;
}
- OUT("};\n");
+ id = MKID(expr->Identifier);
+ OUT("} %s_PR;\n", id);
REDIR(OT_TYPE_DECLS);
if(arg->embed) {
- OUT("struct %s {\n", MKID(expr->Identifier));
+ OUT("struct %s {\n", id);
} else {
- OUT("typedef struct %s {\n", MKID(expr->Identifier));
+ OUT("typedef struct %s {\n", id);
}
TQ_FOR(v, &(expr->members), next) {
@@ -386,6 +394,7 @@
int comp_mode = 0; /* {root,ext=1,root,root,...} */
tag2el_t *tag2el = NULL;
int tag2el_count = 0;
+ int tags_count;
char *p;
/*
@@ -454,7 +463,7 @@
/*
* Print out asn1_DEF_<type>_tags[] vector.
*/
- emit_tags_vector(arg, expr, &tags_impl_skip);
+ tags_count = emit_tags_vector(arg, expr, &tags_impl_skip, 0);
/*
* Tags to elements map.
@@ -515,9 +524,15 @@
OUT("SET_print,\n");
OUT("SET_free,\n");
OUT("0,\t/* Use generic outmost tag fetcher */\n");
- OUT("asn1_DEF_%s_tags,\n", p);
- OUT("sizeof(asn1_DEF_%s_tags)\n", p);
- OUT("\t/sizeof(asn1_DEF_%s_tags[0]),\n", p);
+ if(tags_count) {
+ OUT("asn1_DEF_%s_tags,\n", p);
+ OUT("sizeof(asn1_DEF_%s_tags)\n", p);
+ OUT("\t/sizeof(asn1_DEF_%s_tags[0]), /* %d */\n",
+ p, tags_count);
+ } else {
+ OUT("0,\t/* No explicit tags (pointer) */\n");
+ OUT("0,\t/* No explicit tags (count) */\n");
+ }
OUT("%d,\t/* Tags to skip */\n", tags_impl_skip);
OUT("%d,\t/* Whether CONSTRUCTED */\n", 1);
OUT("&asn1_DEF_%s_specs\t/* Additional specs */\n", p);
@@ -564,6 +579,7 @@
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *v;
int tags_impl_skip = 0;
+ int tags_count;
char *p;
/*
@@ -603,7 +619,7 @@
/*
* Print out asn1_DEF_<type>_tags[] vector.
*/
- emit_tags_vector(arg, expr, &tags_impl_skip);
+ tags_count = emit_tags_vector(arg, expr, &tags_impl_skip, 0);
p = MKID(expr->Identifier);
OUT("static asn1_SET_OF_specifics_t asn1_DEF_%s_specs = {\n", p);
@@ -630,9 +646,15 @@
OUT("SET_OF_free,\n");
}
OUT("0,\t/* Use generic outmost tag fetcher */\n");
- OUT("asn1_DEF_%s_tags,\n", p);
- OUT("sizeof(asn1_DEF_%s_tags)\n", p);
- OUT("\t/sizeof(asn1_DEF_%s_tags[0]),\n", p);
+ if(tags_count) {
+ OUT("asn1_DEF_%s_tags,\n", p);
+ OUT("sizeof(asn1_DEF_%s_tags)\n", p);
+ OUT("\t/sizeof(asn1_DEF_%s_tags[0]), /* %d */\n",
+ p, tags_count);
+ } else {
+ OUT("0,\t/* No explicit tags (pointer) */\n");
+ OUT("0,\t/* No explicit tags (count) */\n");
+ }
OUT("%d,\t/* Tags to skip */\n", tags_impl_skip);
OUT("%d,\t/* Whether CONSTRUCTED */\n", 1);
OUT("&asn1_DEF_%s_specs\t/* Additional specs */\n", p);
@@ -673,7 +695,7 @@
}
);
p = MKID(expr->Identifier);
- OUT("} %s_PR_e;\n", p);
+ OUT("} %s_PR;\n", p);
REDIR(OT_TYPE_DECLS);
@@ -684,7 +706,7 @@
}
INDENTED(
- OUT("%s_PR_e present;\n", p);
+ OUT("%s_PR present;\n", p);
OUT("union {\n", p);
TQ_FOR(v, &(expr->members), next) {
EMBED(v);
@@ -709,6 +731,7 @@
int comp_mode = 0; /* {root,ext=1,root,root,...} */
tag2el_t *tag2el = NULL;
int tag2el_count = 0;
+ int tags_count;
char *p;
/*
@@ -775,29 +798,22 @@
});
OUT("};\n");
- p = MKID(expr->Identifier);
- OUT("static ber_tlv_tag_t asn1_DEF_%s_tags[] = {\n", p);
+
if(arg->embed) {
/*
* Our parent structure has already taken this into account.
*/
+ tags_count = 0;
} else {
- INDENTED(
- if(expr->tag.tag_class) {
- _print_tag(arg, expr, &expr->tag);
- if(expr->tag.tag_mode != TM_EXPLICIT)
- tags_impl_skip++;
- }
- OUT("\n");
- );
+ tags_count = emit_tags_vector(arg, expr, &tags_impl_skip, 1);
}
- OUT("};\n");
/*
* Tags to elements map.
*/
emit_tag2member_map(arg, tag2el, tag2el_count);
+ p = MKID(expr->Identifier);
OUT("static asn1_CHOICE_specifics_t asn1_DEF_%s_specs = {\n", p);
INDENTED(
OUT("sizeof(struct %s),\n", p);
@@ -821,9 +837,15 @@
OUT("CHOICE_print,\n");
OUT("CHOICE_free,\n");
OUT("CHOICE_outmost_tag,\n");
- OUT("asn1_DEF_%s_tags,\n", p);
- OUT("sizeof(asn1_DEF_%s_tags)\n", p);
- OUT("\t/sizeof(asn1_DEF_%s_tags[0]),\n", p);
+ if(tags_count) {
+ OUT("asn1_DEF_%s_tags,\n", p);
+ OUT("sizeof(asn1_DEF_%s_tags)\n", p);
+ OUT("\t/sizeof(asn1_DEF_%s_tags[0]), /* %d */\n",
+ p, tags_count);
+ } else {
+ OUT("0,\t/* No explicit tags (pointer) */\n");
+ OUT("0,\t/* No explicit tags (count) */\n");
+ }
OUT("%d,\t/* Tags to skip */\n", tags_impl_skip);
OUT("%d,\t/* Whether CONSTRUCTED */\n", 1);
OUT("&asn1_DEF_%s_specs\t/* Additional specs */\n", p);
@@ -885,6 +907,7 @@
asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
int tags_impl_skip = 0;
+ int tags_count;
char *p;
if(arg->embed) {
@@ -915,7 +938,7 @@
/*
* Print out asn1_DEF_<type>_tags[] vector.
*/
- emit_tags_vector(arg, expr, &tags_impl_skip);
+ tags_count = emit_tags_vector(arg, expr, &tags_impl_skip, 0);
p = MKID(expr->Identifier);
OUT("asn1_TYPE_descriptor_t asn1_DEF_%s = {\n", p);
@@ -927,9 +950,15 @@
OUT("%s_print,\n", p);
OUT("%s_free,\n", p);
OUT("0,\t/* Use generic outmost tag fetcher */\n");
- OUT("asn1_DEF_%s_tags,\n", p);
- OUT("sizeof(asn1_DEF_%s_tags)\n", p);
- OUT("\t/sizeof(asn1_DEF_%s_tags[0]),\n", p);
+ if(tags_count) {
+ OUT("asn1_DEF_%s_tags,\n", p);
+ OUT("sizeof(asn1_DEF_%s_tags)\n", p);
+ OUT("\t/sizeof(asn1_DEF_%s_tags[0]), /* %d */\n",
+ p, tags_count);
+ } else {
+ OUT("0,\t/* No explicit tags (pointer) */\n");
+ OUT("0,\t/* No explicit tags (count) */\n");
+ }
OUT("%d,\t/* Tags to skip */\n", tags_impl_skip);
OUT("-0,\t/* Unknown yet */\n");
OUT("0\t/* No specifics */\n");
@@ -1284,35 +1313,57 @@
}
static int
-emit_tags_vector(arg_t *arg, asn1p_expr_t *expr, int *tags_impl_skip) {
+emit_tags_vector(arg_t *arg, asn1p_expr_t *expr, int *tags_impl_skip, int choice_mode) {
+ int tags_count = 0;
+ int save_target = arg->target->target;
char *p;
+ if(save_target != OT_IGNORE) {
+ int save_impl_skip = *tags_impl_skip;
+ REDIR(OT_IGNORE);
+ tags_count = emit_tags_vector(arg, expr,
+ tags_impl_skip, choice_mode);
+ REDIR(save_target);
+ if(tags_count) {
+ *tags_impl_skip = save_impl_skip;
+ tags_count = 0;
+ } else {
+ return 0;
+ }
+ }
+
+
p = MKID(expr->Identifier);
OUT("static ber_tlv_tag_t asn1_DEF_%s_tags[] = {\n", p);
INDENTED(
if(expr->tag.tag_class) {
+ tags_count++;
_print_tag(arg, expr, &expr->tag);
if(expr->tag.tag_mode != TM_EXPLICIT)
(*tags_impl_skip)++;
} else {
- (*tags_impl_skip)++;
+ if(!choice_mode)
+ (*tags_impl_skip)++;
}
- if(!expr->tag.tag_class
- || (expr->meta_type == AMT_TYPE
- && expr->tag.tag_mode == TM_EXPLICIT)) {
- struct asn1p_type_tag_s tag;
- if(expr->tag.tag_class)
- OUT(",\n");
- tag.tag_class = TC_UNIVERSAL;
- tag.tag_mode = TM_IMPLICIT;
- tag.tag_value = expr_type2uclass_value[expr->expr_type];
- _print_tag(arg, expr, &tag);
+ if(!choice_mode) {
+ if(!expr->tag.tag_class
+ || (expr->meta_type == AMT_TYPE
+ && expr->tag.tag_mode == TM_EXPLICIT)) {
+ struct asn1p_type_tag_s tag;
+ if(expr->tag.tag_class)
+ OUT(",\n");
+ tag.tag_class = TC_UNIVERSAL;
+ tag.tag_mode = TM_IMPLICIT;
+ tag.tag_value = expr_type2uclass_value[expr->expr_type];
+ _print_tag(arg, expr, &tag);
+ tags_count++;
+ }
}
OUT("\n");
);
OUT("};\n");
- return 0;
+ return tags_count;
}
static int
@@ -1923,12 +1974,17 @@
switch(etype) {
case ASN_BASIC_INTEGER:
case ASN_BASIC_ENUMERATED:
- OUT("if(asn1_INTEGER2long(st, &value)) {\n");
- INDENT(+1);
- OUT("_ASN_ERRLOG(\"%%s: value too large\", td->name);\n");
- OUT("return -1;\n");
- INDENT(-1);
- OUT("}\n");
+ if(arg->flags & A1C_USE_NATIVE_INTEGERS) {
+ OUT("value = *(int *)st;\n");
+ } else {
+ OUT("if(asn1_INTEGER2long(st, &value)) {\n");
+ INDENT(+1);
+ OUT("_ASN_ERRLOG(\"%%s: value too large\", "
+ "td->name);\n");
+ OUT("return -1;\n");
+ INDENT(-1);
+ OUT("}\n");
+ }
break;
case ASN_BASIC_BOOLEAN:
OUT("value = st->value;\n");
diff --git a/libasn1compiler/asn1c_out.c b/libasn1compiler/asn1c_out.c
index 2f7c573..3954916 100644
--- a/libasn1compiler/asn1c_out.c
+++ b/libasn1compiler/asn1c_out.c
@@ -13,6 +13,16 @@
char *buf;
int ret;
+ switch(arg->target->target) {
+ case OT_IGNORE:
+ return 0;
+ case OT_ASSERT:
+ assert(arg->target->target != OT_ASSERT);
+ return -1;
+ default:
+ break;
+ }
+
/*
* Make sure the output has a single LF and only at the end.
*/
diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h
index e989f44..51582d4 100644
--- a/libasn1compiler/asn1c_out.h
+++ b/libasn1compiler/asn1c_out.h
@@ -13,6 +13,8 @@
typedef struct compiler_streams {
enum {
+ OT_IGNORE = -1,
+ OT_ASSERT = 0,
OT_INCLUDES, /* #include files */
OT_DEPS, /* Dependencies (other than #includes) */
OT_TYPE_DECLS, /* Type declarations */
@@ -25,7 +27,7 @@
} compiler_streams_t;
static char *_compiler_stream2str[] __attribute__ ((unused))
- = { "INCLUDES", "DEPS", "TYPE-DECLS", "FUNC-DECLS", "STAT-DEFS", "CODE" };
+ = { "ASSERT", "INCLUDES", "DEPS", "TYPE-DECLS", "FUNC-DECLS", "STAT-DEFS", "CODE" };
int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c
index 5a8d3b6..fd1356b 100644
--- a/libasn1compiler/asn1c_save.c
+++ b/libasn1compiler/asn1c_save.c
@@ -106,7 +106,7 @@
asn1p_expr_t *expr = arg->expr;
int i;
- for(i = 0; i < OT_MAX; i++) {
+ for(i = 1; i < OT_MAX; i++) {
out_chunk_t *ot;
if(TQ_FIRST(&cs->targets[i]) == NULL)
continue;
@@ -202,7 +202,7 @@
TQ_FOR(ot, &(cs->targets[OT_CODE]), next)
fwrite(ot->buf, ot->len, 1, fp_c);
- assert(OT_MAX == 6);
+ assert(OT_MAX == 7);
fclose(fp_c);
fclose(fp_h);
diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c
index 5a3120d..9e8375e 100644
--- a/skeletons/GeneralizedTime.c
+++ b/skeletons/GeneralizedTime.c
@@ -9,6 +9,13 @@
#include <assert.h>
#endif /* __NO_ASSERT_H__ */
+#ifdef WIN32
+#define localtime_r(tlocp, tmp) (*tmp = localtime(&tlocp))
+#warning PLEASE STOP AND READ!
+#warning localtime_r is implemented via localtime(), which is not thread-safe. You must fix the code to insert appropriate locking if you want to use asn_GT2time() or asn_UT2time().
+#warning PLEASE STOP AND READ!
+#endif
+
#ifndef __NO_ASN_TABLE__
/*
diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c
index c910a8c..1e4fe59 100644
--- a/skeletons/OBJECT_IDENTIFIER.c
+++ b/skeletons/OBJECT_IDENTIFIER.c
@@ -359,11 +359,15 @@
unsigned LE = 1;
unsigned isLittleEndian = *(char *)&LE;
#endif
- uint8_t buffer[arcval_size];
uint8_t *tp, *tend;
unsigned int cache;
uint8_t *bp = arcbuf;
int bits;
+#ifdef __GNUC__
+ uint8_t buffer[arcval_size];
+#else
+ uint8_t *buffer = alloca(arcval_size);
+#endif
if(isLittleEndian && !prepared_order) {
uint8_t *a = arcval + arcval_size - 1;
diff --git a/skeletons/asn_types.h b/skeletons/asn_types.h
index 6d42667..d2633f6 100644
--- a/skeletons/asn_types.h
+++ b/skeletons/asn_types.h
@@ -13,10 +13,29 @@
#include <string.h> /* For memcpy(3) */
#include <sys/types.h> /* For size_t */
#include <stdarg.h> /* For va_start */
-#include <inttypes.h> /* C99 Standard specifies this file, for uintXX_t */
#include <stddef.h> /* for offsetof and ptrdiff_t */
+#if __STDC_VERSION__ < 199901L
+#include <inttypes.h> /* C99 Standard specifies this file, for uintXX_t */
+#else
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+typedef int ssize_t;
+#endif
-#ifndef offsetof
+#ifdef WIN32
+#define snprintf(str, size, format, args...) \
+ _snprintf(str, size, format, ##args)
+#define vsnprintf(str, size, format, ap) \
+ _vsnprintf(str, size, format, ap)
+#define alloca(size) _alloca(size)
+#endif
+
+#ifndef __GNUC__
+#define __attribute__(ignore)
+#endif
+
+#ifndef offsetof /* If not defined by <stddef.h> */
#define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0))
#endif /* offsetof */
diff --git a/tests/39-sequence-of-OK.asn1.-P b/tests/39-sequence-of-OK.asn1.-P
index 560406d..383cafc 100644
--- a/tests/39-sequence-of-OK.asn1.-P
+++ b/tests/39-sequence-of-OK.asn1.-P
@@ -51,7 +51,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_collection_tags,
sizeof(asn1_DEF_collection_tags)
- /sizeof(asn1_DEF_collection_tags[0]),
+ /sizeof(asn1_DEF_collection_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_collection_specs /* Additional specs */
@@ -98,7 +98,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_T_tags,
sizeof(asn1_DEF_T_tags)
- /sizeof(asn1_DEF_T_tags[0]),
+ /sizeof(asn1_DEF_T_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_T_specs /* Additional specs */
@@ -169,7 +169,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_T2_tags,
sizeof(asn1_DEF_T2_tags)
- /sizeof(asn1_DEF_T2_tags[0]),
+ /sizeof(asn1_DEF_T2_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_T2_specs /* Additional specs */
diff --git a/tests/42-real-life-OK.asn1.-PR b/tests/42-real-life-OK.asn1.-PR
index 3fc023a..ece1127 100644
--- a/tests/42-real-life-OK.asn1.-PR
+++ b/tests/42-real-life-OK.asn1.-PR
@@ -55,7 +55,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_varsets_tags,
sizeof(asn1_DEF_varsets_tags)
- /sizeof(asn1_DEF_varsets_tags[0]),
+ /sizeof(asn1_DEF_varsets_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_varsets_specs /* Additional specs */
@@ -102,7 +102,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_LogLine_tags,
sizeof(asn1_DEF_LogLine_tags)
- /sizeof(asn1_DEF_LogLine_tags[0]),
+ /sizeof(asn1_DEF_LogLine_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_LogLine_specs /* Additional specs */
@@ -165,7 +165,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_vparts_tags,
sizeof(asn1_DEF_vparts_tags)
- /sizeof(asn1_DEF_vparts_tags[0]),
+ /sizeof(asn1_DEF_vparts_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_vparts_specs /* Additional specs */
@@ -212,7 +212,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_VariablePartSet_tags,
sizeof(asn1_DEF_VariablePartSet_tags)
- /sizeof(asn1_DEF_VariablePartSet_tags[0]),
+ /sizeof(asn1_DEF_VariablePartSet_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_VariablePartSet_specs /* Additional specs */
@@ -234,14 +234,14 @@
VariablePart_PR_vset,
VariablePart_PR_vrange,
/* Extensions may appear below */
-} VariablePart_PR_e;
+} VariablePart_PR;
extern asn1_TYPE_descriptor_t asn1_DEF_VariablePart;
/*** <<< TYPE-DECLS [VariablePart] >>> ***/
typedef struct VariablePart {
- VariablePart_PR_e present;
+ VariablePart_PR present;
union {
struct vset {
A_SET_OF(VisibleString_t) list;
@@ -294,7 +294,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_vset_tags,
sizeof(asn1_DEF_vset_tags)
- /sizeof(asn1_DEF_vset_tags[0]),
+ /sizeof(asn1_DEF_vset_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_vset_specs /* Additional specs */
@@ -341,7 +341,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_vrange_tags,
sizeof(asn1_DEF_vrange_tags)
- /sizeof(asn1_DEF_vrange_tags[0]),
+ /sizeof(asn1_DEF_vrange_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_vrange_specs /* Additional specs */
@@ -361,9 +361,6 @@
"vrange"
},
};
-static ber_tlv_tag_t asn1_DEF_VariablePart_tags[] = {
-
-};
static asn1_TYPE_tag2member_t asn1_DEF_VariablePart_tag2el[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* vrange at 45 */
{ (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 }, /* vset at 42 */
@@ -387,9 +384,8 @@
CHOICE_print,
CHOICE_free,
CHOICE_outmost_tag,
- asn1_DEF_VariablePart_tags,
- sizeof(asn1_DEF_VariablePart_tags)
- /sizeof(asn1_DEF_VariablePart_tags[0]),
+ 0, /* No explicit tags (pointer) */
+ 0, /* No explicit tags (count) */
0, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_VariablePart_specs /* Additional specs */
@@ -471,7 +467,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_email_tags,
sizeof(asn1_DEF_email_tags)
- /sizeof(asn1_DEF_email_tags[0]),
+ /sizeof(asn1_DEF_email_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_email_specs /* Additional specs */
@@ -518,7 +514,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_notify_tags,
sizeof(asn1_DEF_notify_tags)
- /sizeof(asn1_DEF_notify_tags[0]),
+ /sizeof(asn1_DEF_notify_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_notify_specs /* Additional specs */
@@ -565,7 +561,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_ActionItem_tags,
sizeof(asn1_DEF_ActionItem_tags)
- /sizeof(asn1_DEF_ActionItem_tags[0]),
+ /sizeof(asn1_DEF_ActionItem_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_ActionItem_specs /* Additional specs */
diff --git a/tests/44-choice-in-sequence-OK.asn1.-P b/tests/44-choice-in-sequence-OK.asn1.-P
index 03f46ee..0c65871 100644
--- a/tests/44-choice-in-sequence-OK.asn1.-P
+++ b/tests/44-choice-in-sequence-OK.asn1.-P
@@ -13,17 +13,17 @@
b_PR_d,
b_PR_e,
b_PR_h,
- } b_PR_e;
+ } b_PR;
typedef enum e_PR {
e_PR_NOTHING, /* No components present */
e_PR_f,
e_PR_g,
- } e_PR_e;
+ } e_PR;
typedef enum h_PR {
h_PR_NOTHING, /* No components present */
h_PR_i,
h_PR_j,
- } h_PR_e;
+ } h_PR;
extern asn1_TYPE_descriptor_t asn1_DEF_T;
/*** <<< TYPE-DECLS [T] >>> ***/
@@ -32,12 +32,12 @@
typedef struct T {
NULL_t a;
struct b {
- b_PR_e present;
+ b_PR present;
union {
NULL_t c;
NULL_t d;
struct e {
- e_PR_e present;
+ e_PR present;
union {
NULL_t f;
NULL_t g;
@@ -47,7 +47,7 @@
ber_dec_ctx_t _ber_dec_ctx;
} e;
struct h {
- h_PR_e present;
+ h_PR present;
union {
NULL_t i;
NULL_t j;
@@ -82,8 +82,6 @@
"g"
},
};
- static ber_tlv_tag_t asn1_DEF_e_tags[] = {
- };
static asn1_TYPE_tag2member_t asn1_DEF_e_tag2el[] = {
{ (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 0, 0, 0 }, /* f at 20 */
{ (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 }, /* g at 21 */
@@ -107,9 +105,8 @@
CHOICE_print,
CHOICE_free,
CHOICE_outmost_tag,
- asn1_DEF_e_tags,
- sizeof(asn1_DEF_e_tags)
- /sizeof(asn1_DEF_e_tags[0]),
+ 0, /* No explicit tags (pointer) */
+ 0, /* No explicit tags (count) */
0, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_e_specs /* Additional specs */
@@ -129,8 +126,6 @@
"j"
},
};
- static ber_tlv_tag_t asn1_DEF_h_tags[] = {
- };
static asn1_TYPE_tag2member_t asn1_DEF_h_tag2el[] = {
{ (ASN_TAG_CLASS_PRIVATE | (1 << 2)), 0, 0, 0 }, /* i at 24 */
{ (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 1, 0, 0 }, /* j at 25 */
@@ -154,9 +149,8 @@
CHOICE_print,
CHOICE_free,
CHOICE_outmost_tag,
- asn1_DEF_h_tags,
- sizeof(asn1_DEF_h_tags)
- /sizeof(asn1_DEF_h_tags[0]),
+ 0, /* No explicit tags (pointer) */
+ 0, /* No explicit tags (count) */
0, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_h_specs /* Additional specs */
@@ -188,8 +182,6 @@
"h"
},
};
- static ber_tlv_tag_t asn1_DEF_b_tags[] = {
- };
static asn1_TYPE_tag2member_t asn1_DEF_b_tag2el[] = {
{ (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 0, 0, 0 }, /* c at 17 */
{ (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d at 18 */
@@ -216,9 +208,8 @@
CHOICE_print,
CHOICE_free,
CHOICE_outmost_tag,
- asn1_DEF_b_tags,
- sizeof(asn1_DEF_b_tags)
- /sizeof(asn1_DEF_b_tags[0]),
+ 0, /* No explicit tags (pointer) */
+ 0, /* No explicit tags (count) */
0, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_b_specs /* Additional specs */
@@ -269,7 +260,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_T_tags,
sizeof(asn1_DEF_T_tags)
- /sizeof(asn1_DEF_T_tags[0]),
+ /sizeof(asn1_DEF_T_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_T_specs /* Additional specs */
diff --git a/tests/46-redefine-OK.asn1.-PR b/tests/46-redefine-OK.asn1.-PR
index 31f6a8e..639ded0 100644
--- a/tests/46-redefine-OK.asn1.-PR
+++ b/tests/46-redefine-OK.asn1.-PR
@@ -33,7 +33,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_PrimitiveType_tags,
sizeof(asn1_DEF_PrimitiveType_tags)
- /sizeof(asn1_DEF_PrimitiveType_tags[0]),
+ /sizeof(asn1_DEF_PrimitiveType_tags[0]), /* 1 */
1, /* Tags to skip */
-0, /* Unknown yet */
0 /* No specifics */
@@ -149,7 +149,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_ConstructedType_tags,
sizeof(asn1_DEF_ConstructedType_tags)
- /sizeof(asn1_DEF_ConstructedType_tags[0]),
+ /sizeof(asn1_DEF_ConstructedType_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_ConstructedType_specs /* Additional specs */
@@ -190,7 +190,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_T_tags,
sizeof(asn1_DEF_T_tags)
- /sizeof(asn1_DEF_T_tags[0]),
+ /sizeof(asn1_DEF_T_tags[0]), /* 1 */
1, /* Tags to skip */
-0, /* Unknown yet */
0 /* No specifics */
diff --git a/tests/47-set-ext-OK.asn1.-P b/tests/47-set-ext-OK.asn1.-P
index a3d1096..e945ccf 100644
--- a/tests/47-set-ext-OK.asn1.-P
+++ b/tests/47-set-ext-OK.asn1.-P
@@ -10,9 +10,9 @@
/*
* Method of determining the components presence
*/
-enum T1_PR_e {
+typedef enum T1_PR {
T1_PR_i, /* Member i is present */
-};
+} T1_PR;
extern asn1_TYPE_descriptor_t asn1_DEF_T1;
/*** <<< TYPE-DECLS [T1] >>> ***/
@@ -73,7 +73,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_T1_tags,
sizeof(asn1_DEF_T1_tags)
- /sizeof(asn1_DEF_T1_tags[0]),
+ /sizeof(asn1_DEF_T1_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_T1_specs /* Additional specs */
@@ -91,9 +91,9 @@
/*
* Method of determining the components presence
*/
-enum T2_PR_e {
+typedef enum T2_PR {
T2_PR_i, /* Member i is present */
-};
+} T2_PR;
extern asn1_TYPE_descriptor_t asn1_DEF_T2;
/*** <<< TYPE-DECLS [T2] >>> ***/
@@ -154,7 +154,7 @@
0, /* Use generic outmost tag fetcher */
asn1_DEF_T2_tags,
sizeof(asn1_DEF_T2_tags)
- /sizeof(asn1_DEF_T2_tags[0]),
+ /sizeof(asn1_DEF_T2_tags[0]), /* 1 */
1, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_T2_specs /* Additional specs */
@@ -172,14 +172,14 @@
T3_PR_NOTHING, /* No components present */
T3_PR_i,
/* Extensions may appear below */
-} T3_PR_e;
+} T3_PR;
extern asn1_TYPE_descriptor_t asn1_DEF_T3;
/*** <<< TYPE-DECLS [T3] >>> ***/
typedef struct T3 {
- T3_PR_e present;
+ T3_PR present;
union {
INTEGER_t i;
/*
@@ -202,9 +202,6 @@
"i"
},
};
-static ber_tlv_tag_t asn1_DEF_T3_tags[] = {
-
-};
static asn1_TYPE_tag2member_t asn1_DEF_T3_tag2el[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 16 */
};
@@ -227,9 +224,8 @@
CHOICE_print,
CHOICE_free,
CHOICE_outmost_tag,
- asn1_DEF_T3_tags,
- sizeof(asn1_DEF_T3_tags)
- /sizeof(asn1_DEF_T3_tags[0]),
+ 0, /* No explicit tags (pointer) */
+ 0, /* No explicit tags (count) */
0, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_T3_specs /* Additional specs */
@@ -247,14 +243,14 @@
T4_PR_NOTHING, /* No components present */
T4_PR_i,
/* Extensions may appear below */
-} T4_PR_e;
+} T4_PR;
extern asn1_TYPE_descriptor_t asn1_DEF_T4;
/*** <<< TYPE-DECLS [T4] >>> ***/
typedef struct T4 {
- T4_PR_e present;
+ T4_PR present;
union {
INTEGER_t i;
/*
@@ -277,9 +273,6 @@
"i"
},
};
-static ber_tlv_tag_t asn1_DEF_T4_tags[] = {
-
-};
static asn1_TYPE_tag2member_t asn1_DEF_T4_tag2el[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 17 */
};
@@ -302,9 +295,8 @@
CHOICE_print,
CHOICE_free,
CHOICE_outmost_tag,
- asn1_DEF_T4_tags,
- sizeof(asn1_DEF_T4_tags)
- /sizeof(asn1_DEF_T4_tags[0]),
+ 0, /* No explicit tags (pointer) */
+ 0, /* No explicit tags (count) */
0, /* Tags to skip */
1, /* Whether CONSTRUCTED */
&asn1_DEF_T4_specs /* Additional specs */