diff options
author | Björn Gustavsson <[email protected]> | 2014-01-29 10:50:21 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-01-29 10:50:21 +0100 |
commit | 228ef1c22ee2f6f39183091aa70f17417c3d9aa6 (patch) | |
tree | 7d2203d6df886ce1d7f2344dbfd3e6ec7c8a5c3d /lib/asn1/src/asn1ct.erl | |
parent | ae2c2f1d838b523939b586014ceb66c2970b8cf2 (diff) | |
parent | d16a480a43a858d604d1ac8d644589be3f49dda1 (diff) | |
download | otp-228ef1c22ee2f6f39183091aa70f17417c3d9aa6.tar.gz otp-228ef1c22ee2f6f39183091aa70f17417c3d9aa6.tar.bz2 otp-228ef1c22ee2f6f39183091aa70f17417c3d9aa6.zip |
Merge branch 'bjorn/asn1/erlang-types/OTP-11594'
* bjorn/asn1/erlang-types/OTP-11594:
Update documentation
Fix open types
Fix OCTET STRING
Fix BIT STRING
Add legacy_erlang_types
asn1 test suite: Modernize testTimer_* and testTimer.erl
testPrimStrings: Run test of fragmented strings for PER too
Diffstat (limited to 'lib/asn1/src/asn1ct.erl')
-rw-r--r-- | lib/asn1/src/asn1ct.erl | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/asn1/src/asn1ct.erl b/lib/asn1/src/asn1ct.erl index f2e9606ccb..531a4935fe 100644 --- a/lib/asn1/src/asn1ct.erl +++ b/lib/asn1/src/asn1ct.erl @@ -40,7 +40,7 @@ maybe_rename_function/3,current_sindex/0, set_current_sindex/1,maybe_saved_sindex/2, parse_and_save/2,verbose/3,warning/3,warning/4,error/3]). --export([get_bit_string_format/0]). +-export([get_bit_string_format/0,use_legacy_types/0]). -include("asn1_records.hrl"). -include_lib("stdlib/include/erl_compile.hrl"). @@ -841,6 +841,7 @@ delete_double_of_symbol1([],Acc) -> generate({M,GenTOrV}, OutFile, EncodingRule, Options) -> debug_on(Options), setup_bit_string_format(Options), + setup_legacy_erlang_types(Options), put(encoding_options,Options), asn1ct_table:new(check_functions), @@ -869,6 +870,31 @@ generate({M,GenTOrV}, OutFile, EncodingRule, Options) -> asn1ct_table:delete(check_functions), Result. +setup_legacy_erlang_types(Opts) -> + F = case lists:member(legacy_erlang_types, Opts) of + false -> + case get_bit_string_format() of + bitstring -> + false; + compact -> + legacy_forced_info(compact_bit_string), + true; + legacy -> + legacy_forced_info(legacy_bit_string), + true + end; + true -> + true + end, + put(use_legacy_erlang_types, F). + +legacy_forced_info(Opt) -> + io:format("Info: The option 'legacy_erlang_types' " + "is implied by the '~s' option.\n", [Opt]). + +use_legacy_types() -> + get(use_legacy_erlang_types). + setup_bit_string_format(Opts) -> Format = case {lists:member(compact_bit_string, Opts), lists:member(legacy_bit_string, Opts)} of @@ -1075,6 +1101,7 @@ remove_asn_flags(Options) -> X /= optimize, X /= compact_bit_string, X /= legacy_bit_string, + X /= legacy_erlang_types, X /= debug, X /= asn1config, X /= record_name_prefix]. |