aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLars G Thorsen <[email protected]>2010-01-26 10:13:35 +0000
committerErlang/OTP <[email protected]>2010-01-26 18:55:11 +0100
commitdf88b47cdafcc2e04452456942ea572a7b72e2f2 (patch)
tree36da537a36b45ff406acb8e714dde97bbe31e7af /lib
parent39ff2b44d130179d3ce722a9b3c07d27bfb72a2a (diff)
downloadotp-df88b47cdafcc2e04452456942ea572a7b72e2f2.tar.gz
otp-df88b47cdafcc2e04452456942ea572a7b72e2f2.tar.bz2
otp-df88b47cdafcc2e04452456942ea572a7b72e2f2.zip
OTP-8343 The documentation is now possible to build in an open source
environment after a number of bugs are fixed and some features are added in the documentation build process. - The arity calculation is updated. - The module prefix used in the function names for bif's are removed in the generated links so the links will look like http://www.erlang.org/doc/man/erlang.html#append_element-2 instead of http://www.erlang.org/doc/man/erlang.html#erlang:append_element-2 - Enhanced the menu positioning in the html documentation when a new page is loaded. - A number of corrections in the generation of man pages (thanks to Sergei Golovan) - Moved some man pages to more apropriate sections, pages in section 4 moved to 5 and pages in 6 moved to 7. - The legal notice is taken from the xml book file so OTP's build process can be used for non OTP applications.
Diffstat (limited to 'lib')
-rw-r--r--lib/appmon/doc/src/Makefile13
-rw-r--r--lib/common_test/doc/src/Makefile20
-rw-r--r--lib/crypto/doc/src/Makefile3
-rw-r--r--lib/docbuilder/doc/src/inline_tags.xml8
-rw-r--r--lib/edoc/Makefile6
-rw-r--r--lib/edoc/doc/src/Makefile5
-rw-r--r--lib/edoc/src/Makefile2
-rw-r--r--lib/erl_docgen/priv/bin/Makefile13
-rwxr-xr-xlib/erl_docgen/priv/bin/codeline_preprocessing.escript17
-rwxr-xr-xlib/erl_docgen/priv/bin/xml_from_edoc.escript149
-rw-r--r--lib/erl_docgen/priv/xsl/db_eix.xsl68
-rw-r--r--lib/erl_docgen/priv/xsl/db_html.xsl251
-rw-r--r--lib/erl_docgen/priv/xsl/db_man.xsl180
-rw-r--r--lib/erl_docgen/priv/xsl/db_pdf.xsl99
-rw-r--r--lib/erl_docgen/priv/xsl/db_pdf_params.xsl26
-rw-r--r--lib/et/doc/src/Makefile24
-rw-r--r--lib/eunit/doc/src/Makefile5
-rw-r--r--lib/hipe/Makefile18
-rw-r--r--lib/hipe/amd64/Makefile15
-rw-r--r--lib/hipe/arm/Makefile15
-rw-r--r--lib/hipe/cerl/Makefile15
-rw-r--r--lib/hipe/flow/Makefile15
-rw-r--r--lib/hipe/icode/Makefile15
-rw-r--r--lib/hipe/main/Makefile16
-rw-r--r--lib/hipe/misc/Makefile15
-rw-r--r--lib/hipe/opt/Makefile15
-rw-r--r--lib/hipe/ppc/Makefile15
-rw-r--r--lib/hipe/regalloc/Makefile16
-rw-r--r--lib/hipe/sparc/Makefile15
-rw-r--r--lib/hipe/tools/Makefile15
-rw-r--r--lib/hipe/util/Makefile15
-rw-r--r--lib/hipe/x86/Makefile15
-rw-r--r--lib/jinterface/doc/src/Makefile13
-rw-r--r--lib/odbc/doc/src/Makefile13
-rw-r--r--lib/percept/doc/src/Makefile14
-rw-r--r--lib/reltool/test/Makefile82
-rw-r--r--lib/reltool/test/README30
-rw-r--r--lib/reltool/test/reltool.spec2
-rw-r--r--lib/reltool/test/reltool_server_SUITE.erl494
-rw-r--r--lib/reltool/test/reltool_test_lib.erl329
-rw-r--r--lib/reltool/test/reltool_test_lib.hrl91
-rw-r--r--lib/reltool/test/reltool_wx_SUITE.erl62
-rwxr-xr-xlib/reltool/test/rtt55
-rw-r--r--lib/reltool/test/rtt.erl154
-rw-r--r--lib/stdlib/doc/src/beam_lib.xml152
-rw-r--r--lib/stdlib/doc/src/io.xml9
-rw-r--r--lib/stdlib/doc/src/unicode.xml4
-rw-r--r--lib/stdlib/doc/src/unicode_usage.xml6
-rw-r--r--lib/syntax_tools/Makefile6
-rw-r--r--lib/syntax_tools/doc/src/Makefile14
-rw-r--r--lib/syntax_tools/src/Makefile12
-rw-r--r--lib/test_server/doc/src/Makefile13
-rw-r--r--lib/test_server/src/Makefile12
-rw-r--r--lib/wx/doc/src/Makefile18
54 files changed, 2269 insertions, 435 deletions
diff --git a/lib/appmon/doc/src/Makefile b/lib/appmon/doc/src/Makefile
index ece0977810..743f123c06 100644
--- a/lib/appmon/doc/src/Makefile
+++ b/lib/appmon/doc/src/Makefile
@@ -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%
include $(ERL_TOP)/make/target.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk
@@ -46,6 +46,9 @@ XML_CHAPTER_FILES = \
BOOK_FILES = book.xml
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
GIF_FILES = \
app_win.gif \
listbox_win.gif \
diff --git a/lib/common_test/doc/src/Makefile b/lib/common_test/doc/src/Makefile
index a6ece5af28..a2c014418d 100644
--- a/lib/common_test/doc/src/Makefile
+++ b/lib/common_test/doc/src/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2003-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2003-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -112,18 +112,16 @@ DVIPS_FLAGS +=
CT_SRC_DIR = $(ERL_TOP)/../internal_tools/common_test/src
-EDOC_ARGS=[{preprocess,true},{includes,["$(XMERL_DIR)/include","../../../test_server/include","../../include","../../../../erts/lib/kernel/include","../../../../lib/kernel/include","../../../../erts/lib/snmp/include","../../../../lib/snmp/include"]}]
-
-
$(HTMLDIR)/%.gif: %.gif
$(INSTALL_DATA) $< $@
docs: pdf html man
$(CT_XML_FILES):
- erl -boot start_clean -noshell \
- -eval 'docb_gen:module("../../src/$(@:%.xml=%.erl)",$(EDOC_ARGS))' \
- -s erlang halt
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -preprocess true -i $(XMERL_DIR)/include \
+ -i ../../../test_server/include -i ../../include \
+ -i ../../../../erts/lib/kernel/include -i ../../../../lib/kernel/include \
+ -i ../../../../erts/lib/snmp/include -i ../../../../lib/snmp/include ../../src/$(@:%.xml=%.erl)
$(TOP_PDF_FILE): $(XML_FILES)
diff --git a/lib/crypto/doc/src/Makefile b/lib/crypto/doc/src/Makefile
index d2cec9b11b..03aaba939b 100644
--- a/lib/crypto/doc/src/Makefile
+++ b/lib/crypto/doc/src/Makefile
@@ -42,6 +42,9 @@ XML_CHAPTER_FILES = notes.xml licenses.xml
BOOK_FILES = book.xml
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) $(XML_REF6_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
GIF_FILES =
# ----------------------------------------------------
diff --git a/lib/docbuilder/doc/src/inline_tags.xml b/lib/docbuilder/doc/src/inline_tags.xml
index e1d392076a..10afbf143f 100644
--- a/lib/docbuilder/doc/src/inline_tags.xml
+++ b/lib/docbuilder/doc/src/inline_tags.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1997</year><year>2009</year>
+ <year>1997</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
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.
-
+
</legalnotice>
<title>Inline Tags</title>
@@ -157,7 +157,7 @@
<p>The default behaviour can be modified by using the callback
module option to <c>docb_transform:file/1,2</c> and defining a
callback function
- <seealso marker="docb_transform#Module:seealso/1">Module:seealso/1</seealso>.
+ <seealso marker="docb_transform#Module:seealso-1">Module:seealso/1</seealso>.
This possibility is for example used in OTP to resolve cross
references between applications.</p>
</section>
diff --git a/lib/edoc/Makefile b/lib/edoc/Makefile
index 2b011b55cc..e512e390e3 100644
--- a/lib/edoc/Makefile
+++ b/lib/edoc/Makefile
@@ -86,13 +86,13 @@ SYNTAX_TOOLS_DIR=$(ERL_TOP)/lib/syntax_tools
XMERL_DIR=$(ERL_TOP)/lib/xmerl
INCDIR=$(XMERL_DIR)/include
-docs:
+# The overriding docs target have been removed so the default make rules work properly.
+
+edocs:
erl -noshell -pa $(BINDIR) -pa $(SYNTAX_TOOLS_DIR)/ebin \
-pa $(XMERL_DIR)/ebin -run edoc_run application \
"'$(APPNAME)'" '"."' '$(DOC_OPTS)'
-edocs: docs
-
info:
@echo $(HTML_FILES)
diff --git a/lib/edoc/doc/src/Makefile b/lib/edoc/doc/src/Makefile
index 8d22e1c1da..748691d173 100644
--- a/lib/edoc/doc/src/Makefile
+++ b/lib/edoc/doc/src/Makefile
@@ -103,11 +103,10 @@ html: gifs $(HTML_REF_MAN_FILE)
man: $(MAN3_FILES)
$(XML_REF3_FILES):
- docb_gen -def vsn $(EDOC_VSN) -includes $(INC_DIR) \
- $(SRC_DIR)/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EDOC_VSN) -i $(ERL_TOP)/lib/edoc/include $(SRC_DIR)/$(@:%.xml=%.erl)
$(XML_CHAPTER_FILES):
- docb_gen -chapter -def vsn $(EDOC_VSN) ../overview.edoc
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EDOC_VSN) -chapter ../overview.edoc
gifs: $(GIF_FILES:%=$(HTMLDIR)/%)
diff --git a/lib/edoc/src/Makefile b/lib/edoc/src/Makefile
index fd0fbac37d..ca95c4cdad 100644
--- a/lib/edoc/src/Makefile
+++ b/lib/edoc/src/Makefile
@@ -55,6 +55,8 @@ all: $(OBJECTS)
$(OBJECTS): $(HRL_FILES) $(XMERL)/include/xmerl.hrl
+docs:
+
clean:
rm -f $(OBJECTS) edoc_parser.erl
rm -f core *~
diff --git a/lib/erl_docgen/priv/bin/Makefile b/lib/erl_docgen/priv/bin/Makefile
index bd59675003..95ad36216a 100644
--- a/lib/erl_docgen/priv/bin/Makefile
+++ b/lib/erl_docgen/priv/bin/Makefile
@@ -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%
#
#
@@ -38,7 +38,8 @@ RELSYSDIR = $(RELEASE_PATH)/lib/erl_docgen-$(VSN)
ESCRIPT_FILES= \
- codeline_preprocessing.escript
+ codeline_preprocessing.escript \
+ xml_from_edoc.escript
# ----------------------------------------------------
# FLAGS
diff --git a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript
index 33a678d3a4..592b3985e4 100755
--- a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript
+++ b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript
@@ -1,20 +1,20 @@
#!/usr/bin/env escript
%% -*- erlang -*-
%% %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%
%%----------------------------------------------------------------------
%% File : codeline_preprocessing.escript
@@ -54,13 +54,16 @@ main([InFile, OutFile]) ->
main(_) ->
usage().
+%%======================================================================
+%% Internal functions
+%%======================================================================
%%----------------------------------------------------------------------
-%% Function: main/1
+%% Function: usage/0
%% Description:
%%----------------------------------------------------------------------
usage() ->
- io:format("usage: codeline_preprocessing <infile> <outfile>\n"),
+ io:format("usage: codeline_preprocessing.escript <infile> <outfile>\n"),
halt(1).
diff --git a/lib/erl_docgen/priv/bin/xml_from_edoc.escript b/lib/erl_docgen/priv/bin/xml_from_edoc.escript
new file mode 100755
index 0000000000..ee79e82c3a
--- /dev/null
+++ b/lib/erl_docgen/priv/bin/xml_from_edoc.escript
@@ -0,0 +1,149 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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%
+%%----------------------------------------------------------------------
+%% File : xml_from_edoc.escript
+%%
+%% Created : 12 Dec 2009 by Lars Thorsen
+%%----------------------------------------------------------------------
+
+
+%%======================================================================
+%% Records
+%%======================================================================
+-record(args, {suffix=".xml",
+ layout=docb_edoc_xml_cb,
+ def=[],
+ includes=[],
+ preprocess=false,
+ sort_functions=true}).
+
+
+%%======================================================================
+%% External functions
+%%======================================================================
+%%----------------------------------------------------------------------
+%% Function: main/1
+%% Description:
+%%----------------------------------------------------------------------
+main(RawOpts) ->
+ case catch parse(RawOpts, erlref, #args{}) of
+ {ok, File, Type, Args} ->
+ case Type of
+ erlref ->
+ module(File, Args);
+ chapter ->
+ users_guide(File, Args)
+ end;
+ {error, Msg} ->
+ io:format("~p\n", [Msg]),
+ usage()
+ end;
+main(_) ->
+ usage().
+
+%%======================================================================
+%% Internal functions
+%%======================================================================
+
+%%----------------------------------------------------------------------
+%% Function: usage/0
+%% Description:
+%%----------------------------------------------------------------------
+usage() ->
+ io:format("usage: xml_from_edoc.escript [<options>] <file> \n"),
+ halt(1).
+
+
+%%----------------------------------------------------------------------
+%% Function: module/2
+%% Description:
+%%----------------------------------------------------------------------
+module(File, Args) ->
+ case filelib:is_regular(File) of
+ true ->
+ Opts = [{def, Args#args.def},
+ {includes, Args#args.includes},
+ {preprocess, Args#args.preprocess},
+ {sort_functions, Args#args.sort_functions},
+
+ {app_default, "OTPROOT"},
+ {file_suffix, Args#args.suffix},
+ {dir, "."},
+ {layout, Args#args.layout}],
+ edoc:file(File, Opts);
+ false ->
+ io:format("~s: not a regular file\n", [File]),
+ usage()
+ end.
+
+
+%%----------------------------------------------------------------------
+%% Function: users_guide/2
+%% Description:
+%%----------------------------------------------------------------------
+users_guide(File, Args) ->
+ case filelib:is_regular(File) of
+ true ->
+ Opts = [{def, Args#args.def},
+ {app_default, "OTPROOT"},
+ {file_suffix, Args#args.suffix},
+ {layout, Args#args.layout}],
+
+ Env = edoc_lib:get_doc_env(Opts),
+
+ {ok, Tags} =
+ edoc_extract:file(File, overview, Env, Opts),
+ Data =
+ edoc_data:overview("Overview", Tags, Env, Opts),
+ F = fun(M) -> M:overview(Data, Opts) end,
+ Text = edoc_lib:run_layout(F, Opts),
+
+ OutFile = "chapter" ++ Args#args.suffix,
+ edoc_lib:write_file(Text, ".", OutFile);
+ false ->
+ io:format("~s: not a regular file\n", [File]),
+ usage()
+ end.
+
+
+
+parse(["-xml" |RawOpts], Type, Args) ->
+ parse(RawOpts, Type, Args); % default, no update of record necessary
+parse(["-sgml" |RawOpts], Type, Args) ->
+ parse(RawOpts, Type, Args#args{suffix=".sgml", layout=docb_edoc_sgml_cb});
+parse(["-chapter" |RawOpts], _Type, Args) ->
+ parse(RawOpts, chapter, Args);
+parse(["-def", Key, Val |RawOpts], Type, Args) ->
+ Args2 = Args#args{def=Args#args.def++[{list_to_atom(Key), Val}]},
+ parse(RawOpts, Type, Args2);
+
+parse(["-i", Dir |RawOpts], Type, Args) ->
+ Args2 = Args#args{includes=Args#args.includes++[Dir]},
+ parse(RawOpts, Type, Args2);
+parse(["-preprocess", Bool |RawOpts], Type, Args) when Bool == "true";
+ Bool == "false" ->
+ parse(RawOpts, Type, Args#args{preprocess=list_to_atom(Bool)});
+parse(["-sort_functions", Bool |RawOpts], Type, Args) when Bool == "true";
+ Bool == "false" ->
+ parse(RawOpts, Type, Args#args{sort_functions=list_to_atom(Bool)});
+parse([File], Type, Args) ->
+ {ok, File, Type, Args};
+parse([Opt | _RawOpts], _Type, _Args) ->
+ {error, io_lib:format("Bad option: ~p", [Opt])}.
+
diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl
index 929272256a..970b85ccb9 100644
--- a/lib/erl_docgen/priv/xsl/db_eix.xsl
+++ b/lib/erl_docgen/priv/xsl/db_eix.xsl
@@ -137,7 +137,20 @@
<xsl:value-of select="substring-before(nametext, '(')"/>
</xsl:when>
<xsl:when test="ancestor::erlref">
- <xsl:value-of select="substring-before(., '(')"/>
+ <xsl:variable name="fname1">
+ <xsl:value-of select="substring-before(., '(')"/>
+ </xsl:variable>
+ <xsl:variable name="fname2">
+ <xsl:value-of select="substring-after($fname1, 'erlang:')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($fname2) > 0">
+ <xsl:value-of select="$fname2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$fname1"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:variable>
@@ -178,26 +191,63 @@
</xsl:template>
<xsl:template name="remove-paren">
- <xsl:param name="string"/>
- <xsl:variable name="bstring">
- <xsl:value-of select="substring-before($string, '(')"/>
+ <xsl:param name="string"/>
+
+ <xsl:variable name="str1">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$string"/>
+ <xsl:with-param name="start">(</xsl:with-param>
+ <xsl:with-param name="end">)</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="str2">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$str1"/>
+ <xsl:with-param name="start">{</xsl:with-param>
+ <xsl:with-param name="end">}</xsl:with-param>
+ </xsl:call-template>
</xsl:variable>
+
+ <xsl:variable name="str3">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$str2"/>
+ <xsl:with-param name="start">[</xsl:with-param>
+ <xsl:with-param name="end">]</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:value-of select="$str3"/>
+
+ </xsl:template>
+
+
+ <xsl:template name="remove-paren-1">
+ <xsl:param name="string"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+
+ <xsl:variable name="tmp1">
+ <xsl:value-of select="substring-before($string, $start)"/>
+ </xsl:variable>
+
<xsl:choose>
- <xsl:when test="string-length($bstring) > 0">
- <xsl:variable name="astring">
- <xsl:value-of select="substring-after($string, ')')"/>
+ <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)">
+ <xsl:variable name="tmp2">
+ <xsl:value-of select="substring-after($string, $end)"/>
</xsl:variable>
<xsl:variable name="retstring">
<xsl:call-template name="remove-paren">
- <xsl:with-param name="string" select="$astring"/>
+ <xsl:with-param name="string" select="$tmp2"/>
</xsl:call-template>
</xsl:variable>
- <xsl:value-of select="concat($bstring, $retstring)"/>
+ <xsl:value-of select="concat(concat($tmp1, 'x'), $retstring)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
+
</xsl:template>
<!-- default content handling -->
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl
index 984655fc26..c2b58e48ec 100644
--- a/lib/erl_docgen/priv/xsl/db_html.xsl
+++ b/lib/erl_docgen/priv/xsl/db_html.xsl
@@ -2,20 +2,20 @@
<!--
#
# %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%
-->
@@ -40,6 +40,46 @@
<div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="{$topdocdir}/js/flipmenu/flipmenu.js"/>
<script id="js2" type="text/javascript" src="{$topdocdir}/js/erlresolvelinks.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ <xsl:text disable-output-escaping="yes"><![CDATA[
+ <!--
+ function getWinHeight() {
+ var myHeight = 0;
+ if( typeof( window.innerHeight ) == 'number' ) {
+ //Non-IE
+ myHeight = window.innerHeight;
+ } else if( document.documentElement && ( document.documentElement.clientWidth ||
+ document.documentElement.clientHeight ) ) {
+ //IE 6+ in 'standards compliant mode'
+ myHeight = document.documentElement.clientHeight;
+ } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
+ //IE 4 compatible
+ myHeight = document.body.clientHeight;
+ }
+ return myHeight;
+ }
+
+ function setscrollpos() {
+ var objf=document.getElementById('loadscrollpos');
+ document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
+ }
+
+ function addEvent(obj, evType, fn){
+ if (obj.addEventListener){
+ obj.addEventListener(evType, fn, true);
+ return true;
+ } else if (obj.attachEvent){
+ var r = obj.attachEvent("on"+evType, fn);
+ return r;
+ } else {
+ return false;
+ }
+ }
+
+ addEvent(window, 'load', setscrollpos);
+
+ //-->]]></xsl:text>
+ </script>
<!-- Generate menu -->
<xsl:call-template name="menu">
<xsl:with-param name="chapnum" select="$chapnum"/>
@@ -543,7 +583,13 @@
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <li title="{header/title}" expanded="{$expanded}">
+ <xsl:variable name="loadscrollpos">
+ <xsl:choose>
+ <xsl:when test="$chapnum = $curchapnum">loadscrollpos</xsl:when>
+ <xsl:otherwise>no</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <li id="{$loadscrollpos}" title="{header/title}" expanded="{$expanded}">
<xsl:value-of select="header/title"/>
<ul>
<li>
@@ -731,12 +777,19 @@
</xsl:choose>
</xsl:variable>
+ <xsl:variable name="loadscrollpos">
+ <xsl:choose>
+ <xsl:when test="$curModule = $cval">loadscrollpos</xsl:when>
+ <xsl:otherwise>no</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
<xsl:variable name="link_cval"><xsl:value-of select="translate($cval, '&#173;', '')"/></xsl:variable>
<xsl:choose>
<xsl:when test="$genFuncMenu = 'true'">
- <li title="{$cval} " expanded="{$expanded}">
+ <li id="{$loadscrollpos}" title="{$cval} " expanded="{$expanded}">
<xsl:value-of select="$cval"/>
<ul>
<li>
@@ -788,58 +841,73 @@
<xsl:when test="string-length($fname) > 0">
<li title="{$fname}">
<a href="{$basename}.html#{$fname}">
- <xsl:value-of select="$fname"/>()
- </a>
- </li>
- </xsl:when>
- <xsl:otherwise>
- <li title="{name/nametext}">
- <a href="{$basename}.html#{name/nametext}">
- <xsl:value-of select="nametext"/>()
- </a>
- </li>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
-
- <xsl:when test="ancestor::erlref">
-
- <xsl:variable name="tmpstring">
- <xsl:value-of select="substring-before(substring-after(., '('), '->')"/>
- </xsl:variable>
-
- <xsl:variable name="ustring">
- <xsl:choose>
- <xsl:when test="string-length($tmpstring) > 0">
- <xsl:call-template name="remove-paren">
- <xsl:with-param name="string" select="$tmpstring"/>
- </xsl:call-template>
+ <xsl:value-of select="$fname"/>()
+ </a>
+ </li>
</xsl:when>
<xsl:otherwise>
- <xsl:call-template name="remove-paren">
- <xsl:with-param name="string" select="substring-after(., '(')"/>
- </xsl:call-template>
+ <li title="{name/nametext}">
+ <a href="{$basename}.html#{name/nametext}">
+ <xsl:value-of select="nametext"/>()
+ </a>
+ </li>
</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="arity">
- <xsl:call-template name="calc-arity">
- <xsl:with-param name="string" select="substring-before($ustring, ')')"/>
- <xsl:with-param name="no-of-pars" select="0"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="fname">
- <xsl:value-of select="substring-before(., '(')"/>
- </xsl:variable>
- <li title="{$fname}-{$arity}">
- <a href="{$basename}.html#{$fname}-{$arity}">
- <xsl:value-of select="$fname"/>/<xsl:value-of select="$arity"/>
- </a>
- </li>
- </xsl:when>
- </xsl:choose>
-
+ </xsl:choose>
+ </xsl:when>
+
+ <xsl:when test="ancestor::erlref">
+
+ <xsl:variable name="tmpstring">
+ <xsl:value-of select="substring-before(substring-after(., '('), '->')"/>
+ </xsl:variable>
+
+ <xsl:variable name="ustring">
+ <xsl:choose>
+ <xsl:when test="string-length($tmpstring) > 0">
+ <xsl:call-template name="remove-paren">
+ <xsl:with-param name="string" select="$tmpstring"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="remove-paren">
+ <xsl:with-param name="string" select="substring-after(., '(')"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="arity">
+ <xsl:call-template name="calc-arity">
+ <xsl:with-param name="string" select="substring-before($ustring, ')')"/>
+ <xsl:with-param name="no-of-pars" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="fname">
+ <xsl:variable name="fname1">
+ <xsl:value-of select="substring-before(., '(')"/>
+ </xsl:variable>
+ <xsl:variable name="fname2">
+ <xsl:value-of select="substring-after($fname1, 'erlang:')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($fname2) > 0">
+ <xsl:value-of select="$fname2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$fname1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <li title="{$fname}-{$arity}">
+ <a href="{$basename}.html#{$fname}-{$arity}">
+ <xsl:value-of select="$fname"/>/<xsl:value-of select="$arity"/>
+ </a>
+ </li>
+ </xsl:when>
+ </xsl:choose>
+
</xsl:for-each>
</xsl:template>
@@ -1065,6 +1133,7 @@
<!-- Funcs -->
<xsl:template match="funcs">
+ <xsl:param name="partnum"/>
<h3>
<xsl:text>EXPORTS</xsl:text>
@@ -1121,11 +1190,26 @@
<a name="{substring-before(nametext, '(')}"><span class="bold_code"><xsl:value-of select="ret"/><xsl:text> </xsl:text><xsl:value-of select="nametext"/></span></a><br/>
</xsl:when>
<xsl:when test="ancestor::erlref">
- <a name="{substring-before(., '(')}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/>
+ <xsl:variable name="fname">
+ <xsl:variable name="fname1">
+ <xsl:value-of select="substring-before(., '(')"/>
+ </xsl:variable>
+ <xsl:variable name="fname2">
+ <xsl:value-of select="substring-after($fname1, 'erlang:')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($fname2) > 0">
+ <xsl:value-of select="$fname2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$fname1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/>
</xsl:when>
</xsl:choose>
-
</xsl:template>
@@ -1167,6 +1251,7 @@
<!-- Desc -->
<xsl:template match="desc">
+ <xsl:param name="partnum"/>
<div class="REFBODY">
<p>
<xsl:apply-templates>
@@ -1458,29 +1543,65 @@
</xsl:choose>
</xsl:template>
+
<xsl:template name="remove-paren">
<xsl:param name="string"/>
+
+ <xsl:variable name="str1">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$string"/>
+ <xsl:with-param name="start">(</xsl:with-param>
+ <xsl:with-param name="end">)</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="str2">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$str1"/>
+ <xsl:with-param name="start">{</xsl:with-param>
+ <xsl:with-param name="end">}</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="str3">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$str2"/>
+ <xsl:with-param name="start">[</xsl:with-param>
+ <xsl:with-param name="end">]</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:value-of select="$str3"/>
+
+ </xsl:template>
+
+
+ <xsl:template name="remove-paren-1">
+ <xsl:param name="string"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
- <xsl:variable name="bstring">
- <xsl:value-of select="substring-before($string, '(')"/>
+ <xsl:variable name="tmp1">
+ <xsl:value-of select="substring-before($string, $start)"/>
</xsl:variable>
<xsl:choose>
- <xsl:when test="string-length($bstring) > 0">
- <xsl:variable name="astring">
- <xsl:value-of select="substring-after($string, ')')"/>
+ <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)">
+ <xsl:variable name="tmp2">
+ <xsl:value-of select="substring-after($string, $end)"/>
</xsl:variable>
<xsl:variable name="retstring">
<xsl:call-template name="remove-paren">
- <xsl:with-param name="string" select="$astring"/>
+ <xsl:with-param name="string" select="$tmp2"/>
</xsl:call-template>
</xsl:variable>
- <xsl:value-of select="concat($bstring, $retstring)"/>
+ <xsl:value-of select="concat(concat($tmp1, 'x'), $retstring)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
+
</xsl:template>
</xsl:stylesheet>
diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl
index c759a77496..300d1ed362 100644
--- a/lib/erl_docgen/priv/xsl/db_man.xsl
+++ b/lib/erl_docgen/priv/xsl/db_man.xsl
@@ -2,20 +2,20 @@
<!--
#
# %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%
-->
@@ -37,14 +37,12 @@
<!-- *ref/Section -->
<xsl:template match="erlref/section|comref/section|cref/section|fileref/section|appref/section">
- <xsl:text>&#10;.RE&#10;</xsl:text>
<xsl:text>&#10;.SH "</xsl:text><xsl:value-of select="translate(title, 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/><xsl:text>"&#10;</xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!-- *ref/Subsection -->
- <xsl:template match="erlref/section/section|comref/section/section|cref/section/section|fileref/section/section|appref/section/section">
- <xsl:text>&#10;.RE&#10;</xsl:text>
+ <xsl:template match="section/section">
<xsl:text>&#10;.SS "</xsl:text><xsl:value-of select="title"/><xsl:text>"&#10;</xsl:text>
<xsl:apply-templates/>
</xsl:template>
@@ -53,9 +51,9 @@
<!-- Lists -->
<xsl:template match="list">
- <xsl:text>&#10;.RS 2&#10;</xsl:text>
+ <xsl:text>&#10;.RS 2</xsl:text>
<xsl:apply-templates/>
- <xsl:text>&#10;.RE&#10;</xsl:text>
+ <xsl:text>&#10;.RE</xsl:text>
</xsl:template>
<xsl:template match="list/item">
@@ -65,72 +63,80 @@
<xsl:apply-templates/>
</xsl:variable>
<xsl:value-of select="normalize-space($content)"/>
- <xsl:text>&#10;.br&#10;</xsl:text>
- <xsl:text>&#10;.br&#10;</xsl:text>
+ <xsl:text>&#10;.LP&#10;</xsl:text>
</xsl:template>
<xsl:template match="taglist">
- <xsl:text>&#10;.RS 2&#10;</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>&#10;.RE&#10;</xsl:text>
+ <xsl:text>&#10;.RS 2</xsl:text>
+ <xsl:apply-templates select="tag|item"/>
+ <xsl:text>&#10;.RE</xsl:text>
</xsl:template>
<xsl:template match="taglist/tag">
- <xsl:text>&#10;.TP 4&#10;</xsl:text>
+ <xsl:text>&#10;.TP 2&#10;</xsl:text>
<xsl:text>.B&#10;</xsl:text>
- <xsl:apply-templates/>
+ <xsl:apply-templates/><xsl:text>:&#10;</xsl:text>
</xsl:template>
<xsl:template match="item/p">
<xsl:variable name="content">
<xsl:apply-templates/>
</xsl:variable>
- <xsl:value-of select="normalize-space($content)"/>
- <xsl:text>&#10;.br&#10;</xsl:text>
- <xsl:text>&#10;.br&#10;</xsl:text>
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="normalize-space($content)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>&#10;.RS 2</xsl:text>
+ <xsl:text>&#10;.LP&#10;&#10;.LP&#10;</xsl:text>
+ <xsl:value-of select="normalize-space($content)"/>
+ <xsl:text>&#10;.RE</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
-
<xsl:template match="taglist/item">
- <xsl:text>&#10;</xsl:text>
- <xsl:apply-templates/>
+ <xsl:choose>
+ <xsl:when test="child::p">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!-- Note -->
<xsl:template match="note">
- <xsl:text>&#10;.TP 4&#10;.B&#10;Note:&#10;</xsl:text>
+ <xsl:text>&#10;.SS Note:</xsl:text>
<xsl:apply-templates/>
+ <xsl:text>&#10;</xsl:text>
</xsl:template>
<!-- Warning -->
<xsl:template match="warning">
- <xsl:text>&#10;.TP 4&#10;.B&#10;Warning:&#10;</xsl:text>
+ <xsl:text>&#10;.SS Warning:</xsl:text>
<xsl:apply-templates/>
+ <xsl:text>&#10;</xsl:text>
</xsl:template>
- <xsl:template match="warning/p|note/p">
- <xsl:variable name="content">
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:value-of select="normalize-space($content)"/>
- <xsl:text>&#10;.LP&#10;</xsl:text>
- </xsl:template>
-
-
<!-- Paragraph -->
<xsl:template match="p">
- <xsl:text>&#10;.LP&#10;</xsl:text>
<xsl:variable name="content">
<xsl:apply-templates/>
</xsl:variable>
+ <xsl:text>&#10;.LP&#10;</xsl:text>
<xsl:value-of select="normalize-space($content)"/>
</xsl:template>
<!-- Inline elements -->
<xsl:template match="b">
- <xsl:text> \fB</xsl:text>
+ <xsl:text>\fB</xsl:text>
<xsl:apply-templates/>
- <xsl:text>\fR\&amp;</xsl:text>
+ <xsl:text>\fR\&amp; </xsl:text>
</xsl:template>
<xsl:template match="br">
@@ -138,19 +144,20 @@
</xsl:template>
<xsl:template match="c">
- <xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&amp;</xsl:text>
+ <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
</xsl:template>
<xsl:template match="em">
- <xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&amp;</xsl:text>
+ <xsl:text>\fI</xsl:text> <xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
</xsl:template>
<xsl:template match="seealso">
- <xsl:text> \fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
+ <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
</xsl:template>
<!-- Code -->
<xsl:template match="code">
+ <xsl:text>&#10;.LP&#10;</xsl:text>
<xsl:text>&#10;.nf&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;.fi&#10;</xsl:text>
@@ -158,6 +165,7 @@
<!-- Pre -->
<xsl:template match="pre">
+ <xsl:text>&#10;.LP&#10;</xsl:text>
<xsl:text>&#10;.nf&#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#10;.fi&#10;</xsl:text>
@@ -168,16 +176,7 @@
<xsl:template match="table">
</xsl:template>
- <!--xsl:template match="row">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="cell">
- <xsl:apply-templates/>
- </xsl:template -->
-
-
- <!-- Image -->
+ <!-- Image -->
<xsl:template match="image">
</xsl:template>
@@ -192,7 +191,7 @@
<!-- Erlref -->
<xsl:template match="/erlref">
<xsl:text>.TH </xsl:text><xsl:value-of select="module"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Erlang Module Definition"&#10;</xsl:text>
- <xsl:text>.SH MODULE&#10;</xsl:text>
+ <xsl:text>.SH NAME&#10;</xsl:text>
<xsl:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text>&#10;</xsl:text>
<xsl:apply-templates/>
</xsl:template>
@@ -225,7 +224,7 @@
<xsl:template match="/appref">
<xsl:text>.TH </xsl:text><xsl:value-of select="app"/><xsl:text> 6 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Erlang Application Definition"&#10;</xsl:text>
<xsl:text>.SH NAME&#10;</xsl:text>
- <xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text>&#10;</xsl:text>
+ <xsl:value-of select="app"/><xsl:text> \- </xsl:text><xsl:value-of select="appsummary"/><xsl:text>&#10;</xsl:text>
<xsl:apply-templates/>
</xsl:template>
@@ -297,9 +296,80 @@
<!-- This tag is skipped for now. -->
</xsl:template>
- <!-- xsl:template match="p/text()">
- <xsl:value-of select="normalize-space()"/>
- </xsl:template-->
+
+ <!-- Authors -->
+ <xsl:template match="authors">
+ <xsl:text>&#10;.SH AUTHORS</xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- Aname -->
+ <xsl:template match="authors/aname">
+ <xsl:text>&#10;.LP&#10;</xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- Email -->
+ <xsl:template match="authors/email">
+ <xsl:text>&#10;.I&#10;&lt;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&gt;</xsl:text>
+ </xsl:template>
+
+ <!-- Replace ' by \&' ans . by \&. -->
+ <xsl:template match="text()">
+ <!-- xsl:variable name="content">
+ <xsl:choose>
+ <xsl:when test="ancestor::code or ancestor::c">
+ <xsl:value-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable-->
+
+ <xsl:variable name="rep1">
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="." />
+ <xsl:with-param name="replace" select="&quot;\&quot;" />
+ <xsl:with-param name="with" select="&quot;\\&quot;" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rep2">
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="$rep1" />
+ <xsl:with-param name="replace" select="&quot;&apos;&quot;" />
+ <xsl:with-param name="with" select="&quot;\&amp;&apos;&quot;" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="$rep2" />
+ <xsl:with-param name="replace" select="&quot;.&quot;" />
+ <xsl:with-param name="with" select="&quot;\&amp;.&quot;" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- Template replace-string is borrowed at http://www.dpawson.co.uk/xsl/sect2/replace.html -->
+ <xsl:template name="replace-string">
+ <xsl:param name="text"/>
+ <xsl:param name="replace"/>
+ <xsl:param name="with"/>
+ <xsl:choose>
+ <xsl:when test="contains($text,$replace)">
+ <xsl:value-of select="substring-before($text,$replace)"/>
+ <xsl:value-of select="$with"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
+ <xsl:with-param name="replace" select="$replace"/>
+ <xsl:with-param name="with" select="$with"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
<xsl:template match="d/text()">
<xsl:value-of select="normalize-space()"/>
diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl
index bef86277ea..e12b4d219a 100644
--- a/lib/erl_docgen/priv/xsl/db_pdf.xsl
+++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl
@@ -2,20 +2,20 @@
<!--
#
# %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%
-->
@@ -229,7 +229,9 @@
<xsl:value-of select="$companyname"/>
</fo:block>
<fo:block xsl:use-attribute-sets="cover.inner.copyrightnotice">
- The contents of this file are subject to the Erlang Public License,
+ <xsl:value-of select="/book/header/legalnotice"/>
+
+ <!-- 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
@@ -241,6 +243,7 @@
under the License.
The Initial Developer of the Original Code is
+-->
<xsl:value-of select="$companyname"/>.
</fo:block>
<fo:block xsl:use-attribute-sets="cover.inner.date">
@@ -382,7 +385,9 @@
<xsl:choose>
<xsl:when test="ancestor::cref">
<fo:bookmark internal-destination="{generate-id(nametext)}" starting-state="hide">
- <xsl:variable name="fname"><xsl:value-of select="substring-before(nametext, '(')"/></xsl:variable>
+ <xsl:variable name="fname">
+ <xsl:value-of select="substring-before(nametext, '(')"/>
+ </xsl:variable>
<fo:bookmark-title>
<xsl:choose>
<xsl:when test="string-length($fname) > 0">
@@ -422,8 +427,26 @@
<xsl:with-param name="no-of-pars" select="0"/>
</xsl:call-template>
</xsl:variable>
+
+ <xsl:variable name="fname">
+ <xsl:variable name="fname1">
+ <xsl:value-of select="substring-before(., '(')"/>
+ </xsl:variable>
+ <xsl:variable name="fname2">
+ <xsl:value-of select="substring-after($fname1, 'erlang:')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($fname2) > 0">
+ <xsl:value-of select="$fname2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$fname1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
<fo:bookmark-title>
- <xsl:value-of select="substring-before(., '(')"/>/<xsl:value-of select="$arity"/>
+ <xsl:value-of select="$fname"/>/<xsl:value-of select="$arity"/>
</fo:bookmark-title>
</fo:bookmark>
</xsl:when>
@@ -668,12 +691,12 @@
<xsl:number level="any" from="part" count="code"/>
</xsl:variable>
- <fo:block xsl:use-attribute-sets="code" margin-left="1.5em">
+ <fo:block xsl:use-attribute-sets="code">
<xsl:apply-templates select="text()"/>
</fo:block>
<xsl:if test="@caption">
- <fo:block xsl:use-attribute-sets="caption" margin-left="1.5em">
+ <fo:block xsl:use-attribute-sets="caption">
Code listing <xsl:value-of select="$partnum"/>.<xsl:value-of select="$codenum"/>:&#160;
<xsl:value-of select="@caption"/>
</fo:block>
@@ -687,12 +710,12 @@
<xsl:number level="any" from="part" count="code"/>
</xsl:variable>
- <fo:block xsl:use-attribute-sets="code" margin-left="1.5em">
+ <fo:block xsl:use-attribute-sets="code">
<xsl:apply-templates/>
</fo:block>
<xsl:if test="@caption">
- <fo:block xsl:use-attribute-sets="caption" margin-left="1.5em">
+ <fo:block xsl:use-attribute-sets="caption">
Code listing <xsl:value-of select="$partnum"/>.<xsl:value-of select="$codenum"/>:&#160;
<xsl:value-of select="@caption"/>
</fo:block>
@@ -862,7 +885,7 @@
<!-- Funcs -->
<xsl:template match="funcs">
-
+ <xsl:param name="partnum"/>
<fo:block xsl:use-attribute-sets="h3">
<xsl:text>Exports</xsl:text>
</fo:block>
@@ -958,6 +981,7 @@
<!-- Desc -->
<xsl:template match="desc">
+ <xsl:param name="partnum"/>
<xsl:apply-templates>
<xsl:with-param name="partnum" select="$partnum"/>
@@ -1103,27 +1127,62 @@
<xsl:template name="remove-paren">
<xsl:param name="string"/>
+
+ <xsl:variable name="str1">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$string"/>
+ <xsl:with-param name="start">(</xsl:with-param>
+ <xsl:with-param name="end">)</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="str2">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$str1"/>
+ <xsl:with-param name="start">{</xsl:with-param>
+ <xsl:with-param name="end">}</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="str3">
+ <xsl:call-template name="remove-paren-1">
+ <xsl:with-param name="string" select="$str2"/>
+ <xsl:with-param name="start">[</xsl:with-param>
+ <xsl:with-param name="end">]</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:value-of select="$str3"/>
+
+ </xsl:template>
+
+
+ <xsl:template name="remove-paren-1">
+ <xsl:param name="string"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
- <xsl:variable name="bstring">
- <xsl:value-of select="substring-before($string, '(')"/>
+ <xsl:variable name="tmp1">
+ <xsl:value-of select="substring-before($string, $start)"/>
</xsl:variable>
<xsl:choose>
- <xsl:when test="string-length($bstring) > 0">
- <xsl:variable name="astring">
- <xsl:value-of select="substring-after($string, ')')"/>
+ <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)">
+ <xsl:variable name="tmp2">
+ <xsl:value-of select="substring-after($string, $end)"/>
</xsl:variable>
<xsl:variable name="retstring">
<xsl:call-template name="remove-paren">
- <xsl:with-param name="string" select="$astring"/>
+ <xsl:with-param name="string" select="$tmp2"/>
</xsl:call-template>
</xsl:variable>
- <xsl:value-of select="concat($bstring, $retstring)"/>
+ <xsl:value-of select="concat(concat($tmp1, 'x'), $retstring)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
+
</xsl:template>
</xsl:stylesheet>
diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
index e2e264b90a..7de20f2092 100644
--- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
+++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
@@ -2,20 +2,20 @@
<!--
#
# %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%
-->
@@ -110,7 +110,7 @@
<xsl:attribute-set name="cover.inner.copyrightnotice">
<xsl:attribute name="font-size">0.9em</xsl:attribute>
- <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <!-- xsl:attribute name="font-weight">bold</xsl:attribute -->
</xsl:attribute-set>
<xsl:attribute-set name="cover.inner.date">
@@ -248,6 +248,8 @@
<xsl:attribute name="padding-after">1em</xsl:attribute>
<xsl:attribute name="space-after">1em</xsl:attribute>
<xsl:attribute name="space-before">2em</xsl:attribute>
+ <xsl:attribute name="margin-left">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-right">0.5em</xsl:attribute>
<xsl:attribute name="white-space-collapse">false</xsl:attribute>
<xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
@@ -266,8 +268,10 @@
<xsl:attribute name="text-align">justify</xsl:attribute>
<xsl:attribute name="padding-before">1em</xsl:attribute>
<xsl:attribute name="padding-after">0.3em</xsl:attribute>
- <xsl:attribute name="padding-left">1em</xsl:attribute>
- <xsl:attribute name="padding-right">1em</xsl:attribute>
+ <xsl:attribute name="padding-left">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-right">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-left">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-right">0.5em</xsl:attribute>
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
</xsl:attribute-set>
@@ -278,8 +282,10 @@
<xsl:attribute name="text-align">justify</xsl:attribute>
<xsl:attribute name="padding-before">1em</xsl:attribute>
<xsl:attribute name="padding-after">0.3em</xsl:attribute>
- <xsl:attribute name="padding-left">1em</xsl:attribute>
- <xsl:attribute name="padding-right">1em</xsl:attribute>
+ <xsl:attribute name="padding-left">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-right">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-left">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-right">0.5em</xsl:attribute>
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
</xsl:attribute-set>
diff --git a/lib/et/doc/src/Makefile b/lib/et/doc/src/Makefile
index bcbde437d1..6bb8164e91 100644
--- a/lib/et/doc/src/Makefile
+++ b/lib/et/doc/src/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2002-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2002-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -41,6 +41,9 @@ include files.mk
# ----------------------------------------------------
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \
$(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html)
@@ -60,7 +63,7 @@ XML_FLAGS +=
# ----------------------------------------------------
# Targets
# ----------------------------------------------------
-$(HTMLDIR)/%.gif: %.gif
+$(HTMLDIR)/%: %
$(INSTALL_DATA) $< $@
docs: pdf html man
@@ -69,9 +72,14 @@ $(TOP_PDF_FILE): $(XML_FILES)
pdf: $(TOP_PDF_FILE)
-html: gifs $(HTML_REF_MAN_FILE)
+html: images $(HTML_REF_MAN_FILE)
clean clean_docs:
+ for file in $(XML_FILES); do \
+ if [ -f $$file\src ]; then \
+ rm -f $$file; \
+ fi \
+ done
rm -rf $(HTMLDIR)/*
rm -f $(MAN3DIR)/*
rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo)
@@ -79,7 +87,7 @@ clean clean_docs:
man: $(MAN3_FILES)
-gifs: $(GIF_FILES:%=$(HTMLDIR)/%)
+images: $(IMAGE_FILES:%=$(HTMLDIR)/%)
debug opt:
diff --git a/lib/eunit/doc/src/Makefile b/lib/eunit/doc/src/Makefile
index faf2f9a847..19be96d763 100644
--- a/lib/eunit/doc/src/Makefile
+++ b/lib/eunit/doc/src/Makefile
@@ -123,11 +123,10 @@ man: $(MAN3_FILES)
gifs: $(GIF_FILES:%=$(HTMLDIR)/%)
$(XML_REF3_FILES):
- docb_gen -def vsn $(EUNIT_VSN) -includes $(EUNIT_INC_DIR) $(EUNIT_DIR)/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EUNIT_VSN) -i $(EUNIT_INC_DIR) $(EUNIT_DIR)/$(@:%.xml=%.erl)
$(XML_CHAPTER_FILES):
- docb_gen -chapter -def vsn $(EUNIT_VSN) ../overview.edoc
-
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EUNIT_VSN) -chapter ../overview.edoc
info:
@echo "XML_PART_FILES: $(XML_PART_FILES)"
diff --git a/lib/hipe/Makefile b/lib/hipe/Makefile
index be3a618e34..10bf82b2d7 100644
--- a/lib/hipe/Makefile
+++ b/lib/hipe/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
SHELL=/bin/sh
@@ -42,15 +42,13 @@ endif
#
include $(ERL_TOP)/make/otp_subdir.mk
-# This overrides the default recursive-make edocs target in otp_subdir.mk
-# It is not pretty, but it will have to do for now.
-docs:
+# The overriding docs target have been removed so the default make rules work properly.
+
+edocs:
@if [ -d $(ERL_TOP)/lib/edoc/ebin ]; then \
erl -noshell -pa $(ERL_TOP)/lib/edoc/ebin $(ERL_TOP)/lib/syntax_tools/ebin $(ERL_TOP)/lib/xmerl/ebin -run edoc_run application 'hipe' '"."' '[new,no_packages]' -s init stop ; \
fi
-edocs: docs
-
all-subdirs:
-for dir in $(SUB_DIRECTORIES); do \
(cd $$dir; $(MAKE) $(MAKETARGET) EBIN=../ebin; cd ..); \
diff --git a/lib/hipe/amd64/Makefile b/lib/hipe/amd64/Makefile
index 93e5f086d9..58377e5349 100644
--- a/lib/hipe/amd64/Makefile
+++ b/lib/hipe/amd64/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2004-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2004-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -80,7 +80,10 @@ ERL_COMPILE_FLAGS += -DHIPE_AMD64 +warn_exported_vars
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/arm/Makefile b/lib/hipe/arm/Makefile
index 571a1da0fc..3f60cd77cc 100644
--- a/lib/hipe/arm/Makefile
+++ b/lib/hipe/arm/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2005-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2005-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -81,7 +81,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/cerl/Makefile b/lib/hipe/cerl/Makefile
index fb7ca1153b..7fcc44d27d 100644
--- a/lib/hipe/cerl/Makefile
+++ b/lib/hipe/cerl/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2003-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2003-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -73,7 +73,10 @@ ERL_COMPILE_FLAGS += +inline +warn_exported_vars +warn_unused_import +warn_missi
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/flow/Makefile b/lib/hipe/flow/Makefile
index 5b9d0b7582..91dcfda6f5 100644
--- a/lib/hipe/flow/Makefile
+++ b/lib/hipe/flow/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -73,7 +73,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/icode/Makefile b/lib/hipe/icode/Makefile
index de37c4e4c4..eced90b0ec 100644
--- a/lib/hipe/icode/Makefile
+++ b/lib/hipe/icode/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -91,7 +91,10 @@ ERL_COMPILE_FLAGS += +warn_unused_import +warn_missing_spec +warn_untyped_record
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/main/Makefile b/lib/hipe/main/Makefile
index 0ac522b1b2..a14c9c3ca4 100644
--- a/lib/hipe/main/Makefile
+++ b/lib/hipe/main/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -83,7 +83,11 @@ $(EBIN)/hipe_main.beam: hipe.hrl ../icode/hipe_icode.hrl #../rtl/hipe_rtl.hrl
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES) $(DOC_FILES) $(HRL_FILES)
diff --git a/lib/hipe/misc/Makefile b/lib/hipe/misc/Makefile
index d5c395855a..98a69d62c7 100644
--- a/lib/hipe/misc/Makefile
+++ b/lib/hipe/misc/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -76,7 +76,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/opt/Makefile b/lib/hipe/opt/Makefile
index 972cf63944..74fde26c0b 100644
--- a/lib/hipe/opt/Makefile
+++ b/lib/hipe/opt/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -71,7 +71,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/ppc/Makefile b/lib/hipe/ppc/Makefile
index 0857043527..f24139e34b 100644
--- a/lib/hipe/ppc/Makefile
+++ b/lib/hipe/ppc/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2004-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2004-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -83,7 +83,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/regalloc/Makefile b/lib/hipe/regalloc/Makefile
index 5ab70d1837..386f3589c6 100644
--- a/lib/hipe/regalloc/Makefile
+++ b/lib/hipe/regalloc/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -84,7 +84,11 @@ ERL_COMPILE_FLAGS += +warn_exported_vars# +warn_missing_spec +warn_untyped_recor
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/sparc/Makefile b/lib/hipe/sparc/Makefile
index efd4996046..f25212a89b 100644
--- a/lib/hipe/sparc/Makefile
+++ b/lib/hipe/sparc/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -83,7 +83,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/tools/Makefile b/lib/hipe/tools/Makefile
index 6ce5cb1b8b..0eaa3a7b05 100644
--- a/lib/hipe/tools/Makefile
+++ b/lib/hipe/tools/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2002-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2002-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -72,7 +72,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/util/Makefile b/lib/hipe/util/Makefile
index 27cacedf11..85719ec3d6 100644
--- a/lib/hipe/util/Makefile
+++ b/lib/hipe/util/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -76,7 +76,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/hipe/x86/Makefile b/lib/hipe/x86/Makefile
index 065b56fce3..d7d0c7bf5a 100644
--- a/lib/hipe/x86/Makefile
+++ b/lib/hipe/x86/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -91,7 +91,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars
debug opt: $(TARGET_FILES)
-docs: $(DOC_FILES)
+docs:
+
+# Moved docs target to edocs so the standard docs rule work properly.
+edocs: $(DOC_FILES)
clean:
rm -f $(TARGET_FILES)
diff --git a/lib/jinterface/doc/src/Makefile b/lib/jinterface/doc/src/Makefile
index c4cfde0e9c..acd5307dee 100644
--- a/lib/jinterface/doc/src/Makefile
+++ b/lib/jinterface/doc/src/Makefile
@@ -2,20 +2,20 @@
#
# %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%
#
include $(ERL_TOP)/make/target.mk
@@ -53,6 +53,9 @@ XML_CHAPTER_FILES = \
BOOK_FILES = book.xml
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
GIF_FILES = \
notes.gif \
ref_man.gif \
diff --git a/lib/odbc/doc/src/Makefile b/lib/odbc/doc/src/Makefile
index 136ddfb980..e2f09733d0 100644
--- a/lib/odbc/doc/src/Makefile
+++ b/lib/odbc/doc/src/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1999-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 1999-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%
#
@@ -63,6 +63,9 @@ XML_CHAPTER_FILES = \
BOOK_FILES = book.xml
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
GIF_FILES = \
book.gif \
odbc.gif \
diff --git a/lib/percept/doc/src/Makefile b/lib/percept/doc/src/Makefile
index c841d17c01..f0d43c5a01 100644
--- a/lib/percept/doc/src/Makefile
+++ b/lib/percept/doc/src/Makefile
@@ -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%
#
@@ -153,10 +153,10 @@ gifs: $(GIF_FILES:%=$(HTMLDIR)/%)
xml: $(MODULE_XML_FILES)
$(PERCEPT_XML_FILES):
- docb_gen $(PERCEPT_DIR)/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript $(PERCEPT_DIR)/$(@:%.xml=%.erl)
$(RUNTIME_TOOLS_XML_FILES):
- docb_gen $(RUNTIME_TOOLS_DIR)/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript $(RUNTIME_TOOLS_DIR)/$(@:%.xml=%.erl)
info:
@echo "XML_PART_FILES: $(XML_PART_FILES)"
diff --git a/lib/reltool/test/Makefile b/lib/reltool/test/Makefile
new file mode 100644
index 0000000000..00d2add3e5
--- /dev/null
+++ b/lib/reltool/test/Makefile
@@ -0,0 +1,82 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2009. 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%
+
+include $(ERL_TOP)/make/target.mk
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------
+# Target Specs
+# ----------------------------------------------------
+
+MODULES= \
+ rtt \
+ reltool_wx_SUITE \
+ reltool_server_SUITE \
+ reltool_test_lib
+
+
+ERL_FILES= $(MODULES:%=%.erl)
+
+HRL_FILES= reltool_test_lib.hrl
+
+TARGET_FILES= \
+ $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+
+INSTALL_PROGS= $(TARGET_FILES)
+
+# ----------------------------------------------------
+# Release directory specification
+# ----------------------------------------------------
+RELSYSDIR = $(RELEASE_PATH)/reltool_test
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+#ERL_COMPILE_FLAGS +=
+
+EBIN = .
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+
+tests debug opt: $(TARGET_FILES)
+
+clean:
+ rm -f $(TARGET_FILES)
+ rm -f core
+
+docs:
+
+# ----------------------------------------------------
+# Release Target
+# ----------------------------------------------------
+include $(ERL_TOP)/make/otp_release_targets.mk
+
+release_spec: opt
+
+release_tests_spec: opt
+ $(INSTALL_DIR) $(RELSYSDIR)
+ $(INSTALL_DATA) reltool.spec $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR)
+ $(INSTALL_PROGRAM) rtt $(INSTALL_PROGS) $(RELSYSDIR)
+# chmod -f -R u+w $(RELSYSDIR)
+# @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -)
+
+release_docs_spec:
+
+
diff --git a/lib/reltool/test/README b/lib/reltool/test/README
new file mode 100644
index 0000000000..031bd2c961
--- /dev/null
+++ b/lib/reltool/test/README
@@ -0,0 +1,30 @@
+
+Testing and running reltool tests.
+
+Testing gui api/applications can be hard, but we can at least
+test that wxerlang behaves as we expected, i.e. that the api
+is consistent and that it don't crash.
+
+The tests are structured as they are because we want you to
+be able to run them in three different ways.
+ - direct via an erlang shell
+ - via common_test application
+ - via erlang/OTP inhouse ts tool.
+
+To run all the tests compile them and on unix
+run ./rtt to create an erlang terminal.
+
+Invoke rtt:t(). in the erlang shell to run all regression tests.
+If you want to specific tests invoke rtt:t(Module)
+or rtt:t(Module, TestCase).
+
+To run all tests including the ones that require manual intervention run.
+rtt:t(all, [{user,true}]).
+
+To see every test_case window use
+rtt:t(all, [{user,step}]).
+This requires that you manually close each window to step to the
+next test_case.
+
+If you want to run specific test_cases use:
+rtt:t({Module,TestCase}, [{user,step}]).
diff --git a/lib/reltool/test/reltool.spec b/lib/reltool/test/reltool.spec
new file mode 100644
index 0000000000..252232e09d
--- /dev/null
+++ b/lib/reltool/test/reltool.spec
@@ -0,0 +1,2 @@
+{topcase, {dir, "../reltool_test"}}.
+
diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl
new file mode 100644
index 0000000000..cf951191a0
--- /dev/null
+++ b/lib/reltool/test/reltool_server_SUITE.erl
@@ -0,0 +1,494 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2009. 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(reltool_server_SUITE).
+
+-export([all/0, init_per_suite/1, end_per_suite/1,
+ init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]).
+
+-compile(export_all).
+
+-include("reltool_test_lib.hrl").
+
+-define(NODE_NAME, '__RELTOOL__TEMPORARY_TEST__NODE__').
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Initialization functions.
+
+init_per_suite(Config) ->
+ reltool_test_lib:init_per_suite(Config).
+
+end_per_suite(Config) ->
+ reltool_test_lib:end_per_suite(Config).
+
+init_per_testcase(Func,Config) ->
+ reltool_test_lib:init_per_testcase(Func,Config).
+end_per_testcase(Func,Config) ->
+ reltool_test_lib:end_per_testcase(Func,Config).
+fin_per_testcase(Func,Config) -> %% For test_server
+ reltool_test_lib:end_per_testcase(Func,Config).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% SUITE specification
+
+all() ->
+ all(suite).
+all(suite) ->
+ [
+ start_server,
+ set_config,
+ create_release,
+ create_script,
+ create_target,
+ create_embedded,
+ create_standalone,
+ create_old_target
+ ].
+
+%% The test cases
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Start a server process and check that it does not crash
+
+start_server(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+start_server(_Config) ->
+ {ok, Pid} = ?msym({ok, _}, reltool:start_server([])),
+ Libs = lists:sort(erl_libs()),
+ StrippedDefault =
+ case Libs of
+ [] -> {sys, []};
+ _ -> {sys, [{lib_dirs, Libs}]}
+ end,
+ ?m({ok, StrippedDefault}, reltool:get_config(Pid)),
+ ?m(ok, reltool:stop(Pid)),
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Start a server process and check that it does not crash
+
+set_config(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+set_config(_Config) ->
+ Libs = lists:sort(erl_libs()),
+ Default =
+ {sys,
+ [
+ {mod_cond, all},
+ {incl_cond, derived},
+ {root_dir, code:root_dir()},
+ {lib_dirs, Libs}
+ ]},
+ {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Default}])),
+ StrippedDefault =
+ case Libs of
+ [] -> {sys, []};
+ _ -> {sys, [{lib_dirs, Libs}]}
+ end,
+ ?m({ok, StrippedDefault}, reltool:get_config(Pid)),
+
+ ?m(ok, reltool:stop(Pid)),
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Generate releases
+
+create_release(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+create_release(_Config) ->
+ %% Configure the server
+ RelName = "Just testing...",
+ RelVsn = "1.0",
+ Config =
+ {sys,
+ [
+ {lib_dirs, []},
+ {boot_rel, RelName},
+ {rel, RelName, RelVsn, [kernel, stdlib]}
+ ]},
+ %% Generate release
+ ErtsVsn = erlang:system_info(version),
+ Apps = application:loaded_applications(),
+ {value, {_, _, KernelVsn}} = lists:keysearch(kernel, 1, Apps),
+ {value, {_, _, StdlibVsn}} = lists:keysearch(stdlib, 1, Apps),
+ Rel = {release, {RelName, RelVsn},
+ {erts, ErtsVsn},
+ [{kernel, KernelVsn},
+ {stdlib, StdlibVsn}]},
+ ?m({ok, Rel}, reltool:get_rel([{config, Config}], RelName)),
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Generate boot scripts
+
+create_script(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+create_script(_Config) ->
+ %% Configure the server
+ RelName = "Just testing",
+ RelVsn = "1.0",
+ Config =
+ {sys,
+ [
+ {lib_dirs, []},
+ {boot_rel, RelName},
+ {rel, RelName, RelVsn, [stdlib, kernel]}
+ ]},
+ {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Config}])),
+
+ %% Generate release file
+ ErtsVsn = erlang:system_info(version),
+ Apps = application:loaded_applications(),
+ {value, {_, _, KernelVsn}} = lists:keysearch(kernel, 1, Apps),
+ {value, {_, _, StdlibVsn}} = lists:keysearch(stdlib, 1, Apps),
+ Rel = {release,
+ {RelName, RelVsn},
+ {erts, ErtsVsn},
+ [{stdlib, StdlibVsn}, {kernel, KernelVsn}]},
+ ?m({ok, Rel}, reltool:get_rel(Pid, RelName)),
+ RelFile = RelName ++ ".rel",
+ ?m(ok, file:write_file(RelFile, io_lib:format("~p.\n", [Rel]))),
+
+ %% Generate script file
+ ?m(ok, systools:make_script(RelName, [])),
+ ScriptFile = RelName ++ ".script",
+ {ok, [OrigScript]} = ?msym({ok, [_]}, file:consult(ScriptFile)),
+ {ok, Script} = ?msym({ok, _}, reltool:get_script(Pid, RelName)),
+ %% OrigScript2 = sort_script(OrigScript),
+ %% Script2 = sort_script(Script),
+ %% ?m(OrigScript2, Script2),
+
+ ?m(equal, diff_script(OrigScript, Script)),
+
+ %% Stop server
+ ?m(ok, reltool:stop(Pid)),
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Generate target system
+
+create_target(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+create_target(_Config) ->
+ %% Configure the server
+ RelName1 = "Just testing",
+ RelName2 = "Just testing with SASL",
+ RelVsn = "1.0",
+ Config =
+ {sys,
+ [
+ {root_dir, code:root_dir()},
+ {lib_dirs, []},
+ {boot_rel, RelName2},
+ {rel, RelName1, RelVsn, [stdlib, kernel]},
+ {rel, RelName2, RelVsn, [sasl, stdlib, kernel]},
+ {app, sasl, [{incl_cond, include}]}
+ ]},
+
+ %% Generate target file
+ TargetDir = "reltool_target_dir_development",
+ ?m(ok, reltool_utils:recursive_delete(TargetDir)),
+ ?m(ok, file:make_dir(TargetDir)),
+ ?m(ok, reltool:create_target([{config, Config}], TargetDir)),
+
+ Erl = filename:join([TargetDir, "bin", "erl"]),
+ {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)),
+ ?msym(ok, stop_node(Node)),
+
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Generate embedded target system
+
+create_embedded(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+create_embedded(_Config) ->
+ %% Configure the server
+ RelName1 = "Just testing",
+ RelName2 = "Just testing with SASL",
+ RelVsn = "1.0",
+ Config =
+ {sys,
+ [
+ {lib_dirs, []},
+ {profile, embedded},
+ {boot_rel, RelName2},
+ {rel, RelName1, RelVsn, [stdlib, kernel]},
+ {rel, RelName2, RelVsn, [sasl, stdlib, kernel]},
+ {app, sasl, [{incl_cond, include}]}
+ ]},
+
+ %% Generate target file
+ TargetDir = "reltool_target_dir_embedded",
+ ?m(ok, reltool_utils:recursive_delete(TargetDir)),
+ ?m(ok, file:make_dir(TargetDir)),
+ ?m(ok, reltool:create_target([{config, Config}], TargetDir)),
+
+ Erl = filename:join([TargetDir, "bin", "erl"]),
+ {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)),
+ ?msym(ok, stop_node(Node)),
+
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Generate standalone system
+
+create_standalone(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+create_standalone(_Config) ->
+ %% Configure the server
+ ExDir = code:lib_dir(reltool, examples),
+ EscriptName = "display_args",
+ Escript = filename:join([ExDir, EscriptName]),
+ Config =
+ {sys,
+ [
+ {lib_dirs, []},
+ {escript, Escript, [{incl_cond, include}]},
+ {profile, standalone}
+ ]},
+
+ %% Generate target file
+ TargetDir = "reltool_target_dir_standalone",
+ ?m(ok, reltool_utils:recursive_delete(TargetDir)),
+ ?m(ok, file:make_dir(TargetDir)),
+ ?m(ok, reltool:create_target([{config, Config}], TargetDir)),
+
+ BinDir = filename:join([TargetDir, "bin"]),
+ Erl = filename:join([BinDir, "erl"]),
+ {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)),
+ RootDir = ?ignore(rpc:call(Node, code, root_dir, [])),
+ ?msym(ok, stop_node(Node)),
+
+ Expected = iolist_to_binary(["Root dir: ", RootDir, "\n"
+ "Script args: [\"-arg1\",\"arg2\",\"arg3\"]\n",
+ "Smp: false\n",
+ "ExitCode:0"]),
+ io:format("Expected: ~s\n", [Expected]),
+ ?m(Expected, run(BinDir, EscriptName ++ " -arg1 arg2 arg3")),
+
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Generate old type of target system
+
+create_old_target(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+create_old_target(_Config) ->
+ %% Configure the server
+ RelName1 = "Just testing",
+ RelName2 = "Just testing with SASL",
+ RelVsn = "1.0",
+ Config =
+ {sys,
+ [
+ {lib_dirs, []},
+ {boot_rel, RelName2},
+ {rel, RelName1, RelVsn, [stdlib, kernel]},
+ {rel, RelName2, RelVsn, [sasl, stdlib, kernel]},
+ {relocatable, false}, % Implies explicit old style installation
+ {app, sasl, [{incl_cond, include}]}
+ ]},
+
+ %% Generate target file
+ TargetDir = "reltool_target_dir_old",
+ ?m(ok, reltool_utils:recursive_delete(TargetDir)),
+ ?m(ok, file:make_dir(TargetDir)),
+ ?m(ok, reltool:create_target([{config, Config}], TargetDir)),
+
+ %% io:format("Will fail on Windows (should patch erl.ini)\n", []),
+ ?m(ok, reltool:install(RelName2, TargetDir)),
+
+ Erl = filename:join([TargetDir, "bin", "erl"]),
+ {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)),
+ ?msym(ok, stop_node(Node)),
+
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Library functions
+
+erl_libs() ->
+ case os:getenv("ERL_LIBS") of
+ false -> [];
+ LibStr -> string:tokens(LibStr, ":;")
+ end.
+
+diff_script(Script, Script) ->
+ equal;
+diff_script({script, Rel, Commands1}, {script, Rel, Commands2}) ->
+ diff_cmds(Commands1, Commands2);
+diff_script({script, Rel1, _}, {script, Rel2, _}) ->
+ {error, {Rel1, Rel2}}.
+
+diff_cmds([Cmd | Commands1], [Cmd | Commands2]) ->
+ diff_cmds(Commands1, Commands2);
+diff_cmds([Cmd1 | _Commands1], [Cmd2 | _Commands2]) ->
+ {diff, {expected, Cmd1}, {actual, Cmd2}};
+diff_cmds([], []) ->
+ equal.
+
+os_cmd(Cmd) when is_list(Cmd) ->
+ %% Call the plain os:cmd with an echo command appended to print command status
+ %% io:format("os:cmd(~p).\n", [Cmd]),
+ case os:cmd(Cmd++";echo \"#$?\"") of
+ %% There is (as far as I can tell) only one thing that will match this
+ %% and that is too silly to ever be used, but...
+ []->
+ {99, []};
+ Return->
+ %% Find the position of the status code wich is last in the string
+ %% prepended with #
+ case string:rchr(Return, $#) of
+
+ %% This happens only if the sh command pipe is somehow interrupted
+ 0->
+ {98, Return};
+
+ Position->
+ Result = string:left(Return,Position - 1),
+ Status = string:substr(Return,Position + 1, length(Return) - Position - 1),
+ {list_to_integer(Status), Result}
+ end
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Node handling
+
+start_node(Name, ErlPath) ->
+ FullName = full_node_name(Name),
+ CmdLine = mk_node_cmdline(Name, ErlPath),
+ io:format("Starting node ~p: ~s~n", [FullName, CmdLine]),
+ case open_port({spawn, CmdLine}, []) of
+ Port when is_port(Port) ->
+ unlink(Port),
+ erlang:port_close(Port),
+ case ping_node(FullName, 50) of
+ ok -> {ok, FullName};
+ Other -> exit({failed_to_start_node, FullName, Other})
+ end;
+ Error ->
+ exit({failed_to_start_node, FullName, Error})
+ end.
+
+stop_node(Node) ->
+ monitor_node(Node, true),
+ spawn(Node, fun () -> halt() end),
+ receive {nodedown, Node} -> ok end.
+
+mk_node_cmdline(Name) ->
+ Prog = case catch init:get_argument(progname) of
+ {ok,[[P]]} -> P;
+ _ -> exit(no_progname_argument_found)
+ end,
+ mk_node_cmdline(Name, Prog).
+
+mk_node_cmdline(Name, Prog) ->
+ Static = "-detached -noinput",
+ Pa = filename:dirname(code:which(?MODULE)),
+ NameSw = case net_kernel:longnames() of
+ false -> "-sname ";
+ true -> "-name ";
+ _ -> exit(not_distributed_node)
+ end,
+ {ok, Pwd} = file:get_cwd(),
+ NameStr = atom_to_list(Name),
+ Prog ++ " "
+ ++ Static ++ " "
+ ++ NameSw ++ " " ++ NameStr ++ " "
+ ++ "-pa " ++ Pa ++ " "
+ ++ "-env ERL_CRASH_DUMP " ++ Pwd ++ "/erl_crash_dump." ++ NameStr ++ " "
+ ++ "-setcookie " ++ atom_to_list(erlang:get_cookie()).
+
+full_node_name(PreName) ->
+ HostSuffix = lists:dropwhile(fun ($@) -> false; (_) -> true end,
+ atom_to_list(node())),
+ list_to_atom(atom_to_list(PreName) ++ HostSuffix).
+
+ping_node(_Node, 0) ->
+ {error, net_adm};
+ping_node(Node, N) when is_integer(N), N > 0 ->
+ case catch net_adm:ping(Node) of
+ pong ->
+ wait_for_process(Node, code_server, 50);
+ _ ->
+ timer:sleep(1000),
+ ping_node(Node, N-1)
+ end.
+
+wait_for_process(_Node, Name, 0) ->
+ {error, Name};
+wait_for_process(Node, Name, N) when is_integer(N), N > 0 ->
+ case rpc:call(Node, erlang, whereis, [Name]) of
+ undefined ->
+ timer:sleep(1000),
+ wait_for_process(Node, Name, N-1);
+ {badrpc, _} = Reason ->
+ erlang:error({Reason, Node});
+ Pid when is_pid(Pid) ->
+ ok
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Run escript
+
+run(Dir, Cmd0) ->
+ Cmd = case os:type() of
+ {win32,_} -> filename:nativename(Dir) ++ "\\" ++ Cmd0;
+ _ -> Cmd0
+ end,
+ do_run(Dir, Cmd).
+
+run(Dir, Opts, Cmd0) ->
+ Cmd = case os:type() of
+ {win32,_} -> Opts ++ " " ++ filename:nativename(Dir) ++ "\\" ++ Cmd0;
+ _ -> Opts ++ " " ++ Dir ++ "/" ++ Cmd0
+ end,
+ do_run(Dir, Cmd).
+
+do_run(Dir, Cmd) ->
+ io:format("Run: ~p\n", [Cmd]),
+ Env = [{"PATH",Dir++":"++os:getenv("PATH")}],
+ Port = open_port({spawn,Cmd}, [exit_status,eof,in,{env,Env}]),
+ Res = get_data(Port, []),
+ receive
+ {Port,{exit_status,ExitCode}} ->
+ iolist_to_binary([Res,"ExitCode:"++integer_to_list(ExitCode)])
+ end.
+
+get_data(Port, SoFar) ->
+ receive
+ {Port,{data,Bytes}} ->
+ get_data(Port, [SoFar|Bytes]);
+ {Port,eof} ->
+ erlang:port_close(Port),
+ SoFar
+ end.
+
+expected_output([data_dir|T], Data) ->
+ Slash = case os:type() of
+ {win32,_} -> "\\";
+ _ -> "/"
+ end,
+ [filename:nativename(Data)++Slash|expected_output(T, Data)];
+expected_output([H|T], Data) ->
+ [H|expected_output(T, Data)];
+expected_output([], _) ->
+ [];
+expected_output(Bin, _) when is_binary(Bin) ->
+ Bin.
diff --git a/lib/reltool/test/reltool_test_lib.erl b/lib/reltool/test/reltool_test_lib.erl
new file mode 100644
index 0000000000..25978294ee
--- /dev/null
+++ b/lib/reltool/test/reltool_test_lib.erl
@@ -0,0 +1,329 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2009. 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(reltool_test_lib).
+-compile(export_all).
+
+-include("reltool_test_lib.hrl").
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+init_per_suite(Config) when is_list(Config)->
+ incr_timetrap(Config, 5).
+
+end_per_suite(Config) when is_list(Config)->
+ ok.
+
+incr_timetrap(Config, Times) ->
+ Key = tc_timeout,
+ KeyPos = 1,
+ NewTime =
+ case lists:keysearch(Key, KeyPos, Config) of
+ {value, {Key, OldTime}} ->
+ (timer:minutes(1) + OldTime) * Times;
+ false ->
+ timer:minutes(1) * Times
+ end,
+ lists:keystore(Key, KeyPos, Config, {Key, NewTime}).
+
+set_kill_timer(Config) ->
+ case init:get_argument(reltool_test_timeout) of
+ {ok, _} ->
+ Config;
+ _ ->
+ Time =
+ case lookup_config(tc_timeout, Config) of
+ [] ->
+ timer:minutes(5);
+ ConfigTime when is_integer(ConfigTime) ->
+ ConfigTime
+ end,
+ WatchDog = test_server:timetrap(Time),
+ [{kill_timer, WatchDog} | Config]
+ end.
+
+reset_kill_timer(Config) ->
+ DogKiller =
+ case get(reltool_test_server) of
+ true ->
+ fun(P) when is_pid(P) -> P ! stop;
+ (_) -> ok
+ end;
+ _ ->
+ fun(Ref) -> test_server:timetrap_cancel(Ref) end
+ end,
+ case lists:keysearch(kill_timer, 1, Config) of
+ {value, {kill_timer, WatchDog}} ->
+ DogKiller(WatchDog),
+ lists:keydelete(kill_timer, 1, Config);
+ _ ->
+ Config
+ end.
+
+lookup_config(Key,Config) ->
+ case lists:keysearch(Key, 1, Config) of
+ {value,{Key,Val}} ->
+ Val;
+ _ ->
+ []
+ end.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+wx_init_per_suite(Config) ->
+ {_Pid, Ref} =
+ spawn_monitor(fun() ->
+ %% Avoid test case crash if wx master process dies
+ process_flag(trap_exit, true),
+ try
+ case os:type() of
+ {unix,darwin} ->
+ exit({skipped, "Can not test on MacOSX"});
+ {unix, _} ->
+ io:format("DISPLAY ~s~n", [os:getenv("DISPLAY")]),
+ case proplists:get_value(xserver, Config, none) of
+ none -> ignore;
+ Server -> os:putenv("DISPLAY", Server)
+ end;
+ _ ->
+ ignore
+ end,
+ wx:new(),
+ wx:destroy()
+ catch
+ error:undef ->
+ exit({skipped, "No wx compiled for this platform"});
+ _:Reason ->
+ exit({skipped, lists:flatten(io_lib:format("Start wx failed: ~p", [Reason]))})
+ end,
+ exit(normal)
+ end),
+ receive
+ {'DOWN', Ref, _, _, normal} ->
+ init_per_suite(Config);
+ {'DOWN', Ref, _, _, {skipped, _} = Skipped} ->
+ Skipped;
+ {'DOWN', Ref, _, _, Reason} ->
+ exit({wx_init_per_suite, Reason})
+ after timer:minutes(1) ->
+ exit({wx_init_per_suite, timeout})
+ end.
+
+wx_end_per_suite(Config) ->
+ end_per_suite(Config).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+init_per_testcase(_Func, Config) when is_list(Config) ->
+ set_kill_timer(Config),
+ global:register_name(reltool_global_logger, group_leader()),
+ Config.
+
+end_per_testcase(_Func, Config) when is_list(Config) ->
+ global:unregister_name(reltool_global_logger),
+ reset_kill_timer(Config),
+ Config.
+
+%% Backwards compatible with test_server
+tc_info(suite) -> [];
+tc_info(doc) -> "".
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% Use ?log(Format, Args) as wrapper
+log(Format, Args, LongFile, Line) ->
+ File = filename:basename(LongFile),
+ Format2 = lists:concat([File, "(", Line, ")", ": ", Format]),
+ log(Format2, Args).
+
+log(Format, Args) ->
+ case global:whereis_name(reltool_global_logger) of
+ undefined ->
+ io:format(user, Format, Args);
+ Pid ->
+ io:format(Pid, Format, Args)
+ end.
+
+verbose(Format, Args, File, Line) ->
+ Arg = reltool_test_verbose,
+ case get(Arg) of
+ false ->
+ ok;
+ true ->
+ log(Format, Args, File, Line);
+ undefined ->
+ case init:get_argument(Arg) of
+ {ok, List} when is_list(List) ->
+ case lists:last(List) of
+ ["true"] ->
+ put(Arg, true),
+ log(Format, Args, File, Line);
+ _ ->
+ put(Arg, false),
+ ok
+ end;
+ _ ->
+ put(Arg, false),
+ ok
+ end
+ end.
+
+error(Format, Args, File, Line) ->
+ global:send(reltool_global_logger, {failed, File, Line}),
+ Fail = {filename:basename(File),Line,Args},
+ case global:whereis_name(reltool_test_case_sup) of
+ undefined -> ignore;
+ Pid -> Pid ! Fail
+ %% global:send(reltool_test_case_sup, Fail),
+ end,
+ log("<ERROR>~n" ++ Format, Args, File, Line).
+
+
+pick_msg() ->
+ receive
+ Message -> Message
+ after 4000 -> timeout
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Utility functions
+
+user_available(Config) ->
+ false /= proplists:get_value(user, Config, false).
+
+
+wx_destroy(Frame, Config) ->
+ case proplists:get_value(user, Config, false) of
+ false ->
+ timer:sleep(100),
+ ?m(ok, wxFrame:destroy(Frame)),
+ ?m(ok, wx:destroy());
+ true ->
+ timer:sleep(500),
+ ?m(ok, wxFrame:destroy(Frame)),
+ ?m(ok, wx:destroy());
+ step -> %% Wait for user to close window
+ ?m(ok, wxEvtHandler:connect(Frame, close_window, [{skip,true}])),
+ wait_for_close()
+ end.
+
+wait_for_close() ->
+ receive
+ #wx{event=#wxClose{}} ->
+ ?log("Got close~n",[]),
+ ?m(ok, wx:destroy());
+ #wx{obj=Obj, event=Event} ->
+ try
+ Name = wxTopLevelWindow:getTitle(Obj),
+ ?log("~p Event: ~p~n", [Name, Event])
+ catch _:_ ->
+ ?log("Event: ~p~n", [Event])
+ end,
+ wait_for_close();
+ Other ->
+ ?log("Unexpected: ~p~n", [Other]),
+ wait_for_close()
+ end.
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% A small test server, which can be run standalone in a shell
+
+run_test(Test = {_,_},Config) ->
+ run_test([Test],Config);
+run_test([{Module, TC} | Rest], Config) ->
+ log("\n\n=== Eval test suite: ~w ===~n", [Module]),
+ case catch Module:init_per_suite(Config) of
+ {skipped, Reason} ->
+ log("Test suite skipped: ~s~n", [Reason]),
+ [{skipped, Reason}];
+ NewConfig when is_list(NewConfig) ->
+ Res =
+ if
+ TC =:= all ->
+ [do_run_test(Module, Test, NewConfig) || Test <- Module:all()];
+ is_list(TC) ->
+ [do_run_test(Module, Test, NewConfig) || Test <- TC];
+ true ->
+ [do_run_test(Module, TC, NewConfig)]
+ end,
+ Module:end_per_suite(NewConfig),
+ Res ++ run_test(Rest, NewConfig);
+ Error ->
+ ?error("Test suite skipped: ~w~n", [Error]),
+ [{skipped, Error}]
+ end;
+run_test([], _Config) ->
+ [].
+
+do_run_test(Module, all, Config) ->
+ All = [{Module, Test} || Test <- Module:all()],
+ run_test(All, Config);
+do_run_test(Module, TestCase, Config) ->
+ log("Eval test case: ~w~n", [{Module, TestCase}]),
+ Sec = timer:seconds(1) * 1000,
+ {T, Res} =
+ timer:tc(?MODULE, eval_test_case, [Module, TestCase, Config]),
+ log("Tested ~w in ~w sec~n", [TestCase, T div Sec]),
+ {T div Sec, Res}.
+
+eval_test_case(Mod, Fun, Config) ->
+ flush(),
+ global:register_name(reltool_test_case_sup, self()),
+ Flag = process_flag(trap_exit, true),
+ Pid = spawn_link(?MODULE, test_case_evaluator, [Mod, Fun, [Config]]),
+ R = wait_for_evaluator(Pid, Mod, Fun, Config),
+ global:unregister_name(reltool_test_case_sup),
+ process_flag(trap_exit, Flag),
+ R.
+
+test_case_evaluator(Mod, Fun, [Config]) ->
+ NewConfig = Mod:init_per_testcase(Fun, Config),
+ R = apply(Mod, Fun, [NewConfig]),
+ Mod:fin_per_testcase(Fun, NewConfig),
+ exit({test_case_ok, R}).
+
+wait_for_evaluator(Pid, Mod, Fun, Config) ->
+ receive
+ {'EXIT', Pid, {test_case_ok, _PidRes}} ->
+ Errors = flush(),
+ Res =
+ case Errors of
+ [] -> ok;
+ Errors -> failed
+ end,
+ {Res, {Mod, Fun}, Errors};
+ {'EXIT', Pid, {skipped, Reason}} ->
+ log("<WARNING> Test case ~w skipped, because ~p~n",
+ [{Mod, Fun}, Reason]),
+ Mod:fin_per_testcase(Fun, Config),
+ {skip, {Mod, Fun}, Reason};
+ {'EXIT', Pid, Reason} ->
+ log("<ERROR> Eval process ~w exited, because\n\t~p~n",
+ [{Mod, Fun}, Reason]),
+ Mod:fin_per_testcase(Fun, Config),
+ {crash, {Mod, Fun}, Reason}
+ end.
+
+flush() ->
+ receive Msg -> [Msg | flush()]
+ after 0 -> []
+ end.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/lib/reltool/test/reltool_test_lib.hrl b/lib/reltool/test/reltool_test_lib.hrl
new file mode 100644
index 0000000000..93134144ea
--- /dev/null
+++ b/lib/reltool/test/reltool_test_lib.hrl
@@ -0,0 +1,91 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2009. 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%
+
+-include_lib("wx/include/wx.hrl").
+
+-define(log(Format,Args), reltool_test_lib:log(Format,Args,?FILE,?LINE)).
+-define(warning(Format,Args), ?log("<WARNING>\n " ++ Format,Args)).
+-define(error(Format,Args), reltool_test_lib:error(Format,Args,?FILE,?LINE)).
+-define(verbose(Format,Args), reltool_test_lib:verbose(Format,Args,?FILE,?LINE)).
+
+-define(fatal(Format,Args),
+ ?error(Format, Args),
+ exit({test_case_fatal, Format, Args, ?FILE, ?LINE})).
+
+-define(skip(Format,Args),
+ ?warning(Format, Args),
+ exit({skipped, ?flat_format(Format, Args)})).
+
+-define(ignore(Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ ?verbose("ok: ~p\n",[AcTuAlReS]),
+ AcTuAlReS
+ end()).
+
+-define(msym(ExpectedRes, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ ?verbose("ok: ~p\n",[AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ reltool_test_lib:error("Not matching actual result was:\n ~p \nExpected ~s\n",
+ [AcTuAlReS, ??ExpectedRes],
+ ?FILE, ?LINE),
+ AcTuAlReS
+ end
+ end()).
+
+-define(m(ExpectedRes, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ ?verbose("ok: ~p\n",[AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ reltool_test_lib:error("Not matching actual result was:\n\t~p \nExpected:\n\t~p\n",
+ [AcTuAlReS, ExpectedRes],
+ ?FILE, ?LINE),
+ AcTuAlReS
+ end
+ end()).
+
+-define(m_receive(ExpectedMsg),
+ ?m(ExpectedMsg,reltool_test_lib:pick_msg())).
+
+-define(m_multi_receive(ExpectedMsgs),
+ fun() ->
+ TmPeXpCtEdMsGs = lists:sort(ExpectedMsgs),
+ AcTuAlReS =
+ lists:sort(lists:map(fun(_) ->
+ reltool_test_lib:pick_msg()
+ end, TmPeXpCtEdMsGs)),
+ case AcTuAlReS of
+ TmPeXpCtEdMsGs ->
+ ?verbose("ok: ~p\n",[AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ reltool_test_lib:error("Not matching actual result was:\n ~p \nExpected ~p\n",
+ [AcTuAlReS, ExpectedMsgs],
+ ?FILE, ?LINE),
+ AcTuAlReS
+ end
+ end()).
diff --git a/lib/reltool/test/reltool_wx_SUITE.erl b/lib/reltool/test/reltool_wx_SUITE.erl
new file mode 100644
index 0000000000..2e2b355e07
--- /dev/null
+++ b/lib/reltool/test/reltool_wx_SUITE.erl
@@ -0,0 +1,62 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2009. 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(reltool_wx_SUITE).
+
+-export([all/0, init_per_suite/1, end_per_suite/1,
+ init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]).
+
+-compile(export_all).
+
+-include("reltool_test_lib.hrl").
+
+%% Initialization functions.
+init_per_suite(Config) ->
+ reltool_test_lib:wx_init_per_suite(Config).
+
+end_per_suite(Config) ->
+ reltool_test_lib:wx_end_per_suite(Config).
+
+init_per_testcase(Func,Config) ->
+ reltool_test_lib:init_per_testcase(Func,Config).
+end_per_testcase(Func,Config) ->
+ reltool_test_lib:end_per_testcase(Func,Config).
+fin_per_testcase(Func,Config) -> %% For test_server
+ reltool_test_lib:end_per_testcase(Func,Config).
+
+%% SUITE specification
+all() ->
+ all(suite).
+all(suite) ->
+ [
+ start_all_windows
+ ].
+
+%% The test cases
+
+%% Display all windows and see if something crashes
+start_all_windows(TestInfo) when is_atom(TestInfo) ->
+ reltool_test_lib:tc_info(TestInfo);
+start_all_windows(_Config) ->
+ {ok, SysPid} = ?msym({ok, _}, reltool:start([{trap_exit, false}])),
+ {ok, AppPid} = ?msym({ok, _}, reltool_sys_win:open_app(SysPid, stdlib)),
+ ?msym({ok, _}, reltool_app_win:open_mod(AppPid, escript)),
+ timer:sleep(timer:seconds(10)),
+ ?m(ok, reltool:stop(SysPid)),
+
+ ok.
diff --git a/lib/reltool/test/rtt b/lib/reltool/test/rtt
new file mode 100755
index 0000000000..2411195338
--- /dev/null
+++ b/lib/reltool/test/rtt
@@ -0,0 +1,55 @@
+#! /bin/sh -f
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2009. 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%
+
+# Usage: rtt [-cerl] <args to erlang startup script>
+
+emu=erl
+while [ $# -gt 0 ]; do
+ case "$1" in
+ "-cerl")
+ shift
+ emu=cerl
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+log=test_log_$$
+latest=test_log_latest
+args=${1+"$@"}
+
+erlcmd="$emu -sname test_server -smp -pa ../../reltool/ebin $p $args -reltool_test_verbose true -reltool_test_timeout"
+
+echo "Give the following command in order to see the outcome:"
+echo ""
+echo " less $log"
+
+rm "$latest" 2>/dev/null
+ln -s "$log" "$latest"
+touch "$log"
+
+ostype=`uname -s`
+if [ "$ostype" = "SunOS" ] ; then
+ /usr/openwin/bin/xterm -T "Testing reltool" -l -lf "$log" -e $erlcmd &
+else
+ xterm -T "Testing reltool" -e script -f -c "$erlcmd" "$log" &
+fi
+
+tail -f "$log" | egrep 'Eval|<ERROR>|NYI'
diff --git a/lib/reltool/test/rtt.erl b/lib/reltool/test/rtt.erl
new file mode 100644
index 0000000000..6755b8400f
--- /dev/null
+++ b/lib/reltool/test/rtt.erl
@@ -0,0 +1,154 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2009. 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(rtt).
+-compile(export_all).
+
+%% Modules or suites can be shortcuts, for example server expands to reltool_server_SUITE.
+%%
+%% t(Tests) run reltool testcases.
+%% Tests can be module, {module, test_case} or [module|{module,test_case}]
+
+t() ->
+ t(read_test_case()).
+t(Test) ->
+ t(Test, []).
+
+t(Mod, TC) when is_atom(Mod), is_atom(TC) ->
+ t({Mod,TC}, []);
+t(all, Config) when is_list(Config) ->
+ Fs = filelib:wildcard("reltool_*_SUITE.erl"),
+ t([list_to_atom(filename:rootname(File)) || File <- Fs], Config);
+t(Test,Config) when is_list(Config) ->
+ Tests = resolve(Test),
+ write_test_case(Test),
+ Res = reltool_test_lib:run_test(Tests, Config),
+ append_test_case_info(Test, Res).
+
+user() ->
+ user(read_test_case()).
+user(Mod) ->
+ t(Mod, [{user,step}]).
+user(Mod,Tc) when is_atom(Tc) ->
+ t({Mod,Tc}, [{user,step}]).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Resolves the name of test suites and test cases
+%% according to the alias definitions. Single atoms
+%% are assumed to be the name of a test suite.
+
+resolve(Suite0) when is_atom(Suite0) ->
+ case alias(Suite0) of
+ Suite when is_atom(Suite) ->
+ {Suite, all};
+ {Suite, Case} ->
+ {Suite, Case}
+ end;
+resolve({Suite0, Case}) when is_atom(Suite0), is_atom(Case) ->
+ case alias(Suite0) of
+ Suite when is_atom(Suite) ->
+ {Suite, Case};
+ {Suite, Case2} ->
+ {Suite, Case2}
+ end;
+resolve(List) when is_list(List) ->
+ [resolve(Case) || Case <- List].
+
+alias(Suite) when is_atom(Suite) ->
+ Str = atom_to_list(Suite),
+ case {Str, lists:reverse(Str)} of
+ {"reltool" ++ _, "ETIUS" ++ _} ->
+ Suite;
+ _ ->
+ list_to_atom("reltool_" ++ Str ++ "_SUITE")
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+config_fname() ->
+ "reltool_test_case_config".
+
+%% Read default config file
+read_config() ->
+ Fname = config_fname(),
+ reltool_test_lib:log("Consulting file ~s...~n", [Fname]),
+ case file:consult(Fname) of
+ {ok, Config} ->
+ reltool_test_lib:log("Read config ~w~n", [Config]),
+ Config;
+ _Error ->
+ Config = reltool_test_lib:default_config(),
+ reltool_test_lib:log("<>WARNING<> Using default config: ~w~n", [Config]),
+ Config
+ end.
+
+%% Write new default config file
+write_config(Config) when is_list(Config) ->
+ Fname = config_fname(),
+ {ok, Fd} = file:open(Fname, write),
+ write_list(Fd, Config),
+ file:close(Fd).
+
+write_list(Fd, [H | T]) ->
+ ok = io:format(Fd, "~p.~n",[H]),
+ write_list(Fd, T);
+write_list(_, []) ->
+ ok.
+
+test_case_fname() ->
+ "reltool_test_case_info".
+
+%% Read name of test case
+read_test_case() ->
+ Fname = test_case_fname(),
+ case file:open(Fname, [read]) of
+ {ok, Fd} ->
+ Res = io:read(Fd, []),
+ file:close(Fd),
+ case Res of
+ {ok, TestCase} ->
+ reltool_test_lib:log("Using test case ~w from file ~s~n",
+ [TestCase, Fname]),
+ TestCase;
+ {error, _} ->
+ default_test_case(Fname)
+ end;
+ {error, _} ->
+ default_test_case(Fname)
+ end.
+
+default_test_case(Fname) ->
+ TestCase = all,
+ reltool_test_lib:log("<>WARNING<> Cannot read file ~s, "
+ "using default test case: ~w~n",
+ [Fname, TestCase]),
+ TestCase.
+
+write_test_case(TestCase) ->
+ Fname = test_case_fname(),
+ {ok, Fd} = file:open(Fname, write),
+ ok = io:format(Fd, "~p.~n",[TestCase]),
+ file:close(Fd).
+
+append_test_case_info(TestCase, TestCaseInfo) ->
+ Fname = test_case_fname(),
+ {ok, Fd} = file:open(Fname, [read, write]),
+ ok = io:format(Fd, "~p.~n",[TestCase]),
+ ok = io:format(Fd, "~p.~n",[TestCaseInfo]),
+ file:close(Fd),
+ TestCaseInfo.
diff --git a/lib/stdlib/doc/src/beam_lib.xml b/lib/stdlib/doc/src/beam_lib.xml
index f2a9c2a671..b9286f1402 100644
--- a/lib/stdlib/doc/src/beam_lib.xml
+++ b/lib/stdlib/doc/src/beam_lib.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2000</year><year>2009</year>
+ <year>2000</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
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.
-
+
</legalnotice>
<title>beam_lib</title>
@@ -70,82 +70,88 @@
using <seealso marker="#strip/1">strip/1</seealso>,
<seealso marker="#strip_files/1">strip_files/1</seealso> and/or
<seealso marker="#strip_release/1">strip_release/1</seealso>.</p>
- <p><em>Reconstructing source code</em></p>
- <p>Here is an example of how to reconstruct source code from
- the debug information in a BEAM file <c>Beam</c>:</p>
- <code type="none">
+ <section>
+ <title>Reconstructing source code</title>
+ <p>Here is an example of how to reconstruct source code from
+ the debug information in a BEAM file <c>Beam</c>:</p>
+ <code type="none">
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(Beam,[abstract_code]).
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).</code>
- <p><em>Encrypted debug information</em></p>
- <p>The debug information can be encrypted in order to keep
- the source code secret, but still being able to use tools such as
- Xref or Debugger. </p>
- <p>To use encrypted debug information, a key must be provided to
- the compiler and <c>beam_lib</c>. The key is given as a string and
- it is recommended that it contains at least 32 characters and
- that both upper and lower case letters as well as digits and
- special characters are used.</p>
- <p></p>
- <p>The default type -- and currently the only type -- of crypto
- algorithm is <c>des3_cbc</c>, three rounds of DES. The key string
- will be scrambled using <c>erlang:md5/1</c> to generate
- the actual keys used for <c>des3_cbc</c>.</p>
- <note>
- <p>As far as we know by the time of writing, it is
- infeasible to break <c>des3_cbc</c> encryption without any
- knowledge of the key. Therefore, as long as the key is kept
- safe and is unguessable, the encrypted debug information
- <em>should</em> be safe from intruders.</p>
- </note>
- <p>There are two ways to provide the key:</p>
- <list type="ordered">
- <item>
- <p>Use the compiler option <c>{debug_info,Key}</c>, see
- <seealso marker="compiler:compile#debug_info_key">compile(3)</seealso>,
- and the function
- <seealso marker="#crypto_key_fun/1">crypto_key_fun/1</seealso>
- to register a fun which returns the key whenever
- <c>beam_lib</c> needs to decrypt the debug information.</p>
- <p>If no such fun is registered, <c>beam_lib</c> will instead
- search for a <c>.erlang.crypt</c> file, see below.</p>
- </item>
- <item>
- <p>Store the key in a text file named <c>.erlang.crypt</c>.</p>
- <p>In this case, the compiler option <c>encrypt_debug_info</c>
- can be used, see
- <seealso marker="compiler:compile#encrypt_debug_info">compile(3)</seealso>.</p>
- </item>
- </list>
- <p><em>.erlang.crypt</em></p>
- <p><c>beam_lib</c> searches for <c>.erlang.crypt</c> in the current
- directory and then the home directory for the current user. If
- the file is found and contains a key, <c>beam_lib</c> will
- implicitly create a crypto key fun and register it.</p>
- <p>The <c>.erlang.crypt</c> file should contain a single list of
- tuples:</p>
- <code type="none">
+ </section>
+ <section>
+ <title>Encrypted debug information</title>
+ <p>The debug information can be encrypted in order to keep
+ the source code secret, but still being able to use tools such as
+ Xref or Debugger. </p>
+ <p>To use encrypted debug information, a key must be provided to
+ the compiler and <c>beam_lib</c>. The key is given as a string and
+ it is recommended that it contains at least 32 characters and
+ that both upper and lower case letters as well as digits and
+ special characters are used.</p>
+ <p></p>
+ <p>The default type -- and currently the only type -- of crypto
+ algorithm is <c>des3_cbc</c>, three rounds of DES. The key string
+ will be scrambled using <c>erlang:md5/1</c> to generate
+ the actual keys used for <c>des3_cbc</c>.</p>
+ <note>
+ <p>As far as we know by the time of writing, it is
+ infeasible to break <c>des3_cbc</c> encryption without any
+ knowledge of the key. Therefore, as long as the key is kept
+ safe and is unguessable, the encrypted debug information
+ <em>should</em> be safe from intruders.</p>
+ </note>
+ <p>There are two ways to provide the key:</p>
+ <list type="ordered">
+ <item>
+ <p>Use the compiler option <c>{debug_info,Key}</c>, see
+ <seealso marker="compiler:compile#debug_info_key">compile(3)</seealso>,
+ and the function
+ <seealso marker="#crypto_key_fun/1">crypto_key_fun/1</seealso>
+ to register a fun which returns the key whenever
+ <c>beam_lib</c> needs to decrypt the debug information.</p>
+ <p>If no such fun is registered, <c>beam_lib</c> will instead
+ search for a <c>.erlang.crypt</c> file, see below.</p>
+ </item>
+ <item>
+ <p>Store the key in a text file named <c>.erlang.crypt</c>.</p>
+ <p>In this case, the compiler option <c>encrypt_debug_info</c>
+ can be used, see
+ <seealso marker="compiler:compile#encrypt_debug_info">compile(3)</seealso>.</p>
+ </item>
+ </list>
+ </section>
+ <section>
+ <title>.erlang.crypt</title>
+ <p><c>beam_lib</c> searches for <c>.erlang.crypt</c> in the current
+ directory and then the home directory for the current user. If
+ the file is found and contains a key, <c>beam_lib</c> will
+ implicitly create a crypto key fun and register it.</p>
+ <p>The <c>.erlang.crypt</c> file should contain a single list of
+ tuples:</p>
+ <code type="none">
{debug_info, Mode, Module, Key}</code>
- <p><c>Mode</c> is the type of crypto algorithm; currently, the only
- allowed value thus is <c>des3_cbc</c>. <c>Module</c> is either an
- atom, in which case <c>Key</c> will only be used for the module
- <c>Module</c>, or <c>[]</c>, in which case <c>Key</c> will be
- used for all modules. <c>Key</c> is the non-empty key string.</p>
- <p>The <c>Key</c> in the first tuple where both <c>Mode</c> and
- <c>Module</c> matches will be used.</p>
- <p>Here is an example of an <c>.erlang.crypt</c> file that returns
- the same key for all modules:</p>
- <code type="none"><![CDATA[
+ <p><c>Mode</c> is the type of crypto algorithm; currently, the only
+ allowed value thus is <c>des3_cbc</c>. <c>Module</c> is either an
+ atom, in which case <c>Key</c> will only be used for the module
+ <c>Module</c>, or <c>[]</c>, in which case <c>Key</c> will be
+ used for all modules. <c>Key</c> is the non-empty key string.</p>
+ <p>The <c>Key</c> in the first tuple where both <c>Mode</c> and
+ <c>Module</c> matches will be used.</p>
+ <p>Here is an example of an <c>.erlang.crypt</c> file that returns
+ the same key for all modules:</p>
+ <code type="none"><![CDATA[
[{debug_info, des3_cbc, [], "%>7}|pc/DM6Cga*68$Mw]L#&_Gejr]G^"}].]]></code>
- <p>And here is a slightly more complicated example of an
- <c>.erlang.crypt</c> which provides one key for the module
- <c>t</c>, and another key for all other modules:</p>
- <code type="none"><![CDATA[
+ <p>And here is a slightly more complicated example of an
+ <c>.erlang.crypt</c> which provides one key for the module
+ <c>t</c>, and another key for all other modules:</p>
+ <code type="none"><![CDATA[
[{debug_info, des3_cbc, t, "My KEY"},
{debug_info, des3_cbc, [], "%>7}|pc/DM6Cga*68$Mw]L#&_Gejr]G^"}].]]></code>
- <note>
- <p>Do not use any of the keys in these examples. Use your own
- keys.</p>
- </note>
+ <note>
+ <p>Do not use any of the keys in these examples. Use your own
+ keys.</p>
+ </note>
+ </section>
</section>
<section>
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml
index c075f11792..6f9d979c9a 100644
--- a/lib/stdlib/doc/src/io.xml
+++ b/lib/stdlib/doc/src/io.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>1996</year><year>2009</year>
+ <year>1996</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
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.
-
+
</legalnotice>
<title>io</title>
@@ -1003,7 +1003,8 @@ enter><input>bar.</input>
<title>Standard Error</title>
<p>In certain situations, especially when the standard output is redirected, access to an io_server() specific for error messages might be convenient. The io_device 'standard_error' can be used to direct output to whatever the current operating system considers a suitable device for error output. Example on a Unix-like operating system:</p>
<pre>
-$ <input>erl -noshell -noinput -eval 'io:format(standard_error,"Error: ~s~n",["error 11"]),init:stop().' > /dev/null</input>
+$ <input>erl -noshell -noinput -eval 'io:format(standard_error,"Error: ~s~n",["error 11"]),'\</input>
+<input>'init:stop().' > /dev/null</input>
Error: error 11</pre>
diff --git a/lib/stdlib/doc/src/unicode.xml b/lib/stdlib/doc/src/unicode.xml
index b3aad51591..60edd8ade9 100644
--- a/lib/stdlib/doc/src/unicode.xml
+++ b/lib/stdlib/doc/src/unicode.xml
@@ -51,7 +51,9 @@ charlist() = [unicode_char() | unicode_binary() | charlist()]
a unicode_binary is allowed as the tail of the list</code>
<code type="none">
-external_unicode_binary() = binary() with characters coded in a user specified Unicode encoding other than UTF-8 (UTF-16 or UTF-32)
+external_unicode_binary() = binary()
+ with characters coded in a user specified Unicode encoding other
+ than UTF-8 (UTF-16 or UTF-32)
external_chardata() = external_charlist() | external_unicode_binary()
diff --git a/lib/stdlib/doc/src/unicode_usage.xml b/lib/stdlib/doc/src/unicode_usage.xml
index 06347b3aae..c5bf10b63d 100644
--- a/lib/stdlib/doc/src/unicode_usage.xml
+++ b/lib/stdlib/doc/src/unicode_usage.xml
@@ -76,7 +76,8 @@ charlist() = [unicode_char() | unicode_binary() | charlist()]
a unicode_binary is allowed as the tail of the list</code>
<p>The module <c>unicode</c> in stdlib even supports similar mixes with binaries containing other encodings than UTF-8, but that is a special case to allow for conversions to and from external data:</p>
<code type="none">
-external_unicode_binary() = binary() with characters coded in a user specified Unicode encoding other than UTF-8 (UTF-16 or UTF-32)
+external_unicode_binary() = binary() with characters coded in a user specified Unicode
+ encoding other than UTF-8 (UTF-16 or UTF-32)
external_chardata() = external_charlist() | external_unicode_binary()
@@ -93,7 +94,8 @@ external_charlist() = [unicode_char() | external_unicode_binary() | external_cha
<code>
&lt;&lt;Ch/utf8,_/binary&gt;&gt; = Bin1,
&lt;&lt;Ch/utf16-little,_/binary&gt;&gt; = Bin2,
-Bin3 = &lt;&lt;$H/utf32-little, $e/utf32-little, $l/utf32-little, $l/utf32-little, $o/utf32-little&gt;&gt;,</code>
+Bin3 = &lt;&lt;$H/utf32-little, $e/utf32-little, $l/utf32-little, $l/utf32-little,
+ $o/utf32-little&gt;&gt;,</code>
<p>For convenience, literal strings can be encoded with a Unicode encoding in binaries using the following (or similar) syntax:</p>
<code>
Bin4 = &lt;&lt;"Hello"/utf16&gt;&gt;,</code>
diff --git a/lib/syntax_tools/Makefile b/lib/syntax_tools/Makefile
index 08ede67209..37e84a80a5 100644
--- a/lib/syntax_tools/Makefile
+++ b/lib/syntax_tools/Makefile
@@ -58,10 +58,10 @@ include $(ERL_TOP)/make/otp_subdir.mk
version:
@echo "$(VSN)"
-docs:
- erl -noshell -pa "$(BINDIR)" -run edoc_run application "'$(APPNAME)'" '"."' '$(DOC_OPTS)' -s init stop
+# The overriding "docs" target have been removed so the default make rules work properly.
-edocs: docs
+edocs:
+ erl -noshell -pa "$(BINDIR)" -run edoc_run application "'$(APPNAME)'" '"."' '$(DOC_OPTS)' -s init stop
app_release: tar
diff --git a/lib/syntax_tools/doc/src/Makefile b/lib/syntax_tools/doc/src/Makefile
index 2065614251..291b3e3047 100644
--- a/lib/syntax_tools/doc/src/Makefile
+++ b/lib/syntax_tools/doc/src/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2006-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2006-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%
#
include $(ERL_TOP)/make/target.mk
@@ -101,10 +101,10 @@ html: gifs $(HTML_REF_MAN_FILE)
man: $(MAN3_FILES)
$(XML_REF3_FILES):
- docb_gen $(SRC_DIR)/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript $(SRC_DIR)/$(@:%.xml=%.erl)
$(XML_CHAPTER_FILES):
- docb_gen -chapter -def vsn $(VSN) ../overview.edoc
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -chapter ../overview.edoc
gifs: $(GIF_FILES:%=$(HTMLDIR)/%)
diff --git a/lib/syntax_tools/src/Makefile b/lib/syntax_tools/src/Makefile
index 5ffe85c975..62a24d98c0 100644
--- a/lib/syntax_tools/src/Makefile
+++ b/lib/syntax_tools/src/Makefile
@@ -34,15 +34,15 @@ OBJECTS=$(SOURCES:%.erl=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET)
APP_FILE= syntax_tools.app
APP_SRC= $(APP_FILE).src
APP_TARGET= $(EBIN)/$(APP_FILE)
-
+
APPUP_FILE= syntax_tools.appup
APPUP_SRC= $(APPUP_FILE).src
APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
-
+
# ----------------------------------------------------
# Targets
# ----------------------------------------------------
-
+
debug opt: $(OBJECTS)
all: $(OBJECTS)
@@ -52,6 +52,8 @@ clean:
rm -f $(OBJECTS)
rm -f core *~
+docs:
+
distclean: clean
realclean: clean
@@ -62,10 +64,10 @@ $(EBIN)/%.$(EMULATOR):%.erl
# ----------------------------------------------------
# Special Build Targets
# ----------------------------------------------------
-
+
$(APP_TARGET): $(APP_SRC) ../vsn.mk
sed -e 's;%VSN%;$(VSN);' $< > $@
-
+
$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
sed -e 's;%VSN%;$(VSN);' $< > $@
diff --git a/lib/test_server/doc/src/Makefile b/lib/test_server/doc/src/Makefile
index e3c1b8ce92..c7ba415e5b 100644
--- a/lib/test_server/doc/src/Makefile
+++ b/lib/test_server/doc/src/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2002-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2002-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -60,6 +60,9 @@ XML_CHAPTER_FILES = \
BOOK_FILES = book.xml
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) $(XML_REF6_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
GIF_FILES =
# ----------------------------------------------------
diff --git a/lib/test_server/src/Makefile b/lib/test_server/src/Makefile
index 2d7e5b28bc..d55a3a597d 100644
--- a/lib/test_server/src/Makefile
+++ b/lib/test_server/src/Makefile
@@ -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%
#
@@ -104,7 +104,7 @@ clean:
rm -f $(TARGET_FILES) $(TS_TARGET_FILES)
rm -f core
-doc:
+docs:
configure: configure.in
autoconf configure.in > configure
diff --git a/lib/wx/doc/src/Makefile b/lib/wx/doc/src/Makefile
index fd9f7441a3..c8eb6174c4 100644
--- a/lib/wx/doc/src/Makefile
+++ b/lib/wx/doc/src/Makefile
@@ -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%
#
@@ -82,7 +82,6 @@ XML_FILES = \
$(XML_PART_FILES) $(XML_REF3_FILES) \
$(XML_NOTES_FILES) $(XML_APPLICATION_FILES)
-
# ----------------------------------------------------
INFO_FILE = ../../info
@@ -130,12 +129,13 @@ ref_man.xml: ref_man.xml.src
@echo
$(ErlMods:%.erl=%.xml):
- docb_gen -def vsn $(VSN) -sort_functions false ../../src/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -sort_functions false ../../src/$(@:%.xml=%.erl)
+
$(GenMods:%.erl=%.xml):
- docb_gen -def vsn $(VSN) -sort_functions false ../../src/gen/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -sort_functions false ../../src/gen/$(@:%.xml=%.erl)
$(XML_CHAPTER_FILES):
- docb_gen -chapter -def vsn $(VSN) ../overview.edoc
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -chapter ../overview.edoc
debug opt: