diff options
author | Björn Gustavsson <[email protected]> | 2015-03-12 10:42:08 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-03-12 10:42:08 +0100 |
commit | 900276a573ea67039670a71c379f64ac938a4516 (patch) | |
tree | e81f2ee411fd704240e933f81f7d9a3bfb9bf87f | |
parent | 306d7bc2282c8ff9545ae3a9e958b2746677958f (diff) | |
parent | 0796cb716511ae2bf35ee0ee1e0da75f20ad567f (diff) | |
download | otp-900276a573ea67039670a71c379f64ac938a4516.tar.gz otp-900276a573ea67039670a71c379f64ac938a4516.tar.bz2 otp-900276a573ea67039670a71c379f64ac938a4516.zip |
Merge branch 'maint'
* maint:
asn1ct_gen: Correct generation of .hrl files for multiple ellipses
Fix BER code generation
-rw-r--r-- | lib/asn1/src/asn1ct_gen.erl | 16 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/DoubleEllipses.asn | 12 | ||||
-rw-r--r-- | lib/asn1/test/testDoubleEllipses.erl | 8 |
3 files changed, 32 insertions, 4 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl index d3c1f34821..0e41aa1a7a 100644 --- a/lib/asn1/src/asn1ct_gen.erl +++ b/lib/asn1/src/asn1ct_gen.erl @@ -1233,15 +1233,23 @@ gen_record(TorPtype,Name,Type,Num) when is_record(Type,type) -> emit({"}).",nl,nl}), Tr ++ ExtensionList2; {Rootl1,Extl,Rootl2} -> + case Rootl1 =/= [] andalso Extl++Rootl2 =/= [] of + true -> emit([com]); + false -> ok + end, case Rootl1 of - [] -> true; - _ -> emit([",",nl]) + [_|_] -> emit([nl]); + [] -> ok end, emit(["%% with extensions",nl]), gen_record2(Name,'SEQUENCE',Extl,"",ext), + case Extl =/= [] andalso Rootl2 =/= [] of + true -> emit([com]); + false -> ok + end, case Extl of - [_H|_] when Rootl2 /= [] -> emit([",",nl]); - _ -> ok + [_|_] -> emit([nl]); + [] -> ok end, emit(["%% end of extensions",nl]), gen_record2(Name,'SEQUENCE',Rootl2,"",noext), diff --git a/lib/asn1/test/asn1_SUITE_data/DoubleEllipses.asn b/lib/asn1/test/asn1_SUITE_data/DoubleEllipses.asn index a96425cbea..846c3e7569 100644 --- a/lib/asn1/test/asn1_SUITE_data/DoubleEllipses.asn +++ b/lib/asn1/test/asn1_SUITE_data/DoubleEllipses.asn @@ -59,6 +59,18 @@ SeqAltV2 ::= SEQUENCE g INTEGER } +SeqDoubleEmpty1 ::= SEQUENCE { + ..., + ... +} + +SeqDoubleEmpty2 ::= SEQUENCE { + a BOOLEAN, + b INTEGER OPTIONAL, + ..., + ... +} + Set ::= SET { a INTEGER, ..., diff --git a/lib/asn1/test/testDoubleEllipses.erl b/lib/asn1/test/testDoubleEllipses.erl index 3caa166ae0..bd6831bf1e 100644 --- a/lib/asn1/test/testDoubleEllipses.erl +++ b/lib/asn1/test/testDoubleEllipses.erl @@ -58,6 +58,14 @@ main(_Rules) -> #'SetAltV2'{a=10,d=12, b = <<2#1010:4>>, e=true,h="PS",i=13,c=false,f=14,g=16}), + + roundtrip('SeqDoubleEmpty1', + {'SeqDoubleEmpty1'}), + roundtrip('SeqDoubleEmpty2', + {'SeqDoubleEmpty2',true,42}), + roundtrip('SeqDoubleEmpty2', + {'SeqDoubleEmpty2',true,asn1_NOVALUE}), + ok. roundtrip(T, V) -> |