Commit a9cc46e3 authored by Lev Walkin's avatar Lev Walkin
Browse files

XER support

parent e4d6ab83
......@@ -48,7 +48,8 @@ static void
check(int is_ok, uint8_t *buf, int size, size_t consumed) {
T1_t t, *tp;
ber_dec_rval_t rval;
der_enc_rval_t erval;
asn_enc_rval_t erval;
int ret;
int i;
tp = memset(&t, 0, sizeof(t));
......@@ -104,8 +105,12 @@ check(int is_ok, uint8_t *buf, int size, size_t consumed) {
assert(buf1[i] == buf2[i]);
}
fprintf(stderr, "=== PRINT ===\n");
asn_fprint(stderr, &asn1_DEF_T1, tp);
fprintf(stderr, "=== asn_fprint() ===\n");
ret = asn_fprint(stderr, &asn1_DEF_T1, tp);
assert(ret == 0);
fprintf(stderr, "=== xer_fprint() ===\n");
ret = xer_fprint(stderr, &asn1_DEF_T1, tp);
assert(ret == 0);
fprintf(stderr, "=== EOF ===\n");
}
......
......@@ -136,6 +136,7 @@ check(int is_ok, uint8_t *buf, int size, size_t consumed) {
assert(buf_pos == sizeof(buf1_reconstr));
asn_fprint(stderr, &asn1_DEF_Forest, &t);
xer_fprint(stderr, &asn1_DEF_Forest, &t);
asn1_DEF_Forest.free_struct(&asn1_DEF_Forest, &t, 1);
}
......
......@@ -131,6 +131,9 @@ check(T_t *tp, uint8_t *buf, int size, size_t consumed) {
assert(strcmp(tp->a.buf, "ns") == 0);
assert(strcmp(tp->b.choice.b1.buf, "z") == 0
&& strcmp(tp->b.choice.b2.buf, "z") == 0);
asn_fprint(stderr, &asn1_DEF_T, tp);
xer_fprint(stderr, &asn1_DEF_T, tp);
}
size_t buf_pos;
......@@ -157,7 +160,7 @@ buf_fill(const void *buffer, size_t size, void *app_key) {
static void
compare(T_t *tp, uint8_t *cmp_buf, int cmp_buf_size) {
der_enc_rval_t erval;
asn_enc_rval_t erval;
int i;
buf_size = cmp_buf_size + 100;
......@@ -268,12 +271,10 @@ main(int ac, char **av) {
check(&t, buf1, sizeof(buf1) + 10, sizeof(buf1));
compare(&t, buf1_reconstr, sizeof(buf1_reconstr));
asn_fprint(stderr, &asn1_DEF_T, &t);
asn1_DEF_T.free_struct(&asn1_DEF_T, &t, 1);
check(&t, buf2, sizeof(buf2) + 10, sizeof(buf2));
compare(&t, buf2_reconstr, sizeof(buf2_reconstr));
asn_fprint(stderr, &asn1_DEF_T, &t);
asn1_DEF_T.free_struct(&asn1_DEF_T, &t, 1);
/* Split the buffer in parts and check decoder restartability */
......
......@@ -132,10 +132,11 @@ uint8_t buf2_reconstr[] = {
static void
check(T_t *tp, uint8_t *buf, int size, size_t consumed) {
ber_dec_rval_t rval;
int ret;
tp = memset(tp, 0, sizeof(*tp));
fprintf(stderr, "Buf %p (%d)\n", buf, size);
fprintf(stderr, "Buf %p (%d)\n", (int)buf, (int)size);
rval = ber_decode(&asn1_DEF_T, (void **)&tp, buf, size);
fprintf(stderr, "Returned code %d, consumed %d\n",
(int)rval.code, (int)rval.consumed);
......@@ -143,6 +144,14 @@ check(T_t *tp, uint8_t *buf, int size, size_t consumed) {
assert(rval.code == RC_OK);
assert(rval.consumed == consumed);
fprintf(stderr, "=== asn_fprint() ===\n");
ret = asn_fprint(stderr, &asn1_DEF_T, tp);
assert(ret == 0);
fprintf(stderr, "=== xer_fprint() ===\n");
ret = xer_fprint(stderr, &asn1_DEF_T, tp);
fprintf(stderr, "=== END ===\n");
assert(ret == 0);
/*
assert(tp->string.size == 128);
assert(strncmp(tp->string.buf, "zz") == 0);
......@@ -153,32 +162,33 @@ check(T_t *tp, uint8_t *buf, int size, size_t consumed) {
size_t buf_pos;
size_t buf_size;
uint8_t *buf;
uint8_t *buffer;
static int
buf_fill(const void *buffer, size_t size, void *app_key) {
buf_fill(const void *bufp, size_t size, void *app_key) {
(void)app_key; /* Unused argument */
if(buf_pos + size > buf_size) {
fprintf(stderr, "%d + %d > %d\n", buf_pos, (int)size, buf_size);
fprintf(stderr, "%d + %d > %d\n",
(int)buf_pos, (int)size, (int)buf_size);
return -1;
}
memcpy(buf + buf_pos, buffer, size);
memcpy(buffer + buf_pos, bufp, size);
buf_pos += size;
fprintf(stderr, " written %d (%d)\n", (int)size, buf_pos);
fprintf(stderr, " written %d (%d)\n", (int)size, (int)buf_pos);
return 0;
}
static void
compare(T_t *tp, uint8_t *cmp_buf, int cmp_buf_size) {
der_enc_rval_t erval;
asn_enc_rval_t erval;
int i;
buf_size = cmp_buf_size + 100;
buf = alloca(buf_size);
buffer = alloca(buf_size);
buf_pos = 0;
/*
......@@ -187,19 +197,19 @@ compare(T_t *tp, uint8_t *cmp_buf, int cmp_buf_size) {
erval = der_encode(&asn1_DEF_T, tp, buf_fill, 0);
assert(erval.encoded != -1);
if(erval.encoded != cmp_buf_size) {
printf("%d != %d\n", erval.encoded, cmp_buf_size);
printf("%d != %d\n", (int)erval.encoded, (int)cmp_buf_size);
}
assert(erval.encoded == cmp_buf_size);
for(i = 0; i < cmp_buf_size; i++) {
if(buf[i] != cmp_buf[i]) {
if(buffer[i] != cmp_buf[i]) {
fprintf(stderr, "Recreated buffer content mismatch:\n");
fprintf(stderr, "Byte %d, %x != %x (%d != %d)\n",
i,
buf[i], cmp_buf[i],
buf[i], cmp_buf[i]
buffer[i], cmp_buf[i],
buffer[i], cmp_buf[i]
);
}
assert(buf[i] == cmp_buf[i]);
assert(buffer[i] == cmp_buf[i]);
}
}
......@@ -230,7 +240,7 @@ partial_read(uint8_t *buf, size_t size) {
size_t size3 = size - size1 - size2;
fprintf(stderr, "\n%d:{%d, %d, %d}...\n",
size, size1, size2, size3);
(int)size, (int)size1, (int)size2, (int)size3);
memset(buf1, 0, size);
memset(buf2, 0, size);
......@@ -241,7 +251,7 @@ partial_read(uint8_t *buf, size_t size) {
tp = memset(&t, 0, sizeof(t));
fprintf(stderr, "=> Chunk 1 (%d):\n", size1);
fprintf(stderr, "=> Chunk 1 (%d):\n", (int)size1);
rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf1, size1);
assert(rval.code == RC_WMORE);
......@@ -253,7 +263,7 @@ partial_read(uint8_t *buf, size_t size) {
size2 += leftover;
}
fprintf(stderr, "=> Chunk 2 (%d):\n", size2);
fprintf(stderr, "=> Chunk 2 (%d):\n", (int)size2);
rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf2, size2);
assert(rval.code == RC_WMORE);
......@@ -265,7 +275,7 @@ partial_read(uint8_t *buf, size_t size) {
size3 += leftover;
}
fprintf(stderr, "=> Chunk 3 (%d):\n", size3);
fprintf(stderr, "=> Chunk 3 (%d):\n", (int)size3);
rval = ber_decode(&asn1_DEF_T, (void **)&tp,
buf3, size3);
assert(rval.code == RC_OK);
......@@ -283,31 +293,26 @@ main() {
/* Check exact buf0 */
check(&t, buf0, sizeof(buf0), sizeof(buf0));
compare(&t, buf0_reconstr, sizeof(buf0_reconstr));
asn_fprint(stderr, &asn1_DEF_T, &t);
asn1_DEF_T.free_struct(&asn1_DEF_T, &t, 1);
/* Check exact buf1 */
check(&t, buf1, sizeof(buf1), sizeof(buf1));
compare(&t, buf1_reconstr, sizeof(buf1_reconstr));
asn_fprint(stderr, &asn1_DEF_T, &t);
asn1_DEF_T.free_struct(&asn1_DEF_T, &t, 1);
/* Check slightly more than buf1 */
check(&t, buf1, sizeof(buf1) + 10, sizeof(buf1));
compare(&t, buf1_reconstr, sizeof(buf1_reconstr));
asn_fprint(stderr, &asn1_DEF_T, &t);
asn1_DEF_T.free_struct(&asn1_DEF_T, &t, 1);
/* Check exact buf2 */
check(&t, buf2, sizeof(buf2), sizeof(buf2));
compare(&t, buf2_reconstr, sizeof(buf2_reconstr));
asn_fprint(stderr, &asn1_DEF_T, &t);
asn1_DEF_T.free_struct(&asn1_DEF_T, &t, 1);
/* Check slightly more than buf2 */
check(&t, buf2, sizeof(buf2) + 10, sizeof(buf2));
compare(&t, buf2_reconstr, sizeof(buf2_reconstr));
asn_fprint(stderr, &asn1_DEF_T, &t);
asn1_DEF_T.free_struct(&asn1_DEF_T, &t, 1);
/* Split the buffer in parts and check decoder restartability */
......
......@@ -29,7 +29,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
static int
save_object(void *bs, asn1_TYPE_descriptor_t *td) {
der_enc_rval_t rval; /* Return value */
asn_enc_rval_t rval; /* Return value */
int i;
rval = der_encode(td, bs, _buf_writer, 0);
......@@ -44,6 +44,7 @@ save_object(void *bs, asn1_TYPE_descriptor_t *td) {
buf[buf_offset++] = 123; /* Finalize with garbage */
asn_fprint(stderr, td, bs);
xer_fprint(stderr, td, bs);
printf("OUT: [");
for(i = 0; i < buf_offset; i++)
......@@ -63,6 +64,7 @@ load_object(void *bs, asn1_TYPE_descriptor_t *td) {
assert(rval.code == RC_OK);
asn_fprint(stderr, td, bs);
xer_fprint(stderr, td, bs);
return (rval.code == RC_OK)?0:-1;
}
......
......@@ -27,6 +27,7 @@ static int asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of);
static int _print_tag(arg_t *arg, struct asn1p_type_tag_s *tag_p);
static int check_if_extensible(asn1p_expr_t *expr);
static int expr_better_indirect(arg_t *arg, asn1p_expr_t *expr);
static int expr_as_xmlvaluelist(arg_t *arg, asn1p_expr_t *expr);
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);
......@@ -156,7 +157,6 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *v;
int elements; /* Number of elements */
int comp_mode = 0; /* {root,ext=1,root,root,...} */
int ext_start = -1;
int ext_stop = -1;
tag2el_t *tag2el = NULL;
......@@ -183,22 +183,28 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg) {
/*
* Print out the table according to which the parsing is performed.
*/
p = MKID(expr->Identifier);
OUT("static asn1_TYPE_member_t asn1_MBR_%s[] = {\n", p);
if(expr_elements_count(arg, expr)) {
int comp_mode = 0; /* {root,ext=1,root,root,...} */
elements = 0;
INDENTED(TQ_FOR(v, &(expr->members), next) {
if(v->expr_type == A1TC_EXTENSIBLE) {
if((++comp_mode) == 1)
ext_start = elements - 1;
else
ext_stop = elements - 1;
continue;
}
elements++;
emit_member_table(arg, v);
});
OUT("};\n");
p = MKID(expr->Identifier);
OUT("static asn1_TYPE_member_t asn1_MBR_%s[] = {\n", p);
elements = 0;
INDENTED(TQ_FOR(v, &(expr->members), next) {
if(v->expr_type == A1TC_EXTENSIBLE) {
if((++comp_mode) == 1)
ext_start = elements - 1;
else
ext_stop = elements - 1;
continue;
}
elements++;
emit_member_table(arg, v);
});
OUT("};\n");
} else {
elements = 0;
}
/*
* Print out asn1_DEF_<type>_[all_]tags[] vectors.
......@@ -307,7 +313,6 @@ asn1c_lang_C_type_SET_def(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *v;
int elements;
int comp_mode = 0; /* {root,ext=1,root,root,...} */
tag2el_t *tag2el = NULL;
int tag2el_count = 0;
int tags_count;
......@@ -332,22 +337,28 @@ asn1c_lang_C_type_SET_def(arg_t *arg) {
/*
* Print out the table according to which the parsing is performed.
*/
p = MKID(expr->Identifier);
OUT("static asn1_TYPE_member_t asn1_MBR_%s[] = {\n", p);
if(expr_elements_count(arg, expr)) {
int comp_mode = 0; /* {root,ext=1,root,root,...} */
elements = 0;
INDENTED(TQ_FOR(v, &(expr->members), next) {
if(v->expr_type == A1TC_EXTENSIBLE) {
if(comp_mode < 3) comp_mode++;
} else {
if(comp_mode == 1
|| expr_better_indirect(arg, v))
v->marker.flags |= EM_INDIRECT;
elements++;
emit_member_table(arg, v);
}
});
OUT("};\n");
p = MKID(expr->Identifier);
OUT("static asn1_TYPE_member_t asn1_MBR_%s[] = {\n", p);
elements = 0;
INDENTED(TQ_FOR(v, &(expr->members), next) {
if(v->expr_type == A1TC_EXTENSIBLE) {
if(comp_mode < 3) comp_mode++;
} else {
if(comp_mode == 1
|| expr_better_indirect(arg, v))
v->marker.flags |= EM_INDIRECT;
elements++;
emit_member_table(arg, v);
}
});
OUT("};\n");
} else {
elements = 0;
}
/*
* Print out asn1_DEF_<type>_[all_]tags[] vectors.
......@@ -443,12 +454,15 @@ asn1c_lang_C_type_SEx_OF(arg_t *arg) {
tmp.expr = &tmp_memb;
tmp_memb = *memb;
tmp_memb._anonymous_type = 1;
tmp_memb.Identifier = strdup(
asn1c_make_identifier(0,
expr->Identifier, "member", 0));
assert(tmp_memb.Identifier);
if(tmp_memb.Identifier == 0) {
tmp_memb.Identifier = strdup(
asn1c_make_identifier(0,
expr->Identifier, "member", 0));
assert(tmp_memb.Identifier);
}
tmp.default_cb(&tmp);
free(tmp_memb.Identifier);
if(tmp_memb.Identifier != memb->Identifier)
free(tmp_memb.Identifier);
arg->embed--;
assert(arg->target->target == OT_TYPE_DECLS);
} else {
......@@ -496,11 +510,17 @@ asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of) {
*/
p = MKID(expr->Identifier);
OUT("static asn1_TYPE_member_t asn1_MBR_%s[] = {\n", p);
INDENTED(
INDENT(+1);
v = TQ_FIRST(&(expr->members));
if(!v->Identifier) {
v->Identifier = strdup("member");
assert(v->Identifier);
}
v->_anonymous_type = 1;
arg->embed++;
emit_member_table(arg, v);
);
arg->embed--;
INDENT(-1);
OUT("};\n");
/*
......@@ -513,6 +533,10 @@ asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of) {
INDENTED(
OUT("sizeof(struct %s),\n", p);
OUT("offsetof(struct %s, _ber_dec_ctx),\n", p);
if(expr_as_xmlvaluelist(arg, v))
OUT("1,\t/* XER encoding is XMLValueList */\n");
else
OUT("0,\t/* XER encoding is XMLDelimitedItemList */\n");
);
OUT("};\n");
......@@ -589,7 +613,6 @@ asn1c_lang_C_type_CHOICE_def(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *v;
int elements; /* Number of elements */
int comp_mode = 0; /* {root,ext=1,root,root,...} */
tag2el_t *tag2el = NULL;
int tag2el_count = 0;
int tags_count;
......@@ -614,22 +637,28 @@ asn1c_lang_C_type_CHOICE_def(arg_t *arg) {
/*
* Print out the table according to which the parsing is performed.
*/
p = MKID(expr->Identifier);
OUT("static asn1_TYPE_member_t asn1_MBR_%s[] = {\n", p);
if(expr_elements_count(arg, expr)) {
int comp_mode = 0; /* {root,ext=1,root,root,...} */
elements = 0;
INDENTED(TQ_FOR(v, &(expr->members), next) {
if(v->expr_type == A1TC_EXTENSIBLE) {
if(comp_mode < 3) comp_mode++;
} else {
if(comp_mode == 1
|| expr_better_indirect(arg, v))
v->marker.flags |= EM_INDIRECT;
elements++;
emit_member_table(arg, v);
}
});
OUT("};\n");
p = MKID(expr->Identifier);
OUT("static asn1_TYPE_member_t asn1_MBR_%s[] = {\n", p);
elements = 0;
INDENTED(TQ_FOR(v, &(expr->members), next) {
if(v->expr_type == A1TC_EXTENSIBLE) {
if(comp_mode < 3) comp_mode++;
} else {
if(comp_mode == 1
|| expr_better_indirect(arg, v))
v->marker.flags |= EM_INDIRECT;
elements++;
emit_member_table(arg, v);
}
});
OUT("};\n");
} else {
elements = 0;
}
if(arg->embed) {
......@@ -683,7 +712,7 @@ asn1c_lang_C_type_REFERENCE(arg_t *arg) {
arg_t tmp;
int ret;
extract = asn1f_class_access_ex(arg->asn, arg->mod,
extract = asn1f_class_access_ex(arg->asn, arg->expr->module,
arg->expr, ref);
if(extract == NULL)
return -1;
......@@ -808,12 +837,14 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("%s_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {\n", p);
INDENT(+1);
{
asn1p_expr_t *terminal = asn1f_find_terminal_type_ex(arg->asn, arg->mod, expr);
asn1p_expr_t *terminal = asn1f_find_terminal_type_ex(arg->asn, expr);
char *type_name = asn1c_type_name(arg, expr, TNF_SAFE);
OUT("td->ber_decoder = asn1_DEF_%s.ber_decoder;\n", type_name);
OUT("td->der_encoder = asn1_DEF_%s.der_encoder;\n", type_name);
OUT("td->free_struct = asn1_DEF_%s.free_struct;\n", type_name);
OUT("td->print_struct = asn1_DEF_%s.print_struct;\n", type_name);
OUT("td->ber_decoder = asn1_DEF_%s.ber_decoder;\n", type_name);
OUT("td->der_encoder = asn1_DEF_%s.der_encoder;\n", type_name);
OUT("td->xer_decoder = asn1_DEF_%s.xer_decoder;\n", type_name);
OUT("td->xer_encoder = asn1_DEF_%s.xer_encoder;\n", type_name);
if(!terminal && !tags_count) {
OUT("/* The next four lines are here because of -fknown-extern-type */\n");
OUT("td->tags = asn1_DEF_%s.tags;\n", type_name);
......@@ -831,6 +862,28 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("}\n");
OUT("\n");
p = MKID(expr->Identifier);
OUT("void\n");
OUT("%s_free(asn1_TYPE_descriptor_t *td,\n", p);
INDENTED(
OUT("\tvoid *struct_ptr, int contents_only) {\n");
OUT("%s_inherit_TYPE_descriptor(td);\n", p);
OUT("td->free_struct(td, struct_ptr, contents_only);\n");
);
OUT("}\n");
OUT("\n");
p = MKID(expr->Identifier);
OUT("int\n");
OUT("%s_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,\n", p);
INDENTED(
OUT("\tint ilevel, asn_app_consume_bytes_f *cb, void *app_key) {\n");
OUT("%s_inherit_TYPE_descriptor(td);\n", p);
OUT("return td->print_struct(td, struct_ptr, ilevel, cb, app_key);\n");
);
OUT("}\n");
OUT("\n");
p = MKID(expr->Identifier);
OUT("ber_dec_rval_t\n");
OUT("%s_decode_ber(asn1_TYPE_descriptor_t *td,\n", p);
......@@ -843,7 +896,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("\n");
p = MKID(expr->Identifier);
OUT("der_enc_rval_t\n");
OUT("asn_enc_rval_t\n");
OUT("%s_encode_der(asn1_TYPE_descriptor_t *td,\n", p);
INDENTED(
OUT("\tvoid *structure, int tag_mode, ber_tlv_tag_t tag,\n");
......@@ -855,23 +908,13 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("\n");
p = MKID(expr->Identifier);
OUT("int\n");
OUT("%s_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,\n", p);
INDENTED(
OUT("\tint ilevel, asn_app_consume_bytes_f *cb, void *app_key) {\n");
OUT("%s_inherit_TYPE_descriptor(td);\n", p);
OUT("return td->print_struct(td, struct_ptr, ilevel, cb, app_key);\n");
);
OUT("}\n");
OUT("\n");
p = MKID(expr->Identifier);
OUT("void\n");
OUT("%s_free(asn1_TYPE_descriptor_t *td,\n", p);
OUT("asn_enc_rval_t\n");
OUT("%s_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,\n", p);
INDENTED(
OUT("\tvoid *struct_ptr, int contents_only) {\n");
OUT("\tint ilevel, enum xer_encoder_flags_e flags,\n");
OUT("\tasn_app_consume_bytes_f *cb, void *app_key) {\n");
OUT("%s_inherit_TYPE_descriptor(td);\n", p);
OUT("td->free_struct(td, struct_ptr, contents_only);\n");
OUT("return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);\n");
);
OUT("}\n");
OUT("\n");
......@@ -883,11 +926,12 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("extern asn1_TYPE_descriptor_t asn1_DEF_%s;", p);
if(HIDE_INNER_DEFS) OUT(" // (Use -fall-defs-global to expose) */");
OUT("\n");
OUT("asn_struct_free_f %s_free;\n", p);
OUT("asn_struct_print_f %s_print;\n", p);
OUT("asn_constr_check_f %s_constraint;\n", p);
OUT("ber_type_decoder_f %s_decode_ber;\n", p);
OUT("der_type_encoder_f %s_encode_der;\n", p);
OUT("asn_struct_print_f %s_print;\n", p);
OUT("asn_struct_free_f %s_free;\n", p);
OUT("xer_type_encoder_f %s_encode_xer;\n", p);
REDIR(OT_TYPE_DECLS);
......@@ -1031,7 +1075,8 @@ _add_tag2el_member(arg_t *arg, tag2el_t **tag2el, int *count, int el_no) {
assert(el_no >= 0);
ret = asn1f_fetch_outmost_tag(arg->asn, arg->mod, arg->expr, &tag, 1);
ret = asn1f_fetch_outmost_tag(arg->asn, arg->expr->module,
arg->expr, &tag, 1);
if(ret == 0) {
tag2el_t *te;
int new_count = (*count) + 1;
......@@ -1137,12 +1182,12 @@ emit_tags_vectors(arg_t *arg, asn1p_expr_t *expr, int *tags_count_r, int *all_ta
*all_tags_count_r = 0;
/* Fetch a chain of tags */
tags_count = asn1f_fetch_tags(arg->asn, arg->mod, expr, &tags, 0);
tags_count = asn1f_fetch_tags(arg->asn, expr->module, expr, &tags, 0);
if(tags_count < 0)
return -1;
/* Fetch a chain of tags */
all_tags_count = asn1f_fetch_tags(arg->asn, arg->mod, expr,
all_tags_count = asn1f_fetch_tags(arg->asn, expr->module, expr,
&all_tags, AFT_FULL_COLLECT);
if(all_tags_count < 0) {
if(tags) free(tags);
......@@ -1207,7 +1252,7 @@ expr_elements_count(arg_t *arg, asn1p_expr_t *expr) {
asn1p_expr_t *v;
int elements = 0;
topmost_parent = asn1f_find_terminal_type_ex(arg->asn, arg->mod, expr);
topmost_parent = asn1f_find_terminal_type_ex(arg->asn, expr);
if(!topmost_parent) return 0;
if(!(topmost_parent->expr_type & ASN_CONSTR_MASK))
......@@ -1254,15 +1299,15 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr) {
} else {
OUT("0, ");
}
if(expr->Identifier) {
if(expr->_anonymous_type) {
assert(arg->expr->expr_type == ASN_CONSTR_SET_OF
|| arg->