aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/cerl.erl32
-rw-r--r--lib/erl_docgen/priv/xsl/db_html.xsl14
-rw-r--r--lib/eunit/doc/overview.edoc2
-rw-r--r--lib/eunit/include/eunit.hrl8
-rw-r--r--lib/inets/src/ftp/ftp.erl4
-rw-r--r--lib/inets/src/inets_app/Makefile3
-rw-r--r--lib/inets/src/inets_app/inets.app.src1
-rw-r--r--lib/inets/src/inets_app/inets_lib.erl2
-rw-r--r--lib/inets/src/inets_app/inets_time_compat.erl72
-rw-r--r--lib/inets/src/tftp/tftp_logger.erl4
-rw-r--r--lib/inets/src/tftp/tftp_sup.erl4
-rw-r--r--lib/inets/test/ftp_suite_lib.erl2
-rw-r--r--lib/inets/test/httpc_SUITE.erl4
-rw-r--r--lib/inets/test/httpd_time_test.erl2
-rw-r--r--lib/kernel/doc/src/application.xml3
-rw-r--r--lib/kernel/doc/src/file.xml3
-rw-r--r--lib/kernel/doc/src/gen_sctp.xml6
-rw-r--r--lib/kernel/doc/src/gen_tcp.xml3
-rw-r--r--lib/kernel/doc/src/gen_udp.xml1
-rw-r--r--lib/kernel/doc/src/inet.xml4
-rw-r--r--lib/kernel/test/erl_prim_loader_SUITE.erl24
-rw-r--r--lib/observer/src/observer_lib.erl19
-rw-r--r--lib/observer/src/observer_procinfo.erl8
-rw-r--r--lib/observer/src/observer_sys_wx.erl98
-rw-r--r--lib/observer/src/observer_wx.erl58
-rw-r--r--lib/observer/test/observer_SUITE.erl2
-rw-r--r--lib/odbc/src/odbc.erl2
-rw-r--r--lib/percept/src/egd.erl46
-rw-r--r--lib/percept/src/egd.hrl3
-rw-r--r--lib/percept/src/egd_font.erl11
-rw-r--r--lib/percept/src/egd_render.erl1
-rw-r--r--lib/percept/src/percept.erl52
-rw-r--r--lib/percept/src/percept_db.erl54
-rw-r--r--lib/percept/src/percept_graph.erl20
-rw-r--r--lib/percept/src/percept_html.erl102
-rwxr-xr-xlib/public_key/priv/generate2
-rw-r--r--lib/ssl/src/ssl_connection.erl86
-rw-r--r--lib/stdlib/doc/src/digraph.xml2
-rw-r--r--lib/stdlib/doc/src/digraph_utils.xml7
-rw-r--r--lib/stdlib/doc/src/erl_anno.xml4
-rw-r--r--lib/stdlib/doc/src/erl_parse.xml12
-rw-r--r--lib/stdlib/doc/src/ets.xml7
-rw-r--r--lib/stdlib/doc/src/sofs.xml3
-rw-r--r--lib/tools/emacs/erlang-test.el107
-rw-r--r--lib/tools/emacs/erlang.el254
-rw-r--r--lib/tools/emacs/test.erl.indented13
-rw-r--r--lib/tools/emacs/test.erl.orig13
-rw-r--r--lib/xmerl/src/xmerl_eventp.erl4
-rw-r--r--lib/xmerl/src/xmerl_sax_parser.erl12
-rw-r--r--lib/xmerl/src/xmerl_sax_parser_base.erlsrc26
-rw-r--r--lib/xmerl/src/xmerl_scan.erl2
-rw-r--r--lib/xmerl/src/xmerl_xsd.erl26
-rw-r--r--lib/xmerl/src/xmerl_xsd_type.erl14
53 files changed, 744 insertions, 524 deletions
diff --git a/lib/compiler/src/cerl.erl b/lib/compiler/src/cerl.erl
index 6dc162db40..61abae344c 100644
--- a/lib/compiler/src/cerl.erl
+++ b/lib/compiler/src/cerl.erl
@@ -1955,7 +1955,7 @@ is_c_var(_) ->
false.
-%% @spec c_fname(Name::atom(), Arity::integer()) -> cerl()
+%% @spec c_fname(Name::atom(), Arity::arity()) -> cerl()
%% @equiv c_var({Name, Arity})
%% @see fname_id/1
%% @see fname_arity/1
@@ -1963,18 +1963,18 @@ is_c_var(_) ->
%% @see ann_c_fname/3
%% @see update_c_fname/3
--spec c_fname(atom(), non_neg_integer()) -> c_var().
+-spec c_fname(atom(), arity()) -> c_var().
c_fname(Atom, Arity) ->
c_var({Atom, Arity}).
-%% @spec ann_c_fname(As::[term()], Name::atom(), Arity::integer()) ->
+%% @spec ann_c_fname(As::[term()], Name::atom(), Arity::arity()) ->
%% cerl()
%% @equiv ann_c_var(As, {Atom, Arity})
%% @see c_fname/2
--spec ann_c_fname([term()], atom(), non_neg_integer()) -> c_var().
+-spec ann_c_fname([term()], atom(), arity()) -> c_var().
ann_c_fname(As, Atom, Arity) ->
ann_c_var(As, {Atom, Arity}).
@@ -1992,13 +1992,13 @@ update_c_fname(#c_var{name = {_, Arity}, anno = As}, Atom) ->
#c_var{name = {Atom, Arity}, anno = As}.
-%% @spec update_c_fname(Old::cerl(), Name::atom(), Arity::integer()) ->
+%% @spec update_c_fname(Old::cerl(), Name::atom(), Arity::arity()) ->
%% cerl()
%% @equiv update_c_var(Old, {Atom, Arity})
%% @see update_c_fname/2
%% @see c_fname/2
--spec update_c_fname(c_var(), atom(), integer()) -> c_var().
+-spec update_c_fname(c_var(), atom(), arity()) -> c_var().
update_c_fname(Node, Atom, Arity) ->
update_c_var(Node, {Atom, Arity}).
@@ -2047,14 +2047,14 @@ fname_id(#c_var{name={A,_}}) ->
A.
-%% @spec fname_arity(cerl()) -> byte()
+%% @spec fname_arity(cerl()) -> arity()
%%
%% @doc Returns the arity part of an abstract function name variable.
%%
%% @see fname_id/1
%% @see c_fname/2
--spec fname_arity(c_var()) -> byte().
+-spec fname_arity(c_var()) -> arity().
fname_arity(#c_var{name={_,N}}) ->
N.
@@ -2500,7 +2500,7 @@ fun_body(Node) ->
Node#c_fun.body.
-%% @spec fun_arity(Node::cerl()) -> integer()
+%% @spec fun_arity(Node::cerl()) -> arity()
%%
%% @doc Returns the number of parameter subtrees of an abstract
%% fun-expression.
@@ -2511,7 +2511,7 @@ fun_body(Node) ->
%% @see c_fun/2
%% @see fun_vars/1
--spec fun_arity(c_fun()) -> non_neg_integer().
+-spec fun_arity(c_fun()) -> arity().
fun_arity(Node) ->
length(fun_vars(Node)).
@@ -3418,7 +3418,7 @@ apply_args(Node) ->
Node#c_apply.args.
-%% @spec apply_arity(Node::cerl()) -> integer()
+%% @spec apply_arity(Node::cerl()) -> arity()
%%
%% @doc Returns the number of argument subtrees of an abstract
%% function application.
@@ -3430,7 +3430,7 @@ apply_args(Node) ->
%% @see c_apply/2
%% @see apply_args/1
--spec apply_arity(c_apply()) -> non_neg_integer().
+-spec apply_arity(c_apply()) -> arity().
apply_arity(Node) ->
length(apply_args(Node)).
@@ -3536,7 +3536,7 @@ call_args(Node) ->
Node#c_call.args.
-%% @spec call_arity(Node::cerl()) -> integer()
+%% @spec call_arity(Node::cerl()) -> arity()
%%
%% @doc Returns the number of argument subtrees of an abstract
%% inter-module call.
@@ -3548,7 +3548,7 @@ call_args(Node) ->
%% @see c_call/3
%% @see call_args/1
--spec call_arity(c_call()) -> non_neg_integer().
+-spec call_arity(c_call()) -> arity().
call_arity(Node) ->
length(call_args(Node)).
@@ -3640,7 +3640,7 @@ primop_args(Node) ->
Node#c_primop.args.
-%% @spec primop_arity(Node::cerl()) -> integer()
+%% @spec primop_arity(Node::cerl()) -> arity()
%%
%% @doc Returns the number of argument subtrees of an abstract
%% primitive operation call.
@@ -3652,7 +3652,7 @@ primop_args(Node) ->
%% @see c_primop/2
%% @see primop_args/1
--spec primop_arity(c_primop()) -> non_neg_integer().
+-spec primop_arity(c_primop()) -> arity().
primop_arity(Node) ->
length(primop_args(Node)).
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl
index a3c71fea15..c2d7d40446 100644
--- a/lib/erl_docgen/priv/xsl/db_html.xsl
+++ b/lib/erl_docgen/priv/xsl/db_html.xsl
@@ -383,9 +383,7 @@
</xsl:choose>
</xsl:when>
<xsl:otherwise> <!-- <datatype> with <name> -->
- <span class="bold_code">
- <xsl:apply-templates/>
- </span>
+ <xsl:call-template name="name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -1855,6 +1853,7 @@
</xsl:choose>
</xsl:template>
+ <!-- Used both in <datatype> and in <func>! -->
<xsl:template name="name">
<xsl:variable name="tmpstring">
@@ -1911,7 +1910,14 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/>
+ <xsl:choose>
+ <xsl:when test="ancestor::datatype">
+ <a name="type-{$fname}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/>
+ </xsl:when>
+ <xsl:otherwise>
+ <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:otherwise>
<span class="bold_code"><xsl:value-of select="."/></span>
diff --git a/lib/eunit/doc/overview.edoc b/lib/eunit/doc/overview.edoc
index 12ea02f442..ca7ffb83a4 100644
--- a/lib/eunit/doc/overview.edoc
+++ b/lib/eunit/doc/overview.edoc
@@ -693,6 +693,8 @@ it like `debugMsg'. The result is always `ok'.</dd>
shown truncated.) The result is always the value of `Expr', so this
macro can be wrapped around any expression to display its value when
the code is compiled with debugging enabled.</dd>
+<dt>`debugValAll(Expr)'</dt>
+<dd>This is almost same as `debugVal(Expr)`, but doesn't truncate terms to print.</dd>
<dt>`debugTime(Text,Expr)'</dt>
<dd>Prints `Text' and the wall clock time for evaluation of `Expr'. The
result is always the value of `Expr', so this macro can be wrapped
diff --git a/lib/eunit/include/eunit.hrl b/lib/eunit/include/eunit.hrl
index 8f678b0290..b6dbe2d706 100644
--- a/lib/eunit/include/eunit.hrl
+++ b/lib/eunit/include/eunit.hrl
@@ -212,6 +212,7 @@
-define(debugHere, ok).
-define(debugFmt(S, As), ok).
-define(debugVal(E), (E)).
+-define(debugValAll(E), (E)).
-define(debugTime(S, E), (E)).
-else.
-define(debugMsg(S),
@@ -229,6 +230,13 @@
__V
end)(E))
end).
+-define(debugValAll(E),
+ begin
+ ((fun (__V) ->
+ ?debugFmt(<<"~ts = ~tp">>, [(??E), __V]),
+ __V
+ end)(E))
+ end).
-define(debugTime(S, E),
begin
((fun () ->
diff --git a/lib/inets/src/ftp/ftp.erl b/lib/inets/src/ftp/ftp.erl
index db6260c7af..c2ca511795 100644
--- a/lib/inets/src/ftp/ftp.erl
+++ b/lib/inets/src/ftp/ftp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2016. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -2177,7 +2177,7 @@ handle_caller(#state{caller = {transfer_data, {Cmd, Bin, RemoteFile}}} =
%% Connect to FTP server at Host (default is TCP port 21)
%% in order to establish a control connection.
setup_ctrl_connection(Host, Port, Timeout, State) ->
- MsTime = inets_time_compat:monotonic_time(),
+ MsTime = erlang:monotonic_time(),
case connect(Host, Port, Timeout, State) of
{ok, IpFam, CSock} ->
NewState = State#state{csock = {tcp, CSock}, ipfamily = IpFam},
diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile
index 1d870c14e8..eb0098dbee 100644
--- a/lib/inets/src/inets_app/Makefile
+++ b/lib/inets/src/inets_app/Makefile
@@ -48,8 +48,7 @@ MODULES = \
inets_app \
inets_sup \
inets_trace \
- inets_lib \
- inets_time_compat
+ inets_lib
INTERNAL_HRL_FILES = inets_internal.hrl
EXTERNAL_HRL_FILES = ../../include/httpd.hrl \
diff --git a/lib/inets/src/inets_app/inets.app.src b/lib/inets/src/inets_app/inets.app.src
index 5706a335d7..eb4be932ac 100644
--- a/lib/inets/src/inets_app/inets.app.src
+++ b/lib/inets/src/inets_app/inets.app.src
@@ -28,7 +28,6 @@
inets_service,
inets_trace,
inets_lib,
- inets_time_compat,
%% FTP
ftp,
diff --git a/lib/inets/src/inets_app/inets_lib.erl b/lib/inets/src/inets_app/inets_lib.erl
index 6e16f5ef6e..8993be29e4 100644
--- a/lib/inets/src/inets_app/inets_lib.erl
+++ b/lib/inets/src/inets_app/inets_lib.erl
@@ -27,7 +27,7 @@
%% Help function, elapsed milliseconds since T0
millisec_passed({_,_,_} = T0 ) ->
%% OTP 17 and earlier
- timer:now_diff(inets_time_compat:timestamp(), T0) div 1000;
+ timer:now_diff(erlang:timestamp(), T0) div 1000;
millisec_passed(T0) ->
%% OTP 18
diff --git a/lib/inets/src/inets_app/inets_time_compat.erl b/lib/inets/src/inets_app/inets_time_compat.erl
deleted file mode 100644
index 475f0685dc..0000000000
--- a/lib/inets/src/inets_app/inets_time_compat.erl
+++ /dev/null
@@ -1,72 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2015-2015. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%% This module is created to be able to execute on ERTS versions both
-%% earlier and later than 7.0.
-
--module(inets_time_compat).
-
-%% We don't want warnings about the use of erlang:now/0 in
-%% this module.
--compile(nowarn_deprecated_function).
-
--export([monotonic_time/0,
- timestamp/0,
- unique_integer/0,
- unique_integer/1]).
-
-monotonic_time() ->
- try
- erlang:monotonic_time()
- catch
- error:undef ->
- %% Use Erlang system time as monotonic time
- erlang_system_time_fallback()
- end.
-
-timestamp() ->
- try
- erlang:timestamp()
- catch
- error:undef ->
- erlang:now()
- end.
-
-unique_integer() ->
- try
- erlang:unique_integer()
- catch
- error:undef ->
- erlang_system_time_fallback()
- end.
-
-unique_integer(Modifiers) ->
- try
- erlang:unique_integer(Modifiers)
- catch
- error:badarg ->
- erlang:error(badarg, [Modifiers]);
- error:undef ->
- erlang_system_time_fallback()
- end.
-
-erlang_system_time_fallback() ->
- {MS, S, US} = erlang:now(),
- (MS*1000000+S)*1000000+US.
diff --git a/lib/inets/src/tftp/tftp_logger.erl b/lib/inets/src/tftp/tftp_logger.erl
index 5e5d1d56c7..a869958484 100644
--- a/lib/inets/src/tftp/tftp_logger.erl
+++ b/lib/inets/src/tftp/tftp_logger.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2016. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ info_msg(Format, Data) ->
%%-------------------------------------------------------------------
add_timestamp(Format, Data) ->
- Time = inets_time_compat:timestamp(),
+ Time = erlang:timestamp(),
{{_Y, _Mo, _D}, {H, Mi, S}} = calendar:now_to_universal_time(Time),
%% {"~p-~s-~sT~s:~s:~sZ,~6.6.0w tftp: " ++ Format ++ "\n",
%% [Y, t(Mo), t(D), t(H), t(Mi), t(S), MicroSecs | Data]}.
diff --git a/lib/inets/src/tftp/tftp_sup.erl b/lib/inets/src/tftp/tftp_sup.erl
index 98b92cc87c..40b67c499c 100644
--- a/lib/inets/src/tftp/tftp_sup.erl
+++ b/lib/inets/src/tftp/tftp_sup.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2015. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ unique_name(Options) ->
{value, {_, Port}} when is_integer(Port), Port > 0 ->
{tftpd, Port};
_ ->
- {tftpd, inets_time_compat:unique_integer([positive])}
+ {tftpd, erlang:unique_integer([positive])}
end.
default_kill_after() ->
diff --git a/lib/inets/test/ftp_suite_lib.erl b/lib/inets/test/ftp_suite_lib.erl
index 71985df877..0f82b1c1c3 100644
--- a/lib/inets/test/ftp_suite_lib.erl
+++ b/lib/inets/test/ftp_suite_lib.erl
@@ -1353,7 +1353,7 @@ do_delete(Pid, Config) ->
do_mkdir(Pid) ->
NewDir = "earl_" ++
- integer_to_list(inets_time_compat:unique_integer([positive])),
+ integer_to_list(erlang:unique_integer([positive])),
ok = ftp:cd(Pid, "incoming"),
{ok, CurrDir} = ftp:pwd(Pid),
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index f9b3aa5b59..e6c4e48feb 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -2077,7 +2077,7 @@ run_clients(NumClients, ServerPort, SeqNumServer) ->
wait4clients([], _Timeout) ->
ok;
wait4clients(Clients, Timeout) when Timeout > 0 ->
- Time = inets_time_compat:monotonic_time(),
+ Time = erlang:monotonic_time(),
receive
{'DOWN', _MRef, process, Pid, normal} ->
@@ -2177,7 +2177,7 @@ parse_connection_type(Request) ->
end.
set_random_seed() ->
- Unique = inets_time_compat:unique_integer(),
+ Unique = erlang:unique_integer(),
A = erlang:phash2([make_ref(), self(), Unique]),
random:seed(A, A, A).
diff --git a/lib/inets/test/httpd_time_test.erl b/lib/inets/test/httpd_time_test.erl
index fddc0003cd..e858ddf4f6 100644
--- a/lib/inets/test/httpd_time_test.erl
+++ b/lib/inets/test/httpd_time_test.erl
@@ -117,7 +117,7 @@ main(N, SocketType, Host, Port, Time)
loop(Pollers, Timeout) ->
d("loop -> entry when"
"~n Timeout: ~p", [Timeout]),
- Start = inets_time_compat:monotonic_time(),
+ Start = erlang:monotonic_time(),
receive
{'EXIT', Pid, {poller_stat_failure, SocketType, Host, Port, Time, Reason}} ->
diff --git a/lib/kernel/doc/src/application.xml b/lib/kernel/doc/src/application.xml
index 3928078932..8d33aa86e7 100644
--- a/lib/kernel/doc/src/application.xml
+++ b/lib/kernel/doc/src/application.xml
@@ -62,8 +62,7 @@
</datatype>
<datatype>
<name>tuple_of(T)</name>
- <desc><p><marker id="type-tuple_of"/>
- A tuple where the elements are of type <c>T</c>.</p></desc>
+ <desc><p>A tuple where the elements are of type <c>T</c>.</p></desc>
</datatype>
</datatypes>
<funcs>
diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml
index a73038ac58..7d86c3ebcb 100644
--- a/lib/kernel/doc/src/file.xml
+++ b/lib/kernel/doc/src/file.xml
@@ -90,8 +90,7 @@
<datatype>
<name>fd()</name>
<desc>
- <p><marker id="type-fd"/>
- A file descriptor representing a file opened in
+ <p>A file descriptor representing a file opened in
<seealso marker="#raw"><c>raw</c></seealso> mode.</p>
</desc>
</datatype>
diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml
index 57307cd594..737800c6b1 100644
--- a/lib/kernel/doc/src/gen_sctp.xml
+++ b/lib/kernel/doc/src/gen_sctp.xml
@@ -72,8 +72,7 @@
<datatype>
<name>assoc_id()</name>
<desc>
- <p><marker id="type-assoc_id"/>
- An opaque term returned in, for example, <c>#sctp_paddr_change{}</c>,
+ <p>An opaque term returned in, for example, <c>#sctp_paddr_change{}</c>,
which identifies an association for an SCTP socket. The term
is opaque except for the special value <c>0</c>, which has a
meaning such as "the whole endpoint" or "all future associations".</p>
@@ -88,12 +87,11 @@
</datatype>
<datatype>
<name name="option_name"/>
- <desc><marker id="type-sctp_socket"></marker></desc>
</datatype>
<datatype>
<name>sctp_socket()</name>
<desc>
- <p><marker id="type-sctp_socket"/>Socket identifier returned from
+ <p>Socket identifier returned from
<seealso marker="#open/0"><c>open/*</c></seealso>.</p>
<marker id="exports"></marker>
</desc>
diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml
index 919178195f..8bd94892ad 100644
--- a/lib/kernel/doc/src/gen_tcp.xml
+++ b/lib/kernel/doc/src/gen_tcp.xml
@@ -79,8 +79,7 @@ do_recv(Sock, Bs) ->
</datatype>
<datatype>
<name>socket()</name>
- <desc><p><marker id="type-socket"/>
- As returned by
+ <desc><p>As returned by
<seealso marker="#accept/1"><c>accept/1,2</c></seealso> and
<seealso marker="#connect/3"><c>connect/3,4</c></seealso>.</p>
<marker id="connect"></marker>
diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml
index 906883ed34..3db291600d 100644
--- a/lib/kernel/doc/src/gen_udp.xml
+++ b/lib/kernel/doc/src/gen_udp.xml
@@ -45,7 +45,6 @@
<datatype>
<name>socket()</name>
<desc>
- <marker id="type-socket"/>
<p>As returned by
<seealso marker="#open/1"><c>open/1,2</c></seealso>.</p>
</desc>
diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml
index cfff393b8c..bca04aa244 100644
--- a/lib/kernel/doc/src/inet.xml
+++ b/lib/kernel/doc/src/inet.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>1997</year><year>2015</year>
+ <year>1997</year><year>2016</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -128,7 +128,7 @@ fe80::204:acff:fe17:bf38
<datatype>
<name>socket()</name>
<desc>
- <p><marker id="type-socket"></marker>See
+ <p>See
<seealso marker="gen_tcp#type-socket"><c>gen_tcp:type-socket</c></seealso>
and
<seealso marker="gen_udp#type-socket"><c>gen_udp:type-socket</c></seealso>.
diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl
index 4f3881d27e..b6417210b9 100644
--- a/lib/kernel/test/erl_prim_loader_SUITE.erl
+++ b/lib/kernel/test/erl_prim_loader_SUITE.erl
@@ -108,13 +108,18 @@ get_file(Config) when is_list(Config) ->
error = erl_prim_loader:get_file({dummy}),
ok.
-get_modules(_Config) ->
+get_modules(Config) ->
case test_server:is_cover() of
- false -> do_get_modules();
+ false -> do_get_modules(Config);
true -> {skip,"Cover"}
end.
-do_get_modules() ->
+do_get_modules(Config) ->
+ PrivDir = proplists:get_value(priv_dir, Config),
+ NotADir = atom_to_list(?FUNCTION_NAME) ++ "_not_a_dir",
+ ok = file:write_file(filename:join(PrivDir, NotADir), <<>>),
+ ok = file:set_cwd(PrivDir),
+
MsGood = lists:sort([lists,gen_server,gb_trees,code_server]),
Ms = [certainly_not_existing|MsGood],
SuccExp = [begin
@@ -129,8 +134,10 @@ do_get_modules() ->
Path = code:get_path(),
Process = fun(_, F, Code) -> {ok,{F,erlang:md5(Code)}} end,
- {ok,{Succ,FailExp}} = erl_prim_loader:get_modules(Ms, Process, Path),
- SuccExp = lists:sort(Succ),
+ {ok,{SuccExp,FailExp}} = get_modules_sorted(Ms, Process, Path),
+
+ %% Test that an 'enotdir' error can be handled.
+ {ok,{SuccExp,FailExp}} = get_modules_sorted(Ms, Process, [NotADir|Path]),
Name = inet_get_modules,
{ok, Node, BootPid} = complete_start_node(Name),
@@ -147,6 +154,13 @@ do_get_modules() ->
ok.
+get_modules_sorted(Ms, Process, Path) ->
+ case erl_prim_loader:get_modules(Ms, Process, Path) of
+ {ok,{Succ,FailExp}} ->
+ {ok,{lists:sort(Succ),lists:sort(FailExp)}};
+ Other ->
+ Other
+ end.
normalize_and_backslash(Config) ->
%% Test OTP-11170
diff --git a/lib/observer/src/observer_lib.erl b/lib/observer/src/observer_lib.erl
index c6a1c73c83..7c1337025f 100644
--- a/lib/observer/src/observer_lib.erl
+++ b/lib/observer/src/observer_lib.erl
@@ -128,8 +128,8 @@ display_info(Frame, Info) ->
Add = fun(BoxInfo) ->
case create_box(Panel, BoxInfo) of
{Box, InfoFs} ->
- wxSizer:add(Sizer, Box, [{flag, ?wxEXPAND bor ?wxALL},
- {border, 5}]),
+ wxSizer:add(Sizer, Box,
+ [{flag, ?wxEXPAND bor ?wxALL}, {border, 5}]),
wxSizer:addSpacer(Sizer, 5),
InfoFs;
undefined ->
@@ -453,14 +453,19 @@ create_box(Parent, Data) ->
link_entry(Panel,Value);
_ ->
Value = to_str(Value0),
- TCtrl = wxStaticText:new(Panel, ?wxID_ANY,Value),
- length(Value) > 50 andalso
- wxWindow:setToolTip(TCtrl,wxToolTip:new(Value)),
- TCtrl
+ case length(Value) > 100 of
+ true ->
+ Shown = lists:sublist(Value, 80),
+ TCtrl = wxStaticText:new(Panel, ?wxID_ANY, [Shown,"..."]),
+ wxWindow:setToolTip(TCtrl,wxToolTip:new(Value)),
+ TCtrl;
+ false ->
+ wxStaticText:new(Panel, ?wxID_ANY, Value)
+ end
end,
wxSizer:add(Line, 10, 0), % space of size 10 horisontally
wxSizer:add(Line, Field, RightProportion),
- wxSizer:add(Box, Line, [{proportion,1},{flag,?wxEXPAND}]),
+ wxSizer:add(Box, Line, [{proportion,1}]),
Field;
(undefined) ->
undefined
diff --git a/lib/observer/src/observer_procinfo.erl b/lib/observer/src/observer_procinfo.erl
index cff5fbb474..fe2aa11450 100644
--- a/lib/observer/src/observer_procinfo.erl
+++ b/lib/observer/src/observer_procinfo.erl
@@ -370,7 +370,7 @@ process_info_fields(Pid) ->
{"Priority", priority},
{"Trap Exit", trap_exit},
{"Reductions", reductions},
- {"Binary", binary},
+ {"Binary", fun(Data) -> stringify_bins(Data) end},
{"Last Calls", last_calls},
{"Catch Level", catchlevel},
{"Trace", trace},
@@ -437,6 +437,11 @@ filter_monitor_info() ->
[Pid || {process, Pid} <- Ms]
end.
+stringify_bins(Data) ->
+ Bins = proplists:get_value(binary, Data),
+ [lists:flatten(io_lib:format("<< ~s, refc ~w>>", [observer_lib:to_str({bytes,Sz}),Refc]))
+ || {_Ptr, Sz, Refc} <- Bins].
+
local_pid_str(Pid) ->
%% observer can observe remote nodes
%% There is no function to get the local
@@ -449,7 +454,6 @@ local_pid_str(Pid) ->
global_pid_node_pref(Pid) ->
%% Global PID node prefix : X of <X.Y.Z>
string:strip(string:sub_word(pid_to_list(Pid),1,$.),left,$<).
-
io_get_data(Pid) ->
Pid ! {self(), get_data_and_close},
diff --git a/lib/observer/src/observer_sys_wx.erl b/lib/observer/src/observer_sys_wx.erl
index b9b407cb0a..fa824995f7 100644
--- a/lib/observer/src/observer_sys_wx.erl
+++ b/lib/observer/src/observer_sys_wx.erl
@@ -48,40 +48,51 @@ start_link(Notebook, Parent) ->
init([Notebook, Parent]) ->
SysInfo = observer_backend:sys_info(),
- {Info, Stat} = info_fields(),
+ {Sys, Mem, Cpu, Stats} = info_fields(),
Panel = wxPanel:new(Notebook),
Sizer = wxBoxSizer:new(?wxVERTICAL),
- TopSizer = wxBoxSizer:new(?wxHORIZONTAL),
- {FPanel0, _FSizer0, Fields0} =
- observer_lib:display_info(Panel, observer_lib:fill_info(Info, SysInfo)),
- {FPanel1, _FSizer1, Fields1} =
- observer_lib:display_info(Panel, observer_lib:fill_info(Stat, SysInfo)),
- wxSizer:add(TopSizer, FPanel0, [{flag, ?wxEXPAND}, {proportion, 1}]),
- wxSizer:add(TopSizer, FPanel1, [{flag, ?wxEXPAND}, {proportion, 1}]),
+ HSizer0 = wxBoxSizer:new(?wxHORIZONTAL),
+ {FPanel0, _FSizer0, Fields0} = observer_lib:display_info(Panel, observer_lib:fill_info(Sys, SysInfo)),
+ {FPanel1, _FSizer1, Fields1} = observer_lib:display_info(Panel, observer_lib:fill_info(Mem, SysInfo)),
+ wxSizer:add(HSizer0, FPanel0, [{flag, ?wxEXPAND}, {proportion, 1}]),
+ wxSizer:add(HSizer0, FPanel1, [{flag, ?wxEXPAND}, {proportion, 1}]),
+
+ HSizer1 = wxBoxSizer:new(?wxHORIZONTAL),
+ {FPanel2, _FSizer2, Fields2} = observer_lib:display_info(Panel, observer_lib:fill_info(Cpu, SysInfo)),
+ {FPanel3, _FSizer3, Fields3} = observer_lib:display_info(Panel, observer_lib:fill_info(Stats, SysInfo)),
+ wxSizer:add(HSizer1, FPanel2, [{flag, ?wxEXPAND}, {proportion, 1}]),
+ wxSizer:add(HSizer1, FPanel3, [{flag, ?wxEXPAND}, {proportion, 1}]),
+
BorderFlags = ?wxLEFT bor ?wxRIGHT,
- wxSizer:add(Sizer, TopSizer, [{flag, ?wxEXPAND bor BorderFlags bor ?wxTOP},
- {proportion, 0}, {border, 5}]),
+ wxSizer:add(Sizer, HSizer0, [{flag, ?wxEXPAND bor BorderFlags bor ?wxTOP},
+ {proportion, 0}, {border, 5}]),
+ wxSizer:add(Sizer, HSizer1, [{flag, ?wxEXPAND bor BorderFlags bor ?wxBOTTOM},
+ {proportion, 0}, {border, 5}]),
wxPanel:setSizer(Panel, Sizer),
Timer = observer_lib:start_timer(10),
{Panel, #sys_wx_state{parent=Parent,
parent_notebook=Notebook,
panel=Panel, sizer=Sizer,
- timer=Timer, fields=Fields0 ++ Fields1}}.
+ timer=Timer, fields=Fields0 ++ Fields1++Fields2++Fields3}}.
create_sys_menu(Parent) ->
View = {"View", [#create_menu{id = ?ID_REFRESH, text = "Refresh\tCtrl-R"},
#create_menu{id = ?ID_REFRESH_INTERVAL, text = "Refresh interval"}]},
observer_wx:create_menus(Parent, [View]).
+update_syspage(#sys_wx_state{node = undefined}) -> ignore;
update_syspage(#sys_wx_state{node = Node, fields=Fields, sizer=Sizer}) ->
SysInfo = observer_wx:try_rpc(Node, observer_backend, sys_info, []),
- {Info, Stat} = info_fields(),
- observer_lib:update_info(Fields, observer_lib:fill_info(Info, SysInfo) ++
- observer_lib:fill_info(Stat, SysInfo)),
+ {Sys, Mem, Cpu, Stats} = info_fields(),
+ observer_lib:update_info(Fields,
+ observer_lib:fill_info(Sys, SysInfo) ++
+ observer_lib:fill_info(Mem, SysInfo) ++
+ observer_lib:fill_info(Cpu, SysInfo) ++
+ observer_lib:fill_info(Stats, SysInfo)),
wxSizer:layout(Sizer).
info_fields() ->
- Info = [{"System and Architecture",
+ Sys = [{"System and Architecture",
[{"System Version", otp_release},
{"ERTS Version", version},
{"Compiled for", system_architecture},
@@ -90,34 +101,35 @@ info_fields() ->
{"SMP Support", smp_support},
{"Thread Support", threads},
{"Async thread pool size", thread_pool_size}
- ]},
- {"CPU's and Threads",
- [{"Logical CPU's", logical_processors},
- {"Online Logical CPU's", logical_processors_online},
- {"Available Logical CPU's", logical_processors_available},
- {"Schedulers", schedulers},
- {"Online schedulers", schedulers_online},
- {"Available schedulers", schedulers_available}
- ]}
- ],
- Stat = [{"Memory Usage", right,
- [{"Total", {bytes, total}},
- {"Processes", {bytes, processes}},
- {"Atoms", {bytes, atom}},
- {"Binaries", {bytes, binary}},
- {"Code", {bytes, code}},
- {"ETS", {bytes, ets}}
- ]},
- {"Statistics", right,
- [{"Up time", {time_ms, uptime}},
- {"Max Processes", process_limit},
- {"Processes", process_count},
- {"Run Queue", run_queue},
- {"IO Input", {bytes, io_input}},
- {"IO Output", {bytes, io_output}}
- ]}
- ],
- {Info, Stat}.
+ ]}],
+
+ Cpu = [{"CPU's and Threads",
+ [{"Logical CPU's", logical_processors},
+ {"Online Logical CPU's", logical_processors_online},
+ {"Available Logical CPU's", logical_processors_available},
+ {"Schedulers", schedulers},
+ {"Online schedulers", schedulers_online},
+ {"Available schedulers", schedulers_available}
+ ]}
+ ],
+ Mem = [{"Memory Usage", right,
+ [{"Total", {bytes, total}},
+ {"Processes", {bytes, processes}},
+ {"Atoms", {bytes, atom}},
+ {"Binaries", {bytes, binary}},
+ {"Code", {bytes, code}},
+ {"ETS", {bytes, ets}}
+ ]}],
+ Stats = [{"Statistics", right,
+ [{"Up time", {time_ms, uptime}},
+ {"Max Processes", process_limit},
+ {"Processes", process_count},
+ {"Run Queue", run_queue},
+ {"IO Input", {bytes, io_input}},
+ {"IO Output", {bytes, io_output}}
+ ]}
+ ],
+ {Sys, Mem, Cpu, Stats}.
%%%%%%%%%%%%%%%%%%%%%%% Callbacks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl
index eba603eab5..30bd4043e4 100644
--- a/lib/observer/src/observer_wx.erl
+++ b/lib/observer/src/observer_wx.erl
@@ -65,7 +65,8 @@
node,
nodes,
prev_node="",
- log = false
+ log = false,
+ reply_to=false
}).
start() ->
@@ -229,14 +230,13 @@ handle_event(#wx{id = ?ID_CDV, event = #wxCommand{type = command_menu_selected}}
spawn(crashdump_viewer, start, []),
{noreply, State};
-handle_event(#wx{event = #wxClose{}}, #state{log=LogOn} = State) ->
- LogOn andalso rpc:block_call(State#state.node, rb, stop, []),
- {stop, normal, State};
+handle_event(#wx{event = #wxClose{}}, State) ->
+ stop_servers(State),
+ {noreply, State};
-handle_event(#wx{id = ?wxID_EXIT, event = #wxCommand{type = command_menu_selected}},
- #state{log=LogOn} = State) ->
- LogOn andalso rpc:block_call(State#state.node, rb, stop, []),
- {stop, normal, State};
+handle_event(#wx{id = ?wxID_EXIT, event = #wxCommand{type = command_menu_selected}}, State) ->
+ stop_servers(State),
+ {noreply, State};
handle_event(#wx{id = ?wxID_HELP, event = #wxCommand{type = command_menu_selected}}, State) ->
External = "http://www.erlang.org/doc/apps/observer/index.html",
@@ -379,9 +379,9 @@ handle_call({get_attrib, Attrib}, _From, State) ->
handle_call(get_tracer, _From, State=#state{trace_panel=TraceP}) ->
{reply, TraceP, State};
-handle_call(stop, _, State = #state{frame = Frame}) ->
- wxFrame:destroy(Frame),
- {stop, normal, ok, State};
+handle_call(stop, From, State) ->
+ stop_servers(State),
+ {noreply, State#state{reply_to=From}};
handle_call(log_status, _From, State) ->
{reply, State#state.log, State};
@@ -426,17 +426,45 @@ handle_info({get_debug_info, From}, State = #state{notebook=Notebook, active_tab
From ! {observer_debug, wx:get_env(), Notebook, Pid},
{noreply, State};
-handle_info({'EXIT', Pid, _Reason}, State) ->
- io:format("Child (~s) crashed exiting: ~p ~p~n",
- [pid2panel(Pid, State), Pid,_Reason]),
+handle_info({'EXIT', Pid, Reason}, State) ->
+ case Reason of
+ normal ->
+ {noreply, State};
+ _ ->
+ io:format("Observer: Child (~s) crashed exiting: ~p ~p~n",
+ [pid2panel(Pid, State), Pid, Reason]),
+ {stop, normal, State}
+ end;
+
+handle_info({stop, Me}, State) when Me =:= self() ->
{stop, normal, State};
handle_info(_Info, State) ->
{noreply, State}.
-terminate(_Reason, #state{frame = Frame}) ->
+stop_servers(#state{node=Node, log=LogOn, sys_panel=Sys, pro_panel=Procs, tv_panel=TVs,
+ trace_panel=Trace, app_panel=Apps, perf_panel=Perfs,
+ allc_panel=Alloc} = _State) ->
+ LogOn andalso rpc:block_call(Node, rb, stop, []),
+ Me = self(),
+ Tabs = [Sys, Procs, TVs, Trace, Apps, Perfs, Alloc],
+ Stop = fun() ->
+ try
+ _ = [wx_object:stop(Panel) || Panel <- Tabs],
+ ok
+ catch _:_ -> ok
+ end,
+ Me ! {stop, Me}
+ end,
+ spawn(Stop).
+
+terminate(_Reason, #state{frame = Frame, reply_to=From}) ->
wxFrame:destroy(Frame),
wx:destroy(),
+ case From of
+ false -> ignore;
+ _ -> gen_server:reply(From, ok)
+ end,
ok.
code_change(_, _, State) ->
diff --git a/lib/observer/test/observer_SUITE.erl b/lib/observer/test/observer_SUITE.erl
index 3dc3e4772b..ae8111dcd6 100644
--- a/lib/observer/test/observer_SUITE.erl
+++ b/lib/observer/test/observer_SUITE.erl
@@ -38,7 +38,7 @@
]).
%% Default timetrap timeout (set in init_per_testcase)
--define(default_timeout, ?t:minutes(1)).
+-define(default_timeout, ?t:minutes(2)).
suite() -> [{ct_hooks,[ts_install_cth]}].
diff --git a/lib/odbc/src/odbc.erl b/lib/odbc/src/odbc.erl
index 6b0ff27907..8871acd3f4 100644
--- a/lib/odbc/src/odbc.erl
+++ b/lib/odbc/src/odbc.erl
@@ -833,7 +833,7 @@ connect(ConnectionReferense, ConnectionStr, Options) ->
odbc_send(Socket, Msg) -> %% Note currently all allowed messages are lists
NewMsg = Msg ++ [?STR_TERMINATOR],
ok = gen_tcp:send(Socket, NewMsg),
- inet:setopts(Socket, [{active, once}]).
+ ok = inet:setopts(Socket, [{active, once}]).
%%--------------------------------------------------------------------------
connection_config(Key, Options) ->
diff --git a/lib/percept/src/egd.erl b/lib/percept/src/egd.erl
index d57b7bb81d..fe52da71f1 100644
--- a/lib/percept/src/egd.erl
+++ b/lib/percept/src/egd.erl
@@ -37,9 +37,7 @@
-include("egd.hrl").
%%==========================================================================
-%%
-%% Type definitions
-%%
+%% Type definitions
%%==========================================================================
%% @type egd_image()
@@ -54,9 +52,7 @@
-type color() :: {float(), float(), float(), float()}.
%%==========================================================================
-%%
-%% Interface functions
-%%
+%% Interface functions
%%==========================================================================
%% @spec create(integer(), integer()) -> egd_image()
@@ -74,8 +70,7 @@ create(Width,Height) ->
-spec destroy(Image :: egd_image()) -> ok.
destroy(Image) ->
- cast(Image, destroy),
- ok.
+ cast(Image, destroy).
%% @spec render(egd_image()) -> binary()
@@ -113,8 +108,7 @@ render(Image, Type, Options) ->
%% mainly.
information(Pid) ->
- cast(Pid, information),
- ok.
+ cast(Pid, information).
%% @spec line(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a line object from P1 to P2 in the image.
@@ -126,8 +120,7 @@ information(Pid) ->
Color :: color()) -> 'ok'.
line(Image, P1, P2, Color) ->
- cast(Image, {line, P1, P2, Color}),
- ok.
+ cast(Image, {line, P1, P2, Color}).
%% @spec color( Value | Name ) -> color()
%% where
@@ -152,74 +145,67 @@ color(_Image, Color) ->
%% @doc Creates a text object.
text(Image, P, Font, Text, Color) ->
- cast(Image, {text, P, Font, Text, Color}),
- ok.
+ cast(Image, {text, P, Font, Text, Color}).
%% @spec rectangle(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a rectangle object.
rectangle(Image, P1, P2, Color) ->
- cast(Image, {rectangle, P1, P2, Color}),
- ok.
+ cast(Image, {rectangle, P1, P2, Color}).
%% @spec filledRectangle(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a filled rectangle object.
filledRectangle(Image, P1, P2, Color) ->
- cast(Image, {filled_rectangle, P1, P2, Color}),
- ok.
+ cast(Image, {filled_rectangle, P1, P2, Color}).
%% @spec filledEllipse(egd_image(), point(), point(), color()) -> ok
%% @doc Creates a filled ellipse object.
filledEllipse(Image, P1, P2, Color) ->
- cast(Image, {filled_ellipse, P1, P2, Color}),
- ok.
+ cast(Image, {filled_ellipse, P1, P2, Color}).
%% @spec filledTriangle(egd_image(), point(), point(), point(), color()) -> ok
%% @hidden
%% @doc Creates a filled triangle object.
filledTriangle(Image, P1, P2, P3, Color) ->
- cast(Image, {filled_triangle, P1, P2, P3, Color}),
- ok.
+ cast(Image, {filled_triangle, P1, P2, P3, Color}).
%% @spec polygon(egd_image(), [point()], color()) -> ok
%% @hidden
%% @doc Creates a filled filled polygon object.
polygon(Image, Pts, Color) ->
- cast(Image, {polygon, Pts, Color}),
- ok.
+ cast(Image, {polygon, Pts, Color}).
%% @spec arc(egd_image(), point(), point(), color()) -> ok
%% @hidden
%% @doc Creates an arc with radius of bbx corner.
arc(Image, P1, P2, Color) ->
- cast(Image, {arc, P1, P2, Color}),
- ok.
+ cast(Image, {arc, P1, P2, Color}).
%% @spec arc(egd_image(), point(), point(), integer(), color()) -> ok
%% @hidden
%% @doc Creates an arc.
arc(Image, P1, P2, D, Color) ->
- cast(Image, {arc, P1, P2, D, Color}),
- ok.
+ cast(Image, {arc, P1, P2, D, Color}).
%% @spec save(binary(), string()) -> ok
%% @doc Saves the binary to file.
save(Binary, Filename) when is_binary(Binary) ->
- file:write_file(Filename, Binary),
+ ok = file:write_file(Filename, Binary),
ok.
% ---------------------------------
% Aux functions
% ---------------------------------
cast(Pid, Command) ->
- Pid ! {egd, self(), Command}.
+ Pid ! {egd, self(), Command},
+ ok.
call(Pid, Command) ->
Pid ! {egd, self(), Command},
diff --git a/lib/percept/src/egd.hrl b/lib/percept/src/egd.hrl
index 1b125d3a08..fc0a7e10ee 100644
--- a/lib/percept/src/egd.hrl
+++ b/lib/percept/src/egd.hrl
@@ -41,6 +41,5 @@
-ifdef(debug).
-define(dbg(X), io:format("DEBUG: ~p:~p~n",[?MODULE, X])).
-else.
--define(dbg(X), void).
+-define(dbg(X), ok).
-endif.
-
diff --git a/lib/percept/src/egd_font.erl b/lib/percept/src/egd_font.erl
index 95203d5441..ef1cc434df 100644
--- a/lib/percept/src/egd_font.erl
+++ b/lib/percept/src/egd_font.erl
@@ -51,9 +51,7 @@
%%
%%==========================================================================
-%%
-%% Interface functions
-%%
+%% Interface functions
%%==========================================================================
size(Font) ->
@@ -70,15 +68,14 @@ load(Filename) ->
load_font_header(Font).
%%==========================================================================
-%%
-%% Internal functions
-%%
+%% Internal functions
%%==========================================================================
%% ETS handler functions
initialize_table() ->
- ets:new(egd_font_table, [named_table, ordered_set, public]).
+ egd_font_table = ets:new(egd_font_table, [named_table, ordered_set, public]),
+ ok.
glyph_insert(Font, Code, Translation, LSs) ->
Element = {{Font, Code}, Translation, LSs},
diff --git a/lib/percept/src/egd_render.erl b/lib/percept/src/egd_render.erl
index c0075b8c42..6c708e3e86 100644
--- a/lib/percept/src/egd_render.erl
+++ b/lib/percept/src/egd_render.erl
@@ -662,4 +662,3 @@ eps_header(W,H) ->
eps_footer() ->
"%%EOF\n".
-
diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl
index 24ddf1bd14..046e0b7518 100644
--- a/lib/percept/src/percept.erl
+++ b/lib/percept/src/percept.erl
@@ -26,27 +26,24 @@
-module(percept).
-behaviour(application).
--export([
- profile/1,
- profile/2,
- profile/3,
- stop_profile/0,
- start_webserver/0,
- start_webserver/1,
- stop_webserver/0,
- stop_webserver/1,
- analyze/1,
- % Application behaviour
- start/2,
- stop/1]).
+-export([profile/1,
+ profile/2,
+ profile/3,
+ stop_profile/0,
+ start_webserver/0,
+ start_webserver/1,
+ stop_webserver/0,
+ stop_webserver/1,
+ analyze/1,
+ % Application behaviour
+ start/2,
+ stop/1]).
-include("percept.hrl").
%%==========================================================================
-%%
-%% Type definitions
-%%
+%% Type definitions
%%==========================================================================
%% @type percept_option() = procs | ports | exclusive
@@ -54,9 +51,7 @@
-type percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'.
%%==========================================================================
-%%
-%% Application callback functions
-%%
+%% Application callback functions
%%==========================================================================
%% @spec start(Type, Args) -> {started, Hostname, Port} | {error, Reason}
@@ -76,9 +71,7 @@ stop(_State) ->
stop_webserver(0).
%%==========================================================================
-%%
-%% Interface functions
-%%
+%% Interface functions
%%==========================================================================
%% @spec profile(Filename::string()) -> {ok, Port} | {already_started, Port}
@@ -158,11 +151,11 @@ start_webserver() ->
{'started', string(), pos_integer()} | {'error', any()}.
start_webserver(Port) when is_integer(Port) ->
- application:load(percept),
+ ok = ensure_loaded(percept),
case whereis(percept_httpd) of
undefined ->
{ok, Config} = get_webserver_config("percept", Port),
- inets:start(),
+ ok = application:ensure_started(inets),
case inets:start(httpd, Config) of
{ok, Pid} ->
AssignedPort = find_service_port_from_pid(inets:services_info(), Pid),
@@ -217,9 +210,7 @@ stop_webserver(Port) ->
do_stop(Port,[]).
%%==========================================================================
-%%
-%% Auxiliary functions
-%%
+%% Auxiliary functions
%%==========================================================================
%% parse_and_insert
@@ -337,3 +328,10 @@ get_webserver_config(Servername, Port) when is_list(Servername), is_integer(Port
{bind_address, any},
{port, Port}],
{ok, Config}.
+
+ensure_loaded(App) ->
+ case application:load(App) of
+ ok -> ok;
+ {error,{already_loaded,App}} -> ok;
+ Error -> Error
+ end.
diff --git a/lib/percept/src/percept_db.erl b/lib/percept/src/percept_db.erl
index 6c2dddccac..6cbe3ce022 100644
--- a/lib/percept/src/percept_db.erl
+++ b/lib/percept/src/percept_db.erl
@@ -24,21 +24,17 @@
-module(percept_db).
--export([
- start/0,
- stop/0,
- insert/1,
- select/2,
- select/1,
- consolidate/0
- ]).
+-export([start/0,
+ stop/0,
+ insert/1,
+ select/2,
+ select/1,
+ consolidate/0]).
-include("percept.hrl").
-define(STOP_TIMEOUT, 1000).
%%==========================================================================
-%%
-%% Type definitions
-%%
+%% Type definitions
%%==========================================================================
%% @type activity_option() =
@@ -64,9 +60,7 @@
%%==========================================================================
-%%
-%% Interface functions
-%%
+%% Interface functions
%%==========================================================================
%% @spec start() -> ok | {started, Pid} | {restarted, Pid}
@@ -100,7 +94,7 @@ restart(PerceptDB)->
-spec do_start()-> pid().
do_start()->
- Pid = spawn( fun() -> init_percept_db() end),
+ Pid = spawn(fun() -> init_percept_db() end),
erlang:register(percept_db, Pid),
Pid.
@@ -123,17 +117,17 @@ stop() ->
%% @private
%% @doc Stops the percept database, with a synchronous call.
--spec stop_sync(pid())-> true.
+-spec stop_sync(pid()) -> true.
-stop_sync(Pid)->
+stop_sync(Pid) ->
MonitorRef = erlang:monitor(process, Pid),
- stop(),
+ _ = stop(),
receive
{'DOWN', MonitorRef, _Type, Pid, _Info}->
true
after ?STOP_TIMEOUT->
- erlang:demonitor(MonitorRef, [flush]),
- exit(Pid, kill)
+ erlang:demonitor(MonitorRef, [flush]),
+ exit(Pid, kill)
end.
%% @spec insert(tuple()) -> ok
@@ -186,26 +180,24 @@ consolidate() ->
ok.
%%==========================================================================
-%%
-%% Database loop
-%%
+%% Database loop
%%==========================================================================
init_percept_db() ->
% Proc and Port information
- ets:new(pdb_info, [named_table, private, {keypos, #information.id}, set]),
+ pdb_info = ets:new(pdb_info, [named_table, private, {keypos, #information.id}, set]),
% Scheduler runnability
- ets:new(pdb_scheduler, [named_table, private, {keypos, #activity.timestamp}, ordered_set]),
+ pdb_scheduler = ets:new(pdb_scheduler, [named_table, private, {keypos, #activity.timestamp}, ordered_set]),
% Process and Port runnability
- ets:new(pdb_activity, [named_table, private, {keypos, #activity.timestamp}, ordered_set]),
+ pdb_activity = ets:new(pdb_activity, [named_table, private, {keypos, #activity.timestamp}, ordered_set]),
% System status
- ets:new(pdb_system, [named_table, private, {keypos, 1}, set]),
+ pdb_system = ets:new(pdb_system, [named_table, private, {keypos, 1}, set]),
% System warnings
- ets:new(pdb_warnings, [named_table, private, {keypos, 1}, ordered_set]),
+ pdb_warnings = ets:new(pdb_warnings, [named_table, private, {keypos, 1}, ordered_set]),
put(debug, 0),
loop_percept_db().
@@ -232,9 +224,7 @@ loop_percept_db() ->
end.
%%==========================================================================
-%%
-%% Auxiliary functions
-%%
+%% Auxiliary functions
%%==========================================================================
%% cleans trace messages from external pids
@@ -788,5 +778,3 @@ update_system_stop_ts(TS) ->
Unhandled ->
io:format("update_system_stop_ts, unhandled ~p ~n", [Unhandled])
end.
-
-
diff --git a/lib/percept/src/percept_graph.erl b/lib/percept/src/percept_graph.erl
index 1803e035ab..e5bbaca2b4 100644
--- a/lib/percept/src/percept_graph.erl
+++ b/lib/percept/src/percept_graph.erl
@@ -33,28 +33,28 @@
%%
graph(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, binary_to_list(graph(Env, Input))).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, binary_to_list(graph(Env, Input))).
%% activity
%% @spec activity(SessionID, Env, Input) -> term()
%% @doc An ESI callback implementation used by the httpd server.
activity(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, binary_to_list(activity_bar(Env, Input))).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, binary_to_list(activity_bar(Env, Input))).
proc_lifetime(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, binary_to_list(proc_lifetime(Env, Input))).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, binary_to_list(proc_lifetime(Env, Input))).
percentage(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, binary_to_list(percentage(Env,Input))).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, binary_to_list(percentage(Env,Input))).
scheduler_graph(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, binary_to_list(scheduler_graph(Env, Input))).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, binary_to_list(scheduler_graph(Env, Input))).
graph(_Env, Input) ->
Query = httpd:parse_query(Input),
diff --git a/lib/percept/src/percept_html.erl b/lib/percept/src/percept_html.erl
index a8eb29b741..a675227584 100644
--- a/lib/percept/src/percept_html.erl
+++ b/lib/percept/src/percept_html.erl
@@ -18,22 +18,18 @@
%% %CopyrightEnd%
-module(percept_html).
--export([
- page/3,
- codelocation_page/3,
- databases_page/3,
- load_database_page/3,
- processes_page/3,
- concurrency_page/3,
- process_info_page/3
- ]).
-
--export([
- value2pid/1,
- pid2value/1,
- get_option_value/2,
- join_strings_with/2
- ]).
+-export([page/3,
+ codelocation_page/3,
+ databases_page/3,
+ load_database_page/3,
+ processes_page/3,
+ concurrency_page/3,
+ process_info_page/3]).
+
+-export([value2pid/1,
+ pid2value/1,
+ get_option_value/2,
+ join_strings_with/2]).
-include("percept.hrl").
-include_lib("kernel/include/file.hrl").
@@ -42,47 +38,47 @@
%% API
page(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, menu()),
- mod_esi:deliver(SessionID, overview_content(Env, Input)),
- mod_esi:deliver(SessionID, footer()).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, menu()),
+ ok = mod_esi:deliver(SessionID, overview_content(Env, Input)),
+ ok = mod_esi:deliver(SessionID, footer()).
processes_page(SessionID, _, _) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, menu()),
- mod_esi:deliver(SessionID, processes_content()),
- mod_esi:deliver(SessionID, footer()).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, menu()),
+ ok = mod_esi:deliver(SessionID, processes_content()),
+ ok = mod_esi:deliver(SessionID, footer()).
concurrency_page(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, menu()),
- mod_esi:deliver(SessionID, concurrency_content(Env, Input)),
- mod_esi:deliver(SessionID, footer()).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, menu()),
+ ok = mod_esi:deliver(SessionID, concurrency_content(Env, Input)),
+ ok = mod_esi:deliver(SessionID, footer()).
databases_page(SessionID, _, _) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, menu()),
- mod_esi:deliver(SessionID, databases_content()),
- mod_esi:deliver(SessionID, footer()).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, menu()),
+ ok = mod_esi:deliver(SessionID, databases_content()),
+ ok = mod_esi:deliver(SessionID, footer()).
codelocation_page(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, menu()),
- mod_esi:deliver(SessionID, codelocation_content(Env, Input)),
- mod_esi:deliver(SessionID, footer()).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, menu()),
+ ok = mod_esi:deliver(SessionID, codelocation_content(Env, Input)),
+ ok = mod_esi:deliver(SessionID, footer()).
process_info_page(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
- mod_esi:deliver(SessionID, menu()),
- mod_esi:deliver(SessionID, process_info_content(Env, Input)),
- mod_esi:deliver(SessionID, footer()).
+ ok = mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, menu()),
+ ok = mod_esi:deliver(SessionID, process_info_content(Env, Input)),
+ ok = mod_esi:deliver(SessionID, footer()).
load_database_page(SessionID, Env, Input) ->
- mod_esi:deliver(SessionID, header()),
+ ok = mod_esi:deliver(SessionID, header()),
% Very dynamic page, handled differently
load_database_content(SessionID, Env, Input),
- mod_esi:deliver(SessionID, footer()).
+ ok = mod_esi:deliver(SessionID, footer()).
%%% --------------------------- %%%
@@ -446,24 +442,24 @@ load_database_content(SessionId, _Env, Input) ->
Filename = filename:join(Path, File),
% Check path/file/filename
- mod_esi:deliver(SessionId, "<div id=\"content\">"),
+ ok = mod_esi:deliver(SessionId, "<div id=\"content\">"),
case file:read_file_info(Filename) of
{ok, _} ->
Content = "<center>
Parsing: " ++ Filename ++ "<br>
</center>",
- mod_esi:deliver(SessionId, Content),
- case percept:analyze(Filename) of
- {error, Reason} ->
- mod_esi:deliver(SessionId, error_msg("Analyze" ++ term2html(Reason)));
- _ ->
- Complete = "<center><a href=\"/cgi-bin/percept_html/page\">View</a></center>",
- mod_esi:deliver(SessionId, Complete)
- end;
+ ok = mod_esi:deliver(SessionId, Content),
+ case percept:analyze(Filename) of
+ {error, Reason} ->
+ ok = mod_esi:deliver(SessionId, error_msg("Analyze" ++ term2html(Reason)));
+ _ ->
+ Complete = "<center><a href=\"/cgi-bin/percept_html/page\">View</a></center>",
+ ok = mod_esi:deliver(SessionId, Complete)
+ end;
{error, Reason} ->
- mod_esi:deliver(SessionId, error_msg("File" ++ term2html(Reason)))
+ ok = mod_esi:deliver(SessionId, error_msg("File" ++ term2html(Reason)))
end,
- mod_esi:deliver(SessionId, "</div>").
+ ok = mod_esi:deliver(SessionId, "</div>").
codelocation_content(_Env, Input) ->
Query = httpd:parse_query(Input),
diff --git a/lib/public_key/priv/generate b/lib/public_key/priv/generate
index fd185bfd52..69bb2263f4 100755
--- a/lib/public_key/priv/generate
+++ b/lib/public_key/priv/generate
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Generate ssh moduli files for the sizes in $moduli
diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl
index 26c371a8ea..089b3615c6 100644
--- a/lib/ssl/src/ssl_connection.erl
+++ b/lib/ssl/src/ssl_connection.erl
@@ -875,48 +875,14 @@ handle_call({get_opts, OptTags}, From, _,
socket_options = SockOpts}, _) ->
OptsReply = get_socket_opts(Transport, Socket, OptTags, SockOpts, []),
{keep_state_and_data, [{reply, From, OptsReply}]};
-handle_call({set_opts, Opts0}, From, connection = StateName0,
+handle_call({set_opts, Opts0}, From, StateName,
#state{socket_options = Opts1,
- protocol_cb = Connection,
socket = Socket,
- transport_cb = Transport,
- user_data_buffer = Buffer} = State0, _) ->
+ transport_cb = Transport} = State0, _) ->
{Reply, Opts} = set_socket_opts(Transport, Socket, Opts0, Opts1, []),
- State1 = State0#state{socket_options = Opts},
- if
- Opts#socket_options.active =:= false ->
- hibernate_after(StateName0, State1, [{reply, From, Reply}]);
- Buffer =:= <<>>, Opts1#socket_options.active =:= false ->
- %% Need data, set active once
- {Record, State2} = Connection:next_record_if_active(State1),
- %% Note: Renogotiation may cause StateName0 =/= StateName
- case Connection:next_event(StateName0, Record, State2) of
- {next_state, StateName, State} ->
- hibernate_after(StateName, State, [{reply, From, Reply}]);
- {next_state, StateName, State, Actions} ->
- hibernate_after(StateName, State, [{reply, From, Reply} | Actions]);
- {stop, Reason, State} ->
- {stop, Reason, State}
- end;
- Buffer =:= <<>> ->
- %% Active once already set
- hibernate_after(StateName0, State1, [{reply, From, Reply}]);
- true ->
- case Connection:read_application_data(<<>>, State1) of
- {stop, Reason, State} ->
- {stop, Reason, State};
- {Record, State2} ->
- %% Note: Renogotiation may cause StateName0 =/= StateName
- case Connection:next_event(StateName0, Record, State2) of
- {next_state, StateName, State} ->
- hibernate_after(StateName, State, [{reply, From, Reply}]);
- {next_state, StateName, State, Actions} ->
- hibernate_after(StateName, State, [{reply, From, Reply} | Actions]);
- {stop, _, _} = Stop ->
- Stop
- end
- end
- end;
+ State = State0#state{socket_options = Opts},
+ handle_active_option(Opts#socket_options.active, StateName, From, Reply, State);
+
handle_call(renegotiate, From, StateName, _, _) when StateName =/= connection ->
{keep_state_and_data, [{reply, From, {error, already_renegotiating}}]};
handle_call({prf, Secret, Label, Seed, WantedLength}, From, _,
@@ -1876,9 +1842,12 @@ start_or_recv_cancel_timer(infinity, _RecvFrom) ->
start_or_recv_cancel_timer(Timeout, RecvFrom) ->
erlang:send_after(Timeout, self(), {cancel_start_or_recv, RecvFrom}).
-hibernate_after(StateName, #state{ssl_options=#ssl_options{hibernate_after = HibernateAfter}} = State,
+hibernate_after(connection = StateName,
+ #state{ssl_options=#ssl_options{hibernate_after = HibernateAfter}} = State,
Actions) ->
- {next_state, StateName, State, [{timeout, HibernateAfter, hibernate} | Actions]}.
+ {next_state, StateName, State, [{timeout, HibernateAfter, hibernate} | Actions]};
+hibernate_after(StateName, State, Actions) ->
+ {next_state, StateName, State, Actions}.
terminate_alert(normal, Version, ConnectionStates) ->
ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY),
@@ -2032,4 +2001,39 @@ ssl_options_list([ciphers = Key | Keys], [Value | Values], Acc) ->
ssl_options_list([Key | Keys], [Value | Values], Acc) ->
ssl_options_list(Keys, Values, [{Key, Value} | Acc]).
+handle_active_option(false, connection = StateName, To, Reply, State) ->
+ hibernate_after(StateName, State, [{reply, To, Reply}]);
+
+handle_active_option(_, connection = StateName0, To, Reply, #state{protocol_cb = Connection,
+ user_data_buffer = <<>>} = State0) ->
+ %% Need data, set active once
+ {Record, State1} = Connection:next_record_if_active(State0),
+ %% Note: Renogotiation may cause StateName0 =/= StateName
+ case Connection:next_event(StateName0, Record, State1) of
+ {next_state, StateName, State} ->
+ hibernate_after(StateName, State, [{reply, To, Reply}]);
+ {next_state, StateName, State, Actions} ->
+ hibernate_after(StateName, State, [{reply, To, Reply} | Actions]);
+ {stop, Reason, State} ->
+ {stop, Reason, State}
+ end;
+handle_active_option(_, StateName, To, Reply, #state{user_data_buffer = <<>>} = State) ->
+ %% Active once already set
+ {next_state, StateName, State, [{reply, To, Reply}]};
+%% user_data_buffer =/= <<>>
+handle_active_option(_, StateName0, To, Reply, #state{protocol_cb = Connection} = State0) ->
+ case Connection:read_application_data(<<>>, State0) of
+ {stop, Reason, State} ->
+ {stop, Reason, State};
+ {Record, State1} ->
+ %% Note: Renogotiation may cause StateName0 =/= StateName
+ case Connection:next_event(StateName0, Record, State1) of
+ {next_state, StateName, State} ->
+ hibernate_after(StateName, State, [{reply, To, Reply}]);
+ {next_state, StateName, State, Actions} ->
+ hibernate_after(StateName, State, [{reply, To, Reply} | Actions]);
+ {stop, _, _} = Stop ->
+ Stop
+ end
+ end.
diff --git a/lib/stdlib/doc/src/digraph.xml b/lib/stdlib/doc/src/digraph.xml
index 16dd789caf..1bb8eef247 100644
--- a/lib/stdlib/doc/src/digraph.xml
+++ b/lib/stdlib/doc/src/digraph.xml
@@ -104,14 +104,12 @@
</datatype>
<datatype>
<name>edge()</name>
- <desc><p><marker id="type-edge"/></p></desc>
</datatype>
<datatype>
<name name="label"/>
</datatype>
<datatype>
<name>vertex()</name>
- <desc><p><marker id="type-vertex"/></p></desc>
</datatype>
</datatypes>
<funcs>
diff --git a/lib/stdlib/doc/src/digraph_utils.xml b/lib/stdlib/doc/src/digraph_utils.xml
index 9bddee546f..e481711c50 100644
--- a/lib/stdlib/doc/src/digraph_utils.xml
+++ b/lib/stdlib/doc/src/digraph_utils.xml
@@ -120,13 +120,6 @@
considering all edges undirected.</p>
</description>
- <datatypes>
- <datatype>
- <name>digraph()</name>
- <desc><p><marker id="type-digraph"/>
- A digraph as returned by <c>digraph:new/0,1</c>.</p></desc>
- </datatype>
- </datatypes>
<funcs>
<func>
<name name="arborescence_root" arity="1"/>
diff --git a/lib/stdlib/doc/src/erl_anno.xml b/lib/stdlib/doc/src/erl_anno.xml
index ddc8b8c765..9f775943c1 100644
--- a/lib/stdlib/doc/src/erl_anno.xml
+++ b/lib/stdlib/doc/src/erl_anno.xml
@@ -5,7 +5,7 @@
<header>
<copyright>
<year>2015</year>
- <year>2015</year>
+ <year>2016</year>
<holder>Ericsson AB, All Rights Reserved</holder>
</copyright>
<legalnotice>
@@ -103,7 +103,7 @@
<datatypes>
<datatype>
<name>anno()</name>
- <desc><p><marker id="type-anno"/>A collection of annotations.</p>
+ <desc><p>A collection of annotations.</p>
</desc>
</datatype>
<datatype>
diff --git a/lib/stdlib/doc/src/erl_parse.xml b/lib/stdlib/doc/src/erl_parse.xml
index 13be488c33..32fce16d68 100644
--- a/lib/stdlib/doc/src/erl_parse.xml
+++ b/lib/stdlib/doc/src/erl_parse.xml
@@ -45,26 +45,22 @@
<datatypes>
<datatype>
<name>abstract_clause()</name>
- <desc><p><marker id="type-abstract_clause"/>
- Abstract form of an Erlang clause.</p>
+ <desc><p>Abstract form of an Erlang clause.</p>
</desc>
</datatype>
<datatype>
<name>abstract_expr()</name>
- <desc><p><marker id="type-abstract_expr"/>
- Abstract form of an Erlang expression.</p>
+ <desc><p>Abstract form of an Erlang expression.</p>
</desc>
</datatype>
<datatype>
<name>abstract_form()</name>
- <desc><p><marker id="type-abstract_form"/>
- Abstract form of an Erlang form.</p>
+ <desc><p>Abstract form of an Erlang form.</p>
</desc>
</datatype>
<datatype>
<name>abstract_type()</name>
- <desc><p><marker id="type-abstract_type"/>
- Abstract form of an Erlang type.</p>
+ <desc><p>Abstract form of an Erlang type.</p>
</desc>
</datatype>
<datatype>
diff --git a/lib/stdlib/doc/src/ets.xml b/lib/stdlib/doc/src/ets.xml
index b32638f04d..9fb7d227a3 100644
--- a/lib/stdlib/doc/src/ets.xml
+++ b/lib/stdlib/doc/src/ets.xml
@@ -98,10 +98,10 @@
All updates to single objects are guaranteed to be both <em>atomic</em>
and <em>isolated</em>. This means that an updating operation towards
a single object will either succeed or fail completely without any
- effect at all (atomicy).
+ effect at all (atomicity).
Nor can any intermediate results of the update be seen by other
processes (isolation). Some functions that update several objects
- state that they even guarantee atomicy and isolation for the entire
+ state that they even guarantee atomicity and isolation for the entire
operation. In database terms the isolation level can be seen as
"serializable", as if all isolated operations were carried out serially,
one after the other in a strict order.</p>
@@ -135,8 +135,7 @@
<datatype>
<name>continuation()</name>
<desc>
- <p><marker id="type-continuation"/>
- Opaque continuation used by <seealso marker="#select/1">
+ <p>Opaque continuation used by <seealso marker="#select/1">
<c>select/1,3</c></seealso>, <seealso marker="#select_reverse/1">
<c>select_reverse/1,3</c></seealso>, <seealso
marker="#match/1">
diff --git a/lib/stdlib/doc/src/sofs.xml b/lib/stdlib/doc/src/sofs.xml
index cf0855bc85..1e5be367bd 100644
--- a/lib/stdlib/doc/src/sofs.xml
+++ b/lib/stdlib/doc/src/sofs.xml
@@ -399,8 +399,7 @@ fun(S) -> sofs:partition(1, S) end
<datatype>
<!-- Parameterized opaque types are NYI: -->
<name>tuple_of(T)</name>
- <desc><p><marker id="type-tuple_of"/>
- A tuple where the elements are of type <c>T</c>.</p></desc>
+ <desc><p>A tuple where the elements are of type <c>T</c>.</p></desc>
</datatype>
</datatypes>
<funcs>
diff --git a/lib/tools/emacs/erlang-test.el b/lib/tools/emacs/erlang-test.el
new file mode 100644
index 0000000000..a5aab04953
--- /dev/null
+++ b/lib/tools/emacs/erlang-test.el
@@ -0,0 +1,107 @@
+;;; erlang-test.el -*- lexical-binding: t; coding: utf-8-unix -*-
+
+;;; Unit tests for erlang.el.
+
+;; Author: Johan Claesson
+;; Created: 2016-05-07
+;; Keywords: erlang, languages
+
+;; %CopyrightBegin%
+;;
+;; Copyright Ericsson AB 2016. All Rights Reserved.
+;;
+;; Licensed under the Apache License, Version 2.0 (the "License");
+;; you may not use this file except in compliance with the License.
+;; You may obtain a copy of the License at
+;;
+;; http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+;;
+;; %CopyrightEnd%
+
+
+;;; Commentary:
+
+;; This library require GNU Emacs 25 or later.
+
+;;; Code:
+
+(require 'ert)
+(require 'cl-lib)
+
+(defvar erlang-test-code
+ '((nil . "-module(erlang_test).")
+ (nil . "-import(lists, [map/2]).")
+ (nil . "-compile(export_all).")
+ ("SYMBOL" . "-define(SYMBOL, value).")
+ ("MACRO" . "-define(MACRO(X), X + X).")
+ ("struct" . "-record(struct, {until,maps,are,everywhere}).")
+ ("function". "function() -> #struct{}."))
+ "Alist of erlang test code.
+Each entry have the format (TAGNAME . ERLANG_CODE). If TAGNAME
+is nil there is no definitions in the ERLANG_CODE. The
+ERLANG_CODE is a single line of erlang code. These lines will be
+concatenated to form an erlang file to test on.")
+
+
+(ert-deftest erlang-test-tags ()
+ (let* ((dir (make-temp-file "erlang-test" t))
+ (erlang-file (expand-file-name "erlang_test.erl" dir))
+ (tags-file (expand-file-name "TAGS" dir))
+ tags-file-name tags-table-list erlang-buffer)
+ (unwind-protect
+ (progn
+ (erlang-test-create-erlang-file erlang-file)
+ (erlang-test-compile-tags erlang-file tags-file)
+ (setq erlang-buffer (find-file-noselect erlang-file))
+ (with-current-buffer erlang-buffer
+ (setq-local tags-file-name tags-file))
+ ;; PENDING - setting global tags-file-name is a workaround
+ ;; for GNU Emacs bug23164.
+ (setq tags-file-name tags-file)
+ (erlang-test-xref-find-definitions erlang-file erlang-buffer))
+ (when (buffer-live-p erlang-buffer)
+ (kill-buffer erlang-buffer))
+ (let ((tags-buffer (find-buffer-visiting tags-file)))
+ (when (buffer-live-p tags-buffer)
+ (kill-buffer tags-buffer)))
+ (when (file-exists-p dir)
+ (delete-directory dir t)))))
+
+(defun erlang-test-create-erlang-file (erlang-file)
+ (with-temp-file erlang-file
+ (cl-loop for (_ . code) in erlang-test-code
+ do (insert code "\n"))))
+
+(defun erlang-test-compile-tags (erlang-file tags-file)
+ (should (zerop (call-process "etags" nil nil nil
+ "-o" tags-file
+ erlang-file))))
+
+(defun erlang-test-xref-find-definitions (erlang-file erlang-buffer)
+ (cl-loop for (tagname . code) in erlang-test-code
+ for line = 1 then (1+ line)
+ do (when tagname
+ (switch-to-buffer erlang-buffer)
+ (xref-find-definitions tagname)
+ (erlang-test-verify-pos erlang-file line)
+ (xref-find-definitions (concat "erlang_test:" tagname))
+ (erlang-test-verify-pos erlang-file line)))
+ (xref-find-definitions "erlang_test:")
+ (erlang-test-verify-pos erlang-file 1))
+
+(defun erlang-test-verify-pos (expected-file expected-line)
+ (should (string-equal (file-truename expected-file)
+ (file-truename (buffer-file-name))))
+ (should (eq expected-line (line-number-at-pos)))
+ (should (= (point-at-bol) (point))))
+
+
+(provide 'erlang-test)
+
+;;; erlang-test.el ends here
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 0a3fc0ddff..aff2c4b2c9 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -70,8 +70,8 @@
;; `debug-on-error' to `t'. Repeat the error and enclose the debug
;; information in your bug-report.
;;
-;; To set the variable you can use the following command:
-;; M-x set-variable RET debug-on-error RET t RET
+;; To toggle the variable you can use the following command:
+;; M-x toggle-debug-on-error RET
;;; Code:
(eval-when-compile (require 'cl))
@@ -1068,8 +1068,14 @@ behaviour.")
"Font lock keyword highlighting a function header.")
(defface erlang-font-lock-exported-function-name-face
- '((default (:inherit font-lock-function-name-face)))
- "Face used for highlighting exported functions.")
+ (if (featurep 'xemacs)
+ (progn
+ (require 'font-lock)
+ `((t (:foreground ,(face-foreground 'font-lock-function-name-face))
+ (:background ,(face-background 'font-lock-function-name-face)))))
+ '((default (:inherit font-lock-function-name-face))))
+ "Face used for highlighting exported functions."
+ :group 'erlang)
(defvar erlang-font-lock-exported-function-name-face
'erlang-font-lock-exported-function-name-face)
@@ -1338,11 +1344,15 @@ Lock syntax table. The effect is that `apply' in the atom
(defun erlang-version ()
"Return the current version of Erlang mode."
(interactive)
- (if (interactive-p)
+ (if (erlang-interactive-p)
(message "Erlang mode version %s, written by Anders Lindgren"
erlang-version))
erlang-version)
+(defun erlang-interactive-p ()
+ (if (fboundp 'called-interactively-p)
+ (called-interactively-p 'interactive)
+ (funcall (symbol-function 'interactive-p))))
;;;###autoload
(define-derived-mode erlang-mode prog-mode "Erlang"
@@ -1415,7 +1425,11 @@ Other commands:
(erlang-tags-init)
(erlang-font-lock-init)
(erlang-skel-init)
- (tempo-use-tag-list 'erlang-tempo-tags)
+ (when (fboundp 'tempo-use-tag-list)
+ (tempo-use-tag-list 'erlang-tempo-tags))
+ (when (boundp 'xref-backend-functions)
+ (add-hook 'xref-backend-functions #'erlang-etags--xref-backend nil t))
+ (run-hooks 'erlang-mode-hook)
(if (zerop (buffer-size))
(run-hooks 'erlang-new-file-hook)))
@@ -1536,7 +1550,9 @@ Other commands:
table)))
(set (make-local-variable 'font-lock-syntax-table)
erlang-font-lock-syntax-table)
- (set (make-local-variable 'font-lock-beginning-of-syntax-function)
+ (set (make-local-variable (if (boundp 'syntax-begin-function)
+ 'syntax-begin-function
+ 'font-lock-beginning-of-syntax-function))
'erlang-beginning-of-clause)
(make-local-variable 'font-lock-keywords)
(let ((level (cond ((boundp 'font-lock-maximum-decoration)
@@ -2244,6 +2260,7 @@ mode with the command `M-x erlang-mode RET'.")))
;; This code is based on the package `tempo' which is part of modern
;; Emacsen. (GNU Emacs 19.25 (?) and XEmacs 19.14.)
+(defvar erlang-skel)
(defun erlang-skel-init ()
"Generate the skeleton functions and menu items.
The variable `erlang-skel' contains the name and descriptions of
@@ -2970,8 +2987,9 @@ Return nil if inside string, t if in a comment."
(current-column)))
;; Type and Spec indentation
((eq (car stack-top) '::)
- (if (looking-at "}")
- ;; Closing record definition with types
+ (if (looking-at "[},)]")
+ ;; Closing function spec, record definition with types,
+ ;; or a comma at the start of the line
;; pop stack and recurse
(erlang-calculate-stack-indent indent-point
(cons (erlang-pop stack) (cdr state)))
@@ -3812,20 +3830,19 @@ exported function."
(defun erlang-check-module-name-init ()
"Initialize the functionality to compare file and module names.
-Unless we have `before-save-hook', we redefine the function
+Unless we have `before-save-hook', we advice the function
`set-visited-file-name' since it clears the variable
-`local-write-file-hooks'. The original function definition is
-stored in `erlang-orig-set-visited-file-name'."
+`local-write-file-hooks'."
(if (boundp 'before-save-hook)
- ;; If we have that, `make-local-hook' is obsolete.
(add-hook 'before-save-hook 'erlang-check-module-name nil t)
(require 'advice)
- (unless (ad-advised-definition-p 'set-visited-file-name)
- (defadvice set-visited-file-name (after erlang-set-visited-file-name
- activate)
- (if (eq major-mode 'erlang-mode)
- (add-hook 'local-write-file-hooks 'erlang-check-module-name))))
- (add-hook 'local-write-file-hooks 'erlang-check-module-name)))
+ (when (fboundp 'ad-advised-definition-p)
+ (unless (ad-advised-definition-p 'set-visited-file-name)
+ (defadvice set-visited-file-name (after erlang-set-visited-file-name
+ activate)
+ (if (eq major-mode 'erlang-mode)
+ (add-hook 'local-write-file-hooks 'erlang-check-module-name))))
+ (add-hook 'local-write-file-hooks 'erlang-check-module-name))))
(defun erlang-check-module-name ()
@@ -3902,7 +3919,7 @@ non-whitespace characters following the point on the current line."
(newline)
(if (condition-case nil
(progn (erlang-indent-line) t)
- (error (if (bolp) (delete-backward-char 1))))
+ (error (if (bolp) (delete-char -1))))
(if (not (bolp))
(save-excursion
(insert " ->"))
@@ -3914,7 +3931,7 @@ non-whitespace characters following the point on the current line."
(beginning-of-line)
(newline
erlang-electric-semicolon-insert-blank-lines))))
- (error (if (bolp) (delete-backward-char 1))))))))
+ (error (if (bolp) (delete-char -1))))))))
(defun erlang-electric-comma (&optional arg)
@@ -3944,7 +3961,7 @@ non-whitespace characters following the point on the current line."
(newline)
(condition-case nil
(erlang-indent-line)
- (error (if (bolp) (delete-backward-char 1))))))
+ (error (if (bolp) (delete-char -1))))))
(defun erlang-electric-lt (&optional arg)
"Insert a less-than sign, and optionally mark it as an open paren."
@@ -4030,7 +4047,7 @@ non-whitespace characters following the point on the current line."
(newline)
(condition-case nil
(erlang-indent-line)
- (error (if (bolp) (delete-backward-char 1))))))
+ (error (if (bolp) (delete-char -1))))))
;; Then it's just a plain greater-than.
(t
@@ -4070,7 +4087,7 @@ After being split/merged into `erlang-after-arrow' and
(newline)
(condition-case nil
(erlang-indent-line)
- (error (if (bolp) (delete-backward-char 1)))))))
+ (error (if (bolp) (delete-char -1)))))))
(defun erlang-electric-newline (&optional arg)
@@ -4546,6 +4563,11 @@ Tags can be given on the forms `tag', `module:', `module:tag'."
(current-buffer))) ; Return the new buffer.
+
+
+
+
+
;; Process interactive arguments for erlang-find-tag-*.
;;
;; Negative arguments work only for `etags', not `tags'. This is not
@@ -4746,7 +4768,7 @@ for a tag on the form `module:tag'."
(and found
(or (null mod)
(string= mod (erlang-get-module-from-file-name
- (file-of-tag)))))))
+ (funcall (symbol-function 'file-of-tag))))))))
;;; Tags completion, Emacs 19 `etags' specific.
@@ -4786,10 +4808,10 @@ about Erlang modules."
(cond ((and erlang-tags-installed
(fboundp 'etags-tags-completion-table)
(fboundp 'tags-lazy-completion-table)) ; Emacs 23.1+
- ;; This depends on the advice called erlang-replace-tags-table
- ;; above. It is not enough to let-bind
- ;; tags-completion-table-function since that will not override
- ;; the buffer-local value in the TAGS buffer.
+ ;; This depends on the advice called
+ ;; erlang-replace-tags-table above. It is not enough to
+ ;; let-bind tags-completion-table-function since that may be
+ ;; overwritten in etags-recognize-tags-table.
(let ((find-tag-default-function 'erlang-find-tag-for-completion))
(complete-tag)))
((and erlang-tags-installed
@@ -4911,6 +4933,132 @@ about Erlang modules."
(progress-reporter-update progress-reporter (point))))))
table))
+
+;;; Xref backend erlang-etags
+
+;; In GNU Emacs 25 xref was introduced. It is a framework for cross
+;; referencing commands, in particular commands for finding
+;; definitions. It does not replace etags. It rather resides on top
+;; of it and provides user-friendly commands. The idea is that the
+;; user commands should be the same regardless of what backend does
+;; the actual finding of definitions.
+
+;; The backend below is a wrapper around the built-in etags backend.
+;; It adds awareness of the module:tag syntax in a similar way that is
+;; done above for the old etags commands.
+
+
+(defun erlang-etags--xref-backend () 'erlang-etags)
+
+(defun erlang-soft-require (feature)
+ (when (locate-library (symbol-name feature))
+ (require feature)))
+
+(and (erlang-soft-require 'xref)
+ (erlang-soft-require 'cl-generic)
+ ;; The purpose of using eval here is to avoid compilation
+ ;; warnings in emacsen without cl-defmethod.
+ (eval
+ '(progn
+ (cl-defmethod xref-backend-identifier-at-point
+ ((_backend (eql erlang-etags)))
+ (erlang-find-tag-default))
+
+ (cl-defmethod xref-backend-definitions
+ ((_backend (eql erlang-etags)) identifier)
+ (erlang-xref-find-definitions identifier))
+
+ (cl-defmethod xref-backend-apropos
+ ((_backend (eql erlang-etags)) identifier)
+ (erlang-xref-find-definitions identifier t))
+
+ ;; PENDING - This remains to be properly implemented.
+ (cl-defmethod xref-backend-identifier-completion-table
+ ((_backend (eql erlang-etags)))
+ (tags-lazy-completion-table)))))
+
+
+(defun erlang-xref-find-definitions (identifier &optional is-regexp)
+ (let ((id-list (split-string identifier ":")))
+ (cond
+ ;; Handle "tag"
+ ((null (cdr id-list))
+ (erlang-xref-find-definitions-tag identifier is-regexp))
+ ;; Handle "module:"
+ ((string-equal (cadr id-list) "")
+ (erlang-xref-find-definitions-module (car id-list)))
+ ;; Handle "module:tag"
+ (t
+ (erlang-xref-find-definitions-module-tag (car id-list)
+ (cadr id-list)
+ is-regexp)))))
+
+(defun erlang-xref-find-definitions-tag (tag is-regexp)
+ "Find all definitions of TAG and reorder them so that
+definitions in the currently visited file comes first."
+ (when (fboundp 'etags--xref-find-definitions)
+ (let* ((current-file (and (buffer-file-name)
+ (file-truename (buffer-file-name))))
+ (xrefs (etags--xref-find-definitions tag is-regexp))
+ local-xrefs non-local-xrefs)
+ (while xrefs
+ (if (string-equal (erlang-xref-truename-file (car xrefs))
+ current-file)
+ (push (car xrefs) local-xrefs)
+ (push (car xrefs) non-local-xrefs))
+ (setq xrefs (cdr xrefs)))
+ (append (reverse local-xrefs)
+ (reverse non-local-xrefs)))))
+
+(defun erlang-xref-find-definitions-module (module)
+ (and (fboundp 'xref-make)
+ (fboundp 'xref-make-file-location)
+ (let* ((first-time t)
+ xrefs matching-files)
+ (save-excursion
+ (while (visit-tags-table-buffer (not first-time))
+ (setq first-time nil)
+ (let ((files (tags-table-files)))
+ (while files
+ (let* ((file (car files))
+ (m (erlang-get-module-from-file-name file)))
+ (when (and m (string-equal m module))
+ (unless (member file matching-files)
+ (push file
+ matching-files)
+ (push (xref-make file
+ (xref-make-file-location file 1 0))
+ xrefs))))
+ (setq files (cdr files))))))
+ (nreverse xrefs))))
+
+(defun erlang-xref-find-definitions-module-tag (module tag is-regexp)
+ "Find all definitions of TAG and filter away definitions
+outside of MODULE."
+ (when (fboundp 'etags--xref-find-definitions)
+ (let ((xrefs (etags--xref-find-definitions tag is-regexp))
+ xrefs-in-module)
+ (while xrefs
+ (when (string-equal module (erlang-xref-module (car xrefs)))
+ (push (car xrefs) xrefs-in-module))
+ (setq xrefs (cdr xrefs)))
+ xrefs-in-module)))
+
+(defun erlang-xref-module (xref)
+ (erlang-get-module-from-file-name (erlang-xref-file xref)))
+
+(defun erlang-xref-truename-file (xref)
+ (let ((file (erlang-xref-file xref)))
+ (and file
+ (file-truename file))))
+
+(defun erlang-xref-file (xref)
+ (and (fboundp 'xref-location-group)
+ (fboundp 'xref-item-location)
+ (xref-location-group (xref-item-location xref))))
+
+
+
;;;
;;; Prepare for other methods to run an Erlang slave process.
;;;
@@ -5309,8 +5457,7 @@ frame will become deselected before the next command."
()
(or (inferior-erlang-running-p)
(error "No inferior Erlang shell is running"))
- (save-excursion
- (set-buffer inferior-erlang-buffer)
+ (with-current-buffer inferior-erlang-buffer
(let ((msg nil))
(while (save-excursion
(goto-char (process-mark inferior-erlang-process))
@@ -5330,8 +5477,7 @@ frame will become deselected before the next command."
The empty command resembles hitting RET. This is useful in some
situations, for instance if a crash or error report from sasl
has been printed after the last prompt."
- (save-excursion
- (set-buffer inferior-erlang-buffer)
+ (with-current-buffer inferior-erlang-buffer
(if (> (point-max) 1)
;; make sure we get a prompt if buffer contains data
(if (save-excursion
@@ -5397,7 +5543,7 @@ Return the position after the newly inserted command."
(boundp 'comint-last-output-start))
(save-excursion
(goto-char
- (if (interactive-p)
+ (if (erlang-interactive-p)
(symbol-value 'comint-last-input-end)
(symbol-value 'comint-last-output-start)))
(while (progn (skip-chars-forward "^\C-h")
@@ -5416,7 +5562,7 @@ Return the position after the newly inserted command."
(let ((pmark (process-mark (get-buffer-process (current-buffer)))))
(save-excursion
(goto-char
- (if (interactive-p)
+ (if (erlang-interactive-p)
(symbol-value 'comint-last-input-end)
(symbol-value 'comint-last-output-start)))
(while (re-search-forward "\r+$" pmark t)
@@ -5443,23 +5589,21 @@ There exists two workarounds for this bug:
(save-some-buffers)
(inferior-erlang-prepare-for-input)
(let* ((dir (inferior-erlang-compile-outdir))
-;;; (file (file-name-nondirectory (buffer-file-name)))
(noext (substring (erlang-local-buffer-file-name) 0 -4))
(opts (append (list (cons 'outdir dir))
(if current-prefix-arg
(list 'debug_info 'export_all))
erlang-compile-extra-opts))
end)
- (save-excursion
- (set-buffer inferior-erlang-buffer)
- (compilation-forget-errors))
+ (with-current-buffer inferior-erlang-buffer
+ (when (fboundp 'compilation-forget-errors)
+ (compilation-forget-errors)))
(setq end (inferior-erlang-send-command
(inferior-erlang-compute-compile-command noext opts)
nil))
(sit-for 0)
(inferior-erlang-wait-prompt)
- (save-excursion
- (set-buffer inferior-erlang-buffer)
+ (with-current-buffer inferior-erlang-buffer
(setq compilation-error-list nil)
(set-marker compilation-parsing-end end))
(setq compilation-last-buffer inferior-erlang-buffer)))
@@ -5499,7 +5643,8 @@ unless the optional NO-DISPLAY is non-nil."
(let ((ccfn erlang-compile-command-function-alist)
(res (inferior-erlang-compute-erl-compile-command module-name opts))
ccfn-entry
- done)
+ done
+ result)
(if (not (null (erlang-local-buffer-file-name)))
(while (and (not done) (not (null ccfn)))
(setq ccfn-entry (car ccfn))
@@ -5629,12 +5774,14 @@ unless the optional NO-DISPLAY is non-nil."
(tramp-tramp-file-p (buffer-file-name))))
(defun erlang-tramp-get-localname ()
- (let ((tramp-info (tramp-dissect-file-name (buffer-file-name))))
- (if (fboundp 'tramp-file-name-localname)
- (tramp-file-name-localname tramp-info)
- ;; In old versions of tramp, it was `tramp-file-name-path'
- ;; instead of the newer `tramp-file-name-localname'
- (tramp-file-name-path tramp-info))))
+ (when (fboundp 'tramp-dissect-file-name)
+ (let ((tramp-info (tramp-dissect-file-name (buffer-file-name))))
+ (if (fboundp 'tramp-file-name-localname)
+ (tramp-file-name-localname tramp-info)
+ ;; In old versions of tramp, it was `tramp-file-name-path'
+ ;; instead of the newer `tramp-file-name-localname'
+ (when (fboundp 'tramp-file-name-path)
+ (tramp-file-name-path tramp-info))))))
;; `next-error' only accepts buffers with major mode `compilation-mode'
;; or with the minor mode `compilation-minor-mode' activated.
@@ -5651,16 +5798,14 @@ Capable of finding error messages in an inferior Erlang buffer."
(and (boundp 'compilation-last-buffer)
compilation-last-buffer))))
(if (and (bufferp buf)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(and (eq major-mode 'erlang-shell-mode)
(setq major-mode 'compilation-mode))))
(unwind-protect
(progn
(setq done t)
(next-error argp))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(setq major-mode 'erlang-shell-mode))))
(or done
(next-error argp))))
@@ -5763,7 +5908,7 @@ Simplified version of a combination `defalias' and `make-obsolete',
it assumes that NEWDEF is loaded."
(defalias sym (symbol-function newdef))
(if (fboundp 'make-obsolete)
- (make-obsolete sym newdef)))
+ (make-obsolete sym newdef "long ago")))
(erlang-obsolete 'calculate-erlang-indent 'erlang-calculate-indent)
@@ -5781,11 +5926,8 @@ it assumes that NEWDEF is loaded."
(erlang-obsolete 'name-of-erlang-function 'erlang-name-of-function)
-;; Fixme: shouldn't redefine `set-visited-file-name' anyhow -- see above.
(defconst erlang-unload-hook
(list (lambda ()
- (defalias 'set-visited-file-name
- 'erlang-orig-set-visited-file-name)
(when (featurep 'advice)
(ad-unadvise 'Man-notify-when-ready)
(ad-unadvise 'set-visited-file-name)))))
diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented
index 6913068133..7a1ff6a954 100644
--- a/lib/tools/emacs/test.erl.indented
+++ b/lib/tools/emacs/test.erl.indented
@@ -70,6 +70,9 @@ foo() ->
234,
d}).
+-record(record5, { a = 1 :: integer()
+ , b = foobar :: atom()
+ }).
-define(MACRO_1, macro).
-define(MACRO_2(_), macro).
@@ -144,6 +147,12 @@ foo() ->
-type t25() :: #rec3{f123 :: [t24() |
1|2|3|4|a|b|c|d|
nonempty_maybe_improper_list(integer, any())]}.
+-type t26() :: #rec4{ a :: integer()
+ , b :: any()
+ }.
+-type t27() :: { integer()
+ , atom()
+ }.
-type t99() ::
{t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(),
t15(),t20(),t21(), t22(),t25()}.
@@ -179,6 +188,10 @@ foo() ->
| {'error', {'no_process', term()}
| {'no_such_group', term()}}.
+-spec add( X :: integer()
+ , Y :: integer()
+ ) -> integer().
+
-opaque attributes_data() ::
[{'column', column()} | {'line', info_line()} |
{'text', string()}] | {line(),column()}.
diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig
index 621948cbe1..2552c71baf 100644
--- a/lib/tools/emacs/test.erl.orig
+++ b/lib/tools/emacs/test.erl.orig
@@ -70,6 +70,9 @@ foo() ->
234,
d}).
+-record(record5, { a = 1 :: integer()
+, b = foobar :: atom()
+}).
-define(MACRO_1, macro).
-define(MACRO_2(_), macro).
@@ -144,6 +147,12 @@ nonempty_maybe_improper_list('integer', any())|
-type t25() :: #rec3{f123 :: [t24() |
1|2|3|4|a|b|c|d|
nonempty_maybe_improper_list(integer, any())]}.
+-type t26() :: #rec4{ a :: integer()
+, b :: any()
+}.
+-type t27() :: { integer()
+, atom()
+}.
-type t99() ::
{t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(),
t15(),t20(),t21(), t22(),t25()}.
@@ -179,6 +188,10 @@ t15(),t20(),t21(), t22(),t25()}.
| {'error', {'no_process', term()}
| {'no_such_group', term()}}.
+-spec add( X :: integer()
+, Y :: integer()
+) -> integer().
+
-opaque attributes_data() ::
[{'column', column()} | {'line', info_line()} |
{'text', string()}] | {line(),column()}.
diff --git a/lib/xmerl/src/xmerl_eventp.erl b/lib/xmerl/src/xmerl_eventp.erl
index 598d26261d..2cb76abc6e 100644
--- a/lib/xmerl/src/xmerl_eventp.erl
+++ b/lib/xmerl/src/xmerl_eventp.erl
@@ -199,7 +199,7 @@ cont2(F, Exception, Sofar, Fd, Fname, T, S) ->
find_good_split(list_to_binary([Sofar,Bin]),
F,Exception,Fd,Fname,T,S);
eof ->
- file:close(Fd),
+ ok = file:close(Fd),
NewS = xmerl_scan:cont_state([{Fname, eof}|T], S),
F(binary_to_list(Sofar), NewS);
Error ->
@@ -319,7 +319,7 @@ close(S) ->
[{_Fname, eof}|T] ->
xmerl_scan:cont_state(T, S);
[{_Sofar, _Fname, Fd}|T] ->
- file:close(Fd),
+ ok = file:close(Fd),
xmerl_scan:cont_state(T, S)
end.
diff --git a/lib/xmerl/src/xmerl_sax_parser.erl b/lib/xmerl/src/xmerl_sax_parser.erl
index 196baacda7..318a0cf7f4 100644
--- a/lib/xmerl/src/xmerl_sax_parser.erl
+++ b/lib/xmerl/src/xmerl_sax_parser.erl
@@ -32,17 +32,13 @@
%%----------------------------------------------------------------------
%% External exports
%%----------------------------------------------------------------------
--export([
- file/2,
- stream/2
- ]).
+-export([file/2,
+ stream/2]).
%%----------------------------------------------------------------------
%% Internal exports
%%----------------------------------------------------------------------
--export([
- default_continuation_cb/1
- ]).
+-export([default_continuation_cb/1]).
%%----------------------------------------------------------------------
%% Macros
@@ -81,7 +77,7 @@ file(Name,Options) ->
{current_location, CL},
{entity, File}
|Options]),
- file:close(FD),
+ ok = file:close(FD),
Res
end.
diff --git a/lib/xmerl/src/xmerl_sax_parser_base.erlsrc b/lib/xmerl/src/xmerl_sax_parser_base.erlsrc
index 200770a7cf..4d75805b9b 100644
--- a/lib/xmerl/src/xmerl_sax_parser_base.erlsrc
+++ b/lib/xmerl/src/xmerl_sax_parser_base.erlsrc
@@ -29,12 +29,10 @@
%%----------------------------------------------------------------------
%% External exports
%%----------------------------------------------------------------------
--export([
- parse/2,
+-export([parse/2,
parse_dtd/2,
is_name_char/1,
- is_name_start/1
- ]).
+ is_name_start/1]).
%%----------------------------------------------------------------------
%% Internal exports
@@ -1681,7 +1679,7 @@ handle_external_entity({file, FileToOpen}, State) ->
current_location=filename:dirname(FileToOpen),
entity=filename:basename(FileToOpen),
input_type=file}),
- file:close(FD),
+ ok = file:close(FD),
EntityState#xmerl_sax_parser_state.event_state
end;
handle_external_entity({http, Url}, State) ->
@@ -1700,8 +1698,8 @@ handle_external_entity({http, Url}, State) ->
current_location=filename:dirname(Url),
entity=filename:basename(Url),
input_type=file}),
- file:close(FD),
- file:delete(TmpFile),
+ ok = file:close(FD),
+ ok = file:delete(TmpFile),
EntityState#xmerl_sax_parser_state.event_state
end
catch
@@ -3471,17 +3469,17 @@ http_get_file(Host, Port, Key) ->
receive_msg(Socket, FD, true, SendTimeout)
catch
throw:{error, Error} ->
- file:close(FD),
- file:delete(Filename),
+ ok = file:close(FD),
+ ok = file:delete(Filename),
throw({error, Error})
end;
{error, _Reason} ->
- file:close(FD),
- file:delete(Filename),
+ ok = file:close(FD),
+ ok = file:delete(Filename),
throw({error, lists:flatten(io_lib:format("Couldn't fetch http://~s:~p/~s",
[Host, Port, Key]))})
end,
- file:close(FD),
+ ok = file:close(FD),
Filename.
%%----------------------------------------------------------------------
@@ -3498,11 +3496,11 @@ receive_msg(Socket, FD, WaitForHeader, Timeout) ->
{tcp_closed, Socket} ->
ok;
{tcp, Socket, Response} when WaitForHeader == false ->
- file:write(FD, Response),
+ ok = file:write(FD, Response),
receive_msg(Socket, FD, WaitForHeader, Timeout);
{tcp, Socket, Response} ->
MsgBody = remove_header(Response),
- file:write(FD, MsgBody),
+ ok = file:write(FD, MsgBody),
receive_msg(Socket, FD, false, Timeout);
{tcp_error, Socket, _Reason} ->
gen_tcp:close(Socket),
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl
index ea487a0900..2147a46a13 100644
--- a/lib/xmerl/src/xmerl_scan.erl
+++ b/lib/xmerl/src/xmerl_scan.erl
@@ -605,7 +605,7 @@ scan_document(Str0, S=#xmerl_scanner{event_fun = Event,
schema ->
case schemaLocations(Res, S5) of
{ok, Schemas} ->
- cleanup(S5),
+ _ = cleanup(S5),
%%?dbg("Schemas: ~p~nRes: ~p~ninhertih_options(S): ~p~n",
%% [Schemas,Res,inherit_options(S5)]),
XSDRes = xmerl_xsd:process_validate(Schemas, Res,
diff --git a/lib/xmerl/src/xmerl_xsd.erl b/lib/xmerl/src/xmerl_xsd.erl
index 412ef59e41..d97913ecbc 100644
--- a/lib/xmerl/src/xmerl_xsd.erl
+++ b/lib/xmerl/src/xmerl_xsd.erl
@@ -64,12 +64,10 @@
%%----------------------------------------------------------------------
%% External exports
%%----------------------------------------------------------------------
--export([
- validate/2,validate/3,process_validate/2,process_validate/3,
+-export([validate/2,validate/3,process_validate/2,process_validate/3,
process_schema/1,process_schema/2,
process_schemas/1,process_schemas/2,
- state2file/1,state2file/2,file2state/1,format_error/1
- ]).
+ state2file/1,state2file/2,file2state/1,format_error/1]).
%%----------------------------------------------------------------------
%% Internal exports
@@ -1178,7 +1176,7 @@ rename_redef_group(Name={LN,Scope,NS},S) ->
NewName = {LN,['#redefine'|Scope],NS},
case resolve({group,NewName},S) of
{SG=#schema_group{name=Name},_} ->
- save_object({group,SG#schema_group{name=NewName}},S),
+ _ = save_object({group,SG#schema_group{name=NewName}},S),
NewName;
_ ->
failed
@@ -3436,7 +3434,7 @@ check_keys([Key=#id_constraint{selector={selector,SelectorPath},
{L,S1} when length(L)==length(TargetNodeSet) ->
%% Part1: 3.11.4.4.2.1
S2 = key_sequence_uniqueness(L,XMLEl,S1),
- save_key(Key#id_constraint{key_sequence=L},S2),
+ _ = save_key(Key#id_constraint{key_sequence=L},S2),
S2;
{Err,S1} ->
acc_errs(S1,{error_path(XMLEl,XMLEl#xmlElement.name),?MODULE,
@@ -4014,7 +4012,7 @@ merge_derived_types(XSDType,InstType,Blocks,Mode,S) ->
{error,S2} ->
{InstType,S2};
{MergedType,S2} ->
- save_merged_type(MergedType,S2),
+ _ = save_merged_type(MergedType,S2),
{MergedType,S2}
end.
@@ -4970,7 +4968,7 @@ save_schema_element(CM,S=#xsd_state{elementFormDefault = EFD,
undefined -> [];
_ -> TN
end,
- save_in_table({schema,TN2},Schema2,S),
+ _ = save_in_table({schema,TN2},Schema2,S),
save_to_file(S).
%% other_global_elements(S,ElementList) ->
@@ -5006,13 +5004,13 @@ save_to_file(S=#xsd_state{tab2file=TF}) ->
{ok,IO}=file:open(filename:rootname(S#xsd_state.schema_name)++".tab",
[write]),
io:format(IO,"~p~n",[catch ets:tab2list(S#xsd_state.table)]),
- file:close(IO);
+ ok = file:close(IO);
false ->
ok;
IOFile ->
{ok,IO}=file:open(IOFile,[write]),
io:format(IO,"~p~n",[catch ets:tab2list(S#xsd_state.table)]),
- file:close(IO)
+ ok = file:close(IO)
end.
save_merged_type(Type=#schema_simple_type{},S) ->
@@ -5034,25 +5032,25 @@ save_idc(unique,IDConstr,S) ->
save_unique(IDConstr,S).
save_key(Key,S) ->
- save_object({key,Key},S),
+ _ = save_object({key,Key},S),
S.
save_keyref(KeyRef=#id_constraint{category=keyref},S) ->
S1 = add_keyref(KeyRef,S),
- save_object({keyref,KeyRef},S1),
+ _ = save_object({keyref,KeyRef},S1),
S1;
save_keyref(_,S) ->
S.
save_unique(Unique,S) ->
- save_object({unique,Unique},S),
+ _ = save_object({unique,Unique},S),
S.
save_substitutionGroup([],S) ->
S;
save_substitutionGroup([{Head,Members}|SGs],S) ->
%% save {head,[members]}
- save_in_table({substitutionGroup,Head},Members,S),
+ _ = save_in_table({substitutionGroup,Head},Members,S),
%% save {member,head}, an element can only be a member in one
%% substitutionGroup
lists:foreach(fun(X)->save_in_table({substitutionGroup_member,X},Head,S) end,Members),
diff --git a/lib/xmerl/src/xmerl_xsd_type.erl b/lib/xmerl/src/xmerl_xsd_type.erl
index 14a673b0c0..3ee5961522 100644
--- a/lib/xmerl/src/xmerl_xsd_type.erl
+++ b/lib/xmerl/src/xmerl_xsd_type.erl
@@ -229,11 +229,13 @@ check_float(Value) ->
%% {Mantissa,Exponent}=lists:splitwith(Pred,Value),
%% SkipEe = fun([]) -> [];(L) -> tl(L) end,
case string:tokens(Value,"eE") of
- [Mantissa,Exponent] ->
- {ok,_} = check_decimal(Mantissa),
- {ok,_} = check_integer(Exponent);
- [Mantissa] ->
- check_decimal(Mantissa)
+ [Mantissa,Exponent] ->
+ {ok,_} = check_decimal(Mantissa),
+ {ok,_} = check_integer(Exponent),
+ ok;
+ [Mantissa] ->
+ {ok,_} = check_decimal(Mantissa),
+ ok
end,
{ok,Value}.
%% case {check_decimal(Mantissa),
@@ -367,7 +369,7 @@ check_dateTime("+"++_DateTime) ->
check_dateTime(DateTime) ->
[Date,Time] = string:tokens(DateTime,"T"),
[Y,M,D] = string:tokens(Date,"-"),
- check_year(Y),
+ {ok,_} = check_year(Y),
{ok,_} = check_positive_integer(M),
{ok,_} = check_positive_integer(D),
check_time(Time).