Commit 8c2ca0b0 authored by Lev Walkin's avatar Lev Walkin

XER reference types encoding error

parent a9532f4d
...@@ -65,6 +65,23 @@ cat Makefile.am.sample \ ...@@ -65,6 +65,23 @@ cat Makefile.am.sample \
echo ' diff ./.tmp.1.$$ ./.tmp.2.$$ || exit 2; \' echo ' diff ./.tmp.1.$$ ./.tmp.2.$$ || exit 2; \'
echo ' rm -f ./.tmp.[12].$$; \' echo ' rm -f ./.tmp.[12].$$; \'
echo ' done; fi' echo ' done; fi'
echo " @if test -f ./sample-${ASN1PDU}-1.xer ; then \\"
echo " for f in ./sample-${ASN1PDU}-*.xer; do \\"
echo ' echo "Recoding $$f into DER and back..."; \'
echo ' ./${TARGET} -ixer -oder $$f > ./.tmp.1.$$ || exit 2; \'
echo ' ./${TARGET} -iber -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \'
echo ' diff $$f ./.tmp.2.$$ || exit 2; \'
echo ' rm -f ./.tmp.[12].$$; \'
echo ' done; fi'
echo " @if test -f ./sample-${ASN1PDU}-1.per ; then \\"
echo " for f in ./sample-${ASN1PDU}-*.per; do \\"
echo ' echo "Recoding $$f into DER into XER and back..."; \'
echo ' ./${TARGET} -iper -oder $$f > ./.tmp.1.$$ || exit 2; \'
echo ' ./${TARGET} -ider -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \'
echo ' ./${TARGET} -ixer -oper ./.tmp.2.$$ > ./.tmp.1.$$ || exit 2; \'
echo ' diff $$f ./.tmp.1.$$ || exit 2; \'
echo ' rm -f ./.tmp.[12].$$; \'
echo ' done; fi'
echo ' @echo ================' echo ' @echo ================'
echo ' @echo All tests passed' echo ' @echo All tests passed'
echo ' @echo ================' echo ' @echo ================'
......
...@@ -498,6 +498,23 @@ check: ${TARGET} ...@@ -498,6 +498,23 @@ check: ${TARGET}
diff ./.tmp.1.$$ ./.tmp.2.$$ || exit 2; \ diff ./.tmp.1.$$ ./.tmp.2.$$ || exit 2; \
rm -f ./.tmp.[12].$$; \ rm -f ./.tmp.[12].$$; \
done; fi done; fi
@if test -f ./sample-InterchangedObject-1.xer ; then \
for f in ./sample-InterchangedObject-*.xer; do \
echo "Recoding $$f into DER and back..."; \
./${TARGET} -ixer -oder $$f > ./.tmp.1.$$ || exit 2; \
./${TARGET} -iber -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
diff $$f ./.tmp.2.$$ || exit 2; \
rm -f ./.tmp.[12].$$; \
done; fi
@if test -f ./sample-InterchangedObject-1.per ; then \
for f in ./sample-InterchangedObject-*.per; do \
echo "Recoding $$f into DER into XER and back..."; \
./${TARGET} -iper -oder $$f > ./.tmp.1.$$ || exit 2; \
./${TARGET} -ider -oxer ./.tmp.1.$$ > ./.tmp.2.$$ || exit 2; \
./${TARGET} -ixer -oper ./.tmp.2.$$ > ./.tmp.1.$$ || exit 2; \
diff $$f ./.tmp.1.$$ || exit 2; \
rm -f ./.tmp.[12].$$; \
done; fi
@echo ================ @echo ================
@echo All tests passed @echo All tests passed
@echo ================ @echo ================
......
...@@ -2193,9 +2193,12 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr) { ...@@ -2193,9 +2193,12 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr) {
*/ */
static int static int
emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_count, int all_tags_count, int elements_count, enum etd_spec spec) { emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_count, int all_tags_count, int elements_count, enum etd_spec spec) {
asn1p_expr_t *terminal;
int using_type_name = 0; int using_type_name = 0;
char *p = MKID(expr); char *p = MKID(expr);
terminal = asn1f_find_terminal_type_ex(arg->asn, expr);
if((arg->flags & A1C_GEN_PER) if((arg->flags & A1C_GEN_PER)
&& (expr->constraints && (expr->constraints
|| expr->expr_type == ASN_BASIC_ENUMERATED || expr->expr_type == ASN_BASIC_ENUMERATED
...@@ -2255,7 +2258,8 @@ emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_ ...@@ -2255,7 +2258,8 @@ emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_
"use \"-gen-PER\" to enable */\n"); "use \"-gen-PER\" to enable */\n");
} }
if(expr->expr_type == ASN_CONSTR_CHOICE) { if(!terminal || terminal->expr_type == ASN_CONSTR_CHOICE) {
//if(expr->expr_type == ASN_CONSTR_CHOICE) {
OUT("CHOICE_outmost_tag,\n"); OUT("CHOICE_outmost_tag,\n");
} else { } else {
OUT("0,\t/* Use generic outmost tag fetcher */\n"); OUT("0,\t/* Use generic outmost tag fetcher */\n");
......
...@@ -31,5 +31,8 @@ BEGIN ...@@ -31,5 +31,8 @@ BEGIN
} }
Choice3 ::= [3] EXPLICIT Choice2 -- tags [3] [2] Choice3 ::= [3] EXPLICIT Choice2 -- tags [3] [2]
Choice4 ::= [4] IMPLICIT Choice2 -- tags [4]
Choice5 ::= Choice2 -- tags [2]
Choice6 ::= Choice1 -- tags
END END
...@@ -24,4 +24,10 @@ Choice2 ::= [2] EXPLICIT CHOICE { ...@@ -24,4 +24,10 @@ Choice2 ::= [2] EXPLICIT CHOICE {
Choice3 ::= [3] EXPLICIT Choice2 Choice3 ::= [3] EXPLICIT Choice2
Choice4 ::= [4] IMPLICIT Choice2
Choice5 ::= Choice2
Choice6 ::= Choice1
END END
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment