diff options
author | Kenneth Lundin <[email protected]> | 2010-09-01 15:09:31 +0200 |
---|---|---|
committer | Kenneth Lundin <[email protected]> | 2010-09-23 16:45:58 +0200 |
commit | 4774bef8375d7c15c4d52a181acad118543e1e38 (patch) | |
tree | 694ebb1bcd97a6545a38ebd91f59e5bf0535f7fb /lib/asn1 | |
parent | 5ddf44bb91540fd88e604f077d71482c40185cd8 (diff) | |
download | otp-4774bef8375d7c15c4d52a181acad118543e1e38.tar.gz otp-4774bef8375d7c15c4d52a181acad118543e1e38.tar.bz2 otp-4774bef8375d7c15c4d52a181acad118543e1e38.zip |
Add support for ExtensionAdditionGroup notation in nested types as well
In the previous version support for ExtensionAdditionGroups (i.e [[...]])
was added but it did not handle the occurence of the notation in nested types.
Now this is handled as well and the support is hopefully complete.
Also cleanup of warnings for obsolete guard functions in test suites.
Diffstat (limited to 'lib/asn1')
21 files changed, 261 insertions, 150 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index 1c9f2c759a..7cd29623c1 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -6408,6 +6408,12 @@ any_component_relation(S,Type,CNames,NamePath,Acc) when is_record(Type,type) -> [] end, InnerAcc ++ CRelPath ++ Acc; +%% Just skip the markers for ExtensionAdditionGroup start and end +%% in this function +any_component_relation(S,[#'ExtensionAdditionGroup'{}|Cs],CNames,NamePath,Acc) -> + any_component_relation(S,Cs,CNames,NamePath,Acc); +any_component_relation(S,['ExtensionAdditionGroupEnd'|Cs],CNames,NamePath,Acc) -> + any_component_relation(S,Cs,CNames,NamePath,Acc); any_component_relation(_,[],_,_,Acc) -> Acc. diff --git a/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl b/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl index a55ac9db8e..e3be914af4 100644 --- a/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl +++ b/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% Copyright Ericsson AB 2002-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -75,13 +75,15 @@ gen_encode_sequence(Erules,Typename,D) when is_record(D,type) -> "Val" end, - {SeqOrSet,TableConsInfo,CompList} = + {SeqOrSet,TableConsInfo,CompList0} = case D#type.def of #'SEQUENCE'{tablecinf=TCI,components=CL} -> {'SEQUENCE',TCI,CL}; #'SET'{tablecinf=TCI,components=CL} -> {'SET',TCI,CL} end, + %% filter away extensionAdditiongroup markers + CompList = filter_complist(CompList0), Ext = extensible(CompList), CompList1 = case CompList of {Rl1,El,Rl2} -> Rl1 ++ El ++ Rl2; @@ -183,7 +185,10 @@ gen_decode_sequence(Erules,Typename,D) when is_record(D,type) -> asn1ct_name:start(), asn1ct_name:clear(), asn1ct_name:new(tag), - #'SEQUENCE'{tablecinf=TableConsInfo,components=CList} = D#type.def, + #'SEQUENCE'{tablecinf=TableConsInfo,components=CList0} = D#type.def, + + %% filter away extensionAdditiongroup markers + CList = filter_complist(CList0), Ext = extensible(CList), {CompList,CompList2} = case CList of @@ -345,7 +350,9 @@ gen_decode_set(Erules,Typename,D) when is_record(D,type) -> asn1ct_name:clear(), %% asn1ct_name:new(term), asn1ct_name:new(tag), - #'SET'{tablecinf=TableConsInfo,components=TCompList} = D#type.def, + #'SET'{tablecinf=TableConsInfo,components=TCompList0} = D#type.def, + %% filter away extensionAdditiongroup markers + TCompList = filter_complist(TCompList0), Ext = extensible(TCompList), ToOptional = fun(mandatory) -> 'OPTIONAL'; @@ -1426,6 +1433,22 @@ extensible({RootList,ExtList}) -> {ext,length(RootList)+1,length(ExtList)}; extensible({_Rl1,_Ext,_Rl2}) -> extensible. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% filter away ExtensionAdditionGroup start and end marks since these +%% have no significance for the BER encoding +%% +filter_complist(CompList) when is_list(CompList) -> + lists:filter(fun(#'ExtensionAdditionGroup'{}) -> + false; + ('ExtensionAdditionGroupEnd') -> + false; + (_) -> + true + end, CompList); +filter_complist({Root,Ext}) -> + {Root,filter_complist(Ext)}; +filter_complist({Root1,Ext,Root2}) -> + {Root1,filter_complist(Ext),Root2}. print_attribute_comment(InnerType,Pos,Cname,Prop) -> diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl index e4cd29bfbd..7a28a16877 100644 --- a/lib/asn1/src/asn1ct_gen.erl +++ b/lib/asn1/src/asn1ct_gen.erl @@ -536,33 +536,18 @@ gen_part_decode_funcs(WhatKind,_TypeName,{_,Directive,_,_}) -> throw({error,{asn1,{"Not implemented yet",WhatKind," partial incomplete directive:",Directive}}}). -extaddgroup2sequence(ExtList) -> - extaddgroup2sequence(ExtList,[]). - -extaddgroup2sequence([{'ExtensionAdditionGroup',Number0}|T],Acc) -> - Number = case Number0 of undefined -> 1; _ -> Number0 end, - {ExtGroupComps,['ExtensionAdditionGroupEnd'|T2]} = - lists:splitwith(fun(Elem) -> is_record(Elem,'ComponentType') end,T), - extaddgroup2sequence(T2,[#'ComponentType'{ - name='ExtAddGroup', - typespec=#type{def=#'SEQUENCE'{ - extaddgroup=Number, - components=ExtGroupComps}}, - prop='OPTIONAL'}|Acc]); -extaddgroup2sequence([C|T],Acc) -> - extaddgroup2sequence(T,[C|Acc]); -extaddgroup2sequence([],Acc) -> - lists:reverse(Acc). - - gen_types(Erules,Tname,{RootL1,ExtList,RootL2}) when is_list(RootL1), is_list(RootL2) -> gen_types(Erules,Tname,RootL1), - gen_types(Erules,Tname,extaddgroup2sequence(ExtList)), + Rtmod = list_to_atom(lists:concat(["asn1ct_gen_",erule(Erules), + rt2ct_suffix(Erules)])), + gen_types(Erules,Tname,Rtmod:extaddgroup2sequence(ExtList)), gen_types(Erules,Tname,RootL2); gen_types(Erules,Tname,{RootList,ExtList}) when is_list(RootList) -> gen_types(Erules,Tname,RootList), - gen_types(Erules,Tname,extaddgroup2sequence(ExtList)); + Rtmod = list_to_atom(lists:concat(["asn1ct_gen_",erule(Erules), + rt2ct_suffix(Erules)])), + gen_types(Erules,Tname,Rtmod:extaddgroup2sequence(ExtList)); gen_types(Erules,Tname,[{'EXTENSIONMARK',_,_}|Rest]) -> gen_types(Erules,Tname,Rest); gen_types(Erules,Tname,[ComponentType|Rest]) -> diff --git a/lib/asn1/src/asn1ct_gen_ber.erl b/lib/asn1/src/asn1ct_gen_ber.erl index 7c432f29c3..8943541303 100644 --- a/lib/asn1/src/asn1ct_gen_ber.erl +++ b/lib/asn1/src/asn1ct_gen_ber.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -33,6 +33,7 @@ -export([gen_objectset_code/2, gen_obj_code/3]). -export([re_wrap_erule/1]). -export([unused_var/2]). +-export([extaddgroup2sequence/1]). -import(asn1ct_gen, [emit/1,demit/1]). @@ -1734,3 +1735,15 @@ get_object_field(Name,ObjectFields) -> {value,Field} -> Field; false -> false end. + +%% For BER the ExtensionAdditionGroup notation has no impact on the encoding/decoding +%% and therefore we only filter away the ExtensionAdditionGroup start and end markers +%% +extaddgroup2sequence(ExtList) when is_list(ExtList) -> + lists:filter(fun(#'ExtensionAdditionGroup'{}) -> + false; + ('ExtensionAdditionGroupEnd') -> + false; + (_) -> + true + end, ExtList). diff --git a/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl b/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl index b7ac0f407c..ac232ea710 100644 --- a/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl +++ b/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -33,6 +33,7 @@ -export([gen_objectset_code/2, gen_obj_code/3]). -export([encode_tag_val/3]). -export([gen_inc_decode/2,gen_decode_selected/3]). +-export([extaddgroup2sequence/1]). -import(asn1ct_gen, [emit/1,demit/1]). @@ -1826,8 +1827,15 @@ mk_object_val(Val, Ack, Len) -> add_func(F={_Func,_Arity}) -> ets:insert(asn1_functab,{F}). - - - +%% For BER the ExtensionAdditionGroup notation has no impact on the encoding/decoding +%% and therefore we only filter away the ExtensionAdditionGroup start and end markers +extaddgroup2sequence(ExtList) when is_list(ExtList) -> + lists:filter(fun(#'ExtensionAdditionGroup'{}) -> + false; + ('ExtensionAdditionGroupEnd') -> + false; + (_) -> + true + end, ExtList). diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl index 06d2489748..a8908db7e4 100644 --- a/lib/asn1/src/asn1ct_gen_per.erl +++ b/lib/asn1/src/asn1ct_gen_per.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -31,6 +31,7 @@ -export([gen_encode/2, gen_encode/3]). -export([is_already_generated/2,more_genfields/1,get_class_fields/1, get_object_field/2]). +-export([extaddgroup2sequence/1]). -import(asn1ct_gen, [emit/1,demit/1]). @@ -1393,3 +1394,25 @@ get_object_field(Name,ObjectFields) -> false -> false end. + +%% For PER the ExtensionAdditionGroup notation has significance for the encoding and decoding +%% the components within the ExtensionAdditionGroup is treated in a similar way as if they +%% have been specified within a SEQUENCE, therefore we construct a fake sequence type here +%% so that we can generate code for it +extaddgroup2sequence(ExtList) -> + extaddgroup2sequence(ExtList,[]). + +extaddgroup2sequence([{'ExtensionAdditionGroup',Number0}|T],Acc) -> + Number = case Number0 of undefined -> 1; _ -> Number0 end, + {ExtGroupComps,['ExtensionAdditionGroupEnd'|T2]} = + lists:splitwith(fun(Elem) -> is_record(Elem,'ComponentType') end,T), + extaddgroup2sequence(T2,[#'ComponentType'{ + name='ExtAddGroup', + typespec=#type{def=#'SEQUENCE'{ + extaddgroup=Number, + components=ExtGroupComps}}, + prop='OPTIONAL'}|Acc]); +extaddgroup2sequence([C|T],Acc) -> + extaddgroup2sequence(T,[C|Acc]); +extaddgroup2sequence([],Acc) -> + lists:reverse(Acc). diff --git a/lib/asn1/src/asn1ct_gen_per_rt2ct.erl b/lib/asn1/src/asn1ct_gen_per_rt2ct.erl index 56f895828a..cd05701965 100644 --- a/lib/asn1/src/asn1ct_gen_per_rt2ct.erl +++ b/lib/asn1/src/asn1ct_gen_per_rt2ct.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -29,6 +29,7 @@ -export([gen_obj_code/3,gen_objectset_code/2]). -export([gen_decode/2, gen_decode/3]). -export([gen_encode/2, gen_encode/3]). +-export([extaddgroup2sequence/1]). -import(asn1ct_gen, [emit/1,demit/1]). -import(asn1ct_gen_per, [is_already_generated/2,more_genfields/1, @@ -1796,3 +1797,25 @@ dec_enumerated_cases([Name|Rest],Tmpremain,No) -> dec_enumerated_cases(Rest,Tmpremain,No+1); dec_enumerated_cases([],_,_) -> "". + +%% For PER the ExtensionAdditionGroup notation has significance for the encoding and decoding +%% the components within the ExtensionAdditionGroup is treated in a similar way as if they +%% have been specified within a SEQUENCE, therefore we construct a fake sequence type here +%% so that we can generate code for it +extaddgroup2sequence(ExtList) -> + extaddgroup2sequence(ExtList,[]). + +extaddgroup2sequence([{'ExtensionAdditionGroup',Number0}|T],Acc) -> + Number = case Number0 of undefined -> 1; _ -> Number0 end, + {ExtGroupComps,['ExtensionAdditionGroupEnd'|T2]} = + lists:splitwith(fun(Elem) -> is_record(Elem,'ComponentType') end,T), + extaddgroup2sequence(T2,[#'ComponentType'{ + name='ExtAddGroup', + typespec=#type{def=#'SEQUENCE'{ + extaddgroup=Number, + components=ExtGroupComps}}, + prop='OPTIONAL'}|Acc]); +extaddgroup2sequence([C|T],Acc) -> + extaddgroup2sequence(T,[C|Acc]); +extaddgroup2sequence([],Acc) -> + lists:reverse(Acc). diff --git a/lib/asn1/test/asn1_SUITE.erl.src b/lib/asn1/test/asn1_SUITE.erl.src index 9377d23252..8c82be8bd2 100644 --- a/lib/asn1/test/asn1_SUITE.erl.src +++ b/lib/asn1/test/asn1_SUITE.erl.src @@ -2298,11 +2298,12 @@ testExtensionAdditionGroup(Config) -> ?line Path = code:get_path(), ?line code:add_patha(PrivDir), DoIt = fun(Erule) -> - ?line ok = asn1ct:compile(filename:join(DataDir,"Extension-Addition-Group"),[Erule,{outdir,PrivDir}]), + ?line ok = asn1ct:compile(filename:join(DataDir,"Extension-Addition-Group"),Erule ++ [{outdir,PrivDir}]), ?line {ok,_M} = compile:file(filename:join(DataDir,"extensionAdditionGroup"),[{i,PrivDir},{outdir,PrivDir},debug_info]), - ?line ok = extensionAdditionGroup:run(Erule) + ?line ok = extensionAdditionGroup:run(Erule), + ?line ok = extensionAdditionGroup:run2(Erule) end, - ?line [DoIt(Rule)|| Rule <- [per_bin,uper_bin,ber_bin]], + ?line [DoIt(Rule)|| Rule <- [[per_bin],[per_bin,optimize],[uper_bin],[ber_bin],[ber_bin,optimize]]], ?line code:set_path(Path). diff --git a/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn b/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn index b985c970ac..fc244c30a2 100644 --- a/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn +++ b/lib/asn1/test/asn1_SUITE_data/Extension-Addition-Group.asn @@ -48,6 +48,7 @@ Ax ::= SEQUENCE { } -- valAx Ax ::= { a 253, b TRUE, c e: TRUE, g "123", h TRUE } + Ax2 ::= SEQUENCE { a INTEGER (250..253), b BOOLEAN, @@ -55,7 +56,6 @@ Ax2 ::= SEQUENCE { ug NumericString } -END -- The value { a 253, b TRUE, c e: TRUE, g "123", h TRUE } -- is encoded in PER as @@ -64,3 +64,19 @@ END -- is encoded in Unaligned PER as -- 9E000600 040A4690 + +Ax3 ::= SEQUENCE { + a INTEGER (250..253), + b BOOLEAN, + s SEQUENCE { + sa INTEGER, + sb BOOLEAN, + ..., + [[ + sextaddgroup INTEGER OPTIONAL + ]] + } +} + +-- { a 253, b TRUE, s {sa 17, sb TRUE, sextaddgroup 11}} +END diff --git a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl index 79e200f561..c86c787610 100644 --- a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl +++ b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl @@ -41,3 +41,16 @@ run(Erule) -> Val -> ok; _ -> exit({expected,Val, got, Val2}) end. + +run2(Erule) -> + Val = #'Ax3'{a=253, b = true, s = #'Ax3_s'{sa = 11, sb = true, sextaddgroup = 17}}, + io:format("~p:~p~n",[Erule,Val]), + {ok,List}= asn1rt:encode('Extension-Addition-Group','Ax3',Val), + Enc = iolist_to_binary(List), + io:format("~p~n",[Enc]), + {ok,Val2} = asn1rt:decode('Extension-Addition-Group','Ax3',Enc), + io:format("~p~n",[Val2]), + case Val2 of + Val -> ok; + _ -> exit({expected,Val, got, Val2}) + end. diff --git a/lib/asn1/test/asn1_app_test.erl b/lib/asn1/test/asn1_app_test.erl index 8ee42d3ec3..1ea76426f1 100644 --- a/lib/asn1/test/asn1_app_test.erl +++ b/lib/asn1/test/asn1_app_test.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -54,7 +54,7 @@ all(suite) -> app_init(suite) -> []; app_init(doc) -> []; -app_init(Config) when list(Config) -> +app_init(Config) when is_list(Config) -> case is_app(asn1) of {ok, AppFile} -> io:format("AppFile: ~n~p~n", [AppFile]), @@ -76,7 +76,7 @@ is_app(App) -> app_fin(suite) -> []; app_fin(doc) -> []; -app_fin(Config) when list(Config) -> +app_fin(Config) when is_list(Config) -> Config. @@ -86,7 +86,7 @@ fields(suite) -> []; fields(doc) -> []; -fields(Config) when list(Config) -> +fields(Config) when is_list(Config) -> AppFile = key1search(app_file, Config), Fields = [vsn, description, modules, registered, applications], case check_fields(Fields, AppFile, []) of @@ -117,7 +117,7 @@ modules(suite) -> []; modules(doc) -> []; -modules(Config) when list(Config) -> +modules(Config) when is_list(Config) -> AppFile = key1search(app_file, Config), Mods = key1search(modules, AppFile), EbinList = get_ebin_mods(asn1), @@ -188,7 +188,7 @@ exportall(suite) -> []; exportall(doc) -> []; -exportall(Config) when list(Config) -> +exportall(Config) when is_list(Config) -> AppFile = key1search(app_file, Config), Mods = key1search(modules, AppFile), check_export_all(Mods). @@ -221,7 +221,7 @@ app_depend(suite) -> []; app_depend(doc) -> []; -app_depend(Config) when list(Config) -> +app_depend(Config) when is_list(Config) -> AppFile = key1search(app_file, Config), Apps = key1search(applications, AppFile), check_apps(Apps). diff --git a/lib/asn1/test/asn1_appup_test.erl b/lib/asn1/test/asn1_appup_test.erl index 644c0f7d03..96197ed963 100644 --- a/lib/asn1/test/asn1_appup_test.erl +++ b/lib/asn1/test/asn1_appup_test.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -51,7 +51,7 @@ all(suite) -> appup_init(suite) -> []; appup_init(doc) -> []; -appup_init(Config) when list(Config) -> +appup_init(Config) when is_list(Config) -> AppFile = file_name(asn1, ".app"), AppupFile = file_name(asn1, ".appup"), [{app_file, AppFile}, {appup_file, AppupFile}|Config]. @@ -64,7 +64,7 @@ file_name(App, Ext) -> appup_fin(suite) -> []; appup_fin(doc) -> []; -appup_fin(Config) when list(Config) -> +appup_fin(Config) when is_list(Config) -> Config. @@ -74,7 +74,7 @@ appup(suite) -> []; appup(doc) -> "perform a simple check of the appup file"; -appup(Config) when list(Config) -> +appup(Config) when is_list(Config) -> AppupFile = key1search(appup_file, Config), AppFile = key1search(app_file, Config), Modules = modules(AppFile), @@ -161,14 +161,14 @@ check_instructions(UpDown, [Instr|Instrs], AllInstr, Good, Bad, Modules) -> %% A new module is added check_instruction(up, {add_module, Module}, _, Modules) - when atom(Module) -> + when is_atom(Module) -> d("check_instruction -> entry when up-add_module instruction with" "~n Module: ~p", [Module]), check_module(Module, Modules); %% An old module is re-added check_instruction(down, {add_module, Module}, _, Modules) - when atom(Module) -> + when is_atom(Module) -> d("check_instruction -> entry when down-add_module instruction with" "~n Module: ~p", [Module]), case (catch check_module(Module, Modules)) of @@ -182,7 +182,7 @@ check_instruction(down, {add_module, Module}, _, Modules) %% - the module has been removed from the app-file. %% - check that no module depends on this (removed) module check_instruction(up, {remove, {Module, Pre, Post}}, _, Modules) - when atom(Module), atom(Pre), atom(Post) -> + when is_atom(Module), is_atom(Pre), is_atom(Post) -> d("check_instruction -> entry when up-remove instruction with" "~n Module: ~p" "~n Pre: ~p" @@ -198,7 +198,7 @@ check_instruction(up, {remove, {Module, Pre, Post}}, _, Modules) %% Removing a module on downgrade: the module exist %% in the app-file. check_instruction(down, {remove, {Module, Pre, Post}}, AllInstr, Modules) - when atom(Module), atom(Pre), atom(Post) -> + when is_atom(Module), is_atom(Pre), is_atom(Post) -> d("check_instruction -> entry when down-remove instruction with" "~n Module: ~p" "~n Pre: ~p" @@ -214,7 +214,7 @@ check_instruction(down, {remove, {Module, Pre, Post}}, AllInstr, Modules) check_instruction(_, {load_module, Module, Pre, Post, Depend}, AllInstr, Modules) - when atom(Module), atom(Pre), atom(Post), list(Depend) -> + when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> d("check_instruction -> entry when load_module instruction with" "~n Module: ~p" "~n Pre: ~p" @@ -228,7 +228,7 @@ check_instruction(_, {load_module, Module, Pre, Post, Depend}, check_instruction(_, {update, Module, Change, Pre, Post, Depend}, AllInstr, Modules) - when atom(Module), atom(Pre), atom(Post), list(Depend) -> + when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> d("check_instruction -> entry when update instruction with" "~n Module: ~p" "~n Change: ~p" @@ -244,7 +244,7 @@ check_instruction(_, {update, Module, Change, Pre, Post, Depend}, check_instruction(_, {apply, {Module, Function, Args}}, _AllInstr, Modules) - when atom(Module), atom(Function), list(Args) -> + when is_atom(Module), is_atom(Function), is_list(Args) -> d("check_instruction -> entry when apply instruction with" "~n Module: ~p" "~n Function: ~p" @@ -289,13 +289,13 @@ instruction_module(Instr) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -check_version(V) when list(V) -> +check_version(V) when is_list(V) -> ok; check_version(V) -> error({bad_version, V}). -check_module(M, Modules) when atom(M) -> +check_module(M, Modules) when is_atom(M) -> case lists:member(M,Modules) of true -> ok; @@ -307,7 +307,7 @@ check_module(M, _) -> check_apply(Module,Function,Args) -> case (catch Module:module_info()) of - Info when list(Info) -> + Info when is_list(Info) -> check_exported(Function,Args,Info); {'EXIT',{undef,_}} -> error({not_existing_module,Module}) @@ -326,11 +326,11 @@ check_exported(Function,Args,Info) -> error({bad_export,Info}) end. -check_module_depend(M, [], _) when atom(M) -> +check_module_depend(M, [], _) when is_atom(M) -> d("check_module_depend -> entry with" "~n M: ~p", [M]), ok; -check_module_depend(M, Deps, Modules) when atom(M), list(Deps) -> +check_module_depend(M, Deps, Modules) when is_atom(M), is_list(Deps) -> d("check_module_depend -> entry with" "~n M: ~p" "~n Deps: ~p" diff --git a/lib/asn1/test/asn1_wrapper.erl b/lib/asn1/test/asn1_wrapper.erl index 553f0b062c..d515b99ac2 100644 --- a/lib/asn1/test/asn1_wrapper.erl +++ b/lib/asn1/test/asn1_wrapper.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -26,7 +26,7 @@ encode(Module,Type,Value) -> case asn1rt:encode(Module,Type,Value) of - {ok,X} when binary(X) -> + {ok,X} when is_binary(X) -> {ok, binary_to_list(X)}; {ok,X} -> {ok, binary_to_list(list_to_binary(X))}; @@ -38,21 +38,21 @@ decode(Module,Type,Bytes) -> case Module:encoding_rule() of ber -> asn1rt:decode(Module,Type,Bytes); - ber_bin when binary(Bytes) -> + ber_bin when is_binary(Bytes) -> asn1rt:decode(Module,Type,Bytes); ber_bin -> asn1rt:decode(Module,Type,list_to_binary(Bytes)); - ber_bin_v2 when binary(Bytes) -> + ber_bin_v2 when is_binary(Bytes) -> asn1rt:decode(Module,Type,Bytes); ber_bin_v2 -> asn1rt:decode(Module,Type,list_to_binary(Bytes)); per -> asn1rt:decode(Module,Type,Bytes); - per_bin when binary(Bytes) -> + per_bin when is_binary(Bytes) -> asn1rt:decode(Module,Type,Bytes); per_bin -> asn1rt:decode(Module,Type,list_to_binary(Bytes)); - uper_bin when binary(Bytes) -> + uper_bin when is_binary(Bytes) -> asn1rt:decode(Module,Type,Bytes); uper_bin -> asn1rt:decode(Module,Type,list_to_binary(Bytes)) diff --git a/lib/asn1/test/testContextSwitchingTypes.erl b/lib/asn1/test/testContextSwitchingTypes.erl index ef14397d1e..399c9ecaf7 100644 --- a/lib/asn1/test/testContextSwitchingTypes.erl +++ b/lib/asn1/test/testContextSwitchingTypes.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -71,13 +71,13 @@ check_EXTERNAL_Idef({Alt,_}) when Alt=='context-negotiation'; ok; check_EXTERNAL_Idef(I) -> {error,"failed on identification alternative",I}. -check_EXTERNAL_DVD(DVD) when list(DVD) -> +check_EXTERNAL_DVD(DVD) when is_list(DVD) -> ok; check_EXTERNAL_DVD(asn1_NOVALUE) -> ok; check_EXTERNAL_DVD(DVD) -> {error,"failed on data-value-descriptor alternative",DVD}. -check_EXTERNAL_DV(DV) when list(DV) -> +check_EXTERNAL_DV(DV) when is_list(DV) -> ok; check_EXTERNAL_DV(DV) -> {error,"failed on data-value alternative",DV}. diff --git a/lib/asn1/test/testINSTANCE_OF.erl b/lib/asn1/test/testINSTANCE_OF.erl index 2a3a5c333b..7f5b634e06 100644 --- a/lib/asn1/test/testINSTANCE_OF.erl +++ b/lib/asn1/test/testINSTANCE_OF.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -73,17 +73,17 @@ test_encdec(_Erule,{lastName,{'GeneralName_lastName',{2,3,4}, test_encdec(Erule,Res) -> {error,{Erule,Res}}. -wrap(ber,Int) when list(Int) -> +wrap(ber,Int) when is_list(Int) -> binary_to_list(list_to_binary(Int)); -wrap(per,Int) when list(Int) -> +wrap(per,Int) when is_list(Int) -> binary_to_list(list_to_binary(Int)); -wrap(ber_bin,Int) when list(Int) -> +wrap(ber_bin,Int) when is_list(Int) -> list_to_binary(Int); -wrap(ber_bin_v2,Int) when list(Int) -> +wrap(ber_bin_v2,Int) when is_list(Int) -> list_to_binary(Int); -wrap(per_bin,Int) when list(Int) -> +wrap(per_bin,Int) when is_list(Int) -> list_to_binary(Int); -wrap(uper_bin,Int) when list(Int) -> +wrap(uper_bin,Int) when is_list(Int) -> list_to_binary(Int); wrap(_,Int) -> Int. diff --git a/lib/asn1/test/testMegaco.erl b/lib/asn1/test/testMegaco.erl index 8c0565eec7..50bc6e7dee 100644 --- a/lib/asn1/test/testMegaco.erl +++ b/lib/asn1/test/testMegaco.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -163,7 +163,7 @@ read_msg(File) -> end. -request(Mid, TransId, ContextId, CmdReq) when list(CmdReq) -> +request(Mid, TransId, ContextId, CmdReq) when is_list(CmdReq) -> Actions = [#'ActionRequest'{contextId = ContextId, commandRequests = CmdReq}], Req = {transactions, diff --git a/lib/asn1/test/testNBAPsystem.erl b/lib/asn1/test/testNBAPsystem.erl index 402f16ab5d..79e553a596 100644 --- a/lib/asn1/test/testNBAPsystem.erl +++ b/lib/asn1/test/testNBAPsystem.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -299,7 +299,7 @@ protocolIEs_051107() -> compare(V,V) -> ok; -compare(V,L) when list(L) -> +compare(V,L) when is_list(L) -> compare(V,list_to_binary(L)); compare(_,_) -> false. diff --git a/lib/asn1/test/testPrimStrings.erl b/lib/asn1/test/testPrimStrings.erl index 707ee375c1..a2252ba99b 100644 --- a/lib/asn1/test/testPrimStrings.erl +++ b/lib/asn1/test/testPrimStrings.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -930,7 +930,7 @@ utf8_string(_Rules) -> ?line {ok,Bin13} = asn1_wrapper:decode('PrimStrings','UTF',Bytes13), ?line {ok,LongVal} = wrapper_utf8_binary_to_list(Bin13). -wrapper_utf8_binary_to_list(L) when list(L) -> +wrapper_utf8_binary_to_list(L) when is_list(L) -> asn1rt:utf8_binary_to_list(list_to_binary(L)); wrapper_utf8_binary_to_list(B) -> asn1rt:utf8_binary_to_list(B). diff --git a/lib/asn1/test/testTimer.erl b/lib/asn1/test/testTimer.erl index 0fade7ebca..34b9cf1740 100644 --- a/lib/asn1/test/testTimer.erl +++ b/lib/asn1/test/testTimer.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -146,7 +146,7 @@ go(Config,Enc) -> Bytes = case Enc of ber_bin -> list_to_binary(B); - per_bin when list(B) -> + per_bin when is_list(B) -> list_to_binary(B); per_bin -> B; @@ -179,7 +179,7 @@ encode(0, _Module,_Type,_Value) -> encode(N, Module,Type,Value) -> ?line {ok,B} = asn1rt:encode(Module,Type,Value), _B2 = if - list(B) -> list_to_binary(B); + is_list(B) -> list_to_binary(B); true -> B end, encode(N-1, Module,Type,Value). diff --git a/lib/asn1/test/testX420.erl b/lib/asn1/test/testX420.erl index 0fa3e6fb13..314c5c837a 100644 --- a/lib/asn1/test/testX420.erl +++ b/lib/asn1/test/testX420.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -50,7 +50,7 @@ compile_loop(Erule,[Spec|Specs],Options,Config) Error -> Error end; -compile_loop(Erule,_Specs,_Options,_Config) -> +compile_loop(_Erule,_Specs,_Options,_Config) -> ok.%%{skip,io_lib:format("Not tested for ~p",[Erule])}. diff --git a/lib/asn1/test/test_undecoded_rest.erl b/lib/asn1/test/test_undecoded_rest.erl index c7762d28f7..d2c98e130d 100644 --- a/lib/asn1/test/test_undecoded_rest.erl +++ b/lib/asn1/test/test_undecoded_rest.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -39,10 +39,10 @@ test(Opt) -> ?line {ok,Msg} = asn1ct:value('P-Record','PersonnelRecord'), ?line {ok,Bytes} = asn1_wrapper:encode('P-Record','PersonnelRecord',Msg), Bytes2 = - fun(B) when list(B) -> + fun(B) when is_list(B) -> B ++ [55,55,55]; - (B) when binary(B) -> - concat_binary([B,<<55,55,55>>]) + (B) when is_binary(B) -> + erlang:list_to_binary([B,<<55,55,55>>]) end (Bytes), case Opt of |