diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/asn1/src/asn1ct_gen.erl | 16 | ||||
-rw-r--r-- | lib/asn1/src/asn1rt_ber_bin.erl | 157 | ||||
-rw-r--r-- | lib/os_mon/src/cpu_sup.erl | 37 | ||||
-rw-r--r-- | lib/parsetools/include/yeccpre.hrl | 39 | ||||
-rw-r--r-- | lib/parsetools/src/yecc.erl | 49 | ||||
-rw-r--r-- | lib/parsetools/src/yeccparser.erl | 39 | ||||
-rw-r--r-- | lib/percept/src/egd.erl | 38 | ||||
-rw-r--r-- | lib/percept/src/egd.hrl | 6 | ||||
-rw-r--r-- | lib/percept/src/egd_render.erl | 22 | ||||
-rw-r--r-- | lib/percept/src/percept.erl | 56 | ||||
-rw-r--r-- | lib/percept/src/percept.hrl | 21 | ||||
-rw-r--r-- | lib/percept/src/percept_db.erl | 31 | ||||
-rw-r--r-- | lib/percept/src/percept_html.erl | 52 | ||||
-rw-r--r-- | lib/runtime_tools/src/percept_profile.erl | 35 | ||||
-rw-r--r-- | lib/sasl/src/sasl.app.src | 12 | ||||
-rw-r--r-- | lib/sasl/src/sasl.erl | 14 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 33 | ||||
-rw-r--r-- | lib/wx/examples/demo/demo_html_tagger.erl | 12 |
18 files changed, 308 insertions, 361 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl index fefb92bb34..b8440094bc 100644 --- a/lib/asn1/src/asn1ct_gen.erl +++ b/lib/asn1/src/asn1ct_gen.erl @@ -1,26 +1,26 @@ %% %% %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% %% %% -module(asn1ct_gen). -include("asn1_records.hrl"). -%%-compile(export_all). + -export([pgen_exports/3, pgen_hrl/4, gen_head/3, @@ -1301,8 +1301,8 @@ put_chars(undefined,X) -> put_chars(Y,X) -> io:put_chars(Y,X). -fopen(F, Mode) -> - case file:open(F, Mode) of +fopen(F, ModeList) -> + case file:open(F, ModeList) of {ok, Fd} -> Fd; {error, Reason} -> diff --git a/lib/asn1/src/asn1rt_ber_bin.erl b/lib/asn1/src/asn1rt_ber_bin.erl index 71d78377d4..ab04d981b0 100644 --- a/lib/asn1/src/asn1rt_ber_bin.erl +++ b/lib/asn1/src/asn1rt_ber_bin.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2000-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% %% %% @@ -179,7 +179,7 @@ restbytes2(_RemBytes,Bytes,noext) -> exit({error,{asn1, {unexpected,Bytes}}}); restbytes2(RemBytes,Bytes,ext) -> %% {RemBytes,0}. - {RemBytes,size(Bytes)}. + {RemBytes,byte_size(Bytes)}. @@ -256,8 +256,6 @@ skip_ExtensionAdditions(Bytes,Tags,RmB) -> end end. - - %%=============================================================================== %%=============================================================================== %%=============================================================================== @@ -339,7 +337,7 @@ peek_tag(<<PartialTag,Buffer/binary>>, TagAck) -> peek_tag(Buffer,<<TagAck/binary,PartialTag>>); peek_tag(_,TagAck) -> exit({error,{asn1, {invalid_tag,TagAck}}}). -%%peek_tag([Tag|Buffer]) when (Tag band 31) == 31 -> +%%peek_tag([Tag|Buffer]) when (Tag band 31) =:= 31 -> %% [Tag band 2#11011111 | peek_tag(Buffer,[])]; %%%% single tag (tagno < 31) %%peek_tag([Tag|Buffer]) -> @@ -474,8 +472,7 @@ encode_tags2([Tag|Trest], BytesSoFar, LenSoFar) -> encode_tags2([], BytesSoFar, LenSoFar) -> {BytesSoFar,LenSoFar}. -encode_tags1([Tag1, Tag2| Trest], Acc) - when Tag1#tag.type == 'IMPLICIT' -> +encode_tags1([Tag1, Tag2| Trest], Acc) when Tag1#tag.type =:= 'IMPLICIT' -> encode_tags1([Tag1#tag{type=Tag2#tag.type,form=Tag2#tag.form}|Trest],Acc); encode_tags1([Tag1 | Trest], Acc) -> encode_tags1(Trest, [Tag1|Acc]); @@ -483,7 +480,7 @@ encode_tags1([], Acc) -> Acc. % the resulting tags are returned in reverse order encode_one_tag(Bin) when is_binary(Bin) -> - {Bin,size(Bin)}; + {Bin,byte_size(Bin)}; encode_one_tag(#tag{class=Class,number=No,type=Type, form = Form}) -> NewForm = case Type of 'EXPLICIT' -> @@ -506,11 +503,6 @@ encode_one_tag(#tag{class=Class,number=No,type=Type, form = Form}) -> % [encode_tag_val({NewClass, OldForm, NewTagNr}) | Buffer1]. - - - - - %%=============================================================================== %% %% This comment is valid for all the encode/decode functions @@ -533,20 +525,19 @@ encode_one_tag(#tag{class=Class,number=No,type=Type, form = Form}) -> %% This version does not consider Explicit tagging of the open type. It %% is only left because of backward compatibility. encode_open_type(Val) when is_list(Val) -> - {Val,size(list_to_binary(Val))}; + {Val, byte_size(list_to_binary(Val))}; encode_open_type(Val) -> - {Val, size(Val)}. + {Val, byte_size(Val)}. %% encode_open_type(Val, []) when is_list(Val) -> - {Val,size(list_to_binary(Val))}; -encode_open_type(Val,[]) -> - {Val, size(Val)}; + {Val, byte_size(list_to_binary(Val))}; +encode_open_type(Val, []) -> + {Val, byte_size(Val)}; encode_open_type(Val, Tag) when is_list(Val) -> - encode_tags(Tag,Val,size(list_to_binary(Val))); -encode_open_type(Val,Tag) -> - encode_tags(Tag,Val, size(Val)). - + encode_tags(Tag, Val, byte_size(list_to_binary(Val))); +encode_open_type(Val, Tag) -> + encode_tags(Tag, Val, byte_size(Val)). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -652,8 +643,6 @@ decode_boolean2(Buffer, _) -> exit({error,{asn1, {decode_boolean, Buffer}}}). - - %%=========================================================================== %% Integer, ITU_T X.690 Chapter 8.3 @@ -664,7 +653,7 @@ decode_boolean2(Buffer, _) -> %%=========================================================================== encode_integer(C, Val, []) when is_integer(Val) -> - {EncVal,Len}=encode_integer(C, Val), + {EncVal,Len} = encode_integer(C, Val), dotag_universal(?N_INTEGER,EncVal,Len); encode_integer(C, Val, Tag) when is_integer(Val) -> dotag(Tag, ?N_INTEGER, encode_integer(C, Val)); @@ -674,10 +663,9 @@ encode_integer(_, Val, _) -> exit({error,{asn1, {encode_integer, Val}}}). - encode_integer(C, Val, NamedNumberList, Tag) when is_atom(Val) -> - case lists:keysearch(Val, 1, NamedNumberList) of - {value,{_, NewVal}} -> + case lists:keyfind(Val, 1, NamedNumberList) of + {_, NewVal} -> dotag(Tag, ?N_INTEGER, encode_integer(C, NewVal)); _ -> exit({error,{asn1, {encode_integer_namednumber, Val}}}) @@ -688,8 +676,6 @@ encode_integer(C, Val, _NamedNumberList, Tag) -> dotag(Tag, ?N_INTEGER, encode_integer(C, Val)). - - encode_integer(_C, Val) -> Bytes = if @@ -716,7 +702,6 @@ encode_integer_neg(N, Acc) -> %% (Buffer, Range, NamedNumberList, HasTag, TotalLen) -> {Integer, Remain, RemovedBytes} %%=============================================================================== - decode_integer(Buffer, Range, Tags, OptOrMand) -> NewTags = new_tags(Tags,#tag{class=?UNIVERSAL,number=?N_INTEGER}), decode_integer_notag(Buffer, Range, [], NewTags, OptOrMand). @@ -748,8 +733,8 @@ resolve_named_value(Result={Val,Buffer,RemBytes},NamedNumberList) -> case NamedNumberList of [] -> Result; _ -> - NewVal = case lists:keysearch(Val, 2, NamedNumberList) of - {value,{NamedVal, _}} -> + NewVal = case lists:keyfind(Val, 2, NamedNumberList) of + {NamedVal, _} -> NamedVal; _ -> Val @@ -778,10 +763,10 @@ check_integer_constraint(Result={Val, _Buffer,_},Range) -> %% encode enumerated value %%============================================================================ -encode_enumerated(Val, []) when is_integer(Val)-> +encode_enumerated(Val, []) when is_integer(Val) -> {EncVal,Len} = encode_integer(false,Val), dotag_universal(?N_ENUMERATED,EncVal,Len); -encode_enumerated(Val, DoTag) when is_integer(Val)-> +encode_enumerated(Val, DoTag) when is_integer(Val) -> dotag(DoTag, ?N_ENUMERATED, encode_integer(false,Val)); encode_enumerated({Name,Val}, DoTag) when is_atom(Name) -> encode_enumerated(Val, DoTag). @@ -797,11 +782,11 @@ encode_enumerated(C, Val, {NamedNumberList,ExtList}, DoTag) when is_atom(Val) -> end; encode_enumerated(C, Val, NamedNumberList, DoTag) when is_atom(Val) -> - case lists:keysearch(Val, 1, NamedNumberList) of - {value, {_, NewVal}} when DoTag == []-> + case lists:keyfind(Val, 1, NamedNumberList) of + {_, NewVal} when DoTag =:= [] -> {EncVal,Len} = encode_integer(C,NewVal), dotag_universal(?N_ENUMERATED,EncVal,Len); - {value, {_, NewVal}} -> + {_, NewVal} -> dotag(DoTag, ?N_ENUMERATED, encode_integer(C, NewVal)); _ -> exit({error,{asn1, {enumerated_not_in_range, Val}}}) @@ -874,8 +859,8 @@ decode_enumerated_notag(Buffer, Range, NNList, Tags, OptOrMand) -> decode_enumerated1(Val, NamedNumberList) -> %% it must be a named integer - case lists:keysearch(Val, 2, NamedNumberList) of - {value,{NamedVal, _}} -> + case lists:keyfind(Val, 2, NamedNumberList) of + {NamedVal, _} -> NamedVal; _ -> {asn1_enum,Val} @@ -1220,32 +1205,32 @@ encode_bin_bit_string(C,{Unused,BinBits},_NamedBitList,DoTag)-> remove_unused_then_dotag(DoTag,StringType,Unused,BinBits) -> case Unused of - 0 when (size(BinBits) == 0),DoTag==[] -> + 0 when (byte_size(BinBits) =:= 0), DoTag =:= [] -> %% time optimization of next case {[StringType,1,0],3}; - 0 when (size(BinBits) == 0) -> + 0 when (byte_size(BinBits) =:= 0) -> dotag(DoTag,StringType,{<<0>>,1}); - 0 when DoTag==[]-> % time optimization of next case + 0 when DoTag =:= [] -> % time optimization of next case dotag_universal(StringType,[Unused|[BinBits]],size(BinBits)+1); % {LenEnc,Len} = encode_legth(size(BinBits)+1), % {[StringType,LenEnc,[Unused|BinBits]],size(BinBits)+1+Len+1}; 0 -> dotag(DoTag,StringType,<<Unused,BinBits/binary>>); - Num when DoTag == [] -> % time optimization of next case - N = (size(BinBits)-1), + Num when DoTag =:= [] -> % time optimization of next case + N = byte_size(BinBits) - 1, <<BBits:N/binary,LastByte>> = BinBits, dotag_universal(StringType, [Unused,BBits,(LastByte bsr Num) bsl Num], - size(BinBits)+1); + byte_size(BinBits) + 1); % {LenEnc,Len} = encode_legth(size(BinBits)+1), % {[StringType,LenEnc,[Unused,BBits,(LastByte bsr Num) bsl Num], % 1+Len+size(BinBits)+1}; Num -> - N = (size(BinBits)-1), + N = byte_size(BinBits) - 1, <<BBits:N/binary,LastByte>> = BinBits, dotag(DoTag,StringType,{[Unused,binary_to_list(BBits) ++ [(LastByte bsr Num) bsl Num]], - 1+size(BinBits)}) + byte_size(BinBits) + 1}) end. @@ -1291,8 +1276,8 @@ encode_bit_string_named(C, [FirstVal | RestVal], NamedBitList, DoTag) -> get_all_bitposes([{bit,ValPos}|Rest], NamedBitList, Ack) -> get_all_bitposes(Rest, NamedBitList, [ValPos | Ack ]); get_all_bitposes([Val | Rest], NamedBitList, Ack) when is_atom(Val) -> - case lists:keysearch(Val, 1, NamedBitList) of - {value, {_ValName, ValPos}} -> + case lists:keyfind(Val, 1, NamedBitList) of + {_ValName, ValPos} -> get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]); _ -> exit({error,{asn1, {bitstring_namedbit, Val}}}) @@ -1320,10 +1305,6 @@ make_and_set_list(Len, [], XPos) -> [0 | make_and_set_list(Len - 1, [], XPos + 1)]. - - - - %%================================================================= %% Encode bit string for lists of ones and zeroes %%================================================================= @@ -1342,7 +1323,7 @@ encode_bit_string_bits(C, BitListVal, _NamedBitList, DoTag) when is_list(BitList encode_constr_bit_str_bits(Constr,BitListVal,DoTag); Size -> case length(BitListVal) of - BitSize when BitSize == Size -> + BitSize when BitSize =:= Size -> encode_bitstring(BitListVal); BitSize when BitSize < Size -> PaddedList = @@ -1399,7 +1380,7 @@ encode_constr_bit_str_bits({Min,Max},BitListVal,_DoTag) -> %% as the most significant elements followed by padded zero elements pad_bit_list(Size,BitListVal) -> Tail = lists:duplicate(Size,0), - lists:append(BitListVal,Tail). + BitListVal ++ Tail. %%================================================================= %% Do the actual encoding @@ -1513,7 +1494,6 @@ decode_bitstring2(Len, Unused, %% Decode the bitlist to names %%---------------------------------------- - decode_bitstring_NNL(BitList,NamedNumberList) -> decode_bitstring_NNL(BitList,NamedNumberList,0,[]). @@ -1523,15 +1503,15 @@ decode_bitstring_NNL([],_,_No,Result) -> decode_bitstring_NNL([B|BitList],[{Name,No}|NamedNumberList],No,Result) -> if - B == 0 -> + B =:= 0 -> decode_bitstring_NNL(BitList,NamedNumberList,No+1,Result); true -> decode_bitstring_NNL(BitList,NamedNumberList,No+1,[Name|Result]) end; decode_bitstring_NNL([1|BitList],NamedNumberList,No,Result) -> - decode_bitstring_NNL(BitList,NamedNumberList,No+1,[{bit,No}|Result]); + decode_bitstring_NNL(BitList,NamedNumberList,No+1,[{bit,No}|Result]); decode_bitstring_NNL([0|BitList],NamedNumberList,No,Result) -> - decode_bitstring_NNL(BitList,NamedNumberList,No+1,Result). + decode_bitstring_NNL(BitList,NamedNumberList,No+1,Result). %%============================================================================ @@ -1542,18 +1522,18 @@ decode_bitstring_NNL([0|BitList],NamedNumberList,No,Result) -> %% the function does not check this because it takes to much time %%============================================================================ encode_octet_string(_C, OctetList, []) when is_binary(OctetList) -> - dotag_universal(?N_OCTET_STRING,OctetList,size(OctetList)); + dotag_universal(?N_OCTET_STRING,OctetList,byte_size(OctetList)); encode_octet_string(_C, OctetList, DoTag) when is_binary(OctetList) -> - dotag(DoTag, ?N_OCTET_STRING, {OctetList,size(OctetList)}); + dotag(DoTag, ?N_OCTET_STRING, {OctetList,byte_size(OctetList)}); encode_octet_string(_C, OctetList, DoTag) when is_list(OctetList) -> case length(OctetList) of - Len when DoTag == [] -> + Len when DoTag =:= [] -> dotag_universal(?N_OCTET_STRING,OctetList,Len); Len -> dotag(DoTag, ?N_OCTET_STRING, {OctetList,Len}) end; -% encode_octet_string(C, OctetList, DoTag) when is_list(OctetList) -> -% dotag(DoTag, ?N_OCTET_STRING, {OctetList,length(OctetList)}); +%% encode_octet_string(C, OctetList, DoTag) when is_list(OctetList) -> +%% dotag(DoTag, ?N_OCTET_STRING, {OctetList,length(OctetList)}); encode_octet_string(C, {Name,OctetList}, DoTag) when is_atom(Name) -> encode_octet_string(C, OctetList, DoTag). @@ -1565,7 +1545,7 @@ encode_octet_string(C, {Name,OctetList}, DoTag) when is_atom(Name) -> %% Octet string is decoded as a restricted string %%============================================================================ decode_octet_string(Buffer, Range, Tags, TotalLen, OptOrMand) -> -% NewTags = new_tags(HasTag,#tag{class=?UNIVERSAL,number=?N_OCTET_STRING}), +%% NewTags = new_tags(HasTag,#tag{class=?UNIVERSAL,number=?N_OCTET_STRING}), decode_restricted_string(Buffer, Range, ?N_OCTET_STRING, Tags, TotalLen, [], OptOrMand,old). @@ -1753,17 +1733,17 @@ decode_relative_oid_notag(Buffer, Tags, OptOrMand) -> %%============================================================================ encode_restricted_string(_C, OctetList, StringType, []) when is_binary(OctetList) -> - dotag_universal(StringType,OctetList,size(OctetList)); + dotag_universal(StringType, OctetList, byte_size(OctetList)); encode_restricted_string(_C, OctetList, StringType, DoTag) when is_binary(OctetList) -> - dotag(DoTag, StringType, {OctetList, size(OctetList)}); + dotag(DoTag, StringType, {OctetList, byte_size(OctetList)}); encode_restricted_string(_C, OctetList, StringType, []) when is_list(OctetList) -> - dotag_universal(StringType,OctetList,length(OctetList)); + dotag_universal(StringType, OctetList, length(OctetList)); encode_restricted_string(_C, OctetList, StringType, DoTag) when is_list(OctetList) -> dotag(DoTag, StringType, {OctetList, length(OctetList)}); -encode_restricted_string(C,{Name,OctetL},StringType,DoTag) when is_atom(Name)-> +encode_restricted_string(C,{Name,OctetL},StringType,DoTag) when is_atom(Name) -> encode_restricted_string(C, OctetL, StringType, DoTag). %%============================================================================ @@ -1793,23 +1773,21 @@ decode_restricted_string_tag(Buffer, Range, StringType, TagsIn, LenIn, NNList, O LenIn, NNList, OptOrMand, BinOrOld). - - check_and_convert_restricted_string(Val,StringType,Range,NamedNumberList,_BinOrOld) -> {StrLen,NewVal} = case StringType of - ?N_BIT_STRING when NamedNumberList /= [] -> + ?N_BIT_STRING when NamedNumberList =/= [] -> {no_check,Val}; ?N_BIT_STRING when is_list(Val) -> {length(Val),Val}; ?N_BIT_STRING when is_tuple(Val) -> {(size(element(2,Val))*8) - element(1,Val),Val}; _ when is_binary(Val) -> - {size(Val),binary_to_list(Val)}; + {byte_size(Val),binary_to_list(Val)}; _ when is_list(Val) -> {length(Val), Val} end, case Range of - _ when StrLen == no_check -> + _ when StrLen =:= no_check -> NewVal; [] -> % No length constraint NewVal; @@ -1832,7 +1810,6 @@ check_and_convert_restricted_string(Val,StringType,Range,NamedNumberList,_BinOrO NewVal end. - %%============================================================================= %% Common routines for several string types including bit string %% handles indefinite length @@ -1840,7 +1817,7 @@ check_and_convert_restricted_string(Val,StringType,Range,NamedNumberList,_BinOrO decode_restricted_string_notag(Buffer, _Range, StringType, TagsIn, - _, NamedNumberList, OptOrMand,BinOrOld) -> + _, NamedNumberList, OptOrMand, BinOrOld) -> %%----------------------------------------------------------- %% Get inner (the implicit tag or no tag) and %% outer (the explicit tag) lengths. @@ -1891,7 +1868,7 @@ decode_restricted_parts(Buffer, RestBytes, [], StringType, RestTags, Len, NNList {concat_bit_binaries(AccVal, Val), AccRb+Rb}; _ when is_binary(Val),is_binary(AccVal) -> {<<AccVal/binary,Val/binary>>,AccRb+Rb}; - _ when is_binary(Val), AccVal==[] -> + _ when is_binary(Val), AccVal =:= [] -> {Val,AccRb+Rb}; _ -> {AccVal++Val, AccRb+Rb} @@ -1977,16 +1954,14 @@ mk_universal_string([A,B,C,D|T],Acc) -> %% encode UTF8 string %%============================================================================ encode_UTF8_string(_,UTF8String,[]) when is_binary(UTF8String) -> - dotag_universal(?N_UTF8String,UTF8String,size(UTF8String)); + dotag_universal(?N_UTF8String,UTF8String,byte_size(UTF8String)); encode_UTF8_string(_,UTF8String,DoTag) when is_binary(UTF8String) -> - dotag(DoTag,?N_UTF8String,{UTF8String,size(UTF8String)}); + dotag(DoTag,?N_UTF8String,{UTF8String,byte_size(UTF8String)}); encode_UTF8_string(_,UTF8String,[]) -> dotag_universal(?N_UTF8String,UTF8String,length(UTF8String)); encode_UTF8_string(_,UTF8String,DoTag) -> dotag(DoTag,?N_UTF8String,{UTF8String,length(UTF8String)}). - - %%============================================================================ %% decode UTF8 string %%============================================================================ @@ -2016,7 +1991,7 @@ decode_UTF8_string_notag(Buffer, Tags, OptOrMand) -> %% encode BMP string %%============================================================================ -encode_BMP_string(C, {Name,BMPString}, DoTag) when is_atom(Name)-> +encode_BMP_string(C, {Name,BMPString}, DoTag) when is_atom(Name) -> encode_BMP_string(C, BMPString, DoTag); encode_BMP_string(_C, BMPString, []) -> OctetList = mk_BMP_list(BMPString), @@ -2464,16 +2439,16 @@ concat_bit_binaries({U1,B1},{U2,B2}) -> S2 = (size(B2) * 8) - U2, PadBits = 8 - ((S1+S2) rem 8), {PadBits, <<B1:S1/binary-unit:1,B2:S2/binary-unit:1,0:PadBits>>}; -concat_bit_binaries(L1,L2) when is_list(L1),is_list(L2) -> +concat_bit_binaries(L1,L2) when is_list(L1), is_list(L2) -> %% this case occur when decoding with NNL L1 ++ L2. get_constraint(C,Key) -> - case lists:keysearch(Key,1,C) of + case lists:keyfind(Key,1,C) of false -> no; - {value,{_,V}} -> + {_, V} -> V end. @@ -2484,7 +2459,7 @@ get_constraint(C,Key) -> new_tags([],LastTag) -> [LastTag]; -new_tags(Tags=[#tag{type='IMPLICIT'}],_LastTag) -> +new_tags(Tags = [#tag{type='IMPLICIT'}],_LastTag) -> Tags; new_tags([T1 = #tag{type='IMPLICIT'},#tag{type=T2Type}|Rest],LastTag) -> new_tags([T1#tag{type=T2Type}|Rest],LastTag); diff --git a/lib/os_mon/src/cpu_sup.erl b/lib/os_mon/src/cpu_sup.erl index 742e20b1fa..e414e2c10b 100644 --- a/lib/os_mon/src/cpu_sup.erl +++ b/lib/os_mon/src/cpu_sup.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% %% -module(cpu_sup). @@ -65,15 +65,10 @@ %% Contract specifications %%---------------------------------------------------------------------- --type(util_cpus() :: 'all' | integer() | [integer()]). --type(util_state() :: - 'user' | - 'nice_user' | - 'kernel' | - 'wait' | - 'idle'). --type(util_value() :: {util_state(), float()} | float()). --type(util_desc() :: {util_cpus(), util_value(), util_value(), []}). +-type util_cpus() :: 'all' | integer() | [integer()]. +-type util_state() :: 'user' | 'nice_user' | 'kernel' | 'wait' | 'idle'. +-type util_value() :: {util_state(), float()} | float(). +-type util_desc() :: {util_cpus(), util_value(), util_value(), []}. %%---------------------------------------------------------------------- %% Exported functions @@ -88,28 +83,28 @@ start_link() -> stop() -> gen_server:call(cpu_sup, ?quit, infinity). --spec(nprocs/0 :: () -> integer() | {'error', any()}). +-spec nprocs() -> integer() | {'error', any()}. nprocs() -> os_mon:call(cpu_sup, ?nprocs, infinity). --spec(avg1/0 :: () -> integer() | {'error', any()}). +-spec avg1() -> integer() | {'error', any()}. avg1() -> os_mon:call(cpu_sup, ?avg1, infinity). --spec(avg5/0 :: () -> integer() | {'error', any()}). +-spec avg5() -> integer() | {'error', any()}. avg5() -> os_mon:call(cpu_sup, ?avg5, infinity). --spec(avg15/0 :: () -> integer() | {'error', any()}). +-spec avg15() -> integer() | {'error', any()}. avg15() -> os_mon:call(cpu_sup, ?avg15, infinity). --spec(util/1 :: ([ 'detailed' | 'per_cpu']) -> - util_desc() | [util_desc()] | {'error', any()}). +-spec util(['detailed' | 'per_cpu']) -> + util_desc() | [util_desc()] | {'error', any()}. util(Args) when is_list (Args) -> % Get arguments @@ -126,7 +121,7 @@ util(Args) when is_list (Args) -> util(_) -> erlang:error(badarg). --spec(util/0 :: () -> float()). +-spec util() -> float(). util() -> case util([]) of diff --git a/lib/parsetools/include/yeccpre.hrl b/lib/parsetools/include/yeccpre.hrl index 2ffa13d6a7..33a103d95f 100644 --- a/lib/parsetools/include/yeccpre.hrl +++ b/lib/parsetools/include/yeccpre.hrl @@ -1,52 +1,51 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-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% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The parser generator will insert appropriate declarations before this line.% --type(yecc_ret() :: {'error', _} | {'ok', _}). +-type yecc_ret() :: {'error', _} | {'ok', _}. -spec parse(Tokens :: list()) -> yecc_ret(). parse(Tokens) -> yeccpars0(Tokens, {no_func, no_line}, 0, [], []). --spec(parse_and_scan/1 :: - ({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> - yecc_ret()). +-spec parse_and_scan({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> + yecc_ret(). parse_and_scan({F, A}) -> % Fun or {M, F} yeccpars0([], {{F, A}, no_line}, 0, [], []); parse_and_scan({M, F, A}) -> yeccpars0([], {{{M, F}, A}, no_line}, 0, [], []). --spec(format_error/1 :: (any()) -> [char() | list()]). +-spec format_error(any()) -> [char() | list()]. format_error(Message) -> case io_lib:deep_char_list(Message) of - true -> - Message; - _ -> - io_lib:write(Message) + true -> + Message; + _ -> + io_lib:write(Message) end. -% To be used in grammar files to throw an error message to the parser -% toplevel. Doesn't have to be exported! --compile({nowarn_unused_function, return_error/2}). --spec(return_error/2 :: (integer(), any()) -> no_return()). +%% To be used in grammar files to throw an error message to the parser +%% toplevel. Doesn't have to be exported! +-compile({nowarn_unused_function,{return_error,2}}). +-spec return_error(integer(), any()) -> no_return(). return_error(Line, Message) -> throw({error, {Line, ?MODULE, Message}}). @@ -85,7 +84,7 @@ yeccpars1([Token | Tokens], Tzr, State, States, Vstack) -> yeccpars1([], {{F, A},_Line}, State, States, Vstack) -> case apply(F, A) of {ok, Tokens, Endline} -> - yeccpars1(Tokens, {{F, A}, Endline}, State, States, Vstack); + yeccpars1(Tokens, {{F, A}, Endline}, State, States, Vstack); {eof, Endline} -> yeccpars1([], {no_func, Endline}, State, States, Vstack); {error, Descriptor, _Endline} -> @@ -118,7 +117,7 @@ yeccpars1(State1, State, States, Vstack, Token0, [], {no_func, Line}) -> yeccpars2(State, '$end', [State1 | States], [Token0 | Vstack], yecc_end(Line), [], {no_func, Line}). -% For internal use only. +%% For internal use only. yecc_end({Line,_Column}) -> {'$end', Line}; yecc_end(Line) -> diff --git a/lib/parsetools/src/yecc.erl b/lib/parsetools/src/yecc.erl index f4d76f471d..b8b2b2308c 100644 --- a/lib/parsetools/src/yecc.erl +++ b/lib/parsetools/src/yecc.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-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% %% %% Yacc like LALR-1 parser generator for Erlang. @@ -30,8 +30,8 @@ -import(lists, [append/1, append/2, concat/1, delete/2, filter/2, flatmap/2, foldl/3, foldr/3, foreach/2, keydelete/3, - keysearch/3, keysort/2, last/1, map/2, member/2, - reverse/1, sort/1, usort/1]). + keysort/2, last/1, map/2, member/2, reverse/1, + sort/1, usort/1]). -include("erl_compile.hrl"). -include("ms_transform.hrl"). @@ -297,18 +297,18 @@ options(Options0, [Key | Keys], L) when is_list(Options0) -> false -> Options0 end, - V = case keysearch(Key, 1, Options) of - {value, {Key, Filename0}} when Key =:= includefile; - Key =:= parserfile -> + V = case lists:keyfind(Key, 1, Options) of + {Key, Filename0} when Key =:= includefile; + Key =:= parserfile -> case is_filename(Filename0) of no -> badarg; Filename -> {ok, [{Key, Filename}]} end; - {value, {Key, Bool}} when Bool =:= true; Bool =:= false -> - {ok, [{Key, Bool}]}; - {value, {Key, _}} -> + {Key, Bool} = KB when is_boolean(Bool) -> + {ok, [KB]}; + {Key, _} -> badarg; false -> {ok, [{Key, default_option(Key)}]} @@ -348,8 +348,7 @@ atom_option(verbose) -> {verbose, true}; atom_option(Key) -> Key. is_filename(T) -> - try filename:flatten(T) of - Filename -> Filename + try filename:flatten(T) catch error: _ -> no end. @@ -366,8 +365,8 @@ shorten_filename(Name0) -> start(Infilex, Options) -> Infile = assure_extension(Infilex, ".yrl"), - {value, {_, Outfilex0}} = keysearch(parserfile, 1, Options), - {value, {_, Includefilex}} = keysearch(includefile, 1, Options), + {_, Outfilex0} = lists:keyfind(parserfile, 1, Options), + {_, Includefilex} = lists:keyfind(includefile, 1, Options), Outfilex = case Outfilex0 of [] -> filename:rootname(Infilex, ".yrl"); _ -> Outfilex0 @@ -715,14 +714,14 @@ names(Symbols) -> map(fun(Symbol) -> Symbol#symbol.name end, Symbols). symbol_line(Name, St) -> - {value, #symbol{line = Line}} = symbol_search(Name, St#yecc.all_symbols), + #symbol{line = Line} = symbol_find(Name, St#yecc.all_symbols), Line. symbol_member(Symbol, Symbols) -> - symbol_search(Symbol#symbol.name, Symbols) =/= false. + symbol_find(Symbol#symbol.name, Symbols) =/= false. -symbol_search(Name, Symbols) -> - keysearch(Name, #symbol.name, Symbols). +symbol_find(Name, Symbols) -> + lists:keyfind(Name, #symbol.name, Symbols). states_and_goto_table(St0) -> St1 = create_symbol_table(St0), @@ -876,8 +875,8 @@ add_warnings(SymNames, W0, St0) -> check_rhs([#symbol{name = '$empty'}], St) -> St; check_rhs(Rhs, St0) -> - case symbol_search('$empty', Rhs) of - {value, #symbol{line = Line}} -> + case symbol_find('$empty', Rhs) of + #symbol{line = Line} -> add_error(Line, illegal_empty, St0); false -> foldl(fun(Sym, St) -> @@ -1096,10 +1095,10 @@ compute_states2([{Sym,Seed} | Seeds], N, Try, CurrState, StateTab, Tables) -> compute_states2(Seeds, N, Try, CurrState, StateTab, Tables); {merge, M, NewCurrent} -> %% io:fwrite(<<"Merging with state ~w\n">>, [M]), - Try1 = case keysearch(M, 1, Try) of + Try1 = case lists:keyfind(M, 1, Try) of false -> [{M, NewCurrent} | Try]; - {value, {_, OldCurrent}} -> + {_, OldCurrent} -> case ordsets:is_subset(NewCurrent, OldCurrent) of true -> Try; diff --git a/lib/parsetools/src/yeccparser.erl b/lib/parsetools/src/yeccparser.erl index 80a6bbce0e..415547b4ce 100644 --- a/lib/parsetools/src/yeccparser.erl +++ b/lib/parsetools/src/yeccparser.erl @@ -16,53 +16,52 @@ line_of(Token) -> -file("/clearcase/otp/erts/lib/parsetools/include/yeccpre.hrl", 0). %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-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% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The parser generator will insert appropriate declarations before this line.% --type(yecc_ret() :: {'error', _} | {'ok', _}). +-type yecc_ret() :: {'error', _} | {'ok', _}. --spec(parse/1 :: (_) -> yecc_ret()). +-spec parse(_) -> yecc_ret(). parse(Tokens) -> yeccpars0(Tokens, false). --spec(parse_and_scan/1 :: - ({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> - yecc_ret()). +-spec parse_and_scan({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> + yecc_ret(). parse_and_scan({F, A}) -> % Fun or {M, F} yeccpars0([], {F, A}); parse_and_scan({M, F, A}) -> yeccpars0([], {{M, F}, A}). --spec(format_error/1 :: (any()) -> [char() | list()]). +-spec format_error(any()) -> [char() | list()]. format_error(Message) -> case io_lib:deep_char_list(Message) of - true -> - Message; - _ -> - io_lib:write(Message) + true -> + Message; + _ -> + io_lib:write(Message) end. -% To be used in grammar files to throw an error message to the parser -% toplevel. Doesn't have to be exported! +%% To be used in grammar files to throw an error message to the parser +%% toplevel. Doesn't have to be exported! -compile({nowarn_unused_function,{return_error,2}}). --spec(return_error/2 :: (integer(), any()) -> no_return()). +-spec return_error(integer(), any()) -> no_return(). return_error(Line, Message) -> throw({error, {Line, ?MODULE, Message}}). @@ -101,7 +100,7 @@ yeccpars1([Token | Tokens], Tokenizer, State, States, Vstack) -> yeccpars1([], {F, A}, State, States, Vstack) -> case apply(F, A) of {ok, Tokens, _Endline} -> - yeccpars1(Tokens, {F, A}, State, States, Vstack); + yeccpars1(Tokens, {F, A}, State, States, Vstack); {eof, _Endline} -> yeccpars1([], false, State, States, Vstack); {error, Descriptor, _Endline} -> @@ -123,7 +122,7 @@ yeccpars1(State1, State, States, Vstack, Stack1, [Token | Tokens], yeccpars1(State1, State, States, Vstack, Stack1, [], {F, A}) -> case apply(F, A) of {ok, Tokens, _Endline} -> - yeccpars1(State1, State, States, Vstack, Stack1, Tokens, {F, A}); + yeccpars1(State1, State, States, Vstack, Stack1, Tokens, {F, A}); {eof, _Endline} -> yeccpars1(State1, State, States, Vstack, Stack1, [], false); {error, Descriptor, _Endline} -> diff --git a/lib/percept/src/egd.erl b/lib/percept/src/egd.erl index 7972fde597..4fb5b6c46a 100644 --- a/lib/percept/src/egd.erl +++ b/lib/percept/src/egd.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% %% @@ -46,10 +46,10 @@ %% @type color() %% @type render_option() = {render_engine, opaque} | {render_engine, alpha} --type(egd_image() :: pid()). --type(point() :: {non_neg_integer(), non_neg_integer()}). --type(render_option() :: {'render_engine', 'opaque'} | {'render_engine', 'alpha'}). --type(color() :: {float(), float(), float(), float()}). +-type egd_image() :: pid(). +-type point() :: {non_neg_integer(), non_neg_integer()}. +-type render_option() :: {'render_engine', 'opaque'} | {'render_engine', 'alpha'}. +-type color() :: {float(), float(), float(), float()}. %%========================================================================== %% @@ -60,7 +60,7 @@ %% @spec create(integer(), integer()) -> egd_image() %% @doc Creates an image area and returns its reference. --spec(create/2 :: (Width :: integer(), Height :: integer()) -> egd_image()). +-spec create(Width :: integer(), Height :: integer()) -> egd_image(). create(Width,Height) -> spawn_link(fun() -> init(trunc(Width),trunc(Height)) end). @@ -69,16 +69,17 @@ create(Width,Height) -> %% @spec destroy(egd_image()) -> ok %% @doc Destroys the image. --spec(destroy/1 :: (Image :: egd_image()) -> ok). +-spec destroy(Image :: egd_image()) -> ok. destroy(Image) -> cast(Image, destroy), ok. -%% @spec render(egd_image()) -> binary() +%% @spec render(egd_image()) -> binary() %% @equiv render(Image, png, [{render_engine, opaque}]) +-spec render(Image :: egd_image()) -> binary(). render(Image) -> render(Image, png, [{render_engine, opaque}]). @@ -94,10 +95,10 @@ render(Image, Type) -> %% binary can either be a raw bitmap with rgb tripplets or a binary in png %% format. --spec(render/3 :: ( +-spec render( Image :: egd_image(), Type :: 'png' | 'raw_bitmap' | 'eps', - Options :: [render_option()]) -> binary()). + Options :: [render_option()]) -> binary(). render(Image, Type, Options) -> {render_engine, RenderType} = proplists:lookup(render_engine, Options), @@ -116,11 +117,11 @@ information(Pid) -> %% @spec line(egd_image(), point(), point(), color()) -> ok %% @doc Creates a line object from P1 to P2 in the image. --spec(line/4 :: ( +-spec line( Image :: egd_image(), P1 :: point(), P2 :: point(), - Color :: color()) -> 'ok'). + Color :: color()) -> 'ok'. line(Image, P1, P2, Color) -> cast(Image, {line, P1, P2, Color}), @@ -132,9 +133,8 @@ line(Image, P1, P2, Color) -> %% Name = black | silver | gray | white | maroon | red | purple | fuchia | green | lime | olive | yellow | navy | blue | teal | aqua %% @doc Creates a color reference. --spec(color/1 :: ( - Value :: {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()} | atom()) -> - color()). +-spec color(Value :: {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()} | atom()) -> + color(). color(Color) -> egd_primitives:color(Color). diff --git a/lib/percept/src/egd.hrl b/lib/percept/src/egd.hrl index 450c6620cf..2e8f5ebc50 100644 --- a/lib/percept/src/egd.hrl +++ b/lib/percept/src/egd.hrl @@ -16,9 +16,9 @@ %% %% %CopyrightEnd% --type(rgba_float() :: {float(), float(), float(), float()}). --type(rgba_byte() :: {byte(), byte(), byte(), byte()}). --type(rgb() :: {byte(), byte(), byte()}). +-type rgba_float() :: {float(), float(), float(), float()}. +-type rgba_byte() :: {byte(), byte(), byte(), byte()}. +-type rgb() :: {byte(), byte(), byte()}. -record(image_object, { type, diff --git a/lib/percept/src/egd_render.erl b/lib/percept/src/egd_render.erl index 4a0247dd33..7fd1072ab1 100644 --- a/lib/percept/src/egd_render.erl +++ b/lib/percept/src/egd_render.erl @@ -29,7 +29,8 @@ -include("egd.hrl"). -define('DummyC',0). -binary(Image) -> binary(Image, opaque). +binary(Image) -> + binary(Image, opaque). binary(Image, Type) -> parallel_binary(precompile(Image),Type). @@ -42,9 +43,8 @@ parallel_binary(Image = #image{ height = Height },Type) -> W = Image#image.width, Bg = Image#image.background, Os = Image#image.objects, - erlang:list_to_binary(lists:map(fun - (Y) -> scanline(Y, Os, {0,0,W - 1, Bg}, Type) - end, lists:seq(1, Height))); + erlang:list_to_binary([scanline(Y, Os, {0,0,W - 1, Bg}, Type) + || Y <- lists:seq(1, Height)]); Np -> Pids = start_workers(Np, Type), Handler = handle_workers(Height, Pids), @@ -54,7 +54,9 @@ parallel_binary(Image = #image{ height = Height },Type) -> Res end. -start_workers(Np, Type) -> start_workers(Np, Type, []). +start_workers(Np, Type) -> + start_workers(Np, Type, []). + start_workers( 0, _, Pids) -> Pids; start_workers(Np, Type, Pids) when Np > 0 -> start_workers(Np - 1, Type, [spawn_link(fun() -> worker(Type) end)|Pids]). @@ -90,7 +92,9 @@ init_workers(Image, Handler, [Pid|Pids]) -> Handler ! {Pid, scan_complete}, init_workers(Image, Handler, Pids). -handle_workers(H, Pids) -> spawn_link(fun() -> handle_workers(H, H, length(Pids)) end). +handle_workers(H, Pids) -> + spawn_link(fun() -> handle_workers(H, H, length(Pids)) end). + handle_workers(_, 0, _) -> ok; handle_workers(H, Hi, Np) when H > 0 -> N = trunc(Hi/(2*Np)), @@ -110,7 +114,9 @@ finish_workers([Pid|Pids]) -> Pid ! {self(), done}, finish_workers(Pids). -receive_binaries(H) -> receive_binaries(H, []). +receive_binaries(H) -> + receive_binaries(H, []). + receive_binaries(0, Bins) -> erlang:list_to_binary(Bins); receive_binaries(H, Bins) when H > 0 -> receive @@ -118,7 +124,6 @@ receive_binaries(H, Bins) when H > 0 -> receive_binaries(H - 1, [Bin|Bins]) end. - scanline(Y, Os, {_,_,Width,_}=LSB, Type) -> OLSs = parse_objects_on_line(Y-1, Width, Os), RLSs = resulting_line_spans([LSB|OLSs],Type), @@ -190,7 +195,6 @@ modify_layers(Layers,[{{_,Z,start},C}|Trans]) -> modify_layers(Layers,[{{_,Z,stop },C}|Trans]) -> modify_layers(remove_layer(Layers, Z, C), Trans). - add_layer([{Z1,_}=H|Layers],Z,C) when Z1 > Z -> [H|add_layer(Layers,Z,C)]; add_layer(Layers,Z,C) -> diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl index af1a920efd..f5e0f7e469 100644 --- a/lib/percept/src/percept.erl +++ b/lib/percept/src/percept.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-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 @@ %% @type percept_option() = procs | ports | exclusive --type(percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'). +-type percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'. %%========================================================================== %% @@ -85,8 +85,8 @@ stop(_State) -> %% profiling --spec(profile/1 :: (Filename :: string()) -> - {'ok', port()} | {'already_started', port()}). +-spec profile(Filename :: file:filename()) -> + {'ok', port()} | {'already_started', port()}. profile(Filename) -> percept_profile:start(Filename, [procs]). @@ -94,10 +94,9 @@ profile(Filename) -> %% @spec profile(Filename::string(), [percept_option()]) -> {ok, Port} | {already_started, Port} %% @see percept_profile --spec(profile/2 :: ( - Filename :: string(), - Options :: [percept_option()]) -> - {'ok', port()} | {'already_started', port()}). +-spec profile(Filename :: file:filename(), + Options :: [percept_option()]) -> + {'ok', port()} | {'already_started', port()}. profile(Filename, Options) -> percept_profile:start(Filename, Options). @@ -105,16 +104,15 @@ profile(Filename, Options) -> %% @spec profile(Filename::string(), MFA::mfa(), [percept_option()]) -> ok | {already_started, Port} | {error, not_started} %% @see percept_profile --spec(profile/3 :: ( - Filename :: string(), - Entry :: {atom(), atom(), list()}, - Options :: [percept_option()]) -> - 'ok' | {'already_started', port()} | {'error', 'not_started'}). +-spec profile(Filename :: file:filename(), + Entry :: {atom(), atom(), list()}, + Options :: [percept_option()]) -> + 'ok' | {'already_started', port()} | {'error', 'not_started'}. profile(Filename, MFA, Options) -> percept_profile:start(Filename, MFA, Options). --spec(stop_profile/0 :: () -> 'ok' | {'error', 'not_started'}). +-spec stop_profile() -> 'ok' | {'error', 'not_started'}. %% @spec stop_profile() -> ok | {'error', 'not_started'} %% @see percept_profile @@ -125,8 +123,8 @@ stop_profile() -> %% @spec analyze(string()) -> ok | {error, Reason} %% @doc Analyze file. --spec(analyze/1 :: (Filename :: string()) -> - 'ok' | {'error', any()}). +-spec analyze(Filename :: file:filename()) -> + 'ok' | {'error', any()}. analyze(Filename) -> case percept_db:start() of @@ -142,9 +140,8 @@ analyze(Filename) -> %% Reason = term() %% @doc Starts webserver. --spec(start_webserver/0 :: () -> - {'started', string(), pos_integer()} | - {'error', any()}). +-spec start_webserver() -> + {'started', string(), pos_integer()} | {'error', any()}. start_webserver() -> start_webserver(0). @@ -156,9 +153,8 @@ start_webserver() -> %% @doc Starts webserver. If port number is 0, an available port number will %% be assigned by inets. --spec(start_webserver/1 :: (Port :: non_neg_integer()) -> - {'started', string(), pos_integer()} | - {'error', any()}). +-spec start_webserver(Port :: non_neg_integer()) -> + {'started', string(), pos_integer()} | {'error', any()}. start_webserver(Port) when is_integer(Port) -> application:load(percept), @@ -255,20 +251,20 @@ trace_parser(Trace, {Count, Pid}) -> find_service_pid_from_port([], _) -> undefined; find_service_pid_from_port([{_, Pid, Options} | Services], Port) -> - case lists:keysearch(port, 1, Options) of + case lists:keyfind(port, 1, Options) of false -> find_service_pid_from_port(Services, Port); - {value, {port, Port}} -> + {port, Port} -> Pid end. find_service_port_from_pid([], _) -> undefined; find_service_port_from_pid([{_, Pid, Options} | _], Pid) -> - case lists:keysearch(port, 1, Options) of + case lists:keyfind(port, 1, Options) of false -> undefined; - {value, {port, Port}} -> + {port, Port} -> Port end; find_service_port_from_pid([{_, _, _} | Services], Pid) -> diff --git a/lib/percept/src/percept.hrl b/lib/percept/src/percept.hrl index a9afceb6d1..36b6f63a4d 100644 --- a/lib/percept/src/percept.hrl +++ b/lib/percept/src/percept.hrl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-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% %% @@ -23,10 +23,10 @@ %%% Type definitions %%% %%% ------------------- %%% --type(timestamp() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}). --type(true_mfa() :: {atom(), atom(), byte() | list()}). --type(state() :: 'active' | 'inactive'). --type(scheduler_id() :: {'scheduler_id', non_neg_integer()}). +-type timestamp() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}. +-type true_mfa() :: {atom(), atom(), byte() | list()}. +-type state() :: 'active' | 'inactive'. +-type scheduler_id() :: {'scheduler_id', non_neg_integer()}. %%% ------------------- %%% %%% Records %%% @@ -40,8 +40,7 @@ runnable_count = 0 %:: non_neg_integer() }). --record( - information, { +-record(information, { id ,%:: pid() | port(), name = undefined ,%:: atom() | string() | 'undefined', entry = undefined ,%:: true_mfa() | 'undefined', diff --git a/lib/percept/src/percept_db.erl b/lib/percept/src/percept_db.erl index dc85fa3510..edb0d79a29 100644 --- a/lib/percept/src/percept_db.erl +++ b/lib/percept/src/percept_db.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-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% %% @@ -72,7 +72,7 @@ %% Pid = pid() %% @doc Starts or restarts the percept database. --spec(start/0 :: () -> {'started', pid()} | {'restarted', pid()}). +-spec start() -> {'started', pid()} | {'restarted', pid()}. start() -> case erlang:whereis(percept_db) of @@ -92,7 +92,7 @@ start() -> %% Pid = pid() %% @doc Stops the percept database. --spec(stop/0 :: () -> 'not_started' | {'stopped', pid()}). +-spec stop() -> 'not_started' | {'stopped', pid()}. stop() -> case erlang:whereis(percept_db) of @@ -392,23 +392,14 @@ consolidate_runnability_loop(Key) -> consolidate_runnability_loop(ets:next(pdb_activity, Key)). list_all_ts() -> - ATs = [ Act#activity.timestamp || - Act <- select_query({activity, []})], - STs = [ Act#activity.timestamp || - Act <- select_query({scheduler, []})], + ATs = [Act#activity.timestamp || Act <- select_query({activity, []})], + STs = [Act#activity.timestamp || Act <- select_query({scheduler, []})], ITs = lists:flatten([ [I#information.start, I#information.stop] || I <- select_query({information, all})]), - % Filter out all undefined (non ts) - TsList = lists:filter( - fun(Element) -> - case Element of - {_,_,_} -> true; - _ -> false - end - end, ATs ++ STs ++ ITs), - TsList. + %% Filter out all undefined (non ts) + [Elem || Elem = {_,_,_} <- ATs ++ STs ++ ITs]. %% get_runnable_count(Type, State) -> RunnableCount %% In: diff --git a/lib/percept/src/percept_html.erl b/lib/percept/src/percept_html.erl index ffce7a98fa..7e0ea45783 100644 --- a/lib/percept/src/percept_html.erl +++ b/lib/percept/src/percept_html.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-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% -module(percept_html). @@ -172,12 +172,12 @@ div_tag_graph() -> width:40px; height:40px;\"></div></div>". --spec(url_graph/5 :: ( +-spec url_graph( Widht :: non_neg_integer(), Height :: non_neg_integer(), Min :: float(), Max :: float(), - Pids :: [pid()]) -> string()). + Pids :: [pid()]) -> string(). url_graph(W, H, Min, Max, []) -> "/cgi-bin/percept_graph/graph?range_min=" ++ term2html(float(Min)) @@ -508,10 +508,7 @@ cl_deltas([A,B|Ls], Out) -> cl_deltas([B|Ls], [B - A | Out]). join_strings(Strings) -> lists:flatten(Strings). --spec(join_strings_with/2 :: ( - Strings :: [string()], - Separator :: string()) -> - string()). +-spec join_strings_with(Strings :: [string()], Separator :: string()) -> string(). join_strings_with([S1, S2 | R], S) -> join_strings_with([join_strings_with(S1,S2,S) | R], S); @@ -522,7 +519,7 @@ join_strings_with(S1, S2, S) -> %%% Generic erlang2html --spec(html_table/1 :: (Rows :: [[string() | {'td' | 'th', string()}]]) -> string()). +-spec html_table(Rows :: [[string() | {'td' | 'th', string()}]]) -> string(). html_table(Rows) -> "<table>" ++ html_table_row(Rows) ++ "</table>". @@ -539,7 +536,7 @@ html_table_data([Data|Row]) -> "<td>" ++ Data ++ "</td>" ++ html_table_dat --spec(table_line/1 :: (Table :: [any()]) -> string()). +-spec table_line(Table :: [any()]) -> string(). table_line(List) -> table_line(List, ["<tr>"]). table_line([], Out) -> lists:flatten(lists:reverse(["</tr>\n"|Out])); @@ -548,16 +545,12 @@ table_line([Element | Elements], Out) when is_list(Element) -> table_line([Element | Elements], Out) -> table_line(Elements, ["<td>" ++ term2html(Element) ++ "</td>"|Out]). --spec(term2html/1 :: (any()) -> string()). +-spec term2html(any()) -> string(). term2html(Term) when is_float(Term) -> lists:flatten(io_lib:format("~.4f", [Term])); term2html(Term) -> lists:flatten(io_lib:format("~p", [Term])). --spec(mfa2html/1 :: (MFA :: { - atom(), - atom(), - list() | integer()}) -> - string()). +-spec mfa2html(MFA :: {atom(), atom(), list() | integer()}) -> string(). mfa2html({Module, Function, Arguments}) when is_list(Arguments) -> lists:flatten(io_lib:format("~p:~p/~p", [Module, Function, length(Arguments)])); @@ -566,7 +559,7 @@ mfa2html({Module, Function, Arity}) when is_integer(Arity) -> mfa2html(_) -> "undefined". --spec(pid2html/1 :: (Pid :: pid() | port()) -> string()). +-spec pid2html(Pid :: pid() | port()) -> string(). pid2html(Pid) when is_pid(Pid) -> PidString = term2html(Pid), @@ -577,14 +570,14 @@ pid2html(Pid) when is_port(Pid) -> pid2html(_) -> "undefined". --spec(image_string/1 :: (Request :: string()) -> string()). +-spec image_string(Request :: string()) -> string(). image_string(Request) -> "<img border=0 src=\"/cgi-bin/percept_graph/" ++ Request ++ " \">". --spec(image_string/2 :: (atom() | string(), list()) -> string()). +-spec image_string(atom() | string(), list()) -> string(). image_string(Request, Options) when is_atom(Request), is_list(Options) -> image_string(image_string_head(erlang:atom_to_list(Request), Options, [])); @@ -610,13 +603,13 @@ image_string_tail(Request, [{Type, Value} | Opts], Out) -> %%% percept conversions --spec(pid2value/1 :: (Pid :: pid()) -> string()). +-spec pid2value(Pid :: pid()) -> string(). pid2value(Pid) -> String = lists:flatten(io_lib:format("~p", [Pid])), lists:sublist(String, 2, erlang:length(String)-2). --spec(value2pid/1 :: (Value :: string()) -> pid()). +-spec value2pid(Value :: string()) -> pid(). value2pid(Value) -> String = lists:flatten("<" ++ Value ++ ">"), @@ -625,10 +618,8 @@ value2pid(Value) -> %%% get value --spec(get_option_value/2 :: ( - Option :: string(), - Options :: [{string(),any()}]) -> - {'error', any()} | bool() | pid() | [pid()] | number()). +-spec get_option_value(Option :: string(), Options :: [{string(),any()}]) -> + {'error', any()} | boolean() | pid() | [pid()] | number(). get_option_value(Option, Options) -> case catch get_option_value0(Option, Options) of @@ -662,8 +653,7 @@ get_default_option_value(Option) -> _ -> {error, {undefined_default_option, Option}} end. --spec(get_number_value/1 :: (Value :: string()) -> - number() | {'error', 'illegal_number'}). +-spec get_number_value(string()) -> number() | {'error', 'illegal_number'}. get_number_value(Value) -> % Try float @@ -710,7 +700,7 @@ menu() -> <li><a href=/cgi-bin/percept_html/page>overview</a></li> </ul></div>\n". --spec(error_msg/1 :: (Error :: string()) -> string()). +-spec error_msg(Error :: string()) -> string(). error_msg(Error) -> "<table width=300> diff --git a/lib/runtime_tools/src/percept_profile.erl b/lib/runtime_tools/src/percept_profile.erl index b333dee0cf..cdc7a0fca1 100644 --- a/lib/runtime_tools/src/percept_profile.erl +++ b/lib/runtime_tools/src/percept_profile.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% %% @@ -41,7 +41,7 @@ %% @type percept_option() = procs | ports | exclusive --type(percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'). +-type percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'. %%========================================================================== %% @@ -52,8 +52,8 @@ %% @spec start(Filename::string()) -> {ok, Port} | {already_started, Port} %% @equiv start(Filename, [procs]) --spec(start/1 :: (Filename :: string()) -> - {'ok', port()} | {'already_started', port()}). +-spec start(Filename :: file:filename()) -> + {'ok', port()} | {'already_started', port()}. start(Filename) -> profile_to_file(Filename, [procs]). @@ -64,10 +64,9 @@ start(Filename) -> %% All events are stored in the file given by Filename. %% An explicit call to stop/0 is needed to stop profiling. --spec(start/2 :: ( - Filename :: string(), - Options :: [percept_option()]) -> - {'ok', port()} | {'already_started', port()}). +-spec start(Filename :: file:filename(), + Options :: [percept_option()]) -> + {'ok', port()} | {'already_started', port()}. start(Filename, Options) -> profile_to_file(Filename, Options). @@ -79,11 +78,10 @@ start(Filename, Options) -> %% No explicit call to stop/0 is needed, the profiling stops when %% the entry function returns. --spec(start/3 :: ( - Filename :: string(), - Entry :: {atom(), atom(), list()}, - Options :: [percept_option()]) -> - 'ok' | {'already_started', port()} | {'error', 'not_started'}). +-spec start(Filename :: file:filename(), + Entry :: {atom(), atom(), list()}, + Options :: [percept_option()]) -> + 'ok' | {'already_started', port()} | {'error', 'not_started'}. start(Filename, {Module, Function, Args}, Options) -> case whereis(percept_port) of @@ -107,11 +105,11 @@ deliver_all_trace() -> receive {Tracer, ok} -> ok end, erlang:trace(Tracee, false, [procs]), ok. --spec(stop/0 :: () -> 'ok' | {'error', 'not_started'}). %% @spec stop() -> ok | {'error', 'not_started'} %% @doc Stops profiling. +-spec stop() -> 'ok' | {'error', 'not_started'}. stop() -> erlang:system_profile(undefined, [runnable_ports, runnable_procs]), @@ -192,5 +190,4 @@ parse_profile_options([Opt|Opts], {TOpts, POpts}) -> }); _ -> parse_profile_options(Opts, {TOpts, POpts}) - end. diff --git a/lib/sasl/src/sasl.app.src b/lib/sasl/src/sasl.app.src index cfe4b81ab6..8c814cfaf5 100644 --- a/lib/sasl/src/sasl.app.src +++ b/lib/sasl/src/sasl.app.src @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-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% %% {application, sasl, @@ -32,6 +32,8 @@ sasl_report, sasl_report_tty_h, sasl_report_file_h, + si, + si_sasl_supp, systools, systools_make, systools_rc, diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl index 979d80159e..d1babaffff 100644 --- a/lib/sasl/src/sasl.erl +++ b/lib/sasl/src/sasl.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1996-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% %% -module(sasl). @@ -126,13 +126,13 @@ type(_) -> all. add_error_logger_mf(undefined) -> ok; add_error_logger_mf({Dir, MaxB, MaxF}) -> error_logger:add_report_handler( - log_mf_h, log_mf_h:init(Dir, MaxB, MaxF, {sasl, pred})). + log_mf_h, log_mf_h:init(Dir, MaxB, MaxF, fun pred/1)). delete_error_logger_mf(undefined) -> ok; delete_error_logger_mf(_) -> error_logger:delete_report_handler(log_mf_h). -pred({_Type, GL, _Msg}) when node(GL) /= node() -> false; +pred({_Type, GL, _Msg}) when node(GL) =/= node() -> false; pred(_) -> true. %%%----------------------------------------------------------------- diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 780bb2e741..2ed4476440 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -73,8 +73,7 @@ gen_xml() -> -record(hs,{alias,skip,fs,fopt,ev,acc,info}). init_defs(List0) -> - List1 = to_lists(List0), - lists:map(fun mangle_info/1, List1). + [mangle_info(L) || L <- to_lists(List0)]. mangle_info(E={enum,Type0,SkipStr}) -> Type = case is_atom(Type0) of true -> atom_to_list(Type0); false -> Type0 end, @@ -138,9 +137,9 @@ parse_defs([{class,Name,Parent,Info}|Rest], Acc0) -> Defs0 = load_members(FileName, Name, gb_trees:empty(), Tab, Type, Info), put(current_class, Name), - Class0 = #class{name=name(Name,Info),parent=Parent, + Class0 = #class{name=name(Name,Info), parent=Parent, doc=get_value(doc,Info#hs.info,undefined), - file=FileName,options=Info#hs.info, id=next_id(class_id)}, + file=FileName, options=Info#hs.info, id=next_id(class_id)}, ParseClass = fun(Member,{Class,Dfs}) -> parse_class(Member,Tab,Dfs,Class,Info) end, @@ -161,12 +160,11 @@ parse_defs([], Acc) -> reverse(Acc). meta_info(C=#class{name=CName,methods=Ms0}) -> Ms = lists:append(Ms0), - HaveConstructor = - lists:keysearch(constructor, #method.method_type, Ms) =/= false, + HaveConstructor = lists:keymember(constructor, #method.method_type, Ms), case lists:keysearch(destructor, #method.method_type, Ms) of false when HaveConstructor -> - Dest = #method{name="destroy",id=next_id(func_id), - method_type=destructor, params=[this(CName)]}, + Dest = #method{name = "destroy", id = next_id(func_id), + method_type = destructor, params = [this(CName)]}, C#class{methods = [[Dest]|Ms0]}; false -> C#class{abstract = true}; @@ -451,9 +449,9 @@ find_erl_alias_name(MName,Ps,Fopts) -> _ -> Find = fun({all,AliasName},Acc) -> [AliasName|Acc]; ({Var,AliasName},Acc) -> - case lists:keysearch(Var, #param.name, Ps) of - {value, _} -> [AliasName|Acc]; - _ -> Acc + case lists:keymember(Var, #param.name, Ps) of + true -> [AliasName|Acc]; + false -> Acc end end, case lists:foldl(Find, [], Aliases) of @@ -873,11 +871,14 @@ add_method2(M0=#method{name=Name,params=Ps0,type=T0},#class{name=CName,parent=Pa end, M1 = M0#method{defined_in=CName, min_arity = length(Req), - max_arity = length(Req) + if length(Opt) > 0 -> 1; true -> 0 end, + max_arity = length(Req) + case Opt of + [_ | _] -> 1; + _ -> 0 + end, type = Type, method_type = IsStatic, where = Where, - id=next_id(func_id), + id = next_id(func_id), pre_hook = get_opt(pre_hook, Name, length(Ps), Opts), post_hook = get_opt(post_hook, Name, length(Ps), Opts), doc = get_opt(doc, Name, length(Ps), Opts) @@ -1037,10 +1038,10 @@ types_differ([list|R1], [opt_list|R2]) -> types_differ([opt_list|R1], [list|R2]) -> types_differ(R1,R2); types_differ([C1|R1], [C2|R2]) when is_tuple(C1), is_tuple(C2) -> - (size(C1) =/= size(C2)) orelse types_differ(R1,R2); + (tuple_size(C1) =/= tuple_size(C2)) orelse types_differ(R1,R2); types_differ([C1|_R1], [_C2|_R2]) when is_tuple(C1) -> true; -types_differ([_C1|_R1], [C2|_R2]) when is_tuple(C2)-> +types_differ([_C1|_R1], [C2|_R2]) when is_tuple(C2) -> true; types_differ([_C1|R1], [_C2|R2]) -> %% More cases? types_differ(R1,R2); @@ -1198,7 +1199,7 @@ name(Name0, #hs{alias=Alias}) -> Name0; "esaBrekciP" ++ _ -> %% Arrg uses base Name0; - "esaB" ++ Rest when hd(Name0) == $w -> + "esaB" ++ Rest when hd(Name0) =:= $w -> %% Arrg Some decl uses base class directly reverse(Rest); _F -> diff --git a/lib/wx/examples/demo/demo_html_tagger.erl b/lib/wx/examples/demo/demo_html_tagger.erl index 9b6d1fd950..243e5d659f 100644 --- a/lib/wx/examples/demo/demo_html_tagger.erl +++ b/lib/wx/examples/demo/demo_html_tagger.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-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% -module(demo_html_tagger). @@ -462,7 +462,7 @@ fix_remote([H|T]) -> fix_remote([]) -> []. --spec is_keyword(atom()) -> bool(). +-spec is_keyword(atom()) -> boolean(). is_keyword('after' ) -> true; is_keyword('and') -> true; |