aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in16
-rw-r--r--erts/doc/src/erl.xml2
-rw-r--r--erts/doc/src/erl_driver.xml8
-rw-r--r--erts/doc/src/erl_nif.xml4
-rw-r--r--erts/doc/src/erlang.xml112
-rw-r--r--erts/doc/src/notes.xml8
-rw-r--r--erts/emulator/beam/erl_bif_re.c15
-rw-r--r--erts/emulator/beam/erl_db_tree.c14
-rw-r--r--erts/emulator/beam/erl_lock_check.c13
-rw-r--r--erts/emulator/beam/erl_process.c22
-rw-r--r--erts/emulator/beam/erl_time_sup.c14
-rw-r--r--erts/emulator/hipe/hipe_bif0.c123
-rw-r--r--erts/emulator/test/scheduler_SUITE.erl110
-rw-r--r--erts/epmd/test/Makefile24
-rw-r--r--erts/epmd/test/epmd_SUITE.erl160
-rw-r--r--erts/lib_src/Makefile.in5
-rw-r--r--erts/preloaded/ebin/erl_prim_loader.beambin48420 -> 50376 bytes
-rw-r--r--erts/preloaded/ebin/erlang.beambin23284 -> 23284 bytes
-rw-r--r--erts/preloaded/ebin/init.beambin44416 -> 44416 bytes
-rw-r--r--erts/preloaded/ebin/otp_ring0.beambin1392 -> 1392 bytes
-rw-r--r--erts/preloaded/ebin/prim_file.beambin29480 -> 29480 bytes
-rw-r--r--erts/preloaded/ebin/prim_inet.beambin57308 -> 57308 bytes
-rw-r--r--erts/preloaded/ebin/prim_zip.beambin20756 -> 21756 bytes
-rw-r--r--erts/preloaded/ebin/zlib.beambin10624 -> 10624 bytes
-rw-r--r--erts/preloaded/src/erl_prim_loader.erl201
-rw-r--r--erts/preloaded/src/prim_zip.erl57
-rw-r--r--erts/test/erl_print_SUITE.erl12
-rw-r--r--erts/test/erlc_SUITE.erl2
-rw-r--r--erts/test/erlexec_SUITE.erl12
-rw-r--r--erts/test/ethread_SUITE.erl12
-rw-r--r--erts/test/ignore_cores.erl12
-rw-r--r--erts/test/nt_SUITE.erl13
-rw-r--r--erts/test/otp_SUITE.erl13
-rw-r--r--erts/test/run_erl_SUITE.erl12
-rw-r--r--erts/test/z_SUITE.erl12
-rw-r--r--lib/appmon/doc/src/Makefile13
-rw-r--r--lib/common_test/doc/src/Makefile20
-rw-r--r--lib/compiler/src/compile.erl50
-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.xsl253
-rw-r--r--lib/erl_docgen/priv/xsl/db_man.xsl242
-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/erl_interface/src/legacy/erl_eterm.c10
-rw-r--r--lib/et/doc/src/Makefile24
-rw-r--r--lib/eunit/doc/src/Makefile5
-rw-r--r--lib/eunit/test/Makefile12
-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/kernel/src/Makefile12
-rw-r--r--lib/kernel/src/code.erl24
-rw-r--r--lib/kernel/src/code_server.erl14
-rw-r--r--lib/kernel/src/hipe_unified_loader.erl32
-rw-r--r--lib/kernel/test/Makefile12
-rw-r--r--lib/kernel/test/bif_SUITE.erl44
-rw-r--r--lib/kernel/test/cleanup.erl12
-rw-r--r--lib/kernel/test/erl_distribution_SUITE.erl46
-rw-r--r--lib/kernel/test/erl_prim_loader_SUITE.erl74
-rw-r--r--lib/kernel/test/error_logger_SUITE.erl32
-rw-r--r--lib/kernel/test/file_SUITE.erl12
-rw-r--r--lib/kernel/test/global_group_SUITE.erl30
-rw-r--r--lib/kernel/test/heart_SUITE.erl16
-rw-r--r--lib/kernel/test/init_SUITE.erl14
-rw-r--r--lib/kernel/test/kernel_SUITE.erl12
-rw-r--r--lib/kernel/test/kernel_config_SUITE.erl12
-rw-r--r--lib/kernel/test/loose_node.erl27
-rw-r--r--lib/kernel/test/os_SUITE.erl24
-rw-r--r--lib/kernel/test/pdict_SUITE.erl14
-rw-r--r--lib/kernel/test/rpc_SUITE.erl14
-rw-r--r--lib/kernel/test/seq_trace_SUITE.erl16
-rw-r--r--lib/kernel/test/wrap_log_reader_SUITE.erl30
-rw-r--r--lib/odbc/doc/src/Makefile13
-rw-r--r--lib/parsetools/test/Makefile78
-rw-r--r--lib/parsetools/test/leex_SUITE.erl909
-rw-r--r--lib/parsetools/test/parsetools.spec1
-rw-r--r--lib/parsetools/test/yecc_SUITE.erl1795
-rw-r--r--lib/percept/doc/src/Makefile14
-rw-r--r--lib/public_key/doc/src/Makefile13
-rw-r--r--lib/public_key/test/Makefile12
-rw-r--r--lib/public_key/test/public_key_SUITE.erl15
-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/ssh/doc/src/Makefile13
-rw-r--r--lib/ssh/doc/src/notes.xml17
-rw-r--r--lib/ssh/src/ssh.appup.src12
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl14
-rw-r--r--lib/ssh/vsn.mk3
-rw-r--r--lib/ssl/doc/src/Makefile13
-rw-r--r--lib/ssl/test/ssl_packet_SUITE.erl12
-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/stdlib/src/escript.erl13
-rw-r--r--lib/stdlib/src/filelib.erl22
-rw-r--r--lib/stdlib/src/re.erl71
-rw-r--r--lib/stdlib/test/Makefile2
-rw-r--r--lib/stdlib/test/calendar_SUITE.erl26
-rw-r--r--lib/stdlib/test/ets_tough_SUITE.erl18
-rw-r--r--lib/stdlib/test/filelib_SUITE.erl30
-rw-r--r--lib/stdlib/test/fixtable_SUITE.erl26
-rw-r--r--lib/stdlib/test/format_SUITE.erl12
-rw-r--r--lib/stdlib/test/gen_event_SUITE.erl30
-rw-r--r--lib/stdlib/test/io_proto_SUITE.erl40
-rw-r--r--lib/stdlib/test/ms_transform_SUITE.erl36
-rw-r--r--lib/stdlib/test/queue_SUITE.erl22
-rw-r--r--lib/stdlib/test/re_SUITE.erl30
-rw-r--r--lib/stdlib/test/re_SUITE_data/mod_testoutput8877
-rw-r--r--lib/stdlib/test/re_testoutput1_replacement_test.erl11
-rw-r--r--lib/stdlib/test/re_testoutput1_split_test.erl11
-rw-r--r--lib/stdlib/test/run_pcre_tests.erl52
-rw-r--r--lib/stdlib/test/select_SUITE.erl16
-rw-r--r--lib/stdlib/test/slave_SUITE.erl18
-rw-r--r--lib/stdlib/test/sofs_SUITE.erl132
-rw-r--r--lib/stdlib/test/supervisor_SUITE.erl68
-rw-r--r--lib/stdlib/test/tar_SUITE.erl18
-rw-r--r--lib/stdlib/test/timer_SUITE.erl12
-rw-r--r--lib/stdlib/test/unicode_SUITE.erl82
-rw-r--r--lib/stdlib/test/win32reg_SUITE.erl14
-rw-r--r--lib/stdlib/test/zip_SUITE.erl20
-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
-rw-r--r--lib/wx/test/wx_class_SUITE.erl26
-rw-r--r--lib/wx/test/wx_xtra_SUITE.erl7
-rw-r--r--lib/wx/test/wxt.erl18
-rw-r--r--lib/xmerl/doc/src/Makefile12
-rw-r--r--make/otp.mk.in25
-rw-r--r--system/AD.html307
-rw-r--r--system/AD.sgml367
-rw-r--r--system/ADbeam.html261
-rw-r--r--system/ADbeam.sgml246
-rw-r--r--system/doc/book.xml52
-rw-r--r--system/doc/extensions/Makefile142
-rw-r--r--system/doc/extensions/bit_syntax.xml403
-rw-r--r--system/doc/extensions/book.xml45
-rw-r--r--system/doc/extensions/fun_test.erl17
-rw-r--r--system/doc/extensions/funparse.erl74
-rw-r--r--system/doc/extensions/funs.xml486
-rw-r--r--system/doc/extensions/funs1.erl125
-rw-r--r--system/doc/extensions/include.xml81
-rw-r--r--system/doc/extensions/list_comprehensions.erl118
-rw-r--r--system/doc/extensions/list_comprehensions.xml205
-rw-r--r--system/doc/extensions/list_comrehensions.erl75
-rw-r--r--system/doc/extensions/macros.xml177
-rw-r--r--system/doc/extensions/make.dep21
-rw-r--r--system/doc/extensions/mexpand.erl16
-rw-r--r--system/doc/extensions/misc.xml310
-rw-r--r--system/doc/extensions/part.xml57
-rw-r--r--system/doc/extensions/records.xml284
-rw-r--r--system/doc/extensions/warning.gifbin1498 -> 0 bytes
-rw-r--r--system/doc/images/.gitignore0
-rw-r--r--system/doc/pics/Makefile58
-rw-r--r--system/doc/pics/app.gifbin285 -> 0 bytes
-rw-r--r--system/doc/pics/ede.gifbin13644 -> 0 bytes
-rw-r--r--system/doc/pics/ede_logo.gifbin757 -> 0 bytes
-rw-r--r--system/doc/pics/min_head.gifbin2652 -> 0 bytes
-rw-r--r--system/doc/pics/notes.gifbin2005 -> 0 bytes
-rw-r--r--system/doc/pics/otp.gifbin13737 -> 0 bytes
-rw-r--r--system/doc/pics/otp_logo.gifbin1660 -> 0 bytes
-rw-r--r--system/doc/pics/ps.gifbin618 -> 0 bytes
-rw-r--r--system/doc/pics/ref_man.gifbin1530 -> 0 bytes
-rw-r--r--system/doc/pics/user_guide.gifbin1581 -> 0 bytes
-rwxr-xr-x[l---------]system/doc/top/bin/otp_man_index107
-rw-r--r--[l---------]system/doc/top/src/erl_html_tools.erl728
-rw-r--r--[l---------]system/doc/top/src/erlresolvelinks.erl145
l---------system/doc/top/src/permuted_index.erl1
-rw-r--r--system/doc/top/templates/erlang.gifbin2162 -> 0 bytes
-rw-r--r--system/doc/top/templates/first.html.src104
-rwxr-xr-xsystem/doc/top/templates/flip_closed.gifbin82 -> 0 bytes
-rwxr-xr-xsystem/doc/top/templates/flip_google.gifbin257 -> 0 bytes
-rwxr-xr-xsystem/doc/top/templates/flip_open.gifbin86 -> 0 bytes
-rwxr-xr-xsystem/doc/top/templates/flip_static.gifbin109 -> 0 bytes
-rwxr-xr-xsystem/doc/top/templates/flipmenu.js342
-rw-r--r--system/doc/top/templates/index.html.src4
-rw-r--r--system/doc/top/templates/otp_top.css53
-rw-r--r--system/doc/top/templates/system.html.src281
-rw-r--r--system/doc/top/templates/toc_.html.src105
210 files changed, 8538 insertions, 6334 deletions
diff --git a/Makefile.in b/Makefile.in
index 7596a82720..8e97edfd84 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -214,14 +214,15 @@ endif
# ---------------------------------------------------------------
# Target only used when building commercial ERTS patches
# ---------------------------------------------------------------
-release_docs:
+release_docs docs:
ifeq ($(OTP_SMALL_BUILD),true)
- cd $(ERL_TOP)/lib && $(MAKE) TESTROOT=$(RELEASE_ROOT) release_docs
+ cd $(ERL_TOP)/lib && $(MAKE) TESTROOT=$(RELEASE_ROOT) $@
else
- cd $(ERL_TOP)/lib && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release_docs
- cd $(ERL_TOP)/lib/dialyzer && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release_docs
+ cd $(ERL_TOP)/lib && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@
+ cd $(ERL_TOP)/lib/dialyzer && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@
endif
- cd $(ERL_TOP)/erts && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release_docs
+ cd $(ERL_TOP)/erts && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) $@
+ cd $(ERL_TOP)/system/doc && $(MAKE) TESTROOT=$(RELEASE_ROOT) $@
# ----------------------------------------------------------------------
@@ -730,6 +731,11 @@ bootstrap_nc_for_ne_no_debug_sym:
#
install: install.dirs install.emulator install.libs install.Install install.bin
+install-docs:
+ ERL_TOP=$(ERL_TOP) INSTALLROOT=$(ERLANG_LIBDIR) PATH=$(BOOT_PREFIX)$${PATH} \
+ $(MAKE) RELEASE_ROOT=$(ERLANG_LIBDIR) release_docs
+
+
install.emulator:
cd erts && \
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)$${PATH} \
diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml
index 6f5dd248ce..b01d187b01 100644
--- a/erts/doc/src/erl.xml
+++ b/erts/doc/src/erl.xml
@@ -410,7 +410,7 @@
<tag><c><![CDATA[-setcookie Cookie]]></c></tag>
<item>
<p>Sets the magic cookie of the node to <c><![CDATA[Cookie]]></c>, see
- <seealso marker="erlang#erlang:set_cookie/2">erlang:set_cookie/2</seealso>.</p>
+ <seealso marker="erlang#set_cookie/2">erlang:set_cookie/2</seealso>.</p>
</item>
<tag><c><![CDATA[-shutdown_time Time]]></c></tag>
<item>
diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml
index 0b11f4bbcb..5d7a11b70a 100644
--- a/erts/doc/src/erl_driver.xml
+++ b/erts/doc/src/erl_driver.xml
@@ -4,7 +4,7 @@
<cref>
<header>
<copyright>
- <year>2001</year><year>2009</year>
+ <year>2001</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>erl_driver</title>
@@ -1292,7 +1292,7 @@ typedef struct ErlIOVec {
has been set in the
<seealso marker="driver_entry">driver_entry</seealso>,
data can be forced into the driver via
- <seealso marker="erlang#erlang:port_command/3">port_command(Port, Data, [force])</seealso>
+ <seealso marker="erlang#port_command/3">port_command(Port, Data, [force])</seealso>
even though the driver has signaled that it is busy.
</p>
</desc>
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml
index 2033ba8a66..2902d70976 100644
--- a/erts/doc/src/erl_nif.xml
+++ b/erts/doc/src/erl_nif.xml
@@ -148,7 +148,7 @@ ok
that the library needs in able to keep a state between NIF
calls. <c>enif_get_data()</c> will return this pointer.</p>
<p><c>load_info</c> is the second argument to <seealso
- marker="erlang#erlang:load_nif-2">erlang:load_nif/2</seealso>.</p>
+ marker="erlang#load_nif-2">erlang:load_nif/2</seealso>.</p>
<p>The library will fail to load if <c>load</c> returns
anything other than 0. <c>load</c> can be NULL in case no
initialization is needed.</p>
@@ -397,7 +397,7 @@ typedef struct {
</funcs>
<section>
<title>SEE ALSO</title>
- <p><seealso marker="erlang#erlang:load_nif-2">load_nif(3)</seealso></p>
+ <p><seealso marker="erlang#load_nif-2">load_nif(3)</seealso></p>
</section>
</cref>
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 28b040a441..207aabca35 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -452,19 +452,19 @@ iolist() = [char() | binary() | iolist()]
<desc>
<p>Cancels a timer, where <c>TimerRef</c> was returned by
either
- <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>
+ <seealso marker="#send_after/3">erlang:send_after/3</seealso>
or
- <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>.
+ <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>.
If the timer is there to be removed, the function returns
the time in milliseconds left until the timer would have expired,
otherwise <c>false</c> (which means that <c>TimerRef</c> was
never a timer, that it has already been cancelled, or that it
has already delivered its message).</p>
<p>See also
- <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>,
- <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>,
+ <seealso marker="#send_after/3">erlang:send_after/3</seealso>,
+ <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>,
and
- <seealso marker="#erlang:read_timer/1">erlang:read_timer/1</seealso>.</p>
+ <seealso marker="#read_timer/1">erlang:read_timer/1</seealso>.</p>
<p>Note: Cancelling a timer does not guarantee that the message
has not already been delivered to the message queue.</p>
</desc>
@@ -715,7 +715,7 @@ false</pre>
<desc>
<p>If <c>MonitorRef</c> is a reference which the calling process
obtained by calling
- <seealso marker="#erlang:monitor/2">erlang:monitor/2</seealso>,
+ <seealso marker="#monitor/2">erlang:monitor/2</seealso>,
this monitoring is turned off. If the monitoring is already
turned off, nothing happens.</p>
<p>Once <c>erlang:demonitor(MonitorRef)</c> has returned it is
@@ -726,7 +726,7 @@ false</pre>
the call, though. Therefore, in most cases, it is advisable
to remove such a <c>'DOWN'</c> message from the message queue
after monitoring has been stopped.
- <seealso marker="#erlang:demonitor/2">erlang:demonitor(MonitorRef, [flush])</seealso> can be used instead of
+ <seealso marker="#demonitor/2">erlang:demonitor(MonitorRef, [flush])</seealso> can be used instead of
<c>erlang:demonitor(MonitorRef)</c> if this cleanup is wanted.</p>
<note>
<p>Prior to OTP release R11B (erts version 5.5) <c>erlang:demonitor/1</c>
@@ -760,7 +760,7 @@ false</pre>
of <c>OptionList</c>.
</p>
<p><c>erlang:demonitor(MonitorRef, [])</c> is equivalent to
- <seealso marker="#erlang:demonitor/1">erlang:demonitor(MonitorRef)</seealso>.</p>
+ <seealso marker="#demonitor/1">erlang:demonitor(MonitorRef)</seealso>.</p>
<p>Currently the following <c>Option</c>s are valid:</p>
<taglist>
<tag><c>flush</c></tag>
@@ -810,7 +810,7 @@ false</pre>
</note>
<p>Failure: <c>badarg</c> if <c>OptionList</c> is not a list, or
if <c>Option</c> is not a valid option, or the same failure as for
- <seealso marker="#erlang:demonitor/1">erlang:demonitor/1</seealso></p>
+ <seealso marker="#demonitor/1">erlang:demonitor/1</seealso></p>
</desc>
</func>
<func>
@@ -1129,7 +1129,7 @@ b</pre>
<c>uniq</c>, and <c>pid</c>. For an external fun, the value
of any of these items is always the atom <c>undefined</c>.</p>
<p>See
- <seealso marker="#erlang:fun_info/1">erlang:fun_info/1</seealso>.</p>
+ <seealso marker="#fun_info/1">erlang:fun_info/1</seealso>.</p>
</desc>
</func>
<func>
@@ -1275,8 +1275,8 @@ b</pre>
returns, for example:</p>
<p><c>{'EXIT',{badarg,Stacktrace}} = catch abs(x)</c></p>
<p>See also
- <seealso marker="#erlang:error/1">erlang:error/1</seealso> and
- <seealso marker="#erlang:error/2">erlang:error/2</seealso>.</p>
+ <seealso marker="#error/1">erlang:error/1</seealso> and
+ <seealso marker="#error/2">erlang:error/2</seealso>.</p>
</desc>
</func>
<func>
@@ -2387,7 +2387,7 @@ os_prompt%</pre>
<item>
If <c>Type</c> is not one of the memory types listed in the
documentation of
- <seealso marker="#erlang:memory/0">erlang:memory/0</seealso>.
+ <seealso marker="#memory/0">erlang:memory/0</seealso>.
</item>
<tag><c>badarg</c></tag>
<item>
@@ -2401,7 +2401,7 @@ os_prompt%</pre>
</item>
</taglist>
<p>See also
- <seealso marker="#erlang:memory/0">erlang:memory/0</seealso>.</p>
+ <seealso marker="#memory/0">erlang:memory/0</seealso>.</p>
</desc>
</func>
<func>
@@ -2510,7 +2510,7 @@ os_prompt%</pre>
</note>
<p>The monitoring is turned off either when the <c>'DOWN'</c>
message is sent, or when
- <seealso marker="#erlang:demonitor/1">erlang:demonitor/1</seealso>
+ <seealso marker="#demonitor/1">erlang:demonitor/1</seealso>
is called.</p>
<p>If an attempt is made to monitor a process on an older node
(where remote process monitoring is not implemented or one
@@ -3379,7 +3379,7 @@ os_prompt%</pre>
registered name, [] is returned.</p>
<p>For valid values of <c>Item</c>, and corresponding
values of <c>Info</c>, see
- <seealso marker="#erlang:port_info/1">erlang:port_info/1</seealso>.</p>
+ <seealso marker="#port_info/1">erlang:port_info/1</seealso>.</p>
<p>Failure: <c>badarg</c> if <c>Port</c> is not a local port.</p>
</desc>
</func>
@@ -3868,9 +3868,9 @@ os_prompt%</pre>
ActiveSuspendCount, OutstandingSuspendCount}</c> tuples.
<c>Suspendee</c> is the pid of a process that have been or is to
be suspended by the process identified by <c>Pid</c> via the
- <seealso marker="#erlang:suspend_process/2">erlang:suspend_process/2</seealso>
+ <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>
BIF, or the
- <seealso marker="#erlang:suspend_process/1">erlang:suspend_process/1</seealso>
+ <seealso marker="#suspend_process/1">erlang:suspend_process/1</seealso>
BIF. <c>ActiveSuspendCount</c> is the number of times the
<c>Suspendee</c> has been suspended by <c>Pid</c>.
<c>OutstandingSuspendCount</c> is the number of not yet
@@ -4021,19 +4021,19 @@ os_prompt%</pre>
</type>
<desc>
<p><c>TimerRef</c> is a timer reference returned by
- <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>
+ <seealso marker="#send_after/3">erlang:send_after/3</seealso>
or
- <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>.
+ <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>.
If the timer is active, the function returns the time in
milliseconds left until the timer will expire, otherwise
<c>false</c> (which means that <c>TimerRef</c> was never a
timer, that it has been cancelled, or that it has already
delivered its message).</p>
<p>See also
- <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>,
- <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>,
+ <seealso marker="#send_after/3">erlang:send_after/3</seealso>,
+ <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>,
and
- <seealso marker="#erlang:cancel_timer/1">erlang:cancel_timer/1</seealso>.</p>
+ <seealso marker="#cancel_timer/1">erlang:cancel_timer/1</seealso>.</p>
</desc>
</func>
<func>
@@ -4098,9 +4098,9 @@ true</pre>
<p>Decreases the suspend count on the process identified by
<c>Suspendee</c>. <c>Suspendee</c> should previously have been
suspended via
- <seealso marker="#erlang:suspend_process/2">erlang:suspend_process/2</seealso>,
+ <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>,
or
- <seealso marker="#erlang:suspend_process/1">erlang:suspend_process/1</seealso>
+ <seealso marker="#suspend_process/1">erlang:suspend_process/1</seealso>
by the process calling <c>erlang:resume_process(Suspendee)</c>. When
the suspend count on <c>Suspendee</c> reach zero, <c>Suspendee</c>
will be resumed, i.e., the state of the <c>Suspendee</c> is changed
@@ -4186,9 +4186,9 @@ true</pre>
<p>Sends a message and returns <c>ok</c>, or does not send
the message but returns something else (see below). Otherwise
the same as
- <seealso marker="#erlang:send/2">erlang:send/2</seealso>. See
+ <seealso marker="#send/2">erlang:send/2</seealso>. See
also
- <seealso marker="#erlang:send_nosuspend/2">erlang:send_nosuspend/2,3</seealso>.
+ <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2,3</seealso>.
for more detailed explanation and warnings.</p>
<p>The possible options are:</p>
<taglist>
@@ -4234,10 +4234,10 @@ true</pre>
erts version 5.4.11. Note that timers will not be
automatically canceled when <c>Dest</c> is an atom.</p>
<p>See also
- <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>,
- <seealso marker="#erlang:cancel_timer/1">erlang:cancel_timer/1</seealso>,
+ <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>,
+ <seealso marker="#cancel_timer/1">erlang:cancel_timer/1</seealso>,
and
- <seealso marker="#erlang:read_timer/1">erlang:read_timer/1</seealso>.</p>
+ <seealso marker="#read_timer/1">erlang:read_timer/1</seealso>.</p>
<p>Failure: <c>badarg</c> if the arguments does not satisfy
the requirements specified above.</p>
</desc>
@@ -4253,7 +4253,7 @@ true</pre>
</type>
<desc>
<p>The same as
- <seealso marker="#erlang:send/3">erlang:send(Dest, Msg, [nosuspend])</seealso>, but returns <c>true</c> if
+ <seealso marker="#send/3">erlang:send(Dest, Msg, [nosuspend])</seealso>, but returns <c>true</c> if
the message was sent and <c>false</c> if the message was not
sent because the sender would have had to be suspended.</p>
<p>This function is intended for send operations towards an
@@ -4305,10 +4305,10 @@ true</pre>
</type>
<desc>
<p>The same as
- <seealso marker="#erlang:send/3">erlang:send(Dest, Msg, [nosuspend | Options])</seealso>,
+ <seealso marker="#send/3">erlang:send(Dest, Msg, [nosuspend | Options])</seealso>,
but with boolean return value.</p>
<p>This function behaves like
- <seealso marker="#erlang:send_nosuspend/2">erlang:send_nosuspend/2)</seealso>,
+ <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2)</seealso>,
but takes a third parameter, a list of options. The only
currently implemented option is <c>noconnect</c>. The option
<c>noconnect</c> makes the function return <c>false</c> if
@@ -4610,7 +4610,7 @@ true</pre>
<tag><c>monitor</c></tag>
<item>
<p>Monitor the new process (just like
- <seealso marker="#erlang:monitor/2">erlang:monitor/2</seealso> does).</p>
+ <seealso marker="#monitor/2">erlang:monitor/2</seealso> does).</p>
</item>
<tag><c>{priority, Level}</c></tag>
<item>
@@ -4653,7 +4653,7 @@ true</pre>
and no virtual memory, one might want to preserve memory
by setting <c>Number</c> to zero. (The value may be set
globally, see
- <seealso marker="#erlang:system_flag/2">erlang:system_flag/2</seealso>.)</p>
+ <seealso marker="#system_flag/2">erlang:system_flag/2</seealso>.)</p>
</item>
<tag><c>{min_heap_size, Size}</c></tag>
<item>
@@ -4764,10 +4764,10 @@ true</pre>
erts version 5.4.11. Note that timers will not be
automatically canceled when <c>Dest</c> is an atom.</p>
<p>See also
- <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>,
- <seealso marker="#erlang:cancel_timer/1">erlang:cancel_timer/1</seealso>,
+ <seealso marker="#send_after/3">erlang:send_after/3</seealso>,
+ <seealso marker="#cancel_timer/1">erlang:cancel_timer/1</seealso>,
and
- <seealso marker="#erlang:read_timer/1">erlang:read_timer/1</seealso>.</p>
+ <seealso marker="#read_timer/1">erlang:read_timer/1</seealso>.</p>
<p>Failure: <c>badarg</c> if the arguments does not satisfy
the requirements specified above.</p>
</desc>
@@ -4872,7 +4872,7 @@ true</pre>
process will not leave the suspended state until its suspend
count reach zero. The suspend count of <c>Suspendee</c> is
decreased when
- <seealso marker="#erlang:resume_process/1">erlang:resume_process(Suspendee)</seealso>
+ <seealso marker="#resume_process/1">erlang:resume_process(Suspendee)</seealso>
is called by the same process that called
<c>erlang:suspend_process(Suspendee)</c>. All increased suspend
counts on other processes acquired by a process will automatically be
@@ -4961,7 +4961,7 @@ true</pre>
<desc>
<p>Suspends the process identified by <c>Suspendee</c>. The
same as calling
- <seealso marker="#erlang:suspend_process/2">erlang:suspend_process(Suspendee, [])</seealso>. For more information see the documentation of <seealso marker="#erlang:suspend_process/2">erlang:suspend_process/2</seealso>.
+ <seealso marker="#suspend_process/2">erlang:suspend_process(Suspendee, [])</seealso>. For more information see the documentation of <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>.
</p>
<warning>
<p>This BIF is intended for debugging only.</p>
@@ -5272,7 +5272,7 @@ true</pre>
Some values are part of other values, and some memory
areas are not part of the result. If you are interested
in the total amount of memory allocated by the emulator
- see <seealso marker="#erlang:memory/0">erlang:memory/0,1</seealso>.</p>
+ see <seealso marker="#memory/0">erlang:memory/0,1</seealso>.</p>
</item>
<tag><c>allocator</c></tag>
<item>
@@ -5587,7 +5587,7 @@ true</pre>
<c>spawn</c> or <c>spawn_link</c> will use these
garbage collection settings. The default settings can be
changed by use of
- <seealso marker="#erlang:system_flag/2">system_flag/2</seealso>.
+ <seealso marker="#system_flag/2">system_flag/2</seealso>.
<seealso marker="#spawn_opt/4">spawn_opt/4</seealso>
can spawn a process that does not use the default
settings.</p>
@@ -5900,7 +5900,7 @@ true</pre>
</type>
<desc>
<p>Returns the current system monitoring settings set by
- <seealso marker="#erlang:system_monitor/2">erlang:system_monitor/2</seealso>
+ <seealso marker="#system_monitor/2">erlang:system_monitor/2</seealso>
as <c>{MonitorPid, Options}</c>, or <c>undefined</c> if there
are no settings. The order of the options may be different
from the one that was set.</p>
@@ -5918,9 +5918,9 @@ true</pre>
system performance monitoring settings are cleared.</p>
<p>Calling the function with <c>{MonitorPid, Options}</c> as
argument, is the same as calling
- <seealso marker="#erlang:system_monitor/2">erlang:system_monitor(MonitorPid, Options)</seealso>.</p>
+ <seealso marker="#system_monitor/2">erlang:system_monitor(MonitorPid, Options)</seealso>.</p>
<p>Returns the previous system monitor settings just like
- <seealso marker="#erlang:system_monitor/0">erlang:system_monitor/0</seealso>.</p>
+ <seealso marker="#system_monitor/0">erlang:system_monitor/0</seealso>.</p>
</desc>
</func>
@@ -5956,7 +5956,7 @@ true</pre>
explained in the documentation of the
<seealso marker="#gc_start">gc_start</seealso>
trace message (see
- <seealso marker="#erlang:trace/3">erlang:trace/3</seealso>).
+ <seealso marker="#trace/3">erlang:trace/3</seealso>).
New tuples may be added, and the order of the tuples in
the <c>Info</c> list may be changed at any time without prior
notice.
@@ -5998,7 +5998,7 @@ true</pre>
</item>
</taglist>
<p>Returns the previous system monitor settings just like
- <seealso marker="#erlang:system_monitor/0">erlang:system_monitor/0</seealso>.</p>
+ <seealso marker="#system_monitor/0">erlang:system_monitor/0</seealso>.</p>
<note>
<p>If a monitoring process gets so large that it itself
starts to cause system monitor messages when garbage
@@ -6022,7 +6022,7 @@ true</pre>
</type>
<desc>
<p>Returns the current system profiling settings set by
- <seealso marker="#erlang:system_profile/2">erlang:system_profile/2</seealso>
+ <seealso marker="#system_profile/2">erlang:system_profile/2</seealso>
as <c>{ProfilerPid, Options}</c>, or <c>undefined</c> if there
are no settings. The order of the options may be different
from the one that was set.</p>
@@ -6250,7 +6250,7 @@ true</pre>
<item>
<p>Trace certain function calls. Specify which function
calls to trace by calling
- <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
+ <seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
<p>Message tags: <c>call</c>, <c>return_from</c>.</p>
</item>
<tag><c>silent</c></tag>
@@ -6279,7 +6279,7 @@ true</pre>
Trace the actual return from a traced function back to
its caller. Only works for functions traced with
the <c>local</c> option to
- <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
+ <seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
<p>The semantics is that a trace message is sent when a
call traced function actually returns, that is, when a
chain of tail recursive calls is ended. There will be
@@ -6667,7 +6667,7 @@ true</pre>
<c>true</c> for the pseudo function <c>on_load</c> if call
count tracing is active. Return <c>false</c> otherwise.
See also
- <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
+ <seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
</item>
<tag><c>all</c></tag>
<item>
@@ -6690,7 +6690,7 @@ true</pre>
<fsummary>Set trace patterns for global call tracing</fsummary>
<desc>
<p>The same as
- <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern(MFA, MatchSpec, [])</seealso>,
+ <seealso marker="#trace_pattern/3">erlang:trace_pattern(MFA, MatchSpec, [])</seealso>,
retained for backward compatibility.</p>
</desc>
</func>
@@ -6703,7 +6703,7 @@ true</pre>
<desc>
<p>This BIF is used to enable or disable call tracing for
exported functions. It must be combined with
- <seealso marker="#erlang:trace/3">erlang:trace/3</seealso>
+ <seealso marker="#trace/3">erlang:trace/3</seealso>
to set the <c>call</c> trace flag for one or more processes.</p>
<p>Conceptually, call tracing works like this: Inside
the Erlang virtual machine there is a set of processes to be
@@ -6713,7 +6713,7 @@ true</pre>
in the traced function set, the trace action will be taken.
Otherwise, nothing will happen.</p>
<p>Use
- <seealso marker="#erlang:trace/3">erlang:trace/3</seealso> to
+ <seealso marker="#trace/3">erlang:trace/3</seealso> to
add or remove one or more processes to the set of traced
processes. Use <c>erlang:trace_pattern/2</c> to add or remove
exported functions to the set of traced functions.</p>
@@ -6830,7 +6830,7 @@ true</pre>
counters can be restarted from zero with
<c>MatchSpec == restart</c>.</p>
<p>The counter value can be read with
- <seealso marker="#erlang:trace_info/2">erlang:trace_info/2</seealso>.</p>
+ <seealso marker="#trace_info/2">erlang:trace_info/2</seealso>.</p>
</item>
</taglist>
<p>The <c>global</c> and <c>local</c> options are mutually
@@ -6850,7 +6850,7 @@ true</pre>
specification list. If a function has a match specification,
you can replace it with a completely new one. If you need to
change an existing match specification, use the
- <seealso marker="#erlang:trace_info/2">erlang:trace_info/2</seealso>
+ <seealso marker="#trace_info/2">erlang:trace_info/2</seealso>
BIF to retrieve the existing match specification.</p>
<p>Returns the number of exported functions that matched
the <c>MFA</c> argument. This will be zero if none matched at
diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml
index 2252358e0d..5fe414841e 100644
--- a/erts/doc/src/notes.xml
+++ b/erts/doc/src/notes.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2004</year><year>2009</year>
+ <year>2004</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>ERTS Release Notes</title>
@@ -242,7 +242,7 @@
<item>
<p>
The <seealso
- marker="erlang#erlang:port_command/3">erlang:port_command/3</seealso>
+ marker="erlang#port_command/3">erlang:port_command/3</seealso>
BIF has been added. <c>erlang:port_command/3</c> is
currently not auto imported, but it is planned to be auto
imported in OTP R14. For more information see the
diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c
index 16abab65b0..c027cd5984 100644
--- a/erts/emulator/beam/erl_bif_re.c
+++ b/erts/emulator/beam/erl_bif_re.c
@@ -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%
*/
@@ -884,7 +884,7 @@ re_run_3(BIF_ALIST_3)
int capture_count;
if (pflags & PARSE_FLAG_UNICODE &&
- (!is_binary(BIF_ARG_1) ||
+ (!is_binary(BIF_ARG_2) || !is_binary(BIF_ARG_1) ||
(is_list_cap && !(pflags & PARSE_FLAG_GLOBAL)))) {
BIF_TRAP3(urun_trap_exportp, BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3);
}
@@ -1020,6 +1020,9 @@ re_run_3(BIF_ALIST_3)
goto handle_iolist;
}
pb = (ProcBin *) bptr;
+ if (pb->flags) {
+ erts_emasculate_writable_binary(pb);
+ }
restart.subject = (char *) (pb->bytes+offset);
restart.flags |= RESTART_FLAG_SUBJECT_IN_BINARY;
} else {
diff --git a/erts/emulator/beam/erl_db_tree.c b/erts/emulator/beam/erl_db_tree.c
index d3a916d2d9..b421da591b 100644
--- a/erts/emulator/beam/erl_db_tree.c
+++ b/erts/emulator/beam/erl_db_tree.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 1998-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%
*/
@@ -2529,7 +2529,9 @@ static TreeDbTerm *find_node(DbTableTree *tb, Eterm key)
this = this->right;
}
}
- release_stack(tb,stack);
+ if (stack) {
+ release_stack(tb,stack);
+ }
return this;
}
diff --git a/erts/emulator/beam/erl_lock_check.c b/erts/emulator/beam/erl_lock_check.c
index 25f1d420d1..074b08ea57 100644
--- a/erts/emulator/beam/erl_lock_check.c
+++ b/erts/emulator/beam/erl_lock_check.c
@@ -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%
*/
@@ -84,6 +84,9 @@ static erts_lc_lock_order_t erts_lock_order[] = {
{ "reg_tab", NULL },
{ "migration_info_update", NULL },
{ "proc_main", "pid" },
+#ifdef HIPE
+ { "hipe_mfait_lock", NULL },
+#endif
{ "nodes_monitors", NULL },
{ "driver_list", NULL },
{ "proc_link", "pid" },
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 476e29d96f..b519b39d63 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -2522,8 +2522,11 @@ suspend_scheduler(ErtsSchedulerData *esdp)
NULL);
}
- erts_smp_atomic_inc(&schdlr_sspnd.active);
-
+ active_schedulers = erts_smp_atomic_inctest(&schdlr_sspnd.active);
+ if (schdlr_sspnd.changing == ERTS_SCHED_CHANGING_MULTI_SCHED
+ && schdlr_sspnd.online == active_schedulers) {
+ schdlr_sspnd.changing = 0;
+ }
erts_smp_mtx_unlock(&schdlr_sspnd.mtx);
if (erts_system_profile_flags.scheduler)
@@ -2750,11 +2753,12 @@ erts_block_multi_scheduling(Process *p, ErtsProcLocks plocks, int on, int all)
ErtsProcList *plp;
erts_smp_mtx_lock(&schdlr_sspnd.mtx);
- if (on) {
- if (schdlr_sspnd.changing) {
- res = ERTS_SCHDLR_SSPND_YIELD_RESTART; /* Yield */
- }
- else if (erts_is_multi_scheduling_blocked()) {
+
+ if (schdlr_sspnd.changing) {
+ res = ERTS_SCHDLR_SSPND_YIELD_RESTART; /* Yield */
+ }
+ else if (on) { /* ------ BLOCK ------ */
+ if (erts_is_multi_scheduling_blocked()) {
plp = proclist_create(p);
plp->next = schdlr_sspnd.msb.procs;
schdlr_sspnd.msb.procs = plp;
@@ -2842,10 +2846,11 @@ erts_block_multi_scheduling(Process *p, ErtsProcLocks plocks, int on, int all)
}
}
else if (!ongoing_multi_scheduling_block()) {
+ /* unblock not ongoing */
ASSERT(!schdlr_sspnd.msb.procs);
res = ERTS_SCHDLR_SSPND_DONE;
}
- else {
+ else { /* ------ UNBLOCK ------ */
if (p->flags & F_HAVE_BLCKD_MSCHED) {
ErtsProcList **plpp = &schdlr_sspnd.msb.procs;
plp = schdlr_sspnd.msb.procs;
@@ -2930,7 +2935,6 @@ erts_block_multi_scheduling(Process *p, ErtsProcLocks plocks, int on, int all)
erts_smp_mtx_lock(&schdlr_sspnd.mtx);
}
erts_smp_cnd_broadcast(&schdlr_sspnd.cnd);
- schdlr_sspnd.changing = 0;
res = ERTS_SCHDLR_SSPND_DONE;
}
}
diff --git a/erts/emulator/beam/erl_time_sup.c b/erts/emulator/beam/erl_time_sup.c
index 76bfdecd9f..c15f85f8f1 100644
--- a/erts/emulator/beam/erl_time_sup.c
+++ b/erts/emulator/beam/erl_time_sup.c
@@ -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%
*/
@@ -754,12 +754,8 @@ get_sys_now(Uint* megasec, Uint* sec, Uint* microsec)
{
SysTimeval now;
- erts_smp_mtx_lock(&erts_timeofday_mtx);
-
sys_gettimeofday(&now);
- erts_smp_mtx_unlock(&erts_timeofday_mtx);
-
*megasec = (Uint) (now.tv_sec / 1000000);
*sec = (Uint) (now.tv_sec % 1000000);
*microsec = (Uint) (now.tv_usec);
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index 032bf2e896..5291374e25 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -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%
*/
/* $Id$
@@ -656,6 +656,7 @@ static void *hipe_get_emu_address(Eterm m, Eterm f, unsigned int arity, int is_r
address = hipe_find_emu_address(m, f, arity);
if (!address) {
/* if not found, stub it via the export entry */
+ /* no lock needed around erts_export_get_or_make_stub() */
Export *export_entry = erts_export_get_or_make_stub(m, f, arity);
address = export_entry->address;
}
@@ -1188,8 +1189,31 @@ static struct {
unsigned int mask; /* INV: mask == (1 << log2size)-1 */
unsigned int used;
struct hipe_mfa_info **bucket;
+ /*
+ * The mfa info table is normally updated by the loader,
+ * which runs in non-concurrent mode. Unfortunately runtime
+ * apply operations (get_na_nofail) update the table if
+ * they create a new stub for the mfa, which forces locking.
+ * XXX: Redesign apply et al to avoid those updates.
+ */
+ erts_smp_mtx_t lock;
} hipe_mfa_info_table;
+static inline void hipe_mfa_info_table_init_lock(void)
+{
+ erts_smp_mtx_init(&hipe_mfa_info_table.lock, "hipe_mfait_lock");
+}
+
+static inline void hipe_mfa_info_table_lock(void)
+{
+ erts_smp_mtx_lock(&hipe_mfa_info_table.lock);
+}
+
+static inline void hipe_mfa_info_table_unlock(void)
+{
+ erts_smp_mtx_unlock(&hipe_mfa_info_table.lock);
+}
+
#define HIPE_MFA_HASH(M,F,A) ((M) * (F) + (A))
static struct hipe_mfa_info **hipe_mfa_info_table_alloc_bucket(unsigned int size)
@@ -1258,9 +1282,11 @@ void hipe_mfa_info_table_init(void)
hipe_mfa_info_table.mask = size - 1;
hipe_mfa_info_table.used = 0;
hipe_mfa_info_table.bucket = hipe_mfa_info_table_alloc_bucket(size);
+
+ hipe_mfa_info_table_init_lock();
}
-static inline struct hipe_mfa_info *hipe_mfa_info_table_get(Eterm m, Eterm f, unsigned int arity)
+static inline struct hipe_mfa_info *hipe_mfa_info_table_get_locked(Eterm m, Eterm f, unsigned int arity)
{
unsigned long h;
unsigned int i;
@@ -1286,7 +1312,7 @@ void *hipe_mfa_find_na(Eterm m, Eterm f, unsigned int arity)
}
#endif
-static struct hipe_mfa_info *hipe_mfa_info_table_put(Eterm m, Eterm f, unsigned int arity)
+static struct hipe_mfa_info *hipe_mfa_info_table_put_locked(Eterm m, Eterm f, unsigned int arity)
{
unsigned long h;
unsigned int i;
@@ -1313,7 +1339,10 @@ static struct hipe_mfa_info *hipe_mfa_info_table_put(Eterm m, Eterm f, unsigned
static void hipe_mfa_set_na(Eterm m, Eterm f, unsigned int arity, void *address, int is_exported)
{
- struct hipe_mfa_info *p = hipe_mfa_info_table_put(m, f, arity);
+ struct hipe_mfa_info *p;
+
+ hipe_mfa_info_table_lock();
+ p = hipe_mfa_info_table_put_locked(m, f, arity);
#ifdef DEBUG_LINKER
printf("%s: ", __FUNCTION__);
print_mfa(m, f, arity);
@@ -1322,19 +1351,30 @@ static void hipe_mfa_set_na(Eterm m, Eterm f, unsigned int arity, void *address,
p->local_address = address;
if (is_exported)
p->remote_address = address;
+ hipe_mfa_info_table_unlock();
}
#if defined(__powerpc__) || defined(__ppc__) || defined(__powerpc64__) || defined(__arm__)
void *hipe_mfa_get_trampoline(Eterm m, Eterm f, unsigned int arity)
{
- struct hipe_mfa_info *p = hipe_mfa_info_table_put(m, f, arity);
- return p->trampoline;
+ struct hipe_mfa_info *p;
+ void *trampoline;
+
+ hipe_mfa_info_table_lock();
+ p = hipe_mfa_info_table_put_locked(m, f, arity);
+ trampoline = p->trampoline;
+ hipe_mfa_info_table_unlock();
+ return trampoline;
}
void hipe_mfa_set_trampoline(Eterm m, Eterm f, unsigned int arity, void *trampoline)
{
- struct hipe_mfa_info *p = hipe_mfa_info_table_put(m, f, arity);
+ struct hipe_mfa_info *p;
+
+ hipe_mfa_info_table_lock();
+ p = hipe_mfa_info_table_put_locked(m, f, arity);
p->trampoline = trampoline;
+ hipe_mfa_info_table_unlock();
}
#endif
@@ -1365,12 +1405,13 @@ BIF_RETTYPE hipe_bifs_invalidate_funinfo_native_addresses_1(BIF_ALIST_1)
struct mfa mfa;
struct hipe_mfa_info *p;
+ hipe_mfa_info_table_lock();
lst = BIF_ARG_1;
while (is_list(lst)) {
if (!term_to_mfa(CAR(list_val(lst)), &mfa))
- BIF_ERROR(BIF_P, BADARG);
+ break;
lst = CDR(list_val(lst));
- p = hipe_mfa_info_table_get(mfa.mod, mfa.fun, mfa.ari);
+ p = hipe_mfa_info_table_get_locked(mfa.mod, mfa.fun, mfa.ari);
if (p) {
p->remote_address = NULL;
p->local_address = NULL;
@@ -1393,6 +1434,7 @@ BIF_RETTYPE hipe_bifs_invalidate_funinfo_native_addresses_1(BIF_ALIST_1)
}
}
}
+ hipe_mfa_info_table_unlock();
if (is_not_nil(lst))
BIF_ERROR(BIF_P, BADARG);
BIF_RET(NIL);
@@ -1406,7 +1448,8 @@ void hipe_mfa_save_orig_beam_op(Eterm mod, Eterm fun, unsigned int ari, Eterm *p
orig_beam_op = pc[0];
if (orig_beam_op != BeamOpCode(op_hipe_trap_call_closure) &&
orig_beam_op != BeamOpCode(op_hipe_trap_call)) {
- p = hipe_mfa_info_table_put(mod, fun, ari);
+ hipe_mfa_info_table_lock();
+ p = hipe_mfa_info_table_put_locked(mod, fun, ari);
#ifdef DEBUG_LINKER
printf("%s: ", __FUNCTION__);
print_mfa(mod, fun, ari);
@@ -1414,6 +1457,7 @@ void hipe_mfa_save_orig_beam_op(Eterm mod, Eterm fun, unsigned int ari, Eterm *p
#endif
p->beam_code = pc;
p->orig_beam_op = orig_beam_op;
+ hipe_mfa_info_table_unlock();
} else {
#ifdef DEBUG_LINKER
printf("%s: ", __FUNCTION__);
@@ -1440,12 +1484,12 @@ static void *hipe_make_stub(Eterm m, Eterm f, unsigned int arity, int is_remote)
return StubAddress;
}
-static void *hipe_get_na_nofail(Eterm m, Eterm f, unsigned int a, int is_remote)
+static void *hipe_get_na_nofail_locked(Eterm m, Eterm f, unsigned int a, int is_remote)
{
struct hipe_mfa_info *p;
void *address;
- p = hipe_mfa_info_table_get(m, f, a);
+ p = hipe_mfa_info_table_get_locked(m, f, a);
if (p) {
/* find address, predicting for a runtime apply call */
address = p->remote_address;
@@ -1459,13 +1503,23 @@ static void *hipe_get_na_nofail(Eterm m, Eterm f, unsigned int a, int is_remote)
if (address)
return address;
} else
- p = hipe_mfa_info_table_put(m, f, a);
+ p = hipe_mfa_info_table_put_locked(m, f, a);
address = hipe_make_stub(m, f, a, is_remote);
/* XXX: how to tell if a BEAM MFA is exported or not? */
p->remote_address = address;
return address;
}
+static void *hipe_get_na_nofail(Eterm m, Eterm f, unsigned int a, int is_remote)
+{
+ void *p;
+
+ hipe_mfa_info_table_lock();
+ p = hipe_get_na_nofail_locked(m, f, a, is_remote);
+ hipe_mfa_info_table_unlock();
+ return p;
+}
+
/* used for apply/3 in hipe_mode_switch */
void *hipe_get_remote_na(Eterm m, Eterm f, unsigned int a)
{
@@ -1549,6 +1603,8 @@ int hipe_find_mfa_from_ra(const void *ra, Eterm *m, Eterm *f, unsigned int *a)
/* Note about locking: the table is only updated from the
loader, which runs with the rest of the system suspended. */
+ /* XXX: alas not true; see comment at hipe_mfa_info_table.lock */
+ hipe_mfa_info_table_lock();
bucket = hipe_mfa_info_table.bucket;
nrbuckets = 1 << hipe_mfa_info_table.log2size;
mfa = NULL;
@@ -1564,12 +1620,13 @@ int hipe_find_mfa_from_ra(const void *ra, Eterm *m, Eterm *f, unsigned int *a)
b = b->bucket.next;
}
}
- if (!mfa)
- return 0;
- *m = mfa->m;
- *f = mfa->f;
- *a = mfa->a;
- return 1;
+ if (mfa) {
+ *m = mfa->m;
+ *f = mfa->f;
+ *a = mfa->a;
+ }
+ hipe_mfa_info_table_unlock();
+ return mfa ? 1 : 0;
}
/*
@@ -1645,8 +1702,9 @@ BIF_RETTYPE hipe_bifs_add_ref_2(BIF_ALIST_2)
default:
goto badarg;
}
- callee_mfa = hipe_mfa_info_table_put(callee.mod, callee.fun, callee.ari);
- caller_mfa = hipe_mfa_info_table_put(caller.mod, caller.fun, caller.ari);
+ hipe_mfa_info_table_lock();
+ callee_mfa = hipe_mfa_info_table_put_locked(callee.mod, callee.fun, callee.ari);
+ caller_mfa = hipe_mfa_info_table_put_locked(caller.mod, caller.fun, caller.ari);
refers_to = erts_alloc(ERTS_ALC_T_HIPE, sizeof(*refers_to));
refers_to->mfa = callee_mfa;
@@ -1660,6 +1718,7 @@ BIF_RETTYPE hipe_bifs_add_ref_2(BIF_ALIST_2)
ref->flags = flags;
ref->next = callee_mfa->referred_from;
callee_mfa->referred_from = ref;
+ hipe_mfa_info_table_unlock();
BIF_RET(NIL);
@@ -1679,10 +1738,12 @@ BIF_RETTYPE hipe_bifs_mark_referred_from_1(BIF_ALIST_1) /* get_refs_from */
if (!term_to_mfa(BIF_ARG_1, &mfa))
BIF_ERROR(BIF_P, BADARG);
- p = hipe_mfa_info_table_get(mfa.mod, mfa.fun, mfa.ari);
+ hipe_mfa_info_table_lock();
+ p = hipe_mfa_info_table_get_locked(mfa.mod, mfa.fun, mfa.ari);
if (p)
for (ref = p->referred_from; ref != NULL; ref = ref->next)
ref->flags |= REF_FLAG_PENDING_REDIRECT;
+ hipe_mfa_info_table_unlock();
BIF_RET(NIL);
}
@@ -1695,7 +1756,8 @@ BIF_RETTYPE hipe_bifs_remove_refs_from_1(BIF_ALIST_1)
if (!term_to_mfa(BIF_ARG_1, &mfa))
BIF_ERROR(BIF_P, BADARG);
- caller_mfa = hipe_mfa_info_table_get(mfa.mod, mfa.fun, mfa.ari);
+ hipe_mfa_info_table_lock();
+ caller_mfa = hipe_mfa_info_table_get_locked(mfa.mod, mfa.fun, mfa.ari);
if (caller_mfa) {
refers_to = caller_mfa->refers_to;
while (refers_to) {
@@ -1725,6 +1787,7 @@ BIF_RETTYPE hipe_bifs_remove_refs_from_1(BIF_ALIST_1)
}
caller_mfa->refers_to = NULL;
}
+ hipe_mfa_info_table_unlock();
BIF_RET(NIL);
}
@@ -1742,14 +1805,15 @@ BIF_RETTYPE hipe_bifs_redirect_referred_from_1(BIF_ALIST_1)
if (!term_to_mfa(BIF_ARG_1, &mfa))
BIF_ERROR(BIF_P, BADARG);
- p = hipe_mfa_info_table_get(mfa.mod, mfa.fun, mfa.ari);
+ hipe_mfa_info_table_lock();
+ p = hipe_mfa_info_table_get_locked(mfa.mod, mfa.fun, mfa.ari);
if (p) {
prev = &p->referred_from;
ref = *prev;
while (ref) {
if (ref->flags & REF_FLAG_PENDING_REDIRECT) {
is_remote = ref->flags & REF_FLAG_IS_REMOTE;
- new_address = hipe_get_na_nofail(p->m, p->f, p->a, is_remote);
+ new_address = hipe_get_na_nofail_locked(p->m, p->f, p->a, is_remote);
if (ref->flags & REF_FLAG_IS_LOAD_MFA)
res = hipe_patch_insn(ref->address, (Uint)new_address, am_load_mfa);
else
@@ -1772,6 +1836,7 @@ BIF_RETTYPE hipe_bifs_redirect_referred_from_1(BIF_ALIST_1)
}
}
}
+ hipe_mfa_info_table_unlock();
BIF_RET(NIL);
}
diff --git a/erts/emulator/test/scheduler_SUITE.erl b/erts/emulator/test/scheduler_SUITE.erl
index e644ad4dc8..c9101b77c2 100644
--- a/erts/emulator/test/scheduler_SUITE.erl
+++ b/erts/emulator/test/scheduler_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -48,7 +48,8 @@
scheduler_bind_types/1,
cpu_topology/1,
sct_cmd/1,
- sbt_cmd/1]).
+ sbt_cmd/1,
+ scheduler_suspend/1]).
-define(DEFAULT_TIMEOUT, ?t:minutes(10)).
@@ -65,7 +66,8 @@ all(suite) ->
equal_with_high,
equal_with_high_max,
bound_process,
- scheduler_bind].
+ scheduler_bind,
+ scheduler_suspend].
init_per_testcase(Case, Config) when is_list(Config) ->
Dog = ?t:timetrap(?DEFAULT_TIMEOUT),
@@ -882,11 +884,103 @@ sbt_test(Config, CpuTCmd, ClBt, Bt, LP) ->
?line stop_node(Node),
?line ok.
+scheduler_suspend(Config) when is_list(Config) ->
+ ?line Dog = ?t:timetrap(?t:minutes(2)),
+ ?line lists:foreach(fun (S) -> scheduler_suspend_test(Config, S) end,
+ [64, 32, 16, default]),
+ ?line ?t:timetrap_cancel(Dog),
+ ?line ok.
+scheduler_suspend_test(Config, Schedulers) ->
+ ?line Cmd = case Schedulers of
+ default ->
+ "";
+ _ ->
+ S = integer_to_list(Schedulers),
+ "+S"++S++":"++S
+ end,
+ ?line {ok, Node} = start_node(Config, Cmd),
+ ?line [SState] = mcall(Node, [fun () ->
+ erlang:system_info(schedulers_state)
+ end]),
+ ?line {Sched, _, _} = SState,
+ ?line true = is_integer(Sched),
+ ?line [ok] = mcall(Node, [fun () -> sst0_loop(300) end]),
+ ?line [ok] = mcall(Node, [fun () -> sst1_loop(300) end]),
+ ?line [ok] = mcall(Node, [fun () -> sst2_loop(300) end]),
+ ?line [ok, ok, ok, ok, ok] = mcall(Node,
+ [fun () -> sst0_loop(200) end,
+ fun () -> sst1_loop(200) end,
+ fun () -> sst2_loop(200) end,
+ fun () -> sst2_loop(200) end,
+ fun () -> sst3_loop(Sched, 200) end]),
+ ?line [SState] = mcall(Node, [fun () ->
+ erlang:system_info(schedulers_state)
+ end]),
+ ?line stop_node(Node),
+ ?line ok.
+
+
+sst0_loop(0) ->
+ ok;
+sst0_loop(N) ->
+ erlang:system_flag(multi_scheduling, block),
+ erlang:system_flag(multi_scheduling, unblock),
+ erlang:yield(),
+ sst0_loop(N-1).
+
+sst1_loop(0) ->
+ ok;
+sst1_loop(N) ->
+ erlang:system_flag(multi_scheduling, block),
+ erlang:system_flag(multi_scheduling, unblock),
+ sst1_loop(N-1).
+
+sst2_loop(0) ->
+ ok;
+sst2_loop(N) ->
+ erlang:system_flag(multi_scheduling, block),
+ erlang:system_flag(multi_scheduling, block),
+ erlang:system_flag(multi_scheduling, block),
+ erlang:system_flag(multi_scheduling, unblock),
+ erlang:system_flag(multi_scheduling, unblock),
+ erlang:system_flag(multi_scheduling, unblock),
+ sst2_loop(N-1).
+
+sst3_loop(_S, 0) ->
+ ok;
+sst3_loop(S, N) ->
+ erlang:system_flag(schedulers_online, (S div 2)+1),
+ erlang:system_flag(schedulers_online, 1),
+ erlang:system_flag(schedulers_online, (S div 2)+1),
+ erlang:system_flag(schedulers_online, S),
+ erlang:system_flag(schedulers_online, 1),
+ erlang:system_flag(schedulers_online, S),
+ sst3_loop(S, N-1).
+
-%
+%%
%% Utils
%%
+mcall(Node, Funs) ->
+ Parent = self(),
+ Refs = lists:map(fun (Fun) ->
+ Ref = make_ref(),
+ spawn_link(Node,
+ fun () ->
+ Res = Fun(),
+ unlink(Parent),
+ Parent ! {Ref, Res}
+ end),
+ Ref
+ end, Funs),
+ lists:map(fun (Ref) ->
+ receive
+ {Ref, Res} ->
+ Res
+ end
+ end, Refs).
+
erl_rel_flag_var() ->
"ERL_"++erlang:system_info(otp_release)++"_FLAGS".
diff --git a/erts/epmd/test/Makefile b/erts/epmd/test/Makefile
index c1d62f0f93..13dad09ae3 100644
--- a/erts/epmd/test/Makefile
+++ b/erts/epmd/test/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1998-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 1998-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
@@ -34,6 +34,8 @@ ERL_FILES= $(MODULES:%=%.erl)
TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+EMAKEFILE=Emakefile
+
# ----------------------------------------------------
# Release directory specification
# ----------------------------------------------------
@@ -43,15 +45,17 @@ RELEPMDDIR = $(RELEASE_PATH)/epmd_test
# FLAGS
# ----------------------------------------------------
-ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include \
- -I$(ERL_TOP)/lib/kernel/src/ \
- $(EPMD_FLAGS)
+ERL_COMPILE_FLAGS += $(EPMD_FLAGS)
# ----------------------------------------------------
# Targets
# ----------------------------------------------------
-tests debug opt: $(TARGET_FILES)
+tests debug opt: $(EMAKEFILE)
+
+$(EMAKEFILE): Makefile $(ERL_FILES)
+ $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) \
+ -o$(EBIN) $(MODULES) > $(EMAKEFILE)
clean:
rm -f $(TARGET_FILES)
@@ -69,7 +73,7 @@ release_spec:
release_tests_spec: opt
$(INSTALL_DIR) $(RELEPMDDIR)
$(INSTALL_DATA) epmd.spec epmd.spec.vxworks $(ERL_FILES) \
- $(TARGET_FILES) $(RELEPMDDIR)
+ $(EMAKEFILE) $(RELEPMDDIR)
chmod -f -R u+w $(RELEPMDDIR)
release_docs_spec:
diff --git a/erts/epmd/test/epmd_SUITE.erl b/erts/epmd/test/epmd_SUITE.erl
index 513c87a13e..91e09faf75 100644
--- a/erts/epmd/test/epmd_SUITE.erl
+++ b/erts/epmd/test/epmd_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(epmd_SUITE).
@@ -31,6 +31,9 @@
-define(MEDIUM_PAUSE, ?t:seconds(1)).
-define(LONG_PAUSE, ?t:seconds(5)).
+% Information about nodes
+-record(node_info, {port, node_type, prot, lvsn, hvsn, node_name, extra}).
+
% Test server specific exports
-export([all/1, init_per_testcase/2, fin_per_testcase/2]).
@@ -57,7 +60,10 @@
too_large/1,
alive_req_too_small_1/1,
alive_req_too_small_2/1,
- alive_req_too_large/1
+ alive_req_too_large/1,
+
+ returns_valid_empty_extra/1,
+ returns_valid_populated_extra_with_nulls/1
]).
@@ -76,9 +82,13 @@
-define(REG_REPEAT_LIM,1000).
% Message codes in epmd protocol
--define(EPMD_ALIVE_REQ, $a).
--define(EPMD_ALIVE_OK_RESP, $Y).
--define(EPMD_PORT_REQ, $p).
+-define(EPMD_ALIVE_REQ, $a).
+-define(EPMD_ALIVE2_REQ, $x).
+-define(EPMD_ALIVE_OK_RESP, $Y).
+-define(EPMD_ALIVE2_RESP, $y).
+-define(EPMD_PORT_REQ, $p).
+-define(EPMD_PORT_PLEASE2_REQ, $z).
+-define(EPMD_PORT2_RESP, $w).
-define(EPMD_NAMES_REQ, $n).
-define(EPMD_DUMP_REQ, $d).
-define(EPMD_KILL_REQ, $k).
@@ -111,7 +121,10 @@ all(suite) ->
too_large,
alive_req_too_small_1,
alive_req_too_small_2,
- alive_req_too_large
+ alive_req_too_large,
+
+ returns_valid_empty_extra,
+ returns_valid_populated_extra_with_nulls
].
%%
@@ -182,29 +195,70 @@ register_node(Name) ->
register_node(Name,?DUMMY_PORT).
register_node(Name, Port) ->
- case connect() of
+ case send_req([?EPMD_ALIVE_REQ, put16(Port), Name]) of
{ok,Sock} ->
- M = [?EPMD_ALIVE_REQ, put16(Port), Name],
- case send(Sock, [size16(M), M]) of
- ok ->
- case recv(Sock,3) of
- {ok, [?EPMD_ALIVE_OK_RESP,_D1,_D0]} ->
- {ok,Sock};
- Other ->
- test_server:format("recv on sock ~w: ~p~n",
- [Sock,Other]),
- error
- end;
+ case recv(Sock,3) of
+ {ok, [?EPMD_ALIVE_OK_RESP,_D1,_D0]} ->
+ {ok,Sock};
Other ->
- test_server:format("send on sock ~w: ~w~n",[Sock,Other]),
+ test_server:format("recv on sock ~w: ~p~n",
+ [Sock,Other]),
error
end;
- Other ->
- test_server:format("Connect on port ~w: ~p~n",[Port,Other]),
+ error ->
+ error
+ end.
+
+register_node_v2(Port, NodeType, Prot, HVsn, LVsn, Name, Extra) ->
+ Req = [?EPMD_ALIVE2_REQ, put16(Port), NodeType, Prot,
+ put16(HVsn), put16(LVsn),
+ size16(Name), Name,
+ size16(Extra), Extra],
+ case send_req(Req) of
+ {ok,Sock} ->
+ case recv(Sock,4) of
+ {ok, [?EPMD_ALIVE2_RESP,_Res=0,_C0,_C1]} ->
+ {ok,Sock};
+ Other ->
+ test_server:format("recv on sock ~w: ~p~n",
+ [Sock,Other]),
+ error
+ end;
+ error ->
error
end.
+% Internal function to fetch information about a node
+
+port_please_v2(Name) ->
+ case send_req([?EPMD_PORT_PLEASE2_REQ, Name]) of
+ {ok,Sock} ->
+ case recv_until_sock_closes(Sock) of
+ {ok, Resp} ->
+ parse_port2_resp(Resp);
+ Other ->
+ test_server:format("recv on sock ~w: ~p~n",
+ [Sock,Other]),
+ error
+ end;
+ error ->
+ error
+ end.
+parse_port2_resp(Resp) ->
+ case list_to_binary(Resp) of
+ <<?EPMD_PORT2_RESP,Res,Port:16,NodeType,Prot,HVsn:16,LVsn:16,
+ NLen:16,NodeName:NLen/binary,
+ ELen:16,Extra:ELen/binary>> when Res =:= 0 ->
+ {ok, #node_info{port=Port,node_type=NodeType,prot=Prot,
+ hvsn=HVsn,lvsn=LVsn,
+ node_name=binary_to_list(NodeName),
+ extra=binary_to_list(Extra)}};
+ Other ->
+ test_server:format("invalid port2 resp: ~p~n",
+ [Resp]),
+ error
+ end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -631,6 +685,32 @@ alive_req_too_large(Config) when list(Config) ->
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+returns_valid_empty_extra(doc) ->
+ ["Check that an empty extra is prefixed by a two byte length"];
+returns_valid_empty_extra(suite) ->
+ [];
+returns_valid_empty_extra(Config) when list(Config) ->
+ ?line ok = epmdrun(),
+ ?line {ok,Sock} = register_node_v2(4711, 72, 0, 5, 5, "foo", []),
+ ?line {ok,#node_info{extra=[]}} = port_please_v2("foo"),
+ ?line ok = close(Sock),
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+returns_valid_populated_extra_with_nulls(doc) ->
+ ["Check a populated extra with embedded null characters"];
+returns_valid_populated_extra_with_nulls(suite) ->
+ [];
+returns_valid_populated_extra_with_nulls(Config) when list(Config) ->
+ ?line ok = epmdrun(),
+ ?line {ok,Sock} = register_node_v2(4711, 72, 0, 5, 5, "foo", "ABC\000\000"),
+ ?line {ok,#node_info{extra="ABC\000\000"}} = port_please_v2("foo"),
+ ?line ok = close(Sock),
+ ok.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Terminate all tests with killing epmd.
cleanup() ->
@@ -813,6 +893,36 @@ send_direct(Sock, Bytes) ->
Any
end.
+send_req(Req) ->
+ case connect() of
+ {ok,Sock} ->
+ case send(Sock, [size16(Req), Req]) of
+ ok ->
+ {ok,Sock};
+ Other ->
+ test_server:format("Failed to send ~w on sock ~w: ~w~n",
+ [Req,Sock,Other]),
+ error
+ end;
+ Other ->
+ test_server:format("Connect failed when sending ~w: ~p~n",
+ [Req, Other]),
+ error
+ end.
+
+recv_until_sock_closes(Sock) ->
+ recv_until_sock_closes_2(Sock,[]).
+
+recv_until_sock_closes_2(Sock,AccData) ->
+ case recv(Sock,0) of
+ {ok,Data} ->
+ recv_until_sock_closes_2(Sock,AccData++Data);
+ closed ->
+ {ok,AccData};
+ Other ->
+ Other
+ end.
+
sleep(MilliSeconds) ->
timer:sleep(MilliSeconds).
diff --git a/erts/lib_src/Makefile.in b/erts/lib_src/Makefile.in
index 1d2cc7cb0c..49f5b1f048 100644
--- a/erts/lib_src/Makefile.in
+++ b/erts/lib_src/Makefile.in
@@ -24,7 +24,6 @@ OMIT_OMIT_FP=no
CC=@CC@
-GCC=@GCC@
LD=@LD@
AR=@AR@
RANLIB=@RANLIB@
@@ -115,7 +114,7 @@ endif
CREATE_DIRS=
-ifeq ($(GCC)-$(OMIT_FP),yes-true)
+ifeq ($(CC)-$(OMIT_FP), gcc-true)
CFLAGS += -fomit-frame-pointer
endif
@@ -484,6 +483,8 @@ ifneq ($(strip $(INTERNAL_RELEASE_LIBS)),)
$(INSTALL_DATA) $(INTERNAL_RELEASE_LIBS) $(RELSYSDIR)/lib/internal
endif
+docs:
+
release_docs_spec:
diff --git a/erts/preloaded/ebin/erl_prim_loader.beam b/erts/preloaded/ebin/erl_prim_loader.beam
index d7134967bf..e966f727c4 100644
--- a/erts/preloaded/ebin/erl_prim_loader.beam
+++ b/erts/preloaded/ebin/erl_prim_loader.beam
Binary files differ
diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam
index f490fe7c3d..620ee733bd 100644
--- a/erts/preloaded/ebin/erlang.beam
+++ b/erts/preloaded/ebin/erlang.beam
Binary files differ
diff --git a/erts/preloaded/ebin/init.beam b/erts/preloaded/ebin/init.beam
index 39118a0109..aa9bd13dd0 100644
--- a/erts/preloaded/ebin/init.beam
+++ b/erts/preloaded/ebin/init.beam
Binary files differ
diff --git a/erts/preloaded/ebin/otp_ring0.beam b/erts/preloaded/ebin/otp_ring0.beam
index 4680d645cb..f060ac73b7 100644
--- a/erts/preloaded/ebin/otp_ring0.beam
+++ b/erts/preloaded/ebin/otp_ring0.beam
Binary files differ
diff --git a/erts/preloaded/ebin/prim_file.beam b/erts/preloaded/ebin/prim_file.beam
index 2cacb6808c..34f9565fe3 100644
--- a/erts/preloaded/ebin/prim_file.beam
+++ b/erts/preloaded/ebin/prim_file.beam
Binary files differ
diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam
index aa9b255ebb..0ec3130d44 100644
--- a/erts/preloaded/ebin/prim_inet.beam
+++ b/erts/preloaded/ebin/prim_inet.beam
Binary files differ
diff --git a/erts/preloaded/ebin/prim_zip.beam b/erts/preloaded/ebin/prim_zip.beam
index 0e7adad9e8..b7897dd798 100644
--- a/erts/preloaded/ebin/prim_zip.beam
+++ b/erts/preloaded/ebin/prim_zip.beam
Binary files differ
diff --git a/erts/preloaded/ebin/zlib.beam b/erts/preloaded/ebin/zlib.beam
index 93b05172d8..c9be5d2aa0 100644
--- a/erts/preloaded/ebin/zlib.beam
+++ b/erts/preloaded/ebin/zlib.beam
Binary files differ
diff --git a/erts/preloaded/src/erl_prim_loader.erl b/erts/preloaded/src/erl_prim_loader.erl
index 399c2bb55d..c0785083de 100644
--- a/erts/preloaded/src/erl_prim_loader.erl
+++ b/erts/preloaded/src/erl_prim_loader.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -49,7 +49,7 @@
prim_read_file_info/2, prim_get_cwd/2]).
%% Used by escript and code
--export([set_primary_archive/2, release_archives/0]).
+-export([set_primary_archive/3, release_archives/0]).
%% Internal function. Exported to avoid dialyzer warnings
-export([concat/1]).
@@ -220,14 +220,15 @@ get_cwd(Drive) ->
check_file_result(get_cwd, Drive, request({get_cwd,[Drive]})).
-spec set_primary_archive(File :: string() | 'undefined',
- ArchiveBin :: binary() | 'undefined')
- -> {ok, [string()]} | {error,_}.
+ ArchiveBin :: binary() | 'undefined',
+ FileInfo :: #file_info{} | 'undefined')
+ -> {ok, [string()]} | {error,_}.
-set_primary_archive(undefined, undefined) ->
- request({set_primary_archive, undefined, undefined});
-set_primary_archive(File, ArchiveBin)
- when is_list(File), is_binary(ArchiveBin) ->
- request({set_primary_archive, File, ArchiveBin}).
+set_primary_archive(undefined, undefined, undefined) ->
+ request({set_primary_archive, undefined, undefined, undefined});
+set_primary_archive(File, ArchiveBin, FileInfo)
+ when is_list(File), is_binary(ArchiveBin), is_record(FileInfo, file_info) ->
+ request({set_primary_archive, File, ArchiveBin, FileInfo}).
-spec release_archives() -> 'ok' | {'error', _}.
@@ -315,8 +316,8 @@ loop(State, Parent, Paths) ->
{get_cwd,[_]=Args} ->
{Res,State1} = handle_get_cwd(State, Args),
{Res,State1,Paths};
- {set_primary_archive,File,Bin} ->
- {Res,State1} = handle_set_primary_archive(State, File, Bin),
+ {set_primary_archive,File,Bin,FileInfo} ->
+ {Res,State1} = handle_set_primary_archive(State, File, Bin,FileInfo),
{Res,State1,Paths};
release_archives ->
{Res,State1} = handle_release_archives(State),
@@ -356,8 +357,8 @@ handle_get_file(State = #state{loader = efile}, Paths, File) ->
handle_get_file(State = #state{loader = inet}, Paths, File) ->
?SAFE2(inet_get_file_from_port(State, File, Paths), State).
-handle_set_primary_archive(State= #state{loader = efile}, File, Bin) ->
- ?SAFE2(efile_set_primary_archive(State, File, Bin), State).
+handle_set_primary_archive(State= #state{loader = efile}, File, Bin, FileInfo) ->
+ ?SAFE2(efile_set_primary_archive(State, File, Bin, FileInfo), State).
handle_release_archives(State= #state{loader = efile}) ->
?SAFE2(efile_release_archives(State), State).
@@ -481,8 +482,8 @@ efile_get_file_from_port3(State, File, [P | Paths]) ->
efile_get_file_from_port3(State, _File, []) ->
{{error,enoent},State}.
-efile_set_primary_archive(#state{prim_state = PS} = State, File, Bin) ->
- {Res, PS2} = prim_set_primary_archive(PS, File, Bin),
+efile_set_primary_archive(#state{prim_state = PS} = State, File, Bin, FileInfo) ->
+ {Res, PS2} = prim_set_primary_archive(PS, File, Bin, FileInfo),
{Res,State#state{prim_state = PS2}}.
efile_release_archives(#state{prim_state = PS} = State) ->
@@ -572,13 +573,14 @@ find_loop(U, Retry, AL, ReqDelay, SReSleep, Ignore, Tries, LReSleep) ->
case find_loop(U, Retry, AL, ReqDelay, []) of
[] -> % no response from any server
erlang:display({erl_prim_loader,'no server found'}), % lifesign
- Tries1 = if Tries > 0 ->
- sleep(SReSleep),
- Tries - 1;
- true ->
- sleep(LReSleep),
- 0
- end,
+ Tries1 =
+ if Tries > 0 ->
+ sleep(SReSleep),
+ Tries - 1;
+ true ->
+ sleep(LReSleep),
+ 0
+ end,
find_loop(U, Retry, AL, ReqDelay, SReSleep, Ignore, Tries1, LReSleep);
Servers ->
keysort(1, Servers -- Ignore)
@@ -787,9 +789,9 @@ prim_release_archives(PS) ->
prim_do_release_archives(PS, [{ArchiveFile, DictVal} | KeyVals], Acc) ->
Res =
case DictVal of
- {primary, _PrimZip} ->
+ {primary, _PrimZip, _FI} ->
ok; % Keep primary archive
- {_Mtime, Cache} ->
+ {Cache, _FI} ->
debug(PS, {release, cache, ArchiveFile}),
erase(ArchiveFile),
clear_cache(ArchiveFile, Cache)
@@ -805,7 +807,7 @@ prim_do_release_archives(PS, [], []) ->
prim_do_release_archives(PS, [], Errors) ->
{{error, Errors}, PS#prim_state{primary_archive = undefined}}.
-prim_set_primary_archive(PS, undefined, undefined) ->
+prim_set_primary_archive(PS, undefined, undefined, undefined) ->
debug(PS, {set_primary_archive, clean}),
case PS#prim_state.primary_archive of
undefined ->
@@ -813,15 +815,15 @@ prim_set_primary_archive(PS, undefined, undefined) ->
debug(PS, {return, Res}),
{Res, PS};
ArchiveFile ->
- {primary, PrimZip} = erase(ArchiveFile),
+ {primary, PrimZip, _FI} = erase(ArchiveFile),
ok = prim_zip:close(PrimZip),
PS2 = PS#prim_state{primary_archive = undefined},
Res = {ok, []},
debug(PS2, {return, Res}),
{Res, PS2}
end;
-prim_set_primary_archive(PS, ArchiveFile, ArchiveBin)
- when is_list(ArchiveFile), is_binary(ArchiveBin) ->
+prim_set_primary_archive(PS, ArchiveFile, ArchiveBin, FileInfo)
+ when is_list(ArchiveFile), is_binary(ArchiveBin), is_record(FileInfo, file_info) ->
%% Try the archive file
debug(PS, {set_primary_archive, ArchiveFile, byte_size(ArchiveBin)}),
{Res3, PS3} =
@@ -833,17 +835,17 @@ prim_set_primary_archive(PS, ArchiveFile, ArchiveBin)
["", "nibe", RevApp] -> % Reverse ebin
%% Collect ebin directories in archive
Ebin = reverse(RevApp) ++ "/ebin",
- {true, [Ebin | A]};
+ {true, [Ebin | A]};
_ ->
{true, A}
end
end,
Ebins0 = [ArchiveFile],
- case open_archive({ArchiveFile, ArchiveBin}, Ebins0, Fun) of
- {ok, PrimZip, RevEbins} ->
+ case open_archive({ArchiveFile, ArchiveBin}, FileInfo, Ebins0, Fun) of
+ {ok, PrimZip, {RevEbins, FI, _}} ->
Ebins = reverse(RevEbins),
debug(PS, {set_primary_archive, Ebins}),
- put(ArchiveFile, {primary, PrimZip}),
+ put(ArchiveFile, {primary, PrimZip, FI}),
{{ok, Ebins}, PS#prim_state{primary_archive = ArchiveFile}};
Error ->
debug(PS, {set_primary_archive, Error}),
@@ -851,10 +853,10 @@ prim_set_primary_archive(PS, ArchiveFile, ArchiveBin)
end;
OldArchiveFile ->
debug(PS, {set_primary_archive, clean}),
- PrimZip = erase(OldArchiveFile),
+ {primary, PrimZip, _FI} = erase(OldArchiveFile),
ok = prim_zip:close(PrimZip),
PS2 = PS#prim_state{primary_archive = undefined},
- prim_set_primary_archive(PS2, ArchiveFile, ArchiveBin)
+ prim_set_primary_archive(PS2, ArchiveFile, ArchiveBin, FileInfo)
end,
debug(PS3, {return, Res3}),
{Res3, PS3}.
@@ -956,15 +958,15 @@ prim_read_file_info(PS, File) ->
FunnyFile = funny_split(FileInArchive, $/),
Fun =
fun({Funny, GetInfo, _GetBin}, Acc) ->
- if
- hd(Funny) =:= "",
- tl(Funny) =:= FunnyFile ->
+ case Funny of
+ [H | T] when H =:= "",
+ T =:= FunnyFile ->
%% Directory
{false, {ok, GetInfo()}};
- Funny =:= FunnyFile ->
+ F when F =:= FunnyFile ->
%% Plain file
{false, {ok, GetInfo()}};
- true ->
+ _ ->
%% No match
{true, Acc}
end
@@ -990,33 +992,36 @@ prim_get_cwd(PS, [Drive]) ->
apply_archive(PS, Fun, Acc, Archive) ->
case get(Archive) of
undefined ->
+ case open_archive(Archive, Acc, Fun) of
+ {ok, PrimZip, {Acc2, FI, _}} ->
+ debug(PS, {cache, ok}),
+ put(Archive, {{ok, PrimZip}, FI}),
+ {Acc2, PS};
+ Error ->
+ debug(PS, {cache, Error}),
+ %% put(Archive, {Error, FI}),
+ {Error, PS}
+ end;
+ {primary, PrimZip, FI} ->
+ case prim_file:read_file_info(Archive) of
+ {ok, FI2}
+ when FI#file_info.mtime =:= FI2#file_info.mtime ->
+ case foldl_archive(PrimZip, Acc, Fun) of
+ {ok, _PrimZip2, Acc2} ->
+ {Acc2, PS};
+ Error ->
+ debug(PS, {primary, Error}),
+ {Error, PS}
+ end;
+ Error ->
+ debug(PS, {cache, {clear, Error}}),
+ clear_cache(Archive, {ok, PrimZip}),
+ apply_archive(PS, Fun, Acc, Archive)
+ end;
+ {Cache, FI} ->
case prim_file:read_file_info(Archive) of
- {ok, #file_info{mtime = Mtime}} ->
- case open_archive(Archive, Acc, Fun) of
- {ok, PrimZip, Acc2} ->
- debug(PS, {cache, ok}),
- put(Archive, {Mtime, {ok, PrimZip}}),
- {Acc2, PS};
- Error ->
- debug(PS, {cache, Error}),
- put(Archive, {Mtime, Error}),
- {Error, PS}
- end;
- Error ->
- debug(PS, {cache, Error}),
- {Error, PS}
- end;
- {primary, PrimZip} ->
- case foldl_archive(PrimZip, Acc, Fun) of
- {ok, _PrimZip2, Acc2} ->
- {Acc2, PS};
- Error ->
- debug(PS, {primary, Error}),
- {Error, PS}
- end;
- {Mtime, Cache} ->
- case prim_file:read_file_info(Archive) of
- {ok, #file_info{mtime = Mtime2}} when Mtime2 =:= Mtime ->
+ {ok, FI2}
+ when FI#file_info.mtime =:= FI2#file_info.mtime ->
case Cache of
{ok, PrimZip} ->
case foldl_archive(PrimZip, Acc, Fun) of
@@ -1026,7 +1031,8 @@ apply_archive(PS, Fun, Acc, Archive) ->
debug(PS, {cache, {clear, Error}}),
clear_cache(Archive, Cache),
debug(PS, {cache, Error}),
- put(Archive, {Mtime, Error}),
+ erase(Archive),
+ %% put(Archive, {Error, FI}),
{Error, PS}
end;
Error ->
@@ -1041,20 +1047,57 @@ apply_archive(PS, Fun, Acc, Archive) ->
end.
open_archive(Archive, Acc, Fun) ->
+ case prim_file:read_file_info(Archive) of
+ {ok, FileInfo} ->
+ open_archive(Archive, FileInfo, Acc, Fun);
+ {error, Reason} ->
+ {error, Reason}
+ end.
+
+open_archive(Archive, FileInfo, Acc, Fun) ->
+ FakeFI = FileInfo#file_info{type = directory},
Wrapper =
- fun({N, GI, GB}, A) ->
- %% Ensure full iteration at open
- Funny = funny_split(N, $/),
- {_Continue, A2} = Fun({Funny, GI, GB}, A),
- {true, {true, Funny}, A2}
- end,
- prim_zip:open(Wrapper, Acc, Archive).
+ fun({N, GI, GB}, {A, I, FunnyDirs}) -> % Full iteration at open
+ Funny = funny_split(N, $/),
+ FunnyDirs2 =
+ case Funny of
+ ["" | FunnyDir] ->
+ [FunnyDir | FunnyDirs];
+ _ ->
+ FunnyDirs
+ end,
+ {Includes, FunnyDirs3, A2} =
+ ensure_virtual_dirs(Funny, Fun, FakeFI, [{true, Funny}], FunnyDirs2, A),
+ {_Continue, A3} = Fun({Funny, GI, GB}, A2),
+ {true, Includes, {A3, I, FunnyDirs3}}
+ end,
+ prim_zip:open(Wrapper, {Acc, FakeFI, []}, Archive).
+
+ensure_virtual_dirs(Funny, Fun, FakeFI, Includes, FunnyDirs, Acc) ->
+ case Funny of
+ [_ | FunnyDir] ->
+ case lists:member(FunnyDir, FunnyDirs) of % BIF
+ false ->
+ GetInfo = fun() -> FakeFI end,
+ GetBin = fun() -> <<>> end,
+ VirtualDir = ["" | FunnyDir],
+ Includes2 = [{true, VirtualDir, GetInfo, GetBin} | Includes],
+ FunnyDirs2 = [FunnyDir | FunnyDirs],
+ {I, F, Acc2} = ensure_virtual_dirs(FunnyDir, Fun, FakeFI, Includes2, FunnyDirs2, Acc),
+ {_Continue, Acc3} = Fun({VirtualDir, GetInfo, GetBin}, Acc2),
+ {I, F, Acc3};
+ true ->
+ {reverse(Includes), FunnyDirs, Acc}
+ end;
+ [] ->
+ {reverse(Includes), FunnyDirs, Acc}
+ end.
foldl_archive(PrimZip, Acc, Fun) ->
Wrapper =
- fun({N, GI, GB}, A) ->
+ fun({Funny, GI, GB}, A) ->
%% Allow partial iteration at foldl
- {Continue, A2} = Fun({N, GI, GB}, A),
+ {Continue, A2} = Fun({Funny, GI, GB}, A),
{Continue, true, A2}
end,
prim_zip:foldl(Wrapper, Acc, PrimZip).
diff --git a/erts/preloaded/src/prim_zip.erl b/erts/preloaded/src/prim_zip.erl
index 17ef8c6c43..3f5a5b9721 100644
--- a/erts/preloaded/src/prim_zip.erl
+++ b/erts/preloaded/src/prim_zip.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -94,12 +94,7 @@ do_foldl(FilterFun, FilterAcc, [PF | Tail], Acc0, PrimZip, PrimZipOrig) ->
#primzip_file{name = F, get_info = GetInfo, get_bin = GetBin} = PF,
case FilterFun({F, GetInfo, GetBin}, FilterAcc) of
{Continue, Include, FilterAcc2} ->
- Acc1 =
- case Include of
- false -> Acc0;
- true -> [PF | Acc0];
- {true, Nick} -> [PF#primzip_file{name = Nick} | Acc0]
- end,
+ Acc1 = include_acc(Include, PF, Acc0),
case Continue of
true ->
do_foldl(FilterFun, FilterAcc2, Tail, Acc1, PrimZip, PrimZipOrig);
@@ -112,6 +107,28 @@ do_foldl(FilterFun, FilterAcc, [PF | Tail], Acc0, PrimZip, PrimZipOrig) ->
do_foldl(_FilterFun, FilterAcc, [], Acc, PrimZip, _PrimZipOrig) ->
{ok, FilterAcc, PrimZip#primzip{files = reverse(Acc)}}.
+include_acc(Include, PF, Acc) ->
+ case Include of
+ false ->
+ Acc;
+ true ->
+ [PF | Acc];
+ {true, Nick} ->
+ [PF#primzip_file{name = Nick} | Acc];
+ {true, Nick, GetInfo, GetBin} ->
+ PF2 = #primzip_file{name = Nick, get_info = GetInfo, get_bin = GetBin},
+ [PF2 | Acc];
+ List when is_list(List) ->
+ %% Add new entries
+ Fun = fun(I, A) -> include_acc(I, PF, A) end,
+ lists_foldl(Fun, Acc, List)
+ end.
+
+lists_foldl(F, Accu, [Hd|Tail]) ->
+ lists_foldl(F, F(Hd, Accu), Tail);
+lists_foldl(F, Accu, []) when is_function(F, 2) ->
+ Accu.
+
%% close a zip archive
close(#primzip{in = In0, input = Input, zlib = Z}) ->
Input(close, In0),
@@ -199,15 +216,25 @@ get_cd_loop(N, BCD, Acc0, PrimZip, FileName, Offset, CFH, EndOffset, FilterFun,
end,
%% erlang:display({FileName, N, Offset, Size, NextPF}),
GetInfo = fun() -> cd_file_header_to_file_info(FileName, CFH, <<>>) end,
- GetBin = fun() -> get_z_file(FileName, Offset, Size, PrimZip) end,
+ GetBin = fun() -> get_z_file(FileName, Offset, Size, PrimZip) end,
PF = #primzip_file{name = FileName, get_info = GetInfo, get_bin = GetBin},
case FilterFun({FileName, GetInfo, GetBin}, FilterAcc) of
{Continue, Include, FilterAcc2} ->
Acc1 =
case Include of
- false -> Acc0;
- true -> [PF | Acc0];
- {true, Nick} -> [PF#primzip_file{name = Nick} | Acc0]
+ false ->
+ Acc0;
+ true ->
+ [PF | Acc0];
+ {true, Nick} ->
+ [PF#primzip_file{name = Nick} | Acc0];
+ {true, Nick, GI, GB} ->
+ PF2 = #primzip_file{name = Nick, get_info = GI, get_bin = GB},
+ [PF2 | Acc0];
+ List when is_list(List) ->
+ %% Add new entries
+ Fun = fun(I, A) -> include_acc(I, PF, A) end,
+ lists_foldl(Fun, Acc0, List)
end,
case Continue of
true when N > 1 ->
diff --git a/erts/test/erl_print_SUITE.erl b/erts/test/erl_print_SUITE.erl
index b1458d84d0..3bb7d4d016 100644
--- a/erts/test/erl_print_SUITE.erl
+++ b/erts/test/erl_print_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2005-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -36,7 +36,7 @@
-export([erlang_display/1, integer/1, float/1, string/1, character/1, snprintf/1, quote/1]).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
all(doc) -> [];
all(suite) -> test_cases().
diff --git a/erts/test/erlc_SUITE.erl b/erts/test/erlc_SUITE.erl
index 6b4484b31e..437f020f99 100644
--- a/erts/test/erlc_SUITE.erl
+++ b/erts/test/erlc_SUITE.erl
@@ -23,7 +23,7 @@
-export([all/1, compile_erl/1, compile_yecc/1, compile_script/1,
compile_mib/1, good_citizen/1, deep_cwd/1]).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
all(suite) ->
[compile_erl, compile_yecc, compile_script, compile_mib,
diff --git a/erts/test/erlexec_SUITE.erl b/erts/test/erlexec_SUITE.erl
index fcf1e67e9e..164ce9faaf 100644
--- a/erts/test/erlexec_SUITE.erl
+++ b/erts/test/erlexec_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2007-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -35,7 +35,7 @@
-export([args_file/1, evil_args_file/1, env/1, args_file_env/1, otp_7461/1, otp_7461_remote/1, otp_8209/1]).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
init_per_testcase(Case, Config) ->
diff --git a/erts/test/ethread_SUITE.erl b/erts/test/ethread_SUITE.erl
index a8f4f5e90c..bbc79e9381 100644
--- a/erts/test/ethread_SUITE.erl
+++ b/erts/test/ethread_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -53,7 +53,7 @@
atomic/1,
gate/1]).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
tests() ->
[create_join_thread,
diff --git a/erts/test/ignore_cores.erl b/erts/test/ignore_cores.erl
index 7ec2cac706..8b1ac0fe6c 100644
--- a/erts/test/ignore_cores.erl
+++ b/erts/test/ignore_cores.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -27,7 +27,7 @@
-module(ignore_cores).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
-export([init/1, fini/1, setup/3, setup/4, restore/1, dir/1]).
diff --git a/erts/test/nt_SUITE.erl b/erts/test/nt_SUITE.erl
index 7ff5c908e6..530fb55270 100644
--- a/erts/test/nt_SUITE.erl
+++ b/erts/test/nt_SUITE.erl
@@ -1,24 +1,25 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-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%
%%
%%% Purpose: Test NT specific utilities
-module(nt_SUITE).
--include("test_server.hrl").
+
+-include_lib("test_server/include/test_server.hrl").
-include_lib("kernel/include/file.hrl").
-export([all/1,init_per_testcase/2,fin_per_testcase/2,nt/1,handle_eventlog/2,
diff --git a/erts/test/otp_SUITE.erl b/erts/test/otp_SUITE.erl
index c6769743dd..425ad31782 100644
--- a/erts/test/otp_SUITE.erl
+++ b/erts/test/otp_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -24,7 +24,8 @@
obsolete_but_not_deprecated/1,call_to_deprecated/1,
call_to_size_1/1,strong_components/1]).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
+
-import(lists, [filter/2,foldl/3,foreach/2]).
all(suite) ->
diff --git a/erts/test/run_erl_SUITE.erl b/erts/test/run_erl_SUITE.erl
index afff4120d4..efeafbad8c 100644
--- a/erts/test/run_erl_SUITE.erl
+++ b/erts/test/run_erl_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2005-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -23,7 +23,7 @@
basic/1,heavy/1,heavier/1,defunct/1]).
-export([ping_me_back/1]).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
init_per_testcase(_Case, Config) ->
Dog = ?t:timetrap(?t:minutes(2)),
diff --git a/erts/test/z_SUITE.erl b/erts/test/z_SUITE.erl
index 0e37af1ca2..8faddeb0d3 100644
--- a/erts/test/z_SUITE.erl
+++ b/erts/test/z_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -39,7 +39,7 @@
-export([search_for_core_files/1, core_files/1]).
--include("test_server.hrl").
+-include_lib("test_server/include/test_server.hrl").
init_per_testcase(Case, Config) ->
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/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 58e147d508..d73c9cd762 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -187,9 +187,9 @@ format_error(no_crypto_key) ->
format_error({native, E}) ->
io_lib:fwrite("native-code compilation failed with reason: ~P.",
[E, 25]);
-format_error({native_crash, E}) ->
- io_lib:fwrite("native-code compilation crashed with reason: ~P.",
- [E, 25]);
+format_error({native_crash,E,Stk}) ->
+ io_lib:fwrite("native-code compilation crashed with reason: ~P.\n~P\n",
+ [E,25,Stk,25]);
format_error({open,E}) ->
io_lib:format("open error '~s'", [file:format_error(E)]);
format_error({epp,E}) ->
@@ -717,7 +717,7 @@ read_beam_file(St) ->
case file:read_file(St#compile.ifile) of
{ok,Beam} ->
Infile = St#compile.ifile,
- case is_too_old(Infile) of
+ case no_native_compilation(Infile, St) of
true ->
{ok,St#compile{module=none,code=none}};
false ->
@@ -730,12 +730,15 @@ read_beam_file(St) ->
{error,St#compile{errors=St#compile.errors ++ Es}}
end.
-is_too_old(BeamFile) ->
+no_native_compilation(BeamFile, #compile{options=Opts0}) ->
case beam_lib:chunks(BeamFile, ["CInf"]) of
{ok,{_,[{"CInf",Term0}]}} ->
Term = binary_to_term(Term0),
- Opts = proplists:get_value(options, Term, []),
- lists:member(no_new_funs, Opts);
+
+ %% Compiler options in the beam file will override
+ %% options passed to the compiler.
+ Opts = proplists:get_value(options, Term, []) ++ Opts0,
+ member(no_new_funs, Opts) orelse not is_native_enabled(Opts);
_ -> false
end.
@@ -1046,7 +1049,14 @@ beam_asm(#compile{ifile=File,code=Code0,abstract_code=Abst,options=Opts0}=St) ->
test_native(#compile{options=Opts}) ->
%% This test is done late, in case some other option has turned off native.
- member(native, Opts).
+ %% 'native' given on the command line can be overridden by
+ %% 'no_native' in the module itself.
+ is_native_enabled(Opts).
+
+is_native_enabled([native|_]) -> true;
+is_native_enabled([no_native|_]) -> false;
+is_native_enabled([H|T]) -> is_native_enabled(T);
+is_native_enabled([]) -> false.
native_compile(#compile{code=none}=St) -> {ok,St};
native_compile(St) ->
@@ -1070,25 +1080,27 @@ native_compile_1(St) ->
St#compile.core_code,
St#compile.code,
Opts) of
- {ok, {_Type,Bin} = T} when is_binary(Bin) ->
- {ok, embed_native_code(St, T)};
- {error, R} ->
+ {ok,{_Type,Bin}=T} when is_binary(Bin) ->
+ {ok,embed_native_code(St, T)};
+ {error,R} ->
case IgnoreErrors of
true ->
- Ws = [{St#compile.ifile,[{none,?MODULE,{native,R}}]}],
- {ok, St#compile{warnings=St#compile.warnings ++ Ws}};
+ Ws = [{St#compile.ifile,[{?MODULE,{native,R}}]}],
+ {ok,St#compile{warnings=St#compile.warnings ++ Ws}};
false ->
- Es = [{St#compile.ifile,[{none,?MODULE,{native,R}}]}],
- {error, St#compile{errors=St#compile.errors ++ Es}}
+ Es = [{St#compile.ifile,[{?MODULE,{native,R}}]}],
+ {error,St#compile{errors=St#compile.errors ++ Es}}
end
catch
- error:R ->
+ Class:R ->
+ Stk = erlang:get_stacktrace(),
case IgnoreErrors of
true ->
- Ws = [{St#compile.ifile,[{none,?MODULE,{native_crash,R}}]}],
- {ok, St#compile{warnings=St#compile.warnings ++ Ws}};
+ Ws = [{St#compile.ifile,
+ [{?MODULE,{native_crash,R,Stk}}]}],
+ {ok,St#compile{warnings=St#compile.warnings ++ Ws}};
false ->
- exit(R)
+ erlang:raise(Class, R, Stk)
end
end.
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..5614b02bb7 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>
@@ -656,7 +702,7 @@
<!-- Menu.ref -->
<xsl:template name="menu.ref">
- <xsl:param name="$curModule"/>
+ <xsl:param name="curModule"/>
<div id="leftnav">
<div class="innertube">
@@ -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..a9a2781a8a 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,84 +51,76 @@
<!-- 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">
<xsl:text>&#10;.TP 2&#10;</xsl:text>
<xsl:text>*&#10;</xsl:text>
- <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:apply-templates/>
+ <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="taglist/item">
+ <xsl:apply-templates/>
</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:template>
-
-
- <xsl:template match="taglist/item">
- <xsl:text>&#10;</xsl:text>
- <xsl:apply-templates/>
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="$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="$content"/>
+ <xsl:text>&#10;.RE</xsl:text>
+ </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:value-of select="normalize-space($content)"/>
+ <xsl:apply-templates/>
</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 +128,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 +149,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 +160,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>
@@ -191,42 +174,72 @@
<!-- 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:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text>&#10;</xsl:text>
- <xsl:apply-templates/>
+ <xsl:variable name="companyname">
+ <xsl:choose>
+ <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <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>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Erlang Module Definition"&#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>
<!-- Comref -->
<xsl:template match="/comref">
- <xsl:text>.TH </xsl:text><xsl:value-of select="com"/><xsl:text> 1 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "User Commands"&#10;</xsl:text>
- <xsl:text>.SH NAME&#10;</xsl:text>
- <xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text>&#10;</xsl:text>
- <xsl:apply-templates/>
+ <xsl:variable name="companyname">
+ <xsl:choose>
+ <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:text>.TH </xsl:text><xsl:value-of select="com"/><xsl:text> 1 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "User Commands"&#10;</xsl:text>
+ <xsl:text>.SH NAME&#10;</xsl:text>
+ <xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates/>
</xsl:template>
<!-- Cref -->
<xsl:template match="/cref">
- <xsl:text>.TH </xsl:text><xsl:value-of select="lib"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "C Library Functions"&#10;</xsl:text>
- <xsl:text>.SH NAME&#10;</xsl:text>
- <xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text>&#10;</xsl:text>
- <xsl:apply-templates/>
+ <xsl:variable name="companyname">
+ <xsl:choose>
+ <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:text>.TH </xsl:text><xsl:value-of select="lib"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "C Library Functions"&#10;</xsl:text>
+ <xsl:text>.SH NAME&#10;</xsl:text>
+ <xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates/>
</xsl:template>
<!-- Fileref -->
<xsl:template match="/fileref">
- <xsl:text>.TH </xsl:text><xsl:value-of select="file"/><xsl:text> 4 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Files"&#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:apply-templates/>
+ <xsl:variable name="companyname">
+ <xsl:choose>
+ <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:text>.TH </xsl:text><xsl:value-of select="file"/><xsl:text> 5 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Files"&#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:apply-templates/>
</xsl:template>
<!-- Appref -->
<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:apply-templates/>
+ <xsl:variable name="companyname">
+ <xsl:choose>
+ <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:text>.TH </xsl:text><xsl:value-of select="app"/><xsl:text> 7 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Erlang Application Definition"&#10;</xsl:text>
+ <xsl:text>.SH NAME&#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>
<!-- Module|Com|Lib|File|App-->
@@ -297,12 +310,71 @@
<!-- 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>
- <xsl:template match="d/text()">
- <xsl:value-of select="normalize-space()"/>
+ <!-- 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="startstring">
+ <xsl:value-of select="normalize-space()"/><xsl:text> </xsl:text>
+ </xsl:variable>
+ <xsl:variable name="rep1">
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="$startstring" />
+ <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:stylesheet>
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/erl_interface/src/legacy/erl_eterm.c b/lib/erl_interface/src/legacy/erl_eterm.c
index e573cafcb2..8d559f0f55 100644
--- a/lib/erl_interface/src/legacy/erl_eterm.c
+++ b/lib/erl_interface/src/legacy/erl_eterm.c
@@ -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%
*/
/*
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/eunit/test/Makefile b/lib/eunit/test/Makefile
index 83fca0ade4..74d485d1cc 100644
--- a/lib/eunit/test/Makefile
+++ b/lib/eunit/test/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%
#
include $(ERL_TOP)/make/target.mk
@@ -50,7 +50,7 @@ EBIN = .
make_emakefile:
$(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) \
- $(MODULES) >> $(EMAKEFILE)
+ $(MODULES) > $(EMAKEFILE)
tests debug opt: make_emakefile
erl $(ERL_MAKE_FLAGS) -make
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/kernel/src/Makefile b/lib/kernel/src/Makefile
index ef280058fb..cd011f09fe 100644
--- a/lib/kernel/src/Makefile
+++ b/lib/kernel/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%
#
@@ -154,7 +154,7 @@ debug opt: $(TARGET_FILES)
# Note: In the open-source build clean must not destroyed the preloaded
# beam files.
clean:
- rm -f $(NON_PRECIOUS_TARGETS)
+ rm -f $(TARGET_FILES)
rm -f core
diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl
index fef11d7e6e..89d893f8c1 100644
--- a/lib/kernel/src/code.erl
+++ b/lib/kernel/src/code.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(code).
@@ -63,7 +63,7 @@
which/1,
where_is_file/1,
where_is_file/2,
- set_primary_archive/2,
+ set_primary_archive/3,
clash/0]).
-include_lib("kernel/include/file.hrl").
@@ -101,7 +101,7 @@
%% unstick_dir(Dir) -> ok | error
%% is_sticky(Module) -> true | false
%% which(Module) -> Filename
-%% set_primary_archive((FileName, Bin) -> ok | {error, Reason}
+%% set_primary_archive((FileName, Bin, FileInfo) -> ok | {error, Reason}
%% clash() -> -> print out
%%----------------------------------------------------------------------------
@@ -420,11 +420,15 @@ where_is_file(Path, File) when is_list(Path), is_list(File) ->
which(File, ".", Path)
end.
--spec set_primary_archive(ArchiveFile :: file:filename(), ArchiveBin :: binary()) -> 'ok' | {'error', atom()}.
+-spec set_primary_archive(ArchiveFile :: file:filename(),
+ ArchiveBin :: binary(),
+ FileInfo :: #file_info{})
+ -> 'ok' | {'error', atom()}.
-set_primary_archive(ArchiveFile0, ArchiveBin) when is_list(ArchiveFile0), is_binary(ArchiveBin) ->
+set_primary_archive(ArchiveFile0, ArchiveBin, FileInfo)
+ when is_list(ArchiveFile0), is_binary(ArchiveBin), is_record(FileInfo, file_info) ->
ArchiveFile = filename:absname(ArchiveFile0),
- case call({set_primary_archive, ArchiveFile, ArchiveBin}) of
+ case call({set_primary_archive, ArchiveFile, ArchiveBin, FileInfo}) of
{ok, []} ->
ok;
{ok, _Mode, Ebins} ->
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index d4e3f0bcf8..7aeddb73d1 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(code_server).
@@ -384,8 +384,8 @@ handle_call(stop,{_From,_Tag}, S) ->
handle_call({is_cached,_File}, {_From,_Tag}, S=#state{cache=no_cache}) ->
{reply, no, S};
-handle_call({set_primary_archive, File, ArchiveBin}, {_From,_Tag}, S=#state{mode=Mode}) ->
- case erl_prim_loader:set_primary_archive(File, ArchiveBin) of
+handle_call({set_primary_archive, File, ArchiveBin, FileInfo}, {_From,_Tag}, S=#state{mode=Mode}) ->
+ case erl_prim_loader:set_primary_archive(File, ArchiveBin, FileInfo) of
{ok, Files} ->
{reply, {ok, Mode, Files}, S};
{error, Reason} ->
diff --git a/lib/kernel/src/hipe_unified_loader.erl b/lib/kernel/src/hipe_unified_loader.erl
index 7e26d57ced..42eab67478 100644
--- a/lib/kernel/src/hipe_unified_loader.erl
+++ b/lib/kernel/src/hipe_unified_loader.erl
@@ -96,6 +96,14 @@ load_hipe_modules() ->
%% code:load_file/1) and the atom `no_native' on failure.
load_native_code(Mod, Bin) when is_atom(Mod), is_binary(Bin) ->
+ erlang:system_flag(multi_scheduling, block),
+ try
+ load_native_code_nosmp(Mod, Bin)
+ after
+ erlang:system_flag(multi_scheduling, unblock)
+ end.
+
+load_native_code_nosmp(Mod, Bin) ->
Architecture = erlang:system_info(hipe_architecture),
try chunk_name(Architecture) of
ChunkTag ->
@@ -120,6 +128,14 @@ load_native_code(Mod, Bin) when is_atom(Mod), is_binary(Bin) ->
-spec post_beam_load(atom()) -> 'ok'.
post_beam_load(Mod) when is_atom(Mod) ->
+ erlang:system_flag(multi_scheduling, block),
+ try
+ post_beam_load_nosmp(Mod)
+ after
+ erlang:system_flag(multi_scheduling, unblock)
+ end.
+
+post_beam_load_nosmp(Mod) ->
Architecture = erlang:system_info(hipe_architecture),
try chunk_name(Architecture) of _ChunkTag -> patch_to_emu(Mod)
catch _:_ -> ok
@@ -141,6 +157,14 @@ version_check(Version, Mod) when is_atom(Mod) ->
-spec load_module(Mod, binary(), _) -> 'bad_crc' | {'module',Mod}
when is_subtype(Mod,atom()).
load_module(Mod, Bin, Beam) ->
+ erlang:system_flag(multi_scheduling, block),
+ try
+ load_module_nosmp(Mod, Bin, Beam)
+ after
+ erlang:system_flag(multi_scheduling, unblock)
+ end.
+
+load_module_nosmp(Mod, Bin, Beam) ->
load_module(Mod, Bin, Beam, []).
load_module(Mod, Bin, Beam, OldReferencesToPatch) ->
@@ -154,6 +178,14 @@ load_module(Mod, Bin, Beam, OldReferencesToPatch) ->
-spec load(Mod, binary()) -> 'bad_crc' | {'module',Mod}
when is_subtype(Mod,atom()).
load(Mod, Bin) ->
+ erlang:system_flag(multi_scheduling, block),
+ try
+ load_nosmp(Mod, Bin)
+ after
+ erlang:system_flag(multi_scheduling, unblock)
+ end.
+
+load_nosmp(Mod, Bin) ->
?debug_msg("********* Loading funs in module ~w *********\n",[Mod]),
%% Loading just some functions in a module; patch closures separately.
put(hipe_patch_closures, true),
diff --git a/lib/kernel/test/Makefile b/lib/kernel/test/Makefile
index ffad998d96..293c368e2a 100644
--- a/lib/kernel/test/Makefile
+++ b/lib/kernel/test/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
@@ -116,7 +116,7 @@ EBIN = .
make_emakefile:
$(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' \
- >> $(EMAKEFILE)
+ > $(EMAKEFILE)
$(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \
>> $(EMAKEFILE)
diff --git a/lib/kernel/test/bif_SUITE.erl b/lib/kernel/test/bif_SUITE.erl
index c78d82659f..ae2a3a08ff 100644
--- a/lib/kernel/test/bif_SUITE.erl
+++ b/lib/kernel/test/bif_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(bif_SUITE).
@@ -66,7 +66,7 @@ spawn_opt_tests(suite) ->
spawn1(doc) -> ["Test spawn/1"];
spawn1(suite) ->
[];
-spawn1(Config) when list(Config) ->
+spawn1(Config) when is_list(Config) ->
?line Node = node(),
?line Parent = self(),
?line {_, _, FA, _} = fetch_proc_vals(self()),
@@ -83,7 +83,7 @@ spawn1(Config) when list(Config) ->
spawn2(doc) -> ["Test spawn/2"];
spawn2(suite) ->
[];
-spawn2(Config) when list(Config) ->
+spawn2(Config) when is_list(Config) ->
?line {ok, Node} = start_node(spawn2),
?line Parent = self(),
@@ -105,7 +105,7 @@ spawn2(Config) when list(Config) ->
spawn3(doc) -> ["Test spawn/3"];
spawn3(suite) ->
[];
-spawn3(Config) when list(Config) ->
+spawn3(Config) when is_list(Config) ->
?line Node = node(),
?line Parent = self(),
@@ -127,7 +127,7 @@ spawn3(Config) when list(Config) ->
spawn4(doc) -> ["Test spawn/4"];
spawn4(suite) ->
[];
-spawn4(Config) when list(Config) ->
+spawn4(Config) when is_list(Config) ->
?line {ok, Node} = start_node(spawn4),
?line Parent = self(),
@@ -154,7 +154,7 @@ spawn4(Config) when list(Config) ->
spawn_link1(doc) -> ["Test spawn_link/1"];
spawn_link1(suite) ->
[];
-spawn_link1(Config) when list(Config) ->
+spawn_link1(Config) when is_list(Config) ->
?line Node = node(),
?line Parent = self(),
?line {_, _, FA, _} = fetch_proc_vals(self()),
@@ -171,7 +171,7 @@ spawn_link1(Config) when list(Config) ->
spawn_link2(doc) -> ["Test spawn_link/2"];
spawn_link2(suite) ->
[];
-spawn_link2(Config) when list(Config) ->
+spawn_link2(Config) when is_list(Config) ->
?line {ok, Node} = start_node(spawn_link2),
?line Parent = self(),
@@ -192,7 +192,7 @@ spawn_link2(Config) when list(Config) ->
spawn_link3(doc) -> ["Test spawn_link/3"];
spawn_link3(suite) ->
[];
-spawn_link3(Config) when list(Config) ->
+spawn_link3(Config) when is_list(Config) ->
?line Node = node(),
?line Parent = self(),
@@ -214,7 +214,7 @@ spawn_link3(Config) when list(Config) ->
spawn_link4(doc) -> ["Test spawn_link/4"];
spawn_link4(suite) ->
[];
-spawn_link4(Config) when list(Config) ->
+spawn_link4(Config) when is_list(Config) ->
?line {ok, Node} = start_node(spawn_link4),
?line Parent = self(),
@@ -240,7 +240,7 @@ spawn_link4(Config) when list(Config) ->
spawn_opt2(doc) -> ["Test spawn_opt/2"];
spawn_opt2(suite) ->
[];
-spawn_opt2(Config) when list(Config) ->
+spawn_opt2(Config) when is_list(Config) ->
?line Node = node(),
?line Parent = self(),
?line {_, _, FA, _} = fetch_proc_vals(self()),
@@ -275,7 +275,7 @@ spawn_opt2(Config) when list(Config) ->
spawn_opt3(doc) -> ["Test spawn_opt/3"];
spawn_opt3(suite) ->
[];
-spawn_opt3(Config) when list(Config) ->
+spawn_opt3(Config) when is_list(Config) ->
?line {ok, Node} = start_node(spawn_opt3),
?line Parent = self(),
?line {_, _, FA, _} = fetch_proc_vals(self()),
@@ -312,7 +312,7 @@ spawn_opt3(Config) when list(Config) ->
spawn_opt4(doc) -> ["Test spawn_opt/4"];
spawn_opt4(suite) ->
[];
-spawn_opt4(Config) when list(Config) ->
+spawn_opt4(Config) when is_list(Config) ->
?line Node = node(),
?line Parent = self(),
?line {_, _, FA, _} = fetch_proc_vals(self()),
@@ -352,7 +352,7 @@ spawn_opt4(Config) when list(Config) ->
spawn_opt5(doc) -> ["Test spawn_opt/5"];
spawn_opt5(suite) ->
[];
-spawn_opt5(Config) when list(Config) ->
+spawn_opt5(Config) when is_list(Config) ->
?line {ok, Node} = start_node(spawn_opt5),
?line Parent = self(),
?line {_, _, FA, _} = fetch_proc_vals(self()),
@@ -396,7 +396,7 @@ spawn_failures(doc) ->
["Test failure behavior of spawn bifs"];
spawn_failures(suite) ->
[];
-spawn_failures(Config) when list(Config) ->
+spawn_failures(Config) when is_list(Config) ->
?line ThisNode = node(),
?line {ok, Node} = start_node(spawn_remote_failure),
@@ -556,7 +556,7 @@ wilderness(doc) ->
"wilderness of the heap are interpreted correct by the emulator "];
wilderness(suite) ->
[];
-wilderness(Config) when list(Config) ->
+wilderness(Config) when is_list(Config) ->
?line Dog = ?t:timetrap(?default_timeout),
?line OKParams = {512, 8},
?line Alloc = erlang:system_info(allocator),
@@ -604,11 +604,11 @@ run_wilderness_test({Set_tt, Set_tp}, {Exp_tt, Exp_tp}) ->
end,
stop_node(Node).
-to_string(X) when integer(X) ->
+to_string(X) when is_integer(X) ->
integer_to_list(X);
-to_string(X) when atom(X) ->
+to_string(X) when is_atom(X) ->
atom_to_list(X);
-to_string(X) when list(X) ->
+to_string(X) when is_list(X) ->
X.
get_nodenames(N, T) ->
diff --git a/lib/kernel/test/cleanup.erl b/lib/kernel/test/cleanup.erl
index 6e1a1edeac..831ceba8f5 100644
--- a/lib/kernel/test/cleanup.erl
+++ b/lib/kernel/test/cleanup.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(cleanup).
@@ -31,7 +31,7 @@ cleanup(_) ->
?line case nodes() of
[] ->
ok;
- Nodes when list(Nodes) ->
+ Nodes when is_list(Nodes) ->
Kill = fun(Node) -> spawn(Node, erlang, halt, []) end,
?line lists:foreach(Kill, Nodes),
?line test_server:fail({nodes_left, Nodes})
diff --git a/lib/kernel/test/erl_distribution_SUITE.erl b/lib/kernel/test/erl_distribution_SUITE.erl
index 8f2e2512e0..d15f6aa0d5 100644
--- a/lib/kernel/test/erl_distribution_SUITE.erl
+++ b/lib/kernel/test/erl_distribution_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(erl_distribution_SUITE).
@@ -62,7 +62,7 @@ all(suite) ->
table_waste, net_setuptime,
monitor_nodes].
-init_per_testcase(Func, Config) when atom(Func), list(Config) ->
+init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
Dog=?t:timetrap(?t:minutes(4)),
[{watchdog, Dog}|Config].
@@ -72,7 +72,7 @@ fin_per_testcase(_Func, Config) ->
tick(suite) -> [];
tick(doc) -> [];
-tick(Config) when list(Config) ->
+tick(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(120)),
PaDir = filename:dirname(code:which(erl_distribution_SUITE)),
@@ -119,7 +119,7 @@ tick(Config) when list(Config) ->
monitor_node(Node, true),
receive
- {tick_test, T} when integer(T) ->
+ {tick_test, T} when is_integer(T) ->
stop_node(ServNode),
stop_node(Node),
T;
@@ -141,7 +141,7 @@ table_waste(doc) ->
["Checks that pinging nonexistyent nodes does not waste space in distribution table"];
table_waste(suite) ->
[];
-table_waste(Config) when list(Config) ->
+table_waste(Config) when is_list(Config) ->
?line {ok, HName} = inet:gethostname(),
F = fun(0,_F) -> [];
(N,F) ->
@@ -161,7 +161,7 @@ illegal_nodenames(doc) ->
["Test that pinging an illegal nodename does not kill the node"];
illegal_nodenames(suite) ->
[];
-illegal_nodenames(Config) when list(Config) ->
+illegal_nodenames(Config) when is_list(Config) ->
?line Dog=?t:timetrap(?t:minutes(2)),
PaDir = filename:dirname(code:which(erl_distribution_SUITE)),
?line {ok, Node}=start_node(illegal_nodenames, "-pa " ++ PaDir),
@@ -269,12 +269,12 @@ tick_cli_test1(Node) ->
tick_change(doc) -> ["OTP-4255"];
tick_change(suite) -> [];
-tick_change(Config) when list(Config) ->
+tick_change(Config) when is_list(Config) ->
?line PaDir = filename:dirname(code:which(?MODULE)),
?line [BN, CN] = get_nodenames(2, tick_change),
?line DefaultTT = net_kernel:get_net_ticktime(),
?line case DefaultTT of
- I when integer(I) -> ?line ok;
+ I when is_integer(I) -> ?line ok;
_ -> ?line ?t:fail(DefaultTT)
end,
@@ -445,7 +445,7 @@ hidden_node(doc) ->
["Basic test of hidden node"];
hidden_node(suite) ->
[];
-hidden_node(Config) when list(Config) ->
+hidden_node(Config) when is_list(Config) ->
?line Dog = ?t:timetrap(?t:seconds(40)),
PaDir = filename:dirname(code:which(?MODULE)),
VArgs = "-pa " ++ PaDir,
@@ -548,7 +548,7 @@ monitor_nodes(suite) ->
monitor_nodes_nodedown_reason(doc) -> [];
monitor_nodes_nodedown_reason(suite) -> [];
-monitor_nodes_nodedown_reason(Config) when list(Config) ->
+monitor_nodes_nodedown_reason(Config) when is_list(Config) ->
?line MonNodeState = monitor_node_state(),
?line ok = net_kernel:monitor_nodes(true),
?line ok = net_kernel:monitor_nodes(true, [nodedown_reason]),
@@ -603,7 +603,7 @@ monitor_nodes_nodedown_reason(Config) when list(Config) ->
monitor_nodes_complex_nodedown_reason(doc) -> [];
monitor_nodes_complex_nodedown_reason(suite) -> [];
-monitor_nodes_complex_nodedown_reason(Config) when list(Config) ->
+monitor_nodes_complex_nodedown_reason(Config) when is_list(Config) ->
?line MonNodeState = monitor_node_state(),
?line Me = self(),
?line ok = net_kernel:monitor_nodes(true, [nodedown_reason]),
@@ -885,7 +885,7 @@ monitor_nodes_errors(doc) ->
[];
monitor_nodes_errors(suite) ->
[];
-monitor_nodes_errors(Config) when list(Config) ->
+monitor_nodes_errors(Config) when is_list(Config) ->
?line MonNodeState = monitor_node_state(),
?line error = net_kernel:monitor_nodes(asdf),
?line {error,
@@ -922,7 +922,7 @@ monitor_nodes_combinations(doc) ->
[];
monitor_nodes_combinations(suite) ->
[];
-monitor_nodes_combinations(Config) when list(Config) ->
+monitor_nodes_combinations(Config) when is_list(Config) ->
?line MonNodeState = monitor_node_state(),
?line monitor_nodes_all_comb(true),
?line [VisibleName, HiddenName] = get_nodenames(2,
@@ -1044,7 +1044,7 @@ monitor_nodes_cleanup(doc) ->
[];
monitor_nodes_cleanup(suite) ->
[];
-monitor_nodes_cleanup(Config) when list(Config) ->
+monitor_nodes_cleanup(Config) when is_list(Config) ->
?line MonNodeState = monitor_node_state(),
?line Me = self(),
?line No = monitor_nodes_all_comb(true),
@@ -1076,7 +1076,7 @@ monitor_nodes_many(doc) ->
[];
monitor_nodes_many(suite) ->
[];
-monitor_nodes_many(Config) when list(Config) ->
+monitor_nodes_many(Config) when is_list(Config) ->
?line MonNodeState = monitor_node_state(),
?line [Name] = get_nodenames(1, monitor_nodes_many),
%% We want to perform more than 2^16 net_kernel:monitor_nodes
@@ -1139,10 +1139,10 @@ start_node(Name, Param, this) ->
start_node(Name, Param, "this") ->
NewParam = Param ++ " -pa " ++ filename:dirname(code:which(?MODULE)),
?t:start_node(Name, peer, [{args, NewParam}, {erl, [this]}]);
-start_node(Name, Param, Rel) when atom(Rel) ->
+start_node(Name, Param, Rel) when is_atom(Rel) ->
NewParam = Param ++ " -pa " ++ filename:dirname(code:which(?MODULE)),
?t:start_node(Name, peer, [{args, NewParam}, {erl, [{release, atom_to_list(Rel)}]}]);
-start_node(Name, Param, Rel) when list(Rel) ->
+start_node(Name, Param, Rel) when is_list(Rel) ->
NewParam = Param ++ " -pa " ++ filename:dirname(code:which(?MODULE)),
?t:start_node(Name, peer, [{args, NewParam}, {erl, [{release, Rel}]}]).
@@ -1216,9 +1216,9 @@ wait_until(Fun) ->
end
end.
-repeat(Fun, 0) when function(Fun) ->
+repeat(Fun, 0) when is_function(Fun) ->
ok;
-repeat(Fun, N) when function(Fun), integer(N), N > 0 ->
+repeat(Fun, N) when is_function(Fun), is_integer(N), N > 0 ->
Fun(),
repeat(Fun, N-1).
diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl
index 4d090f4db5..19c84ab34c 100644
--- a/lib/kernel/test/erl_prim_loader_SUITE.erl
+++ b/lib/kernel/test/erl_prim_loader_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(erl_prim_loader_SUITE).
@@ -27,7 +27,7 @@
inet_existing/1, inet_coming_up/1, inet_disconnects/1,
multiple_slaves/1, file_requests/1,
local_archive/1, remote_archive/1,
- primary_archive/1]).
+ primary_archive/1, virtual_dir_in_archive/1]).
-export([init_per_testcase/2, fin_per_testcase/2]).
@@ -41,10 +41,11 @@ all(suite) ->
inet_existing, inet_coming_up,
inet_disconnects, multiple_slaves,
file_requests, local_archive,
- remote_archive, primary_archive
+ remote_archive, primary_archive,
+ virtual_dir_in_archive
].
-init_per_testcase(Func, Config) when atom(Func), list(Config) ->
+init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
Dog=?t:timetrap(?t:minutes(3)),
[{watchdog, Dog}|Config].
@@ -81,7 +82,7 @@ set_path(Config) when is_list(Config) ->
get_file(doc) -> [];
get_file(Config) when is_list(Config) ->
?line case erl_prim_loader:get_file("lists" ++ code:objfile_extension()) of
- {ok,Bin,File} when binary(Bin), list(File) ->
+ {ok,Bin,File} when is_binary(Bin), is_list(File) ->
ok;
_ ->
test_server:fail(get_valid_file)
@@ -344,8 +345,9 @@ local_archive(Config) when is_list(Config) ->
Node = node(),
BeamName = "inet.beam",
?line ok = test_archive(Node, Archive, KernelDir, BeamName),
- ?line ok = rpc:call(Node, erl_prim_loader, release_archives, []),
+ %% Cleanup
+ ?line ok = rpc:call(Node, erl_prim_loader, release_archives, []),
?line ok = file:delete(Archive),
ok.
@@ -365,6 +367,7 @@ remote_archive(Config) when is_list(Config) ->
BeamName = "inet.beam",
?line ok = test_archive(Node, Archive, KernelDir, BeamName),
+ %% Cleanup
?line stop_node(Node),
?line unlink(BootPid),
?line exit(BootPid, kill),
@@ -401,21 +404,22 @@ primary_archive(Config) when is_list(Config) ->
?line Args = " -setcookie " ++ Cookie,
?line {ok,Node} = start_node(primary_archive, Args),
?line wait_really_started(Node, 25),
+ ?line {_,_,_} = rpc:call(Node, erlang, date, []),
%% Set primary archive
- ?line {_,_,_} = rpc:call(Node, erlang, date, []),
- ?line {ok, Ebins} = rpc:call(Node, erl_prim_loader, set_primary_archive, [Archive, ArchiveBin]),
ExpectedEbins = [Archive, DictDir ++ "/ebin", DummyDir ++ "/ebin"],
io:format("ExpectedEbins: ~p\n", [ExpectedEbins]),
- ?line ExpectedEbins = lists:sort(Ebins),
+ ?line {ok, FileInfo} = prim_file:read_file_info(Archive),
+ ?line {ok, Ebins} = rpc:call(Node, erl_prim_loader, set_primary_archive, [Archive, ArchiveBin, FileInfo]),
+ ?line ExpectedEbins = lists:sort(Ebins), % assert
?line {ok, TopFiles2} = rpc:call(Node, erl_prim_loader, list_dir, [Archive]),
?line [DictDir, DummyDir] = lists:sort(TopFiles2),
BeamName = "primary_archive_dict_app.beam",
?line ok = test_archive(Node, Archive, DictDir, BeamName),
- ?line {ok, []} = rpc:call(Node, erl_prim_loader, set_primary_archive, [undefined, undefined]),
-
+ %% Cleanup
+ ?line {ok, []} = rpc:call(Node, erl_prim_loader, set_primary_archive, [undefined, undefined, undefined]),
?line stop_node(Node),
?line ok = file:delete(Archive),
ok.
@@ -461,6 +465,46 @@ create_archive(Archive, AppDirs) ->
io:format("zip:create(~p,\n\t~p,\n\t~p).\n", [Archive, AppDirs, Opts]),
zip:create(Archive, AppDirs, Opts).
+
+virtual_dir_in_archive(suite) ->
+ [];
+virtual_dir_in_archive(doc) ->
+ ["Read virtual directories from archive."];
+virtual_dir_in_archive(Config) when is_list(Config) ->
+ PrivDir = ?config(priv_dir, Config),
+ Data = <<"A little piece of data.">>,
+ ArchiveBase = "archive_with_virtual_dirs",
+ Archive = filename:join([PrivDir, ArchiveBase ++ init:archive_extension()]),
+ FileBase = "a_data_file.beam",
+ EbinBase = "ebin",
+ FileInArchive = filename:join([ArchiveBase, EbinBase, FileBase]),
+ BinFiles = [{FileInArchive, Data}],
+ Opts = [{compress, []}],
+ ?line file:delete(Archive),
+ io:format("zip:create(~p,\n\t~p,\n\t~p).\n", [Archive, BinFiles, Opts]),
+ ?line {ok, Archive} = zip:create(Archive, BinFiles, Opts),
+
+ %% Verify that there is no directories
+ ?line {ok, BinFiles} = zip:unzip(Archive, [memory]),
+
+ FullPath = filename:join([Archive, FileInArchive]),
+ ?line {ok, _} = erl_prim_loader:read_file_info(FullPath),
+
+ %% Read one virtual dir
+ EbinDir = filename:dirname(FullPath),
+ ?line {ok, _} = erl_prim_loader:read_file_info(EbinDir),
+ ?line {ok, [FileBase]} = erl_prim_loader:list_dir(EbinDir),
+
+ %% Read another virtual dir
+ AppDir = filename:dirname(EbinDir),
+ ?line {ok, _} = erl_prim_loader:read_file_info(AppDir),
+ ?line {ok, [EbinBase]} = erl_prim_loader:list_dir(AppDir),
+
+ %% Cleanup
+ ?line ok = erl_prim_loader:release_archives(),
+ ?line ok = file:delete(Archive),
+ ok.
+
%% Misc. functions
ip_str({A, B, C, D}) ->
diff --git a/lib/kernel/test/error_logger_SUITE.erl b/lib/kernel/test/error_logger_SUITE.erl
index a737949bbb..eda86861d5 100644
--- a/lib/kernel/test/error_logger_SUITE.erl
+++ b/lib/kernel/test/error_logger_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(error_logger_SUITE).
@@ -45,7 +45,7 @@ all(suite) ->
error_report(suite) -> [];
error_report(doc) -> [];
-error_report(Config) when list(Config) ->
+error_report(Config) when is_list(Config) ->
?line error_logger:add_report_handler(?MODULE, self()),
Rep1 = [{tag1,"data1"},{tag2,data2},{tag3,3}],
Rep2 = [testing,"testing",{tag1,"tag1"}],
@@ -85,7 +85,7 @@ error_report(Config) when list(Config) ->
info_report(suite) -> [];
info_report(doc) -> [];
-info_report(Config) when list(Config) ->
+info_report(Config) when is_list(Config) ->
?line error_logger:add_report_handler(?MODULE, self()),
Rep1 = [{tag1,"data1"},{tag2,data2},{tag3,3}],
Rep2 = [testing,"testing",{tag1,"tag1"}],
@@ -125,7 +125,7 @@ info_report(Config) when list(Config) ->
error(suite) -> [];
error(doc) -> [];
-error(Config) when list(Config) ->
+error(Config) when is_list(Config) ->
?line error_logger:add_report_handler(?MODULE, self()),
Msg1 = "This is a plain text string~n",
Msg2 = "This is a text with arguments ~p~n",
@@ -160,7 +160,7 @@ error(Config) when list(Config) ->
info(suite) -> [];
info(doc) -> [];
-info(Config) when list(Config) ->
+info(Config) when is_list(Config) ->
?line error_logger:add_report_handler(?MODULE, self()),
Msg1 = "This is a plain text string~n",
Msg2 = "This is a text with arguments ~p~n",
@@ -188,7 +188,7 @@ info(Config) when list(Config) ->
emulator(suite) -> [];
emulator(doc) -> [];
-emulator(Config) when list(Config) ->
+emulator(Config) when is_list(Config) ->
?line error_logger:add_report_handler(?MODULE, self()),
spawn(?MODULE, generate_error, []),
reported(emulator),
@@ -215,7 +215,7 @@ tty(Config) when is_list(Config) ->
logfile(suite) -> [];
logfile(doc) -> [];
-logfile(Config) when list(Config) ->
+logfile(Config) when is_list(Config) ->
?line case error_logger:logfile(filename) of
{error, no_log_file} -> % Ok, we continues.
do_logfile();
@@ -236,7 +236,7 @@ do_logfile() ->
add(suite) -> [];
add(doc) -> [];
-add(Config) when list(Config) ->
+add(Config) when is_list(Config) ->
?line {'EXIT',_} = (catch error_logger:add_report_handler("dummy")),
?line {'EXIT',_} = error_logger:add_report_handler(non_existing),
?line my_error = error_logger:add_report_handler(?MODULE, [error]),
@@ -246,7 +246,7 @@ add(Config) when list(Config) ->
delete(suite) -> [];
delete(doc) -> [];
-delete(Config) when list(Config) ->
+delete(Config) when is_list(Config) ->
?line {'EXIT',_} = (catch error_logger:delete_report_handler("dummy")),
?line {error,_} = error_logger:delete_report_handler(non_existing),
ok.
@@ -265,7 +265,7 @@ reported(Tag, Type, Report) ->
reported(emulator) ->
receive
- {error, "~s~n", String} when list(String) ->
+ {error, "~s~n", String} when is_list(String) ->
test_server:messages_get(),
ok
after 1000 ->
@@ -277,9 +277,9 @@ reported(emulator) ->
%% Sends a notification to the Tester process about the events
%% generated by the Tester process.
%%-----------------------------------------------------------------
-init(Tester) when pid(Tester) ->
+init(Tester) when is_pid(Tester) ->
{ok, Tester};
-init(Config) when list(Config) ->
+init(Config) when is_list(Config) ->
my_error.
handle_event({Tag, _GL, {_EPid, Type, Report}}, Tester) ->
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl
index c645d0f842..d01e1f1fcf 100644
--- a/lib/kernel/test/file_SUITE.erl
+++ b/lib/kernel/test/file_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -3371,7 +3371,7 @@ read_line_create_files(TestData) ->
[ Function(File) || {Function,File,_,_} <- TestData ].
read_line_remove_files(TestData) ->
- [ file:delete(File) || {Function,File,_,_} <- TestData ].
+ [ file:delete(File) || {_Function,File,_,_} <- TestData ].
read_line_1(suite) ->
[];
diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl
index a8b87390eb..430cc61267 100644
--- a/lib/kernel/test/global_group_SUITE.erl
+++ b/lib/kernel/test/global_group_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-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%
%%
@@ -42,7 +42,7 @@ all(suite) ->
-define(TESTCASE, testcase_name).
-define(testcase, ?config(?TESTCASE, Config)).
-init_per_testcase(Case, Config) when atom(Case), list(Config) ->
+init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) ->
Dog=?t:timetrap(?t:minutes(5)),
[{?TESTCASE, Case}, {watchdog, Dog}|Config].
@@ -59,7 +59,7 @@ fin_per_testcase(_Func, Config) ->
start_gg_proc(suite) -> [];
start_gg_proc(doc) -> ["Check that the global_group processes are started automatically. "];
-start_gg_proc(Config) when list(Config) ->
+start_gg_proc(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(120)),
?line Dir = ?config(priv_dir, Config),
@@ -94,7 +94,7 @@ start_gg_proc(Config) when list(Config) ->
no_gg_proc(suite) -> [];
no_gg_proc(doc) -> ["Start a system without global groups. Nodes are not "
"synced at start (sync_nodes_optional is not defined)"];
-no_gg_proc(Config) when list(Config) ->
+no_gg_proc(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(200)),
?line Dir = ?config(priv_dir, Config),
@@ -267,7 +267,7 @@ no_gg_proc_sync(suite) -> [];
no_gg_proc_sync(doc) ->
["Start a system without global groups, but syncing the nodes by using "
"sync_nodes_optional."];
-no_gg_proc_sync(Config) when list(Config) ->
+no_gg_proc_sync(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(200)),
?line Dir = ?config(priv_dir, Config),
@@ -441,7 +441,7 @@ no_gg_proc_sync(Config) when list(Config) ->
compatible(suite) -> [];
compatible(doc) ->
["Check that a system without global groups is compatible with the old R4 system."];
-compatible(Config) when list(Config) ->
+compatible(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(200)),
?line Dir = ?config(priv_dir, Config),
@@ -614,7 +614,7 @@ compatible(Config) when list(Config) ->
one_grp(suite) -> [];
one_grp(doc) -> ["Test a system with only one global group. "];
-one_grp(Config) when list(Config) ->
+one_grp(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(120)),
?line Dir = ?config(priv_dir, Config),
@@ -701,7 +701,7 @@ one_grp(Config) when list(Config) ->
one_grp_x(suite) -> [];
one_grp_x(doc) -> ["Check a system with only one global group. "
"Start the nodes with different time intervals. "];
-one_grp_x(Config) when list(Config) ->
+one_grp_x(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(120)),
?line Dir = ?config(priv_dir, Config),
@@ -763,7 +763,7 @@ one_grp_x(Config) when list(Config) ->
two_grp(suite) -> [];
two_grp(doc) -> ["Test a two global group system. "];
-two_grp(Config) when list(Config) ->
+two_grp(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(200)),
?line Dir = ?config(priv_dir, Config),
@@ -1063,7 +1063,7 @@ two_grp(Config) when list(Config) ->
hidden_groups(suite) -> [];
hidden_groups(doc) -> ["Test hidden global groups."];
-hidden_groups(Config) when list(Config) ->
+hidden_groups(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(200)),
?line Dir = ?config(priv_dir, Config),
@@ -1138,7 +1138,7 @@ hidden_groups(Config) when list(Config) ->
test_exit(suite) -> [];
test_exit(doc) -> ["Checks when the search process exits. "];
-test_exit(Config) when list(Config) ->
+test_exit(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(120)),
?line NN = node_name(atom_to_list(node())),
diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl
index b06244db3c..0d0296238b 100644
--- a/lib/kernel/test/heart_SUITE.erl
+++ b/lib/kernel/test/heart_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(heart_SUITE).
@@ -80,7 +80,7 @@ start_check(Type, Name) ->
end,
erlang:monitor_node(Node, true),
case rpc:call(Node, erlang, whereis, [heart]) of
- Pid when pid(Pid) ->
+ Pid when is_pid(Pid) ->
ok;
_ ->
test_server:fail(heart_not_started)
@@ -355,7 +355,7 @@ erl() ->
end.
name(Node) when is_list(Node) -> name(Node,[]);
-name(Node) when atom(Node) -> name(atom_to_list(Node),[]).
+name(Node) when is_atom(Node) -> name(atom_to_list(Node),[]).
name([$@|Node], Name) ->
case lists:member($., Node) of
@@ -368,7 +368,7 @@ name([H|T], Name) ->
name(T, [H|Name]).
-atom_conv(A) when atom(A) ->
+atom_conv(A) when is_atom(A) ->
atom_to_list(A);
atom_conv(A) when is_list(A) ->
A.
diff --git a/lib/kernel/test/init_SUITE.erl b/lib/kernel/test/init_SUITE.erl
index 3d777f93a4..bbd8261197 100644
--- a/lib/kernel/test/init_SUITE.erl
+++ b/lib/kernel/test/init_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(init_SUITE).
@@ -44,7 +44,7 @@ all(suite) ->
restart,
get_status, script_id, boot].
-init_per_testcase(Func, Config) when atom(Func), list(Config) ->
+init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
Dog=?t:timetrap(?t:seconds(?DEFAULT_TIMEOUT_SEC)),
[{watchdog, Dog}|Config].
@@ -477,7 +477,7 @@ script_id(Config) when is_list(Config) ->
?line {Name, Vsn} = init:script_id(),
?line if
- list(Name), list(Vsn) ->
+ is_list(Name), is_list(Vsn) ->
ok;
true ->
?t:fail(not_standard_script)
diff --git a/lib/kernel/test/kernel_SUITE.erl b/lib/kernel/test/kernel_SUITE.erl
index 225bc38b05..bb1d905de3 100644
--- a/lib/kernel/test/kernel_SUITE.erl
+++ b/lib/kernel/test/kernel_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%%%----------------------------------------------------------------
@@ -56,6 +56,6 @@ app_test(doc) ->
["Tests the applications consistency."];
app_test(suite) ->
[];
-app_test(Config) when list(Config) ->
+app_test(Config) when is_list(Config) ->
?line ok=?t:app_test(kernel),
ok.
diff --git a/lib/kernel/test/kernel_config_SUITE.erl b/lib/kernel/test/kernel_config_SUITE.erl
index 6b7d788e60..c72fc3f02d 100644
--- a/lib/kernel/test/kernel_config_SUITE.erl
+++ b/lib/kernel/test/kernel_config_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(kernel_config_SUITE).
@@ -56,7 +56,7 @@ from(_, []) -> [].
%%-----------------------------------------------------------------
sync(doc) -> [];
sync(suite) -> [];
-sync(Conf) when list(Conf) ->
+sync(Conf) when is_list(Conf) ->
?line Dog = ?t:timetrap(?t:seconds(120)),
% Write a config file
Dir = ?config(priv_dir,Conf),
diff --git a/lib/kernel/test/loose_node.erl b/lib/kernel/test/loose_node.erl
index ac1ddb8d9a..87a4ef01c0 100644
--- a/lib/kernel/test/loose_node.erl
+++ b/lib/kernel/test/loose_node.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -55,7 +55,7 @@
%% Exported functions.
%%
-stop(Node) when atom(Node) ->
+stop(Node) when is_atom(Node) ->
rpc:cast(Node, erlang, halt, []),
io:format("Stopped loose node ~p~n", [Node]),
ok.
@@ -63,9 +63,10 @@ stop(Node) when atom(Node) ->
start(Name, Args) ->
start(Name, Args, -1).
-start(Name, Args, TimeOut) when atom(Name) ->
+start(Name, Args, TimeOut) when is_atom(Name) ->
start(atom_to_list(Name), Args, TimeOut);
-start(Name, Args, TimeOut) when list(Name), list(Args), integer(TimeOut) ->
+start(Name, Args, TimeOut)
+ when is_list(Name), is_list(Args), is_integer(TimeOut) ->
Parent = self(),
Ref = make_ref(),
Starter
@@ -119,7 +120,7 @@ start(Name, Args, TimeOut) when list(Name), list(Args), integer(TimeOut) ->
io:format("Trying to start loose node...~n"
" --> ~p~n", [Cmd]),
Res = case open_port({spawn, Cmd}, []) of
- P when port(P) ->
+ P when is_port(P) ->
receive
{loose_node_started,
Node,
@@ -150,14 +151,14 @@ start(Name, Args, TimeOut) when list(Name), list(Args), integer(TimeOut) ->
%% Exported functions for internal use.
%%
-loose_node_started([Name, Node, TimeOutSecs]) when list(Name),
- list(Node),
- list(TimeOutSecs) ->
+loose_node_started([Name, Node, TimeOutSecs]) when is_list(Name),
+ is_list(Node),
+ is_list(TimeOutSecs) ->
spawn_opt(fun () ->
process_flag(trap_exit, true),
Proc = {list_to_atom(Name), list_to_atom(Node)},
Timeout = case catch list_to_integer(TimeOutSecs) of
- I when integer(I), I >= 0 -> I*1000;
+ I when is_integer(I), I >= 0 -> I*1000;
_ -> infinity
end,
wait_until(fun () -> is_alive() end),
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl
index 667f267079..1673b33010 100644
--- a/lib/kernel/test/os_SUITE.erl
+++ b/lib/kernel/test/os_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(os_SUITE).
@@ -32,7 +32,7 @@ space_in_cwd(doc) ->
"Test that executing a command in a current working directory "
"with space in its name works.";
space_in_cwd(suite) -> [];
-space_in_cwd(Config) when list(Config) ->
+space_in_cwd(Config) when is_list(Config) ->
?line PrivDir = ?config(priv_dir, Config),
?line Dirname = filename:join(PrivDir, "cwd with space"),
?line ok = file:make_dir(Dirname),
@@ -60,7 +60,7 @@ space_in_cwd(Config) when list(Config) ->
quoting(doc) -> "Test that various ways of quoting arguments work.";
quoting(suite) -> [];
-quoting(Config) when list(Config) ->
+quoting(Config) when is_list(Config) ->
?line DataDir = ?config(data_dir, Config),
?line Echo = filename:join(DataDir, "my_echo"),
@@ -78,7 +78,7 @@ quoting(Config) when list(Config) ->
space_in_name(doc) ->
"Test that program with a space in its name can be executed.";
space_in_name(suite) -> [];
-space_in_name(Config) when list(Config) ->
+space_in_name(Config) when is_list(Config) ->
?line PrivDir = ?config(priv_dir, Config),
?line DataDir = ?config(data_dir, Config),
?line Spacedir = filename:join(PrivDir, "program files"),
@@ -108,7 +108,7 @@ space_in_name(Config) when list(Config) ->
bad_command(doc) ->
"Check that a bad command doesn't crasch the server or the emulator (it used to).";
bad_command(suite) -> [];
-bad_command(Config) when list(Config) ->
+bad_command(Config) when is_list(Config) ->
?line catch os:cmd([a|b]),
?line catch os:cmd({bad, thing}),
@@ -120,7 +120,7 @@ bad_command(Config) when list(Config) ->
find_executable(suite) -> [];
find_executable(doc) -> [];
-find_executable(Config) when list(Config) ->
+find_executable(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
?line DataDir = filename:join(?config(data_dir, Config), "win32"),
@@ -159,7 +159,7 @@ find_exe(Where, Name, Ext, Path) ->
case os:find_executable(Name, Path) of
Expected ->
ok;
- Name when list(Name) ->
+ Name when is_list(Name) ->
case filename:absname(Name) of
Expected ->
ok;
@@ -176,7 +176,7 @@ find_exe(Where, Name, Ext, Path) ->
unix_comment_in_command(doc) ->
"OTP-1805: Test that os:cmd(\"ls #\") works correctly (used to hang).";
unix_comment_in_command(suite) -> [];
-unix_comment_in_command(Config) when list(Config) ->
+unix_comment_in_command(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(20)),
?line Priv = ?config(priv_dir, Config),
?line ok = file:set_cwd(Priv),
diff --git a/lib/kernel/test/pdict_SUITE.erl b/lib/kernel/test/pdict_SUITE.erl
index 6aa434b614..87ee951a0c 100644
--- a/lib/kernel/test/pdict_SUITE.erl
+++ b/lib/kernel/test/pdict_SUITE.erl
@@ -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%
%%
-module(pdict_SUITE).
@@ -49,7 +49,7 @@ simple(doc) ->
["Tests simple functionality in process dictionary."];
simple(suite) ->
[];
-simple(Config) when list(Config) ->
+simple(Config) when is_list(Config) ->
XX = get(),
erase(),
L = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,
@@ -146,7 +146,7 @@ info(doc) ->
["Tests process_info(Pid, dictionary)"];
info(suite) ->
[];
-info(Config) when list(Config) ->
+info(Config) when is_list(Config) ->
L = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,
q,r,s,t,u,v,x,y,z,'A','B','C','D'],
process_flag(trap_exit,true),
diff --git a/lib/kernel/test/rpc_SUITE.erl b/lib/kernel/test/rpc_SUITE.erl
index 2b39e31a80..2b7de40797 100644
--- a/lib/kernel/test/rpc_SUITE.erl
+++ b/lib/kernel/test/rpc_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(rpc_SUITE).
@@ -333,7 +333,7 @@ suicide(exit, Reason) ->
suicide(erlang, exit, [Name, Reason]) when is_atom(Name) ->
case whereis(Name) of
- Pid when pid(Pid) -> suicide(erlang, exit, [Pid, Reason])
+ Pid when is_pid(Pid) -> suicide(erlang, exit, [Pid, Reason])
end;
suicide(Mod, Func, Args) ->
spawn_link(
@@ -448,7 +448,7 @@ call_benchmark(Config) when is_list(Config) ->
?t:timetrap_cancel(Timetrap),
ok.
-do_call_benchmark(Node, M) when integer(M), M > 0 ->
+do_call_benchmark(Node, M) when is_integer(M), M > 0 ->
do_call_benchmark(Node, erlang:now(), 0, M).
do_call_benchmark(Node, {A,B,C}, M, M) ->
diff --git a/lib/kernel/test/seq_trace_SUITE.erl b/lib/kernel/test/seq_trace_SUITE.erl
index f582b94c97..b557c7fb1e 100644
--- a/lib/kernel/test/seq_trace_SUITE.erl
+++ b/lib/kernel/test/seq_trace_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(seq_trace_SUITE).
@@ -381,7 +381,7 @@ port(Config) when is_list(Config) ->
get_port_message(Port) ->
receive
- {Port,{data,Bin}} when binary(Bin) ->
+ {Port,{data,Bin}} when is_binary(Bin) ->
binary_to_term(Bin);
Other ->
?t:fail({unexpected,Other})
@@ -678,7 +678,7 @@ transparent_tracer() ->
receive {started, Ref} -> ok end,
fun(pid) ->
Pid;
- ({stop, N}) when integer(N), N >= 0 ->
+ ({stop, N}) when is_integer(N), N >= 0 ->
Mref = erlang:monitor(process, Pid),
receive
{'DOWN', Mref, _, _, _} ->
@@ -717,7 +717,7 @@ simple_tracer(Data, DN) ->
From ! {tracerlog,lists:reverse(Data)}
end.
-stop_tracer(N) when integer(N) ->
+stop_tracer(N) when is_integer(N) ->
case catch (seq_trace_SUITE_tracer ! {stop,N,self()}) of
{'EXIT', _} ->
{error, not_started};
diff --git a/lib/kernel/test/wrap_log_reader_SUITE.erl b/lib/kernel/test/wrap_log_reader_SUITE.erl
index 1d1570fbd9..ceac593e44 100644
--- a/lib/kernel/test/wrap_log_reader_SUITE.erl
+++ b/lib/kernel/test/wrap_log_reader_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-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%
%%
@@ -48,7 +48,7 @@
all(suite) ->
[no_file, one, two, four, wrap, wrapping, external, error].
-init_per_testcase(Func, Config) when atom(Func), list(Config) ->
+init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
Dog=?t:timetrap(?t:seconds(60)),
[{watchdog, Dog} | Config].
@@ -58,7 +58,7 @@ fin_per_testcase(_Func, _Config) ->
no_file(suite) -> [];
no_file(doc) -> ["No log file exists"];
-no_file(Conf) when list(Conf) ->
+no_file(Conf) when is_list(Conf) ->
?line code:add_path(?config(data_dir,Conf)),
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
@@ -81,7 +81,7 @@ one(doc) -> ["One index file"].
one_empty(suite) -> [];
one_empty(doc) -> ["One empty index file"];
-one_empty(Conf) when list(Conf) ->
+one_empty(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
delete_files(File),
@@ -107,7 +107,7 @@ one_empty(Conf) when list(Conf) ->
one_filled(suite) -> [];
one_filled(doc) -> ["One filled index file"];
-one_filled(Conf) when list(Conf) ->
+one_filled(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
delete_files(File),
@@ -144,7 +144,7 @@ two(doc) -> ["Two index files"].
two_filled(suite) -> [];
two_filled(doc) -> ["Two filled index files"];
-two_filled(Conf) when list(Conf) ->
+two_filled(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = list_to_atom(join(Dir, "sune.LOG")),
delete_files(File),
@@ -186,7 +186,7 @@ four(doc) -> ["Four index files"].
four_filled(suite) -> [];
four_filled(doc) -> ["Four filled index files"];
-four_filled(Conf) when list(Conf) ->
+four_filled(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
delete_files(File),
@@ -231,7 +231,7 @@ wrap(doc) -> ["Wrap index file, first wrapping"].
wrap_filled(suite) -> [];
wrap_filled(doc) -> ["First wrap, open, filled index file"];
-wrap_filled(Conf) when list(Conf) ->
+wrap_filled(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
delete_files(File),
@@ -274,7 +274,7 @@ test_wrap(File) ->
wrapping(suite) -> [];
wrapping(doc) -> ["Wrapping at the same time as reading"];
-wrapping(Conf) when list(Conf) ->
+wrapping(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
delete_files(File),
@@ -329,7 +329,7 @@ wrapping(Conf) when list(Conf) ->
external(suite) -> [];
external(doc) -> ["External format"];
-external(Conf) when list(Conf) ->
+external(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
delete_files(File),
@@ -349,7 +349,7 @@ external(Conf) when list(Conf) ->
error(suite) -> [];
error(doc) -> ["Error situations"];
-error(Conf) when list(Conf) ->
+error(Conf) when is_list(Conf) ->
Dir = ?privdir(Conf),
File = join(Dir, "sune.LOG"),
delete_files(File),
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/parsetools/test/Makefile b/lib/parsetools/test/Makefile
new file mode 100644
index 0000000000..19354b87b2
--- /dev/null
+++ b/lib/parsetools/test/Makefile
@@ -0,0 +1,78 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2005-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
+
+MODULES = \
+ leex_SUITE \
+ yecc_SUITE
+
+ERL_FILES= $(MODULES:%=%.erl)
+
+TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+INSTALL_PROGS= $(TARGET_FILES)
+
+EMAKEFILE=Emakefile
+
+# ----------------------------------------------------
+# Release directory specification
+# ----------------------------------------------------
+RELSYSDIR = $(RELEASE_PATH)/parsetools_test
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+ERL_MAKE_FLAGS +=
+ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include
+
+EBIN = .
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+.PHONY: make_emakefile
+
+make_emakefile:
+ $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES)\
+ > $(EMAKEFILE)
+
+tests debug opt: make_emakefile
+ erl $(ERL_MAKE_FLAGS) -make
+
+clean:
+ rm -f $(EMAKEFILE)
+ rm -f $(TARGET_FILES)
+ rm -f core
+
+docs:
+
+# ----------------------------------------------------
+# Release Target
+# ----------------------------------------------------
+include $(ERL_TOP)/make/otp_release_targets.mk
+
+release_spec: opt
+
+release_tests_spec: make_emakefile
+ $(INSTALL_DIR) $(RELSYSDIR)
+ $(INSTALL_DATA) parsetools.spec $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR)
+ chmod -f -R u+w $(RELSYSDIR)
+ # @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -)
+
+release_docs_spec:
diff --git a/lib/parsetools/test/leex_SUITE.erl b/lib/parsetools/test/leex_SUITE.erl
new file mode 100644
index 0000000000..069f780b5e
--- /dev/null
+++ b/lib/parsetools/test/leex_SUITE.erl
@@ -0,0 +1,909 @@
+%%
+%% %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(leex_SUITE).
+
+%-define(debug, true).
+
+-include_lib("stdlib/include/erl_compile.hrl").
+-include_lib("kernel/include/file.hrl").
+
+-ifdef(debug).
+-define(line, put(line, ?LINE), ).
+-define(config(X,Y), foo).
+-define(datadir, "leex_SUITE_data").
+-define(privdir, "leex_SUITE_priv").
+-define(t, test_server).
+-else.
+-include("test_server.hrl").
+-define(datadir, ?config(data_dir, Config)).
+-define(privdir, ?config(priv_dir, Config)).
+-endif.
+
+-export([all/1, init_per_testcase/2, fin_per_testcase/2]).
+
+-export([checks/1,
+ file/1, compile/1, syntax/1,
+ examples/1,
+ pt/1, man/1, ex/1, ex2/1, not_yet/1]).
+
+% Default timetrap timeout (set in init_per_testcase).
+-define(default_timeout, ?t:minutes(1)).
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog = ?t:timetrap(?default_timeout),
+ [{watchdog, Dog} | Config].
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+all(suite) -> [checks, examples].
+
+checks(suite) ->
+ [file, compile, syntax].
+
+file(doc) ->
+ "Bad files and options.";
+file(suite) -> [];
+file(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Ret = [return, {report, false}],
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file("not_a_file", Ret),
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file("not_a_file", [{return,true}]),
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file("not_a_file", [{report,false},return_errors]),
+ ?line error = leex:file("not_a_file"),
+ ?line error = leex:file("not_a_file", [{return,false},report]),
+ ?line error = leex:file("not_a_file", [return_warnings,{report,false}]),
+
+ Filename = filename:join(Dir, "file.xrl"),
+ file:delete(Filename),
+
+ ?line {'EXIT', {badarg, _}} = (catch leex:file({foo})),
+ ?line {'EXIT', {badarg, _}} =
+ (catch leex:file(Filename, {parserfile,{foo}})),
+ ?line {'EXIT', {badarg, _}} =
+ (catch leex:file(Filename, {includefile,{foo}})),
+
+ ?line {'EXIT', {badarg, _}} = (catch leex:file(Filename, no_option)),
+ ?line {'EXIT', {badarg, _}} =
+ (catch leex:file(Filename, [return | report])),
+ ?line {'EXIT', {badarg, _}} =
+ (catch leex:file(Filename, {return,foo})),
+ ?line {'EXIT', {badarg, _}} =
+ (catch leex:file(Filename, includefile)),
+
+ Mini = <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ : {token,{word,TokenLine,TokenChars}}.\n"
+ "Erlang code.\n">>,
+ ?line ok = file:write_file(Filename, Mini),
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file(Filename, [{scannerfile,"//"} | Ret]),
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file(Filename, [{includefile,"//"} | Ret]),
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file(Filename, [{includefile,"/ /"} | Ret]),
+
+ LeexPre = filename:join(Dir, "leexinc.hrl"),
+ ?line ok = file:write_file(LeexPre, <<"syntax error.\n">>),
+ PreErrors = run_test(Config, Mini, LeexPre),
+ ?line {errors,
+ [{1,_,["syntax error before: ","error"]},
+ {3,_,undefined_module}],
+ []} =
+ extract(LeexPre, PreErrors),
+ file:delete(LeexPre),
+
+ Ret2 = [return, report_errors, report_warnings, verbose],
+ Scannerfile = filename:join(Dir, "file.erl"),
+ ?line ok = file:write_file(Scannerfile, <<"nothing">>),
+ ?line unwritable(Scannerfile),
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file(Filename, Ret2),
+ ?line writable(Scannerfile),
+ file:delete(Scannerfile),
+
+ Dotfile = filename:join(Dir, "file.dot"),
+ ?line ok = file:write_file(Dotfile, <<"nothing">>),
+ ?line unwritable(Dotfile),
+ ?line {error,[{_,[{none,leex,{file_error,_}}]}],[]} =
+ leex:file(Filename, [dfa_graph | Ret2]),
+ ?line writable(Dotfile),
+ file:delete(Dotfile),
+
+ file:delete(Filename),
+ ok.
+
+compile(doc) ->
+ "Check of compile/3.";
+compile(suite) -> [];
+compile(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Filename = filename:join(Dir, "file.xrl"),
+ Scannerfile = filename:join(Dir, "file.erl"),
+ Mini = <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ : {token,{word,TokenLine,TokenChars}}.\n"
+ "Erlang code.\n">>,
+ ?line ok = file:write_file(Filename, Mini),
+ ?line error = leex:compile(Filename, "//", #options{}),
+ ?line ok = leex:compile(Filename, Scannerfile, #options{}),
+ file:delete(Scannerfile),
+ file:delete(Filename),
+ ok.
+
+syntax(doc) ->
+ "Syntax checks.";
+syntax(suite) -> [];
+syntax(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Filename = filename:join(Dir, "file.xrl"),
+ Ret = [return, {report, true}],
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "%% comment\n"
+ "Rules.\n"
+ "{L}+ : {token,{word,TokenLine,TokenChars}}.\n
+ ">>),
+ ?line {error,[{_,[{7,leex,missing_code}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ : \n">>),
+ ?line {error,[{_,[{5,leex,missing_code}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "[] :">>),
+ ?line {error,[{_,[{4,leex,{regexp,_}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ : .\n"
+ "[] : ">>),
+ ?line {error,[{_,[{5,leex,{regexp,_}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "[] : .\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,_}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ ">>),
+ ?line {error,[{_,[{5,leex,bad_rule}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ ; ">>),
+ ?line {error,[{_,[{4,leex,bad_rule}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "[] : '99\n">>),
+ ?line {error,[{_,[{4,erl_scan,_}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n">>),
+ ?line {error,[{_,[{3,leex,empty_rules}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "Erlang code.\n">>),
+ ?line {error,[{_,[{4,leex,empty_rules}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n">>),
+ ?line {error,[{_,[{2,leex,missing_rules}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Erlang code.\n">>),
+ ?line {error,[{_,[{3,leex,missing_rules}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"">>),
+ %% This is a weird line:
+ ?line {error,[{_,[{0,leex,missing_defs}]}],[]} = leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Rules.\n">>),
+ ?line {error,[{_,[{1,leex,missing_defs}]}],[]} = leex:file(Filename, Ret),
+
+ %% Check that correct line number is used in messages.
+ ErlFile = filename:join(Dir, "file.erl"),
+ Ret1 = [{scannerfile,ErlFile}|Ret],
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ : {token,\n"
+ " {word,TokenLine,TokenChars,\n"
+ " DDDD}}.\n" % unbound
+ "Erlang code.\n"
+ "an error.\n">>), % syntax error
+ ?line {ok, _, []} = leex:file(Filename, Ret1),
+ ?line {error,
+ [{_,[{8,_,["syntax error before: ","error"]}]},
+ {_,[{6,_,{unbound_var,'DDDD'}}]}],
+ []} =
+ compile:file(ErlFile, [basic_validation, return]),
+
+ %% Ignored characters
+ ?line ok = file:write_file(Filename,
+ <<"Definitions. D = [0-9]\n"
+ "Rules. [a-z] : .\n"
+ "1 : skip_token.\n"
+ "Erlang code. f() -> a.\n">>),
+ ?line {ok,_,[{_,
+ [{1,leex,ignored_characters},
+ {2,leex,ignored_characters},
+ {4,leex,ignored_characters}]}]} =
+ leex:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+\\ : token.\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,{unterminated,"\\"}}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+\\x : token.\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,{illegal_char,"\\x"}}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+\\x{ : token.\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,{unterminated,"\\x{"}}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "[^ab : token.\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,{unterminated,"["}}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "(a : token.\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,{unterminated,"("}}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "[b-a] : token.\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,{char_class,"b-a"}}}]}],[]} =
+ leex:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "\\x{333333333333333333333333} : token.\n">>),
+ ?line {error,[{_,[{4,leex,{regexp,
+ {illegal_char,
+ "\\x{333333333333333333333333}"}}}]}],[]} =
+ leex:file(Filename, Ret),
+ ok.
+
+examples(suite) ->
+ [pt,man,ex,ex2,not_yet].
+
+pt(doc) ->
+ "Pushing back characters.";
+pt(suite) -> [];
+pt(Config) when is_list(Config) ->
+ %% Needs more testing...
+ Ts = [{pt_1,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "L = [a-z]\n"
+
+ "Rules.\n"
+ "{L}+ : {token,{word,TokenLine,TokenChars}}.\n"
+ "abc{D}+ : {skip_token,\"sture\" ++ string:substr(TokenChars, 4)}.\n"
+ "{D}+ : {token,{integer,TokenLine,list_to_integer(TokenChars)}}.\n"
+ "\\s : .\n"
+ "\\r\\n : {end_token,{crlf,TokenLine}}.\n"
+
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->
+ {ok,[{word,1,\"sture\"},{integer,1,123}],1} =
+ string(\"abc123\"), ok. ">>,
+ default,
+ ok}],
+
+ ?line run(Config, Ts),
+ ok.
+
+man(doc) ->
+ "Examples from the manpage.";
+man(suite) -> [];
+man(Config) when is_list(Config) ->
+ Ts = [{man_1,
+ <<"Definitions.\n"
+ "Rules.\n"
+ "[a-z][0-9a-zA-Z_]* :\n"
+ " {token,{atom,TokenLine,list_to_atom(TokenChars)}}.\n"
+ "[A-Z_][0-9a-zA-Z_]* :\n"
+ " {token,{var,TokenLine,list_to_atom(TokenChars)}}.\n"
+ "(\\+|-)?[0-9]+\\.[0-9]+((E|e)(\\+|-)?[0-9]+)? : \n"
+ " {token,{float,TokenLine,list_to_float(TokenChars)}}.\n"
+ "\\s : skip_token.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " {ok,[{float,1,3.14},{atom,1,atom},{var,1,'V314'}],1} =\n"
+ " string(\"3.14atom V314\"),\n"
+ " ok.\n">>,
+ default,
+ ok},
+
+ {man_2,
+ <<"Definitions.\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{D}+ :\n"
+ " {token,{integer,TokenLine,list_to_integer(TokenChars)}}.\n"
+ "{D}+\\.{D}+((E|e)(\\+|\\-)?{D}+)? :\n"
+ " {token,{float,TokenLine,list_to_float(TokenChars)}}.\n"
+ "\\s : skip_token.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " {ok,[{float,1,3.14},{integer,1,314}],1} = \n"
+ " string(\"3.14 314\"),\n"
+ " ok.\n">>,
+ default,
+ ok}],
+
+ ?line run(Config, Ts),
+ ok.
+
+ex(doc) ->
+ "Examples.";
+ex(suite) -> [];
+ex(Config) when is_list(Config) ->
+ Ts = [{ex_1,
+ <<"Definitions.\n"
+ "D = [0-543-705-982]\n"
+ "Rules.\n"
+ "{D}+ :\n"
+ " {token,{integer,TokenLine,list_to_integer(TokenChars)}}.\n"
+ "[^235]+ :\n"
+ " {token,{list_to_atom(TokenChars),TokenLine}}.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " {ok,[{integer,1,12},{' c\\na',1},{integer,2,34},{b789a,2}],2} =\n"
+ " string(\"12 c\\na34b789a\"),\n"
+ " ok.\n">>,
+ default,
+ ok},
+
+ {ex_2,
+ <<"Definitions.\n"
+ "L = [a-z]\n"
+ "D = [0-9]\n"
+ "Rules.\n"
+ "{L}+ : {token,chars}.\n"
+ "zyx{D}+ : {token,zyx}.\n"
+ "\\s : skip_token.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " {ok,[chars,zyx],1} = string(\"abcdef zyx123\"),\n"
+ " ok.\n">>,
+ default,
+ ok},
+
+ {ex_3,
+ <<"Definitions.\n"
+ "NL = [\\n]\n"
+ "Rules.\n"
+ "{NL}* : {token,newlines}.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " {ok,[],1} = string(\"\"), ok.\n">>, % string("a") would loop...
+ default,
+ ok},
+
+ {ex_4,
+ <<"Definitions.\n"
+ "SP1 = [\\n-\\s]\n"
+ "SP0 = [\\000-\\n]\n"
+ "Rules.\n"
+ "{SP0}+ : {token,{small,TokenChars}}.\n"
+ "{SP1}+ : {token,{big,TokenChars}}.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " string(\"\\x00\\n\\s\\n\\n\"),\n"
+ " ok.\n">>,
+ default,
+ ok},
+
+ {ex_5,
+ <<"Definitions.\n"
+ "L = [a-z]\n"
+ "W = [\\s\\b\\n\\r\\t\\e\\v\\d\\f]\n"
+ "Rules.\n"
+ "\\[{L}+(,{L}+)*\\] : {token,{list,TokenChars}}.\n"
+ "\"{L}+\" : {token,{string,TokenChars}}.\n"
+ "\\$. : {token,{char,TokenChars}}.\n"
+ "{W}+ : {token,{white,TokenChars}}.\n"
+ "ff\\f+ : {token,{form,TokenChars}}.\n"
+ "\\$\\^+\\\\+ : {token,{other,TokenChars}}.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " {ok,[{white,\"\\b\\f\"}],1} = string(\"\\b\\f\"),\n"
+ " {ok,[{form,\"ff\\f\"}],1} = string(\"ff\\f\"),\n"
+ " {ok,[{string,\"\\\"foo\\\"\"}],1} = string(\"\\\"foo\\\"\"),\n"
+ " {ok,[{char,\"$.\"}],1} = string(\"$\\.\"),\n"
+ " {ok,[{list,\"[a,b,c]\"}],1} = string(\"[a,b,c]\"),\n"
+ " {ok,[{other,\"$^\\\\\"}],1} = string(\"$^\\\\\"),\n"
+ " ok.\n">>,
+ default,
+ ok},
+
+ {ex_6,
+ <<"Definitions.\n"
+ "L = [a-z]\n"
+ "Rules.\n"
+ "L}+ : {token,{TokenChars,#r.f}}.\n"
+ "Erlang code.\n"
+ "-record(r, {f}).\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " string(\"abc\"),\n"
+ " ok.\n">>,
+ default,
+ ok},
+
+ {ex_7, %% Assumes regexp can handle \x
+ <<"Definitions.\n"
+ "H1 = \\x11\\x{ab}\n"
+ "H2 = [\\x{30}\\x{ac}]\n"
+ "Rules.\n"
+ "{H1}{H2}+ : {token,{hex,TokenChars}}.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() ->\n"
+ " {ok,[{hex,[17,171,48,172]}],1} =\n"
+ " string(\"\\x{11}\\xab0\\xac\"),\n"
+ " ok.\n">>,
+ default,
+ ok}],
+
+ ?line run(Config, Ts),
+ ok.
+
+ex2(doc) ->
+ "More examples.";
+ex2(suite) -> [];
+ex2(Config) when is_list(Config) ->
+ Xrl =
+ <<"
+%%% File : erlang_scan.xrl
+%%% Author : Robert Virding
+%%% Purpose : Tkoen definitions for Erlang.
+
+Definitions.
+O = [0-7]
+D = [0-9]
+H = [0-9a-fA-F]
+U = [A-Z]
+L = [a-z]
+A = ({U}|{L}|{D}|_|@)
+WS = ([\\000-\\s]|%.*)
+
+Rules.
+{D}+\\.{D}+((E|e)(\\+|\\-)?{D}+)? :
+ {token,{float,TokenLine,list_to_float(TokenChars)}}.
+{D}+#{H}+ : base(TokenLine, TokenChars).
+{D}+ : {token,{integer,TokenLine,list_to_integer(TokenChars)}}.
+{L}{A}* : Atom = list_to_atom(TokenChars),
+ {token,case reserved_word(Atom) of
+ true -> {Atom,TokenLine};
+ false -> {atom,TokenLine,Atom}
+ end}.
+'(\\\\\\^.|\\\\.|[^'])*' :
+ %% Strip quotes.
+ S = lists:sublist(TokenChars, 2, TokenLen - 2),
+ case catch list_to_atom(string_gen(S)) of
+ {'EXIT',_} -> {error,\"illegal atom \" ++ TokenChars};
+ Atom -> {token,{atom,TokenLine,Atom}}
+ end.
+({U}|_){A}* : {token,{var,TokenLine,list_to_atom(TokenChars)}}.
+\"(\\\\\\^.|\\\\.|[^\"])*\" :
+ %% Strip quotes.
+ S = lists:sublist(TokenChars, 2, TokenLen - 2),
+ {token,{string,TokenLine,string_gen(S)}}.
+\\$(\\\\{O}{O}{O}|\\\\\\^.|\\\\.|.) :
+ {token,{char,TokenLine,cc_convert(TokenChars)}}.
+-> : {token,{'->',TokenLine}}.
+:- : {token,{':-',TokenLine}}.
+\\|\\| : {token,{'||',TokenLine}}.
+<- : {token,{'<-',TokenLine}}.
+\\+\\+ : {token,{'++',TokenLine}}.
+-- : {token,{'--',TokenLine}}.
+=/= : {token,{'=/=',TokenLine}}.
+== : {token,{'==',TokenLine}}.
+=:= : {token,{'=:=',TokenLine}}.
+/= : {token,{'/=',TokenLine}}.
+>= : {token,{'>=',TokenLine}}.
+=< : {token,{'=<',TokenLine}}.
+<= : {token,{'<=',TokenLine}}.
+<< : {token,{'<<',TokenLine}}.
+>> : {token,{'>>',TokenLine}}.
+:: : {token,{'::',TokenLine}}.
+[]()[}{|!?/;:,.*+#<>=-] :
+ {token,{list_to_atom(TokenChars),TokenLine}}.
+\\.{WS} : {end_token,{dot,TokenLine}}.
+{WS}+ : skip_token.
+
+Erlang code.
+
+-export([reserved_word/1]).
+
+%% reserved_word(Atom) -> Bool
+%% return 'true' if Atom is an Erlang reserved word, else 'false'.
+
+reserved_word('after') -> true;
+reserved_word('begin') -> true;
+reserved_word('case') -> true;
+reserved_word('try') -> true;
+reserved_word('cond') -> true;
+reserved_word('catch') -> true;
+reserved_word('andalso') -> true;
+reserved_word('orelse') -> true;
+reserved_word('end') -> true;
+reserved_word('fun') -> true;
+reserved_word('if') -> true;
+reserved_word('let') -> true;
+reserved_word('of') -> true;
+reserved_word('query') -> true;
+reserved_word('receive') -> true;
+reserved_word('when') -> true;
+reserved_word('bnot') -> true;
+reserved_word('not') -> true;
+reserved_word('div') -> true;
+reserved_word('rem') -> true;
+reserved_word('band') -> true;
+reserved_word('and') -> true;
+reserved_word('bor') -> true;
+reserved_word('bxor') -> true;
+reserved_word('bsl') -> true;
+reserved_word('bsr') -> true;
+reserved_word('or') -> true;
+reserved_word('xor') -> true;
+reserved_word('spec') -> true;
+reserved_word(_) -> false.
+
+base(L, Cs) ->
+ H = string:chr(Cs, $#),
+ case list_to_integer(string:substr(Cs, 1, H-1)) of
+ B when B > 16 -> {error,\"illegal base\"};
+ B ->
+ case base(string:substr(Cs, H+1), B, 0) of
+ error -> {error,\"illegal based number\"};
+ N -> {token,{integer,L,N}}
+ end
+ end.
+
+base([C|Cs], Base, SoFar) when C >= $0, C =< $9, C < Base + $0 ->
+ Next = SoFar * Base + (C - $0),
+ base(Cs, Base, Next);
+base([C|Cs], Base, SoFar) when C >= $a, C =< $f, C < Base + $a - 10 ->
+ Next = SoFar * Base + (C - $a + 10),
+ base(Cs, Base, Next);
+base([C|Cs], Base, SoFar) when C >= $A, C =< $F, C < Base + $A - 10 ->
+ Next = SoFar * Base + (C - $A + 10),
+ base(Cs, Base, Next);
+base([_|_], _, _) -> error; %Unknown character
+base([], _, N) -> N.
+
+cc_convert([$$,$\\\\|Cs]) ->
+ hd(string_escape(Cs));
+cc_convert([$$,C]) -> C.
+
+string_gen([$\\\\|Cs]) ->
+ string_escape(Cs);
+string_gen([C|Cs]) ->
+ [C|string_gen(Cs)];
+string_gen([]) -> [].
+
+string_escape([O1,O2,O3|S]) when
+ O1 >= $0, O1 =< $7, O2 >= $0, O2 =< $7, O3 >= $0, O3 =< $7 ->
+ [(O1*8 + O2)*8 + O3 - 73*$0|string_gen(S)];
+string_escape([$^,C|Cs]) ->
+ [C band 31|string_gen(Cs)];
+string_escape([C|Cs]) when C >= $\\000, C =< $\\s ->
+ string_gen(Cs);
+string_escape([C|Cs]) ->
+ [escape_char(C)|string_gen(Cs)].
+
+escape_char($n) -> $\\n; %\\n = LF
+escape_char($r) -> $\\r; %\\r = CR
+escape_char($t) -> $\\t; %\\t = TAB
+escape_char($v) -> $\\v; %\\v = VT
+escape_char($b) -> $\\b; %\\b = BS
+escape_char($f) -> $\\f; %\\f = FF
+escape_char($e) -> $\\e; %\\e = ESC
+escape_char($s) -> $\\s; %\\s = SPC
+escape_char($d) -> $\\d; %\\d = DEL
+escape_char(C) -> C.
+ ">>,
+ Dir = ?privdir,
+ XrlFile = filename:join(Dir, "erlang_scan.xrl"),
+ ?line ok = file:write_file(XrlFile, Xrl),
+ ErlFile = filename:join(Dir, "erlang_scan.erl"),
+ ?line {ok, _} = leex:file(XrlFile, []),
+ ?line {ok, _} = compile:file(ErlFile, [{outdir,Dir}]),
+ code:purge(erlang_scan),
+ AbsFile = filename:rootname(ErlFile, ".erl"),
+ code:load_abs(AbsFile, erlang_scan),
+
+ F = fun(Cont, Chars, Location) ->
+ erlang_scan:tokens(Cont, Chars, Location)
+ end,
+ F1 = fun(Cont, Chars, Location) ->
+ erlang_scan:token(Cont, Chars, Location)
+ end,
+ fun() ->
+ S = "ab cd. ",
+ {ok, Ts, 1} = scan_tokens_1(S, F, 1),
+ {ok, Ts, 1} = scan_token_1(S, F1, 1),
+ {ok, Ts, 1} = scan_tokens(S, F, 1),
+ {ok, Ts, 1} = erlang_scan:string(S, 1)
+ end(),
+ fun() ->
+ S = "'ab\n cd'. ",
+ {ok, Ts, 2} = scan_tokens_1(S, F, 1),
+ {ok, Ts, 2} = scan_token_1(S, F1, 1),
+ {ok, Ts, 2} = scan_tokens(S, F, 1),
+ {ok, Ts, 2} = erlang_scan:string(S, 1)
+ end(),
+ fun() ->
+ S = "99. ",
+ {ok, Ts, 1} = scan_tokens_1(S, F, 1),
+ {ok, Ts, 1} = scan_token_1(S, F1, 1),
+ {ok, Ts, 1} = scan_tokens(S, F, 1),
+ {ok, Ts, 1} = erlang_scan:string(S, 1)
+ end(),
+ {ok,[{integer,1,99},{dot,1}],1} = erlang_scan:string("99. "),
+ fun() ->
+ Atom = "'" ++ lists:duplicate(1000,$a) ++ "'",
+ S = Atom ++ ". ",
+ Reason = "illegal atom " ++ Atom,
+ Err = {error,{1,erlang_scan,{user,Reason}},1},
+ {done,Err,[]} = scan_tokens_1(S, F, 1),
+ {done,Err,[]} = scan_token_1(S, F1, 1),
+ {done,Err,[]} = scan_tokens(S, F, 1),
+ Err = erlang_scan:string(S, 1)
+ end(),
+ fun() ->
+ S = "\x{aaa}. ",
+ Err = {error,{1,erlang_scan,{illegal,[2730]}},1},
+ {done,Err,[]} = scan_tokens_1(S, F, 1),
+ {done,Err,[_]} = scan_token_1(S, F1, 1), % Note: Rest non-empty
+ {done,Err,[]} = scan_tokens(S, F, 1),
+ Err = erlang_scan:string(S, 1)
+ end(),
+ fun() ->
+ S = "\x{aaa} + 1. 34",
+ Err = {error,{1,erlang_scan,{illegal,[2730]}},1},
+ {done,Err,[]} = scan_tokens_1(S, F, 1),
+ {done,Err,[_]} = scan_token_1(S, F1, 1), % Note: Rest non-empty
+ {done,Err,"34"} = scan_tokens(S, F, 1),
+ Err = erlang_scan:string(S, 1)
+ end(),
+ fun() ->
+ S = "\x{aaa} \x{bbb}. 34",
+ Err = {error,{1,erlang_scan,{illegal,[2730]}},1},
+ {done,Err,[]} = scan_tokens_1(S, F, 1),
+ {done,Err,[_]} = scan_token_1(S, F1, 1), % Note: Rest non-empty
+ {done,Err,"34"} = scan_tokens(S, F, 1),
+ Err = erlang_scan:string(S, 1)
+ end(),
+ fun() ->
+ S = "\x{aaa} 18#34. 34",
+ Err = {error,{1,erlang_scan,{illegal,[2730]}},1},
+ {done,Err,[]} = scan_tokens_1(S, F, 1),
+ {done,Err,[_]} = scan_token_1(S, F1, 1), % Note: Rest non-empty
+ {done,Err,"34"} = scan_tokens(S, F, 1),
+ Err = erlang_scan:string(S, 1)
+ end(),
+ fun() ->
+ S = "\x{aaa}"++eof,
+ Err = {error,{1,erlang_scan,{illegal,[2730]}},1},
+ {done,Err,eof} = scan_tokens_1(S, F, 1),
+ {done,Err,[_]} = scan_token_1(S, F1, 1), % Note: Rest non-empty
+ {done,Err,eof} = scan_tokens(S, F, 1),
+ Err = erlang_scan:string(S, 1)
+ end(),
+ ok.
+
+scan_tokens(String, Fun, Location) ->
+ scan_tokens(String, Fun, Location, []).
+
+scan_tokens(String, Fun, Location, Rs) ->
+ case Fun([], String, Location) of
+ {done, {error,_,_}, _} = Error ->
+ Error;
+ {done, {ok,Ts,End}, ""} ->
+ {ok, lists:append(lists:reverse([Ts|Rs])), End};
+ {done, {ok,Ts,End}, Rest} ->
+ scan_tokens(Rest, Fun, End, [Ts|Rs])
+ end.
+
+scan_tokens_1(String, Fun, Location) ->
+ scan_tokens_1({more, []}, String, Fun, Location, []).
+
+scan_tokens_1({done, {error, _, _}, _}=Error, _Cs, _Fun, _Location, _Rs) ->
+ Error;
+scan_tokens_1({done, {ok,Ts,End}, ""}, "", _Fun, _Location, Rs) ->
+ {ok,lists:append(lists:reverse([Ts|Rs])),End};
+scan_tokens_1({done, {ok,Ts,End}, Rest}, Cs, Fun, _Location, Rs) ->
+ scan_tokens_1({more,[]}, Rest++Cs, Fun, End, [Ts|Rs]);
+scan_tokens_1({more, Cont}, [C | Cs], Fun, Loc, Rs) ->
+ R = Fun(Cont, [C], Loc),
+ scan_tokens_1(R, Cs, Fun, Loc, Rs);
+scan_tokens_1({more, Cont}, eof, Fun, Loc, Rs) ->
+ R = Fun(Cont, eof, Loc),
+ scan_tokens_1(R, eof, Fun, Loc, Rs).
+
+scan_token_1(String, Fun, Location) ->
+ scan_token_1({more, []}, String, Fun, Location, []).
+
+scan_token_1({done, {error, _, _}, _}=Error, _Cs, _Fun, _Location, _Rs) ->
+ Error;
+scan_token_1({done, {ok,Ts,End}, ""}, "", _Fun, _Location, Rs) ->
+ {ok,lists:reverse([Ts|Rs]),End};
+scan_token_1({done, {ok,Ts,End}, Rest}, Cs, Fun, _Location, Rs) ->
+ scan_token_1({more,[]}, Rest++Cs, Fun, End, [Ts|Rs]);
+scan_token_1({more, Cont}, [C | Cs], Fun, Loc, Rs) ->
+ R = Fun(Cont, [C], Loc),
+ scan_token_1(R, Cs, Fun, Loc, Rs).
+
+%% End of ex2
+
+not_yet(doc) ->
+ "Not yet implemented.";
+not_yet(suite) -> [];
+not_yet(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Filename = filename:join(Dir, "file.xrl"),
+ Ret = [return, {report, true}],
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "Rules.\n"
+ "$ : .\n"
+ "Erlang code.\n">>),
+ ?line {error,[{_,[{3,leex,{regexp,_}}]}],[]} =
+ leex:file(Filename, Ret),
+ ?line ok = file:write_file(Filename,
+ <<"Definitions.\n"
+ "Rules.\n"
+ "^ : .\n"
+ "Erlang code.\n">>),
+ ?line {error,[{_,[{3,leex,{regexp,_}}]}],[]} =
+ leex:file(Filename, Ret),
+
+ ok.
+
+unwritable(Fname) ->
+ {ok, Info} = file:read_file_info(Fname),
+ Mode = Info#file_info.mode - 8#00200,
+ ok = file:write_file_info(Fname, Info#file_info{mode = Mode}).
+
+writable(Fname) ->
+ {ok, Info} = file:read_file_info(Fname),
+ Mode = Info#file_info.mode bor 8#00200,
+ ok = file:write_file_info(Fname, Info#file_info{mode = Mode}).
+
+run(Config, Tests) ->
+ F = fun({N,P,Pre,E}) ->
+ case catch run_test(Config, P, Pre) of
+ E ->
+ ok;
+ Bad ->
+ ?t:format("~nTest ~p failed. Expected~n ~p~n"
+ "but got~n ~p~n", [N, E, Bad]),
+ fail()
+ end
+ end,
+ lists:foreach(F, Tests).
+
+run_test(Config, Def, Pre) ->
+ %% io:format("testing ~s~n", [binary_to_list(Def)]),
+ DefFile = 'leex_test.xrl',
+ Filename = 'leex_test.erl',
+ DataDir = ?privdir,
+ XrlFile = filename:join(DataDir, DefFile),
+ ErlFile = filename:join(DataDir, Filename),
+ Opts = [return, warn_unused_vars,{outdir,DataDir}],
+ ok = file:write_file(XrlFile, Def),
+ LOpts = [return, {report, false} |
+ case Pre of
+ default ->
+ [];
+ _ ->
+ [{includefile,Pre}]
+ end],
+ XOpts = [verbose, dfa_graph], % just to get some code coverage...
+ LRet = leex:file(XrlFile, XOpts ++ LOpts),
+ case LRet of
+ {ok, _Outfile, _LWs} ->
+ CRet = compile:file(ErlFile, Opts),
+ case CRet of
+ {ok, _M, _Ws} ->
+ AbsFile = filename:rootname(ErlFile, ".erl"),
+ Mod = leex_test,
+ code:purge(Mod),
+ code:load_abs(AbsFile, Mod),
+ Mod:t();
+ %% warnings(ErlFile, Ws);
+ {error, [{ErlFile,Es}], []} -> {error, Es, []};
+ {error, [{ErlFile,Es}], [{ErlFile,Ws}]} -> {error, Es, Ws};
+ Error -> Error
+ end;
+ {error, [{XrlFile,LEs}], []} -> {error, LEs, []};
+ {error, [{XrlFile,LEs}], [{XrlFile,LWs}]} -> {error, LEs, LWs};
+ LError -> LError
+ end.
+
+extract(File, {error, Es, Ws}) ->
+ {errors, extract(File, Es), extract(File, Ws)};
+extract(File, Ts) ->
+ lists:append([T || {F, T} <- Ts, F =:= File]).
+
+fail() ->
+ ?t:fail().
diff --git a/lib/parsetools/test/parsetools.spec b/lib/parsetools/test/parsetools.spec
new file mode 100644
index 0000000000..5b34633378
--- /dev/null
+++ b/lib/parsetools/test/parsetools.spec
@@ -0,0 +1 @@
+{topcase, {dir, "../parsetools_test"}}.
diff --git a/lib/parsetools/test/yecc_SUITE.erl b/lib/parsetools/test/yecc_SUITE.erl
new file mode 100644
index 0000000000..212557194c
--- /dev/null
+++ b/lib/parsetools/test/yecc_SUITE.erl
@@ -0,0 +1,1795 @@
+%%
+%% %CopyrightBegin%
+%%
+%% 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%
+%%
+-module(yecc_SUITE).
+
+%-define(debug, true).
+
+-include_lib("stdlib/include/erl_compile.hrl").
+
+-ifdef(debug).
+-define(line, put(line, ?LINE), ).
+-define(config(X,Y), foo).
+-define(datadir, "yecc_SUITE_data").
+-define(privdir, "yecc_SUITE_priv").
+-define(t, test_server).
+-else.
+-include("test_server.hrl").
+-define(datadir, ?config(data_dir, Config)).
+-define(privdir, ?config(priv_dir, Config)).
+-endif.
+
+-export([all/1, init_per_testcase/2, fin_per_testcase/2]).
+
+-export([app_test/1,
+ checks/1,
+ file/1, syntax/1, compile/1, rules/1, expect/1,
+ conflicts/1,
+ examples/1,
+ empty/1, prec/1, yeccpre/1, lalr/1, old_yecc/1,
+ other_examples/1,
+ bugs/1,
+ otp_5369/1, otp_6362/1, otp_7945/1,
+ improvements/1,
+ otp_7292/1, otp_7969/1]).
+
+% Default timetrap timeout (set in init_per_testcase).
+-define(default_timeout, ?t:minutes(1)).
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog = ?t:timetrap(?default_timeout),
+ [{watchdog, Dog} | Config].
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+all(suite) -> [app_test, checks, examples, bugs, improvements].
+
+app_test(doc) ->
+ ["Tests the applications consistency."];
+app_test(suite) ->
+ [];
+app_test(Config) when is_list(Config) ->
+ ?line ok=?t:app_test(parsetools),
+ ok.
+
+checks(suite) ->
+ [file, syntax, compile, rules, expect, conflicts].
+
+file(doc) ->
+ "Bad files and options.";
+file(suite) -> [];
+file(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Ret = [return, {report, false}],
+ ?line {error,[{_,[{none,yecc,{file_error,_}}]}],[]} =
+ yecc:file("not_a_file", Ret),
+ ?line {error,[{_,[{none,yecc,{file_error,_}}]}],[]} =
+ yecc:file("not_a_file", [{return,true}]),
+ ?line {error,[{_,[{none,yecc,{file_error,_}}]}],[]} =
+ yecc:file("not_a_file", [{report,false},return_errors]),
+ ?line error = yecc:file("not_a_file"),
+ ?line error = yecc:file("not_a_file", [{return,false},report]),
+ ?line error = yecc:file("not_a_file", [return_warnings,{report,false}]),
+ Filename = filename:join(Dir, "file.yrl"),
+ file:delete(Filename),
+
+ ?line {'EXIT', {badarg, _}} = (catch yecc:file({foo})),
+ ?line {'EXIT', {badarg, _}} =
+ (catch yecc:file(Filename, {parserfile,{foo}})),
+ ?line {'EXIT', {badarg, _}} =
+ (catch yecc:file(Filename, {includefile,{foo}})),
+
+ ?line {'EXIT', {badarg, _}} = (catch yecc:file(Filename, no_option)),
+ ?line {'EXIT', {badarg, _}} =
+ (catch yecc:file(Filename, [return | report])),
+ ?line {'EXIT', {badarg, _}} =
+ (catch yecc:file(Filename, {return,foo})),
+ ?line {'EXIT', {badarg, _}} =
+ (catch yecc:file(Filename, includefile)),
+
+ Mini = <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ nt -> t.">>,
+ ?line ok = file:write_file(Filename, Mini),
+ ?line {error,[{_,[{none,yecc,{file_error,_}}]}],[]} =
+ yecc:file(Filename, [{parserfile,"//"} | Ret]),
+
+ ?line {error,[{_,[{none,yecc,{file_error,_}}]}],[]} =
+ yecc:file(Filename, [{includefile,"//"} | Ret]),
+ ?line {error,[{_,[{none,yecc,{file_error,_}}]}],[]} =
+ yecc:file(Filename, [{includefile,"/ /"} | Ret]),
+
+ YeccPre = filename:join(Dir, "yeccpre.hrl"),
+ ?line ok = file:write_file(YeccPre, <<"syntax error. ">>),
+ PreErrors1 = run_test(Config, Mini, YeccPre),
+ ?line {errors,[_],[]} = extract(YeccPre, PreErrors1),
+ ?line ok = file:write_file(YeccPre, my_yeccpre()),
+ ?line {'EXIT', {undef,_}} = (catch run_test(Config, Mini, YeccPre)),
+
+ MiniCode = <<"
+ Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ nt -> t.
+ Erlang code.
+ ">>,
+ ?line {'EXIT', {undef,_}} = (catch run_test(Config, MiniCode, YeccPre)),
+
+ file:delete(YeccPre),
+ file:delete(Filename),
+
+ ok.
+
+syntax(doc) ->
+ "Syntax checks.";
+syntax(suite) -> [];
+syntax(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ %% Report errors. Very simple test of format_error/1.
+ Ret = [return, {report, true}],
+ Filename = filename:join(Dir, "file.yrl"),
+ Parserfile1 = filename:join(Dir, "a file"),
+
+ ?line ok = file:write_file(Filename, <<"">>),
+ ?line {error,[{_,[{none,yecc,no_grammar_rules},
+ {none,yecc,nonterminals_missing},
+ {none,yecc,rootsymbol_missing},
+ {none,yecc,terminals_missing}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename, <<"Nonterminals">>),
+ ?line {error,[{_,[{_,yecc,{error,yeccparser,_}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename, <<"Nonterminals nt.">>),
+ ?line {error,[{_,[{none,yecc,no_grammar_rules},
+ {none,yecc,rootsymbol_missing},
+ {none,yecc,terminals_missing}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename, <<"Nonterminals nt. Terminals t.">>),
+ ?line {error,[{_,[{none,yecc,no_grammar_rules},
+ {none,yecc,rootsymbol_missing}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Nonterminals and terminals not disjoint.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt 't t'. Terminals t 't t'. Rootsymbol nt.">>),
+ ?line {error,[{_,[{1,yecc,{symbol_terminal_and_nonterminal,'t t'}},
+ {none,yecc,no_grammar_rules}]}],
+ []} = yecc:file(Filename, Ret),
+
+ %% Rootsymbol is not a nonterminal.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t.
+ Rootsymbol t. nt -> t.">>),
+ ?line {error,[{_,[{2,yecc,{bad_rootsymbol,t}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Rootsymbol is not a nonterminal.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t.
+ Rootsymbol t. nt -> t.">>),
+ ?line {error,[{_,[{2,yecc,{bad_rootsymbol,t}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Endsymbol is a nonterminal.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol nt.
+ Endsymbol nt.
+ nt -> t.">>),
+ ?line {error,[{_,[{2,yecc,{endsymbol_is_nonterminal,nt}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Endsymbol is a terminal.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol nt.
+ Endsymbol t.
+ nt -> t.">>),
+ ?line {error,[{_,[{2,yecc,{endsymbol_is_terminal,t}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% No grammar rules.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol nt. Endsymbol e.">>),
+ ?line {error,[{_,[{none,yecc,no_grammar_rules}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Bad declaration.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol nt. Endsymbol e.
+ nt -> t. e e.">>),
+ ?line {ok,_,[{_,[{2,yecc,bad_declaration}]}]} =
+ yecc:file(Filename, Ret),
+
+ %% Bad declaration.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t.
+ Rootsymbol nt nt. Rootsymbol nt. Endsymbol e.
+ nt -> t.">>),
+ ?line {ok,_,[{_,[{2,yecc,bad_declaration}]}]} =
+ yecc:file(Filename, Ret),
+
+ %% Syntax error found by yeccparser.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol nt. Endsymbol e.
+ a - a.">>),
+ ?line {error,[{_,[{2,yecc,{error,_yeccparser,_}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Syntax error: unknown nonterminal.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol nt. Endsymbol e.
+ 'unknown ' -> t.">>),
+ ?line {error,[{_,[{2,yecc,{undefined_nonterminal,'unknown '}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Undefined rhs symbols. Note quotes in output.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals Nonterminals nt.
+ Terminals t Terminals.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> Nonterminals.
+ Nonterminals -> Terminals receive foo 45
+ '17' 'a b'.">>),
+ ?line {error,[{_,[{6,yecc,{undefined_symbol,45}},
+ {6,yecc,{undefined_symbol,foo}},
+ {6,yecc,{undefined_symbol,'receive'}},
+ {7,yecc,{undefined_symbol,'17'}},
+ {7,yecc,{undefined_symbol,'a b'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% '$empty' used early, before Terminals. OK.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt.
+ nt -> '$empty'.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.">>),
+ ?line {ok,_,[{_,[{3,yecc,{unused_terminal,t}}]}]} =
+ yecc:file(Filename, Ret),
+
+ %% Illegal use of '$empty'.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt nt2.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t.
+ nt2 -> t '$empty'.">>),
+ ?line {error,[{_,[{6,yecc,illegal_empty}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ ParserFile3 = [{parserfile, Parserfile1}],
+
+ %% Bad Erlang expression in action. Changed in OTP-7224.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t : a bad code.">>),
+ ?line {ok, _, []} = yecc:file(Filename, ParserFile3 ++ Ret),
+
+ SzYeccPre = yeccpre_size(),
+ %% Note: checking the line numbers. Changes when yeccpre.hrl changes.
+ fun() ->
+ ?line {error,[{_,[{5,_,["syntax error before: ","bad"]}]},
+ {_,[{L1,_,{undefined_function,{yeccpars2_2_,1}}},
+ {L2,_,{bad_inline,{yeccpars2_2_,1}}}]}],
+ []} = compile:file(Parserfile1, [basic_validation,return]),
+ ?line L1 = 24 + SzYeccPre,
+ ?line L2 = 31 + SzYeccPre
+ end(),
+
+ %% Bad macro in action. OTP-7224.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t : ?F(3).">>),
+ ?line {ok, _, []} = yecc:file(Filename, ParserFile3 ++ Ret),
+ %% Note: checking the line numbers. Changes when yeccpre.hrl changes.
+ fun() ->
+ ?line {error,[{_,[{5,_,{undefined,'F'}}]},
+ {_,[{L1,_,{undefined_function,{yeccpars2_2_,1}}},
+ {L2,_,{bad_inline,{yeccpars2_2_,1}}}]}],
+ []} = compile:file(Parserfile1, [basic_validation,return]),
+ ?line L1 = 24 + SzYeccPre,
+ ?line L2 = 31 + SzYeccPre
+ end(),
+
+ %% Check line numbers. OTP-7224.
+ ?line ok = file:write_file(Filename,
+ <<"Terminals t.
+ Nonterminals nt.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t : ?F(3).
+ Erlang code.
+ -define(F(X), X).
+ t() ->
+ bad().">>),
+ ?line {ok, _, []} = yecc:file(Filename, ParserFile3 ++ Ret),
+ ?line {error,[{_,[{9,_,{undefined_function,{bad,0}}}]}],
+ [{_,[{8,_,{unused_function,{t,0}}}]}]}
+ = compile:file(Parserfile1, [basic_validation, return]),
+
+ %% Terminals defined before nonterminals. (One of many checks...)
+ %% Used to give an error message, but now allowed.
+ ?line ok = file:write_file(Filename,
+ <<"Terminals t.
+ Nonterminals nt.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t.
+ Erlang code.">>),
+ ?line {ok, _, []} = yecc:file(Filename, Ret),
+
+ %% Precedence with swapped arguments. Bad declaration.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t.
+ Right t.
+ Left nt 100.">>),
+ ?line {ok,_,[{_,[{6,yecc,bad_declaration},{7,yecc,bad_declaration}]}]} =
+ yecc:file(Filename, Ret),
+
+ %% Precedence with unknown operator.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t.
+ Unary 100 '-'.">>),
+ ?line {error,[{_,[{6,yecc,{precedence_op_is_unknown,'-'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Precedence with endsymbol operator.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t.
+ Unary 100 e.">>),
+ ?line {error,[{_,[{6,yecc,{precedence_op_is_endsymbol,e}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Duplicated precedence.
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals nt.
+ Terminals t '+'.
+ Rootsymbol nt.
+ nt -> t '+' nt.
+ Left 100 '+'.
+ Right 200 t.
+ Left 200 '+'.
+ Left 200 '+'.
+ Right 200 t.">>),
+ ?line {error,[{_,[{8,yecc,{duplicate_precedence,'+'}},
+ {9,yecc,{duplicate_precedence,'+'}},
+ {10,yecc,{duplicate_precedence,t}}]}],
+ []} = yecc:file(Filename, Ret),
+
+ %% Duplicated nonterminal.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals 'n t' 'n t'. Terminals t.
+ Rootsymbol 'n t'. 'n t' -> t.">>),
+ ?line {ok, _, [{_,[{1,yecc,{duplicate_nonterminal,'n t'}}]}]} =
+ yecc:file(Filename, Ret),
+ ?line {ok, _, [{_,[{1,yecc,{duplicate_nonterminal,'n t'}}]}]} =
+ yecc:file(Filename, [return_warnings, {report, false}]),
+ ?line {ok, _} = yecc:file(Filename),
+ ?line {ok, _} =
+ yecc:file(Filename, [{report,false}, {return_warnings,false}]),
+
+ %% Duplicated terminal.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals 't t' 't t'.
+ Rootsymbol nt. nt -> 't t'.">>),
+ ?line {ok, _, [{_,[{1,yecc,{duplicate_terminal,'t t'}}]}]} =
+ yecc:file(Filename, Ret),
+
+ %% Two Nonterminals declarations.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t.
+ Nonterminals nt2.
+ Rootsymbol nt2. nt -> t. nt2 -> nt.">>),
+ ?line {error,[{_,[{2,yecc,{duplicate_declaration,'Nonterminals'}}]}],
+ []} = yecc:file(Filename, Ret),
+
+ %% Three Terminals declarations.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t.
+ Terminals t1.
+ Terminals t1.
+ Rootsymbol nt. nt -> t t1.">>),
+ ?line {error,[{_,[{2,yecc,{duplicate_declaration,'Terminals'}},
+ {3,yecc,{duplicate_declaration,'Terminals'}}]}],
+ []} = yecc:file(Filename, Ret),
+
+ %% Two root symbols.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol t.
+ Rootsymbol nt. nt -> t.">>),
+ ?line {error,[{_,[{2,yecc,{duplicate_declaration,'Rootsymbol'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Two end symbols.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol t.
+ Endsymbol e.
+ Endsymbol e. nt -> t.">>),
+ ?line {error,[{_,[{3,yecc,{duplicate_declaration,'Endsymbol'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Two end symbols.
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol t.
+ Expect 1.
+ Expect 0.
+ Endsymbol e. nt -> t.">>),
+ ?line {error,[{_,[{3,yecc,{duplicate_declaration,'Expect'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Some words should not be used.
+ ?line ok = file:write_file(Filename, <<"
+ Terminals '$empty' '$end'.
+ Nonterminals '$undefined'.
+ Rootsymbol '$undefined'.
+ Endsymbol '$end'.
+ '$undefined' -> '$empty'.
+ ">>),
+ ?line {error,[{_,[{2,yecc,{reserved,'$empty'}},
+ {2,yecc,{reserved,'$end'}},
+ {3,yecc,{reserved,'$undefined'}},
+ {5,yecc,{endsymbol_is_terminal,'$end'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Undefined pseudo variable.
+ ?line ok = file:write_file(Filename,<<"
+ Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ nt -> t : '$2'.
+ ">>),
+ ?line {error,[{_,[{5,yecc,{undefined_pseudo_variable,'$2'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Space in module name.
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals list.
+ Terminals element.
+ Rootsymbol list.
+
+ list -> element : {single, '$1'}.
+ list -> list element : {pair, '$1', '$2'}.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ L = [{element, 1}, {element, 2}, {element, 3}],
+ {ok,_} = parse(L),
+ ok.
+ ">>),
+
+ Parserfile2 = filename:join(Dir, "a \"file\""),
+ %% The parser (yeccgramm.yrl) allows many symbol names...
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals Nonterminals Rootsymbol ':' '->'.
+ Terminals Terminals.
+ Rootsymbol Rootsymbol.
+ Endsymbol e.
+ Rootsymbol -> Nonterminals ':' '->'.
+ Nonterminals -> Terminals.
+ ':' -> '->'.
+ '->' -> Terminals.
+ ">>),
+ ?line {ok, _} = yecc:file(Filename, [{parserfile, Parserfile1}]),
+ ?line {ok, _} = yecc:file(Filename, [{parserfile, Parserfile1},time]),
+ ?line {ok,[]} = compile:file(Parserfile1, [basic_validation]),
+
+ Quotes = <<"
+ Nonterminals
+ tail try 17 42 Unused ' unused ' '42' 'fnutt\\'' receive.
+
+ Terminals
+ ']' '|' ',' '\"hi\"' 'there\\'' 'you\\'' ACCEPT.
+
+ Rootsymbol 17.
+
+ Endsymbol '$end'.
+
+ 17 -> try : '$1':more([\"hi \\\" there\", '.', 3.14, % $3 , % '$1' is a module
+ -104, ' ', ' a', '->', $a, $\t]), '$1'.
+
+ try -> tail 'you\\'' 'fnutt\\''.
+
+ 'fnutt\\'' -> 'you\\'' ACCEPT.
+
+ '42' -> tail.
+
+ tail -> ']' :
+ (fun(Strange) -> foo end)(apa).
+ tail -> '|' try ']' :
+ (fun(Strange) -> foo;
+ (_) -> 'when' % warning
+ end)('ap a', foo),
+ %% This line intentionally left blank.
+ R = #rec{},
+ A = R#rec.a,
+ <<\"hi\">> = <<\"hi\">>,
+ there.
+ tail -> ',' try tail : {cons,line('$2'),'$2','$3'}.
+
+
+ Erlang code.
+
+ -export([t/0]).
+
+ -record(rec, {a}).
+
+ just(Some, Code) ->
+ true.
+
+ more(Code) ->
+ io:format(\"~p~n\", [Code]), true.
+
+ line(_) ->
+ 17.
+
+ t() ->
+ ok. % compiled successfully...
+
+ ">>,
+
+ ?line ok = file:write_file(Filename, Quotes),
+ ?line {ok,_,[{_,
+ [{3,yecc,{unused_nonterminal,42}},
+ {3,yecc,{unused_nonterminal,' unused '}},
+ {3,yecc,{unused_nonterminal,'42'}},
+ {3,yecc,{unused_nonterminal,'Unused'}},
+ {3,yecc,{unused_nonterminal,'receive'}},
+ {6,yecc,{unused_terminal,'"hi"'}},
+ {6,yecc,{unused_terminal,'there\''}}]}]} =
+ yecc:file(Filename, Ret),
+
+ Ts = [{quotes, Quotes, default, ok}],
+ ?line run(Config, Ts),
+
+ %% Non-terminal has no rules, but is unused.
+ ?line ok = file:write_file(Filename,<<"
+ Nonterminals nt bad.
+ Terminals t.
+ Rootsymbol nt.
+
+ nt -> t : something.
+ ">>),
+ ?line {ok,_,[{_,[{2,yecc,{unused_nonterminal,bad}}]}]} =
+ yecc:file(Filename, Ret),
+
+ %% Non-terminal has no rules and is used.
+ ?line ok = file:write_file(Filename,<<"
+ Nonterminals nt bad.
+ Terminals t.
+ Rootsymbol nt.
+
+ nt -> t bad : something.
+ ">>),
+ ?line {error,[{_,[{2,yecc,{missing_syntax_rule,bad}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% Warning in Erlang code. With and without file attributes.
+ ?line ok = file:write_file(Filename,<<"
+ Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+
+ nt -> t : t(17).
+
+ Erlang code.
+
+ t(A) ->
+ b.
+ ">>),
+ ?line {ok, _, []} =
+ yecc:file(Filename, [file_attributes | Ret]),
+ Opts = [basic_validation, return],
+ Erlfile = filename:join(Dir, "file.erl"),
+ ?line {ok,[],[{_,[{10,_,_}]}]} = compile:file(Erlfile, Opts),
+ ?line {ok, _, []} =
+ yecc:file(Filename, [{file_attributes,false} | Ret]),
+ ?line {ok,[],[{_,[{4,_,_}]}]} = compile:file(Erlfile, Opts),
+
+ file:delete(Parserfile1 ++ ".erl"),
+ file:delete(Parserfile2 ++ ".erl"),
+ file:delete(Filename),
+
+ ok.
+
+compile(doc) ->
+ "Check of compile/3.";
+compile(suite) -> [];
+compile(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Filename = filename:join(Dir, "file.yrl"),
+ Parserfile = filename:join(Dir, "file.erl"),
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ nt -> t.">>),
+ ?line error = yecc:compile(Filename, "//", #options{}),
+ ?line ok = yecc:compile(Filename, Parserfile, #options{}),
+ file:delete(Parserfile),
+ file:delete(Filename),
+ ok.
+
+rules(doc) ->
+ "Check of rules.";
+rules(suite) -> [];
+rules(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Ret = [return, {report, false}],
+ Filename = filename:join(Dir, "file.yrl"),
+
+ ?line ok = file:write_file(Filename,
+ <<"Nonterminals nt. Terminals t. Rootsymbol nt.
+ nt -> t. nt -> t.">>),
+ ?line {error,[{_,[{none,yecc,{conflict,_}}]}],
+ [{_,[{none,yecc,{conflicts,0,1}}]}]} =
+ yecc:file(Filename, [return, report]),
+
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals A B E.
+ Terminals c d f x y.
+ Rootsymbol A.
+
+ A -> B c d.
+ A -> E c f.
+ B -> x y.
+ E -> x y.
+ ">>),
+ ?line {error,[{_,[{none,yecc,{conflict,_}}]}],
+ [{_,[{none,yecc,{conflicts,0,1}}]}]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename,<<"
+ Terminals t.
+ Nonterminals nt.
+ Rootsymbol nt.
+ nt -> '$empty' : '$1'.
+ nt -> t.
+ ">>),
+ ?line {error,[{_,[{5,yecc,{undefined_pseudo_variable,'$1'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename,<<"
+ Terminals t.
+ Nonterminals nt.
+ Rootsymbol nt.
+ nt -> '$empty' : '$0'.
+ nt -> t.
+ ">>),
+ ?line {error,[{_,[{5,yecc,{undefined_pseudo_variable,'$0'}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ file:delete(Filename),
+
+ %% No precedences.
+ Ts = [{rules_1,<<"
+ Nonterminals exp.
+ Terminals number '*' '+' '(' ')'.
+ Rootsymbol exp.
+
+ exp -> exp '+' exp : {plus,'$1','$3'}.
+ exp -> exp '*' exp : {times,'$1','$3'}.
+ exp -> number : element(2, '$1').
+ exp -> '(' exp ')' : '$2'.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ {ok, {times, 1, {plus, 3, 5}}} =
+ parse([{number,1}, {'*',2}, {number,3},
+ {'+',4}, {number,5}]),
+ ok.
+ ">>,
+ default,
+ ok}],
+ ?line run(Config, Ts),
+ ok.
+
+examples(suite) ->
+ [empty, prec, yeccpre, lalr, old_yecc, other_examples].
+
+expect(doc) ->
+ "Check of expect.";
+expect(suite) -> [];
+expect(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Ret = [return, {report, true}],
+ Filename = filename:join(Dir, "file.yrl"),
+
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals e.
+ Terminals i t else.
+ Rootsymbol e.
+ Expect a.
+
+ e -> i e t e.
+ e -> i e t e else e.
+ ">>),
+ ?line {error,[{_,[{5,yecc,{bad_expect,a}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals e.
+ Terminals i t else.
+ Rootsymbol e.
+ Expect 1.
+
+ e -> i e t e.
+ e -> i e t e else e.
+ ">>),
+ ?line {ok, _, []} = yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals e.
+ Terminals i t else.
+ Rootsymbol e.
+ Expect 2.
+
+ e -> i e t e.
+ e -> i e t e else e.
+ ">>),
+ ?line {ok, _, [{_,[{none,yecc,{conflicts,1,0}}]}]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals e.
+ Terminals i t else.
+ Rootsymbol e.
+ Expect -2.
+
+ e -> i e t e.
+ e -> i e t e else e.
+ ">>),
+ ?line {error,[{_,[{5,yecc,{error,_yeccparser,_}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ %% States N. An undocumented declaration used for testing.
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ States 100.
+ nt -> t.">>),
+ ?line {ok,_,[{_, [{none,yecc,{n_states,100,3}}]}]} =
+ yecc:file(Filename, Ret),
+
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ States bad.
+ nt -> t.">>),
+ ?line {error,[{_,[{5,yecc,{bad_states,bad}}]}],[]} =
+ yecc:file(Filename, Ret),
+
+ file:delete(Filename),
+ ok.
+
+conflicts(doc) ->
+ "Shift/reduce and reduce/reduce conflicts.";
+conflicts(suite) -> [];
+conflicts(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Ret = [return, {report, true}],
+ Filename = filename:join(Dir, "file.yrl"),
+
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals S List Tuple Elements Element.
+ Terminals '{' '}' '[' ']' ',' nil e.
+ Rootsymbol S.
+
+ S -> '$empty' : empty.
+ S -> List : '$1'.
+
+ List -> '$empty' : [].
+ List -> nil : [].
+ List -> '[' Tuple ']' : {list, '$2'}.
+
+ Tuple -> '$empty' : {}.
+ Tuple -> '{' '}' : {}.
+ Tuple -> '{' Elements '}' : {tuple, '$2'}.
+
+ Elements -> '$empty' : none.
+ Elements -> Elements ',' Element : {elements, '$3', '$1'}.
+ Elements -> Element : '$1'.
+
+ Element -> List : '$1'.
+ Element -> Tuple : '$1'.
+ Element -> e : '$1'.
+ ">>),
+ ?line {error,[{_,_}],[{_,[{none,yecc,{conflicts,1,5}}]}]} =
+ yecc:file(Filename, Ret),
+
+ %% Can easily be resolved (but don't do it!).
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals S List Tuple Elements Element.
+ Terminals '{' '}' '[' ']' ',' nil e.
+ Rootsymbol S.
+
+ Right 100 List.
+
+ S -> '$empty' : empty.
+ S -> List : '$1'.
+
+ List -> '$empty' : [].
+ List -> nil : [].
+ List -> '[' Tuple ']' : {list, '$2'}.
+
+ Tuple -> '$empty' : {}.
+ Tuple -> '{' '}' : {}.
+ Tuple -> '{' Elements '}' : {tuple, '$2'}.
+
+ Elements -> '$empty' : none.
+ Elements -> Elements ',' Element : {elements, '$3', '$1'}.
+ Elements -> Element : '$1'.
+
+ Element -> List : '$1'.
+ Element -> Tuple : '$1'.
+ Element -> e : '$1'.
+ ">>),
+ ?line {ok, _, []} =
+ yecc:file(Filename, Ret),
+
+ file:delete(Filename),
+ ok.
+
+empty(doc) ->
+ "'$empty'.";
+empty(suite) -> [];
+empty(Config) when is_list(Config) ->
+ Ts = [{empty_1, <<"
+ Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> '$empty': nothing.
+ nt -> t : something.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ {ok, nothing} = parse([{e,2}]),
+ {ok, something} = parse([{t,1},{e,2}]),
+ ok.">>,
+ default,
+ ok},
+ {empty_2, <<"
+ %% There used to be a bug when it came to the left
+ %% corners. In this example rule 2 is a prefix of rule 1
+ %% such that the rule 2 generates $empty but rule 1 does
+ %% not. The old buggy code seemingly worked well too.
+ Nonterminals top A B C D.
+ Terminals t.
+ Rootsymbol top.
+
+ top -> A B C D : {'$1','$2','$3','$4'}.
+ top -> A B C : {'$1','$2','$3'}.
+
+ A -> '$empty' : e.
+ B -> '$empty' : e.
+ C -> '$empty' : e.
+
+ D -> t : t.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ {ok,{e,e,e,t}} = parse([{t, 1}]),
+ {ok,{e,e,e}} = parse([]),
+ ok.
+ ">>,
+ default,
+ ok}],
+ ?line run(Config, Ts),
+ ok.
+
+prec(doc) ->
+ "Precedence.";
+prec(suite) -> [];
+prec(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Ret = [return, {report, false}],
+ Filename = filename:join(Dir, "file.yrl"),
+
+ %% Don't know what 'Unary' actually means, but this is how it has
+ %% always worked...
+ ?line ok = file:write_file(Filename, <<"
+ Nonterminals E.
+ Terminals '*' '+' '=' integer.
+ Rootsymbol E.
+
+ E -> E '=' E : {op, '=', '$1', '$3'}.
+ E -> E '*' E : {op, '*', '$1', '$3'}.
+ E -> E '+' E : {op, '+', '$1', '$3'}.
+ E -> integer : '$1'.
+
+ Unary 100 '='.
+ Left 200 '+'.
+ Left 400 '*'.
+ ">>),
+ ?line {error,[{_,[{none,yecc,{conflict,_}}]}],
+ [{_,[{none,yecc,{conflicts,1,0}}]}]} =
+ yecc:file(Filename, Ret),
+
+ Ts = [{prec_1, <<"
+ Nonterminals E Expr Uminus.
+ Terminals '=' '+' '*' '-' '(' ')' integer var dot.
+ Rootsymbol Expr.
+
+ Expr -> E dot : '$1'.
+ E -> var '=' E : {match, line_of('$1'), '$1', '$3'}.
+ E -> E '+' E : {op, line_of('$1'), '+', '$1', '$3'}.
+ E -> E '-' E : {op, line_of('$1'), '-', '$1', '$3'}.
+ E -> E '*' E : {op, line_of('$1'), '*', '$1', '$3'}.
+ E -> Uminus : '$1'.
+ E -> '(' E ')' : '$2'.
+ E -> integer : '$1'.
+
+ Uminus -> '-' E : {op, line_of('$1'), '-', '$2'}.
+
+ Right 200 '='.
+ Left 300 '+'.
+ Left 300 '-'.
+ Left 400 '*'.
+ Unary 500 Uminus.
+
+ Erlang code.
+
+ -export([t/0, t/1]).
+
+ line_of(Token) ->
+ element(2, Token).
+
+ t() ->
+ {ok, -56} = t(\"A = (4 + 3) * - 8. \"),
+ {ok, 28} = t(\"A = 4 + B=3 * 8. \"),
+ {ok, 28} = t(\"4 - 3 * - 8. \"),
+ {ok, -20} = t(\"4 - 3 * 8. \"),
+ {ok, 2} = t(\"1 - - 1.\"),
+ ok.
+
+ t(S) ->
+ case erl_scan:string(S) of
+ {ok, Tokens, _Line} ->
+ case parse(Tokens) of
+ {ok, Expr} ->
+ case catch erl_eval:expr(Expr, []) of
+ {value, Value, _Bs} ->
+ {ok, Value};
+ {'EXIT', Reason} ->
+ {error, Reason}
+ end;
+ Error ->
+ Error
+ end;
+ Error ->
+ Error
+ end.
+ ">>,
+ default,
+ ok},
+
+ {prec_2, <<"
+ Nonterminals E uminus.
+ Terminals '*' '-' integer.
+ Rootsymbol E.
+
+ E -> E '-' E : {op, '-', '$1', '$3'}.
+ E -> E '*' E : {op, '*', '$1', '$3'}.
+ E -> uminus: '$1'.
+ E -> integer : '$1'.
+
+ uminus -> '-' E : {op, '-', '$2'}.
+
+ Left 200 '-'.
+ Left 400 '*'.
+ Unary 500 uminus.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ %% This used to be parsed -(4 * 3), but that has been corrected:
+ {ok,{op,'*',{op,'-',{integer,1,4}},{integer,3,12}}} =
+ parse([{'-',0},{integer,1,4},{'*',2},{integer,3,12}]),
+
+ {ok,{op,'-',{op,'-',{integer,1,4}},{integer,3,12}}} =
+ parse([{'-',0},{integer,1,4},{'-',2},{integer,3,12}]),
+ {ok,{op,'*',{op,'-',{op,'-',{integer,2,4}}},{integer,4,12}}} =
+ parse([{'-',0},{'-',1},{integer,2,4},{'*',3},{integer,4,12}]),
+ {ok,{op,'-',{integer,1,4},{op,'-',{integer,4,12}}}} =
+ parse([{integer,1,4},{'-',2},{'-',3},{integer,4,12}]),
+ ok.
+ ">>,
+ default,
+ ok},
+ {prec_3, <<"
+ Nonterminals nt.
+ Terminals '(' ')' t op.
+ Rootsymbol nt.
+
+ Nonassoc 100 op.
+
+ nt -> nt op nt : {'$2', '$1', '$3'}.
+ nt -> '(' nt ')' : '$2'.
+ nt -> t : '$1'.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ {error,{4,yecc_test,[\"syntax error before: \",\"op\"]}} =
+ parse([{t,1},{op,2},{t,3},{op,4},{t,5}]),
+ {ok,{{op,2},{t,1},{{op,5},{t,4},{t,6}}}} =
+ parse([{t,1},{op,2},{'(',3},{t,4},{op,5},{t,6},{')',7}]),
+ ok.
+ ">>,
+ default,
+ ok},
+
+ {prec_4, <<"
+ Nonterminals E.
+ Terminals '-' '+' '=' id.
+ Rootsymbol E.
+
+ E -> E '=' E : {op, '=', '$1', '$3'}.
+ E -> E '+' E : {op, '+', '$1', '$3'}.
+ E -> '-' E : {op, '-', '$2'}.
+ E -> id : '$1'.
+
+ Nonassoc 100 '='.
+ Right 200 '+' '-'.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ {ok,{op,'=',{id,1},{op,'-',{op,'+',{id,4},{id,6}}}}} =
+ parse([{id,1},{'=',2},{'-',3},{id,4},{'+',5},{id,6}]),
+ ok.
+
+ ">>,
+ default,
+ ok}],
+
+ ?line run(Config, Ts),
+ ok.
+
+yeccpre(doc) ->
+ "Errors etc. in actions, handled by yeccpre. parse_and_scan.";
+yeccpre(suite) -> [];
+yeccpre(Config) when is_list(Config) ->
+ Ts = [{error_1, <<"
+ Nonterminals list.
+ Terminals element e.
+ Rootsymbol list.
+
+ list -> element : {single, '$1'}.
+ list -> list element : throw(error).
+ list -> e : return_error(element(2, '$1'), bad_element).
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ error = (catch parse([{element,1},{element,2}])),
+ {error, {2, _, Mess}} = parse([{element,1},{e,2}]),
+ ok.
+ ">>,
+ default,
+ ok},
+
+ {error_2, <<"
+ Nonterminals list.
+ Terminals element.
+ Rootsymbol list.
+
+ list -> element.
+
+ Erlang code.
+
+ -export([t/0, scan/1]).
+
+ scan(How) ->
+ case How of
+ thrown -> throw(thrown);
+ error -> erlang:error(error);
+ exit -> exit(exit)
+ end.
+
+ t() ->
+ try parse_and_scan({yecc_test, scan, [thrown]})
+ catch throw: thrown ->
+ ok
+ end,
+ try parse_and_scan({yecc_test, scan, [error]})
+ catch error: error ->
+ ok
+ end,
+ try parse_and_scan({{yecc_test, scan}, [exit]})
+ catch exit: exit ->
+ ok
+ end,
+ try parse_and_scan({fun scan/1, [thrown]})
+ catch throw: thrown ->
+ ok
+ end,
+ ok.
+ ">>,
+ default,
+ ok}],
+
+ ?line run(Config, Ts),
+ ok.
+
+lalr(doc) ->
+ "Examples of grammars that are LALR(1) but not SLR(1).";
+lalr(suite) -> [];
+lalr(Config) when is_list(Config) ->
+ Ts = [{lalr_1, <<"
+ %% http://inst.cs.berkeley.edu/~cs164/lectures/slide14a.pdf
+ %% http://pages.cpsc.ucalgary.ca/~robin/class/411/LR.1.html
+ %% b d . c. Shift or reduce?
+ Nonterminals S A.
+ Terminals a b c d.
+ Rootsymbol S.
+ S -> A a : {r1,'$1','$2'}.
+ S -> b A c : {r2,'$1','$2','$3'}.
+ S -> d c : {r3,'$1','$2'}.
+ S -> b d a : {r4,'$1','$2','$3'}.
+
+ A -> d : {r5,'$1'}.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ %% Reduce!
+ {ok,{r2,{b,1},{r5,{d,2}},{c,3}}} = parse([{b,1},{d,2},{c,3}]),
+ ok.
+ ">>,
+ default,
+ ok},
+ {lalr_2, <<"
+ %% http://www.cs.pitt.edu/~mock/cs2210/lectures/lecture5.pdf
+ Nonterminals S L R.
+ Terminals '*' id '='.
+ Rootsymbol S.
+ S -> L '=' R : {r1,'$1','$3'}.
+ S -> R : {r2,'$1'}.
+
+ L -> '*' R : {r3,'$2'}.
+ L -> id : {r4,'$1'}.
+
+ R -> L : {r5,'$1'}.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ {ok,{r1,{r3,{r5,{r4,{id,1}}}},{r5,{r4,{id,3}}}}} =
+ parse([{'*',0},{id,1},{'=',2},{id,3}]),
+ ok.
+ ">>,
+ default,
+ ok}],
+ ?line run(Config, Ts),
+ ok.
+
+old_yecc(doc) ->
+ "The old interface yecc:yecc/2,3,4.";
+old_yecc(suite) -> [];
+old_yecc(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Filename = filename:join(Dir, "file.yrl"),
+ Parserfile = filename:join(Dir, "file.erl"),
+ Mini = <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ nt -> t.">>,
+ ?line ok = file:write_file(Filename, Mini),
+ ?line {_, _} = yecc:yecc(Filename, Parserfile),
+ ?line {_, _} = yecc:yecc(Filename, Parserfile, true),
+ ?line {_, _} = yecc:yecc(Filename, Parserfile, true),
+ TE = process_flag(trap_exit, true),
+ ?line {'EXIT', error} =
+ (catch yecc:yecc(Filename, Parserfile, false, Parserfile)),
+ _ = process_flag(trap_exit, TE),
+ ok.
+
+other_examples(doc) ->
+ "Misc examples.";
+other_examples(suite) -> [];
+other_examples(Config) when is_list(Config) ->
+ Ts = [{empty, <<"
+ %% G1 from the 1974 article.
+
+ Nonterminals LIST ELEMENT.
+ Terminals ',' a b.
+ Rootsymbol LIST.
+
+ LIST -> LIST ',' ELEMENT : {'$1', '$3'}.
+ LIST -> ELEMENT : '$1'.
+
+ ELEMENT -> a : '$1'.
+ ELEMENT -> b : '$1'.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ L = [{a, 1}, {',', 2}, {b, 3}],
+ {ok,{{a,1},{b,3}}} = parse(L),
+ ok.
+ ">>,
+ default,
+ ok}],
+ ?line run(Config, Ts),
+ ok.
+
+bugs(suite) ->
+ [otp_5369, otp_6362, otp_7945].
+
+otp_5369(doc) ->
+ "OTP-5369. A bug in parse_and_scan reported on erlang questions.";
+otp_5369(suite) -> [];
+otp_5369(Config) when is_list(Config) ->
+ Ts = [{otp_5369,<<"
+ Nonterminals list.
+ Terminals element.
+ Rootsymbol list.
+
+ list -> element : {single, '$1'}.
+ list -> list element : {pair, '$1', '$2'}.
+
+ Erlang code.
+
+ -export([t/0, scan/1]).
+
+ scan(Lexer) ->
+ Lexer ! {scan, self()},
+ receive
+ {ok, Lexer, [Token], Position} ->
+ {ok, [Token], Position};
+ {eof, Lexer, Position} ->
+ {eof, Position}
+ end.
+
+ make_scanner(L) ->
+ spawn_link(fun() ->
+ loop(L)
+ end).
+
+ loop([]) ->
+ receive
+ {scan, Pid} ->
+ Pid ! {eof, self(), 1000}
+ end;
+ loop([Token = {_, P}|T]) ->
+ receive
+ {scan, Pid} ->
+ Pid ! {ok, self(), [Token], P},
+ loop(T)
+ end.
+
+ t(L) ->
+ case parse_and_scan({yecc_test, scan, [make_scanner(L)]}) of
+ {ok, _Result} ->
+ ok;
+ {error, {_LineNumber, Module, Message}} ->
+ _M = apply(Module, format_error, [Message]),
+ not_ok
+ end.
+
+ t() ->
+ not_ok = t([]), %% This test has been added afterwards.
+ %% OTP-5369 did not fix this bug!
+ L = [{element, 1},
+ {element, 2},
+ {element, 3}],
+ t(L).
+ ">>,
+ default,
+ ok}],
+ ?line run(Config, Ts),
+ ok.
+
+otp_6362(doc) ->
+ "OTP-6362. A precedence declaration bug reported on erlang questions.";
+otp_6362(suite) -> [];
+otp_6362(Config) when is_list(Config) ->
+ Ts = [{otp_6362_1,<<"
+ Nonterminals cmp compare expr.
+ Terminals 'string' '>' '='.
+ Rootsymbol compare.
+ Nonassoc 250 cmp.
+ compare -> expr cmp expr : {cmp, '$2', '$1', '$3'}.
+ compare -> expr : {cmp, '==', '$1', {string, \"TRUE\"}}.
+ cmp -> '>' '=' : '>='.
+ cmp -> '>' : '>'.
+ expr -> 'string' : '$1'.
+
+ Erlang code.
+
+ -export([t/0]).
+
+ t() ->
+ {ok,{cmp,'>',{string,1},{string,3}}} =
+ parse([{string,1}, {'>', 2}, {string,3}]),
+ ok.
+ ">>,
+ default,
+ ok}],
+ ?line run(Config, Ts),
+
+ Dir = ?privdir,
+ %% Report errors. Very simple test of format_error/1.
+ Ret = [return, {report, true}],
+ Filename = filename:join(Dir, "file.yrl"),
+
+ %% An error introduced due to this ticket. Terminals can be
+ %% assigned conflicting precedences, which cannot be resolved.
+ ?line ok = file:write_file(Filename,<<"
+ Nonterminals cmp compare expr fopp.
+ Terminals string '>' '='.
+ Rootsymbol compare.
+ Nonassoc 250 cmp.
+ Left 300 '>'.
+
+ compare -> expr cmp expr : {cmp, '$2', '$1', '$3'}.
+ compare -> expr fopp expr : {cmp, '$2', '$1', '$3'}.
+ compare -> expr '=' expr : '$1'.
+ compare -> expr : {cmp, '==', '$1', {string, foo}}.
+ cmp -> '>' '=' : '>='.
+ cmp -> '>' : '>'.
+ expr -> string : '$1'.
+
+ fopp -> '>' '=' : '>='.
+ fopp -> '>' : '>'.">>),
+
+ Ret = [return, {report, true}],
+ ?line {error,[{_,[{none,yecc,{conflict,_}}]}],[]} =
+ yecc:file(Filename, Ret),
+ file:delete(Filename),
+ ok.
+
+my_yeccpre() ->
+ %% Version 1.1.
+ <<"parse(Tokens) ->
+ yeccpars0(Tokens, false).
+
+ parse_and_scan({F, A}) -> % Fun or {M, F}
+ yeccpars0([], {F, A});
+ parse_and_scan({M, F, A}) ->
+ yeccpars0([], {{M, F}, A}).
+
+ format_error(Message) ->
+ case io_lib:deep_char_list(Message) of
+ true ->
+ Message;
+ _ ->
+ io_lib:write(Message)
+ end.
+
+ % To be used in grammar files to throw an error message to the parser
+ % toplevel. Doesn't have to be exported!
+ -compile({nowarn_unused_function,{return_error,2}}).
+ return_error(Line, Message) ->
+ throw({error, {Line, yecc_test, Message}}).
+
+ yeccpars0(Tokens, MFA) ->
+ try yeccpars1(Tokens, MFA, 0, [], [])
+ catch
+ throw: {error, {_Line, yecc_test, _M}} = Error ->
+ Error % probably from return_error/1
+ end.
+
+ % Don't change yeccpars1/6 too much, it is called recursively by yeccpars2/8!
+ yeccpars1([Token | Tokens], Tokenizer, State, States, Vstack) ->
+ yeccpars2(State, element(1, Token), States, Vstack, Token, Tokens,
+ Tokenizer);
+ yeccpars1([], {F, A}, State, States, Vstack) ->
+ case apply(F, A) of
+ {ok, Tokens, _Endline} ->
+ yeccpars1(Tokens, {F, A}, State, States, Vstack);
+ {eof, _Endline} ->
+ yeccpars1([], false, State, States, Vstack);
+ {error, Descriptor, _Endline} ->
+ {error, Descriptor}
+ end;
+ yeccpars1([], false, State, States, Vstack) ->
+ yeccpars2(State, '$end', States, Vstack, {'$end', 999999}, [], false).
+
+ % For internal use only.
+ yeccerror(Token) ->
+ {error,
+ {element(2, Token), yecc_test,
+ [\"syntax error before: \", yecctoken2string(Token)]}}.
+
+ yecctoken2string({atom, _, A}) -> io_lib:write(A);
+ yecctoken2string({integer,_,N}) -> io_lib:write(N);
+ yecctoken2string({float,_,F}) -> io_lib:write(F);
+ yecctoken2string({char,_,C}) -> io_lib:write_char(C);
+ yecctoken2string({var,_,V}) -> io_lib:format('~s', [V]);
+ yecctoken2string({string,_,S}) -> io_lib:write_string(S);
+ yecctoken2string({reserved_symbol, _, A}) -> io_lib:format('~w', [A]);
+ yecctoken2string({_Cat, _, Val}) -> io_lib:format('~w', [Val]);
+ yecctoken2string({'dot', _}) -> io_lib:format('~w', ['.']);
+ yecctoken2string({'$end', _}) ->
+ [];
+ yecctoken2string({Other, _}) when is_atom(Other) ->
+ io_lib:format('~w', [Other]);
+ yecctoken2string(Other) ->
+ io_lib:write(Other).
+">>.
+
+otp_7945(doc) ->
+ "OTP-7945. A bug introduced in R13A.";
+otp_7945(suite) -> [];
+otp_7945(Config) when is_list(Config) ->
+ ?line {error,_} = erl_parse:parse([{atom,3,foo},{'.',2,9,9}]),
+ ok.
+
+improvements(suite) ->
+ [otp_7292, otp_7969].
+
+otp_7292(doc) ->
+ "OTP-7292. Header declarations for edoc.";
+otp_7292(suite) -> [];
+otp_7292(Config) when is_list(Config) ->
+ Dir = ?privdir,
+ Filename = filename:join(Dir, "file.yrl"),
+ Parserfile1 = filename:join(Dir, "a file"),
+
+ Contents = <<"Nonterminals nt.
+ Terminals t.
+ Rootsymbol nt.
+ Endsymbol e.
+ nt -> t : a bad code.
+
+ Header \"%% copyright bla bla bla\"
+ \"%% @private\" \"%% foo\"
+ \"%% @author X.Y.\".
+
+ Erlang code.
+
+ %% @private
+ %% etc.
+
+ foo() ->
+ bar. ">>,
+
+ %% Check that correct line number is used in messages.
+ ?line ok = file:write_file(Filename, Contents),
+ ParserFile3 = [{parserfile, Parserfile1}],
+ Ret = [return, {report, true}],
+ ?line {ok, _, []} = yecc:file(Filename, ParserFile3 ++ Ret),
+
+ %% Note: checking the line numbers. Changes when yeccpre.hrl changes.
+ fun() ->
+ SzYeccPre = yeccpre_size(),
+ ?line {error,
+ [{_,[{5,_,["syntax error before: ","bad"]}]},
+ {_,[{L1,_,{undefined_function,{yeccpars2_2_,1}}},
+ {L2,_,{bad_inline,{yeccpars2_2_,1}}}]}],
+ [{_,[{16,_,{unused_function,{foo,0}}}]}]} =
+ compile:file(Parserfile1, [basic_validation, return]),
+ ?line L1 = 34 + SzYeccPre,
+ ?line L2 = 41 + SzYeccPre
+ end(),
+
+ YeccPre = filename:join(Dir, "yeccpre.hrl"),
+ ?line ok = file:write_file(YeccPre,
+ [<<"-export([parse/1, parse_and_scan/1, format_error/1]).\n">>,
+ yeccpre_v1_2()]),
+ Inc = [{includefile,YeccPre}],
+ ?line {ok, _, []} = yecc:file(Filename, ParserFile3 ++ Inc ++ Ret),
+ fun() ->
+ SzYeccPre = yeccpre_size(YeccPre),
+ ?line {error,
+ [{_,[{5,_,["syntax error before: ","bad"]}]},
+ {_,[{L1,_,{undefined_function,{yeccpars2_2_,1}}},
+ {L2,_,{bad_inline,{yeccpars2_2_,1}}}]}],
+ [{_,[{16,_,{unused_function,{foo,0}}}]}]} =
+ compile:file(Parserfile1, [basic_validation, return]),
+ ?line L1 = 33 + SzYeccPre,
+ ?line L2 = 40 + SzYeccPre
+ end(),
+
+ file:delete(YeccPre),
+ file:delete(Parserfile1 ++ ".erl"),
+ file:delete(Filename),
+
+ ok.
+
+yeccpre_v1_2() ->
+ <<"
+parse(Tokens) ->
+ yeccpars0(Tokens, false).
+
+parse_and_scan({F, A}) -> % Fun or {M, F}
+ yeccpars0([], {F, A});
+parse_and_scan({M, F, A}) ->
+ yeccpars0([], {{M, F}, A}).
+
+format_error(Message) ->
+ case io_lib:deep_char_list(Message) of
+ true ->
+ Message;
+ _ ->
+ io_lib:write(Message)
+ end.
+
+-define(CODE_VERSION, \"1.2\").
+
+yeccpars0(Tokens, MFA) ->
+ try yeccpars1(Tokens, MFA, 0, [], [])
+ catch
+ error: Error ->
+ Stacktrace = erlang:get_stacktrace(),
+ try yecc_error_type(Error, Stacktrace) of
+ {syntax_error, Token} ->
+ yeccerror(Token);
+ {missing_in_goto_table=Tag, State} ->
+ Desc = {State, Tag},
+ erlang:raise(error, {yecc_bug, ?CODE_VERSION, Desc},
+ Stacktrace);
+ {missing_in_goto_table=Tag, Symbol, State} ->
+ Desc = {Symbol, State, Tag},
+ erlang:raise(error, {yecc_bug, ?CODE_VERSION, Desc},
+ Stacktrace)
+ catch _:_ -> erlang:raise(error, Error, Stacktrace)
+ end;
+ throw: {error, {_Line, ?MODULE, _M}} = Error ->
+ Error % probably from return_error/2
+ end.
+
+yecc_error_type(function_clause, [{?MODULE,F,[_,_,_,_,Token,_,_]} | _]) ->
+ \"yeccpars2\" ++ _ = atom_to_list(F),
+ {syntax_error, Token};
+yecc_error_type({case_clause,{State}}, [{?MODULE,yeccpars2,_}|_]) ->
+ %% Inlined goto-function
+ {missing_in_goto_table, State};
+yecc_error_type(function_clause, [{?MODULE,F,[State]}|_]) ->
+ \"yeccgoto_\" ++ SymbolL = atom_to_list(F),
+ {ok,[{atom,_,Symbol}]} = erl_scan:string(SymbolL),
+ {missing_in_goto_table, Symbol, State}.
+
+yeccpars1([Token | Tokens], Tokenizer, State, States, Vstack) ->
+ yeccpars2(State, element(1, Token), States, Vstack, Token, Tokens,
+ Tokenizer);
+yeccpars1([], {F, A}, State, States, Vstack) ->
+ case apply(F, A) of
+ {ok, Tokens, _Endline} ->
+ yeccpars1(Tokens, {F, A}, State, States, Vstack);
+ {eof, _Endline} ->
+ yeccpars1([], false, State, States, Vstack);
+ {error, Descriptor, _Endline} ->
+ {error, Descriptor}
+ end;
+yeccpars1([], false, State, States, Vstack) ->
+ yeccpars2(State, '$end', States, Vstack, {'$end', 999999}, [], false).
+
+yeccpars1(State1, State, States, Vstack, Stack1, [Token | Tokens],
+ Tokenizer) ->
+ yeccpars2(State, element(1, Token), [State1 | States],
+ [Stack1 | Vstack], Token, Tokens, Tokenizer);
+yeccpars1(State1, State, States, Vstack, Stack1, [], {F, A}) ->
+ case apply(F, A) of
+ {ok, Tokens, _Endline} ->
+ yeccpars1(State1, State, States, Vstack, Stack1, Tokens, {F, A});
+ {eof, _Endline} ->
+ yeccpars1(State1, State, States, Vstack, Stack1, [], false);
+ {error, Descriptor, _Endline} ->
+ {error, Descriptor}
+ end;
+yeccpars1(State1, State, States, Vstack, Stack1, [], false) ->
+ yeccpars2(State, '$end', [State1 | States], [Stack1 | Vstack],
+ {'$end', 999999}, [], false).
+
+yeccerror(Token) ->
+ {error,
+ {element(2, Token), ?MODULE,
+ [\"syntax error before: \", yecctoken2string(Token)]}}.
+
+yecctoken2string({atom, _, A}) -> io_lib:write(A);
+yecctoken2string({integer,_,N}) -> io_lib:write(N);
+yecctoken2string({float,_,F}) -> io_lib:write(F);
+yecctoken2string({char,_,C}) -> io_lib:write_char(C);
+yecctoken2string({var,_,V}) -> io_lib:format('~s', [V]);
+yecctoken2string({string,_,S}) -> io_lib:write_string(S);
+yecctoken2string({reserved_symbol, _, A}) -> io_lib:format('~w', [A]);
+yecctoken2string({_Cat, _, Val}) -> io_lib:format('~w', [Val]);
+yecctoken2string({'dot', _}) -> io_lib:format('~w', ['.']);
+yecctoken2string({'$end', _}) ->
+ [];
+yecctoken2string({Other, _}) when is_atom(Other) ->
+ io_lib:format('~w', [Other]);
+yecctoken2string(Other) ->
+ io_lib:write(Other).
+">>.
+
+run(Config, Tests) ->
+ F = fun({N,P,Pre,E}) ->
+ case catch run_test(Config, P, Pre) of
+ E ->
+ ok;
+ Bad ->
+ ?t:format("~nTest ~p failed. Expected~n ~p~n"
+ "but got~n ~p~n", [N, E, Bad]),
+ fail()
+ end
+ end,
+ lists:foreach(F, Tests).
+
+otp_7969(doc) ->
+ "OTP-7969. Interface to the I/O protocol..";
+otp_7969(suite) -> [];
+otp_7969(Config) when is_list(Config) ->
+ ?line {ok,Ts1,_} =
+ erl_scan:string("'foo\nbar'", {1,1}, [text]),
+ ?line {error,{2,_,["syntax error before: ",[]]}} = erl_parse:parse(Ts1),
+
+ ?line {ok,Ts1_1,_} = erl_scan:string("'foo\nbar'", 1, [text]),
+ ?line {error,{2,_,["syntax error before: ",[]]}} = erl_parse:parse(Ts1_1),
+
+ ?line {ok,Ts2,_EndLocation} =
+ erl_scan:string("'foo\nbar'", {1,1}, []),
+ %% Can't do better than report possibly wrong line:
+ ?line {error,{1,_,["syntax error before: ",[]]}} = erl_parse:parse(Ts2),
+
+ ?line {ok, Ts11, _}=R1 = erl_scan:string("f() -> a."),
+ ?line F1 = fun() -> {ok,Ts11 ++ [{'$end',2}],2} end,
+ ?line{ok,{function,1,f,0,[{clause,1,[],[],[{atom,1,a}]}]}} =
+ erl_parse:parse_and_scan({F1, []}),
+ ?line F2 = fun() -> erl_scan:string("f() -> ,") end,
+ ?line {error,{1,erl_parse,_}} = erl_parse:parse_and_scan({F2, []}),
+ ?line F3 = fun() -> case erase(foo) of
+ bar ->
+ {ok,[{'$end',2}],3};
+ undefined ->
+ put(foo,bar), R1
+ end
+ end,
+ ?line {ok,{function,1,f,0,[{clause,1,[],[],[{atom,1,a}]}]}} =
+ erl_parse:parse_and_scan({F3,[]}),
+ F4 = fun() -> {error, {1, ?MODULE, bad}, 2} end,
+ ?line {error, {1,?MODULE,bad}} = erl_parse:parse_and_scan({F4, []}),
+ F5 = fun() -> {eof, 3} end,
+ ?line {error,{3,erl_parse,_}} = erl_parse:parse_and_scan({F5, []}),
+ ?line {error,{999999,erl_parse,_}} = erl_parse:parse([]),
+ ?line {ok, Ts21, EL} = erl_scan:string("f() -> a; g() -> b. ", {1,1}),
+ ?line F6 = fun() -> {ok, Ts21, EL} end,
+ ?line {error,{{1,11},erl_parse,_}} = erl_parse:parse_and_scan({F6, []}),
+ ok.
+
+yeccpre_size() ->
+ yeccpre_size(default_yeccpre()).
+
+yeccpre_size(File) ->
+ n_lines(File).
+
+default_yeccpre() ->
+ filename:join([code:lib_dir(parsetools),"include","yeccpre.hrl"]).
+
+n_lines(File) ->
+ {ok, Bin} = file:read_file(File),
+ length([C || C=$\n <- binary_to_list(Bin)]).
+
+run_test(Config, Def, Pre) ->
+ %% io:format("testing ~s~n", [binary_to_list(Def)]),
+ DefFile = 'yecc_test.yrl',
+ Filename = 'yecc_test.erl',
+ DataDir = ?privdir,
+ YrlFile = filename:join(DataDir, DefFile),
+ ErlFile = filename:join(DataDir, Filename),
+ Opts = [return, warn_unused_vars,{outdir,DataDir}],
+ ok = file:write_file(YrlFile, Def),
+ YOpts = [return, {report, false} |
+ case Pre of
+ default ->
+ [];
+ _ ->
+ [{includefile,Pre}]
+ end],
+ P0 = pps(),
+ YRet = yecc:file(YrlFile, [verbose | YOpts]),
+ case {pps(), YRet} of
+ {P0, {ok, _Outfile, _YWs}} ->
+ case compile:file(ErlFile, Opts) of
+ {ok, _M, _Ws} ->
+ AbsFile = filename:rootname(ErlFile, ".erl"),
+ Mod = yecc_test,
+ code:purge(Mod),
+ code:load_abs(AbsFile, Mod),
+ Mod:t();
+ %% warnings(ErlFile, Ws);
+ {error, [{ErlFile,Es}], []} -> {error, Es, []};
+ {error, [{ErlFile,Es}], [{ErlFile,Ws}]} -> {error, Es, Ws};
+ Error -> Error
+ end;
+ {P0, {error, [{YrlFile,YEs}], []}} -> {error, YEs, []};
+ {P0, {error, [{YrlFile,YEs}], [{YrlFile,YWs}]}} -> {error, YEs, YWs};
+ {P0, YError} -> YError;
+ {P, _} ->
+ io:format("failure, got ~p~n, expected ~p\n", [P, P0]),
+ fail()
+ end.
+
+extract(File, {error, Es, Ws}) ->
+ {errors, extract(File, Es), extract(File, Ws)};
+extract(File, Ts) ->
+ lists:append([T || {F, T} <- Ts, F =:= File]).
+
+pps() ->
+ {port_list(), process_list()}.
+
+port_list() ->
+ [{P,safe_second_element(erlang:port_info(P, name))} || P <- erlang:ports()].
+
+process_list() ->
+ [{P,process_info(P, registered_name),
+ safe_second_element(process_info(P, initial_call))} ||
+ P <- processes(), is_process_alive(P)].
+
+safe_second_element({_,Info}) -> Info;
+safe_second_element(Other) -> Other.
+
+fail() ->
+ ?t:fail().
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/public_key/doc/src/Makefile b/lib/public_key/doc/src/Makefile
index 08d1396cca..298c28a740 100644
--- a/lib/public_key/doc/src/Makefile
+++ b/lib/public_key/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%
#
@@ -56,6 +56,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 = note.gif
# ----------------------------------------------------
diff --git a/lib/public_key/test/Makefile b/lib/public_key/test/Makefile
index 2a4687677c..c7215020c7 100644
--- a/lib/public_key/test/Makefile
+++ b/lib/public_key/test/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%
#
@@ -21,7 +21,7 @@ include $(ERL_TOP)/make/target.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk
-INCLUDES= -I. -I$(ERL_TOP)/lib/test_server/include/ -I ../include \
+INCLUDES= -I. -I ../include
# ----------------------------------------------------
# Target Specs
diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl
index 93ae6e6eda..8cc36e490d 100644
--- a/lib/public_key/test/public_key_SUITE.erl
+++ b/lib/public_key/test/public_key_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -23,8 +23,9 @@
%% Note: This directive should only be used in test suites.
-compile(export_all).
--include("test_server.hrl").
--include("test_server_line.hrl").
+-include_lib("test_server/include/test_server.hrl").
+-include_lib("test_server/include/test_server_line.hrl").
+
-include("public_key.hrl").
-define(TIMEOUT, 120000). % 2 min
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/ssh/doc/src/Makefile b/lib/ssh/doc/src/Makefile
index e02f04e7ad..c4d8d9901c 100644
--- a/lib/ssh/doc/src/Makefile
+++ b/lib/ssh/doc/src/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%
#
@@ -58,6 +58,9 @@ XML_CHAPTER_FILES = notes.xml
BOOK_FILES = book.xml
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
# ----------------------------------------------------
HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \
diff --git a/lib/ssh/doc/src/notes.xml b/lib/ssh/doc/src/notes.xml
index ef49bb8b3d..9597137cdf 100644
--- a/lib/ssh/doc/src/notes.xml
+++ b/lib/ssh/doc/src/notes.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2004</year><year>2009</year>
+ <year>2004</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>SSH Release Notes</title>
@@ -31,6 +31,17 @@
<section><title>Ssh 1.1.8</title>
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ In some cases SSH ceased to collect more data from the transport layer.</p>
+ <p>
+ Own Id: OTP-8401 Aux Id: seq11479</p>
+ </item>
+ </list>
+ </section>
+
<section><title>Improvements and New Features</title>
<list>
<item>
diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src
index 3bf772b42b..5329373862 100644
--- a/lib/ssh/src/ssh.appup.src
+++ b/lib/ssh/src/ssh.appup.src
@@ -1,24 +1,25 @@
%%
%% %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%
%%
{"%VSN%",
[
+ {"1.1.7", [{load_module, ssh_connection_handler, soft_purge, soft_purge, []}]},
{"1.1.6", [{restart_application, ssh}]},
{"1.1.5", [{restart_application, ssh}]},
{"1.1.4", [{restart_application, ssh}]},
@@ -26,6 +27,7 @@
{"1.1.2", [{restart_application, ssh}]}
],
[
+ {"1.1.7", [{load_module, ssh_connection_handler, soft_purge, soft_purge, []}]},
{"1.1.6", [{restart_application, ssh}]},
{"1.1.5", [{restart_application, ssh}]},
{"1.1.4", [{restart_application, ssh}]},
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 5240b4b4c5..822ef8f8f9 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%%
@@ -530,6 +530,7 @@ handle_info({Protocol, Socket, Data}, Statename,
case size(EncData0) + size(Data) >= max(8, BlockSize) of
true ->
{Ssh, SshPacketLen, DecData, EncData} =
+
ssh_transport:decrypt_first_block(<<EncData0/binary,
Data/binary>>, Ssh0),
case SshPacketLen > ?SSH_MAX_PACKET_SIZE of
@@ -737,7 +738,8 @@ next_packet(#state{decoded_data_buffer = <<>>,
State) when Buff =/= <<>> andalso size(Buff) >= 8 ->
%% More data from the next packet has been received
%% Fake a socket-recive message so that the data will be processed
- self() ! {Protocol, Socket, <<>>} ,
+ inet:setopts(Socket, [{active, once}]),
+ self() ! {Protocol, Socket, <<>>},
State;
next_packet(#state{socket = Socket} = State) ->
diff --git a/lib/ssh/vsn.mk b/lib/ssh/vsn.mk
index 2b9df4ae60..bc7bceeb24 100644
--- a/lib/ssh/vsn.mk
+++ b/lib/ssh/vsn.mk
@@ -3,7 +3,8 @@
SSH_VSN = 1.1.8
APP_VSN = "ssh-$(SSH_VSN)"
-TICKETS = OTP-8356
+TICKETS = OTP-8356 \
+ OTP-8401
TICKETS_1.1.7 = OTP-8121 \
OTP-8277 \
diff --git a/lib/ssl/doc/src/Makefile b/lib/ssl/doc/src/Makefile
index 54d274ef83..fa263d28ab 100644
--- a/lib/ssl/doc/src/Makefile
+++ b/lib/ssl/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%
#
@@ -52,6 +52,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 = warning.gif
PS_FILES =
diff --git a/lib/ssl/test/ssl_packet_SUITE.erl b/lib/ssl/test/ssl_packet_SUITE.erl
index 929f69c6c6..c59a5c9256 100644
--- a/lib/ssl/test/ssl_packet_SUITE.erl
+++ b/lib/ssl/test/ssl_packet_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -37,7 +37,7 @@
-define(uint24(X), << ?UINT24(X) >> ).
-define(uint32(X), << ?UINT32(X) >> ).
-define(uint64(X), << ?UINT64(X) >> ).
--define(TIMEOUT, 60000).
+-define(TIMEOUT, 120000).
-define(MANY, 1000).
-define(SOME, 50).
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/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl
index 697a69b801..c0f71fb3f5 100644
--- a/lib/stdlib/src/escript.erl
+++ b/lib/stdlib/src/escript.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2007-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
-module(escript).
@@ -180,7 +180,8 @@ parse_and_run(File, Args, Options) ->
is_binary(FormsOrBin) ->
case Source of
archive ->
- case code:set_primary_archive(File, FormsOrBin) of
+ {ok, FileInfo} = file:read_file_info(File),
+ case code:set_primary_archive(File, FormsOrBin, FileInfo) of
ok when CheckOnly ->
case code:load_file(Module) of
{module, _} ->
diff --git a/lib/stdlib/src/filelib.erl b/lib/stdlib/src/filelib.erl
index d65588f0d1..74c5172137 100644
--- a/lib/stdlib/src/filelib.erl
+++ b/lib/stdlib/src/filelib.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
-module(filelib).
@@ -228,7 +228,17 @@ ensure_dir(F) ->
ok;
false ->
ensure_dir(Dir),
- file:make_dir(Dir)
+ case file:make_dir(Dir) of
+ {error,eexist}=EExist ->
+ case do_is_dir(Dir, file) of
+ true ->
+ ok;
+ false ->
+ EExist
+ end;
+ Err ->
+ Err
+ end
end.
diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl
index 5417ac02e5..296a6b3d23 100644
--- a/lib/stdlib/src/re.erl
+++ b/lib/stdlib/src/re.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(re).
@@ -32,18 +32,7 @@ split(Subject,RE,Options) ->
try
{NewOpt,Convert,Unicode,Limit,Strip,Group} =
process_split_params(Options,iodata,false,-1,false,false),
- FlatSubject =
- case is_binary(Subject) of
- true ->
- Subject;
- false ->
- case Unicode of
- true ->
- unicode:characters_to_binary(Subject,unicode);
- false ->
- iolist_to_binary(Subject)
- end
- end,
+ FlatSubject = to_binary(Subject, Unicode),
case compile_split(RE,NewOpt) of
{error,_Err} ->
throw(badre);
@@ -217,19 +206,9 @@ replace(Subject,RE,Replacement,Options) ->
try
{NewOpt,Convert,Unicode} =
process_repl_params(Options,iodata,false),
- FlatSubject =
- case is_binary(Subject) of
- true ->
- Subject;
- false ->
- case Unicode of
- true ->
- unicode:characters_to_binary(Subject,unicode);
- false ->
- iolist_to_binary(Subject)
- end
- end,
- case do_replace(FlatSubject,Subject,RE,Replacement,NewOpt) of
+ FlatSubject = to_binary(Subject, Unicode),
+ FlatReplacement = to_binary(Replacement, Unicode),
+ case do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt) of
{error,_Err} ->
throw(badre);
IoList ->
@@ -237,7 +216,12 @@ replace(Subject,RE,Replacement,Options) ->
iodata ->
IoList;
binary ->
- iolist_to_binary(IoList);
+ case Unicode of
+ false ->
+ iolist_to_binary(IoList);
+ true ->
+ unicode:characters_to_binary(IoList,unicode)
+ end;
list ->
case Unicode of
false ->
@@ -324,8 +308,7 @@ process_split_params([H|T],C,U,L,S,G) ->
{[H|NT],NC,NU,NL,NS,NG}.
apply_mlist(Subject,Replacement,Mlist) ->
- do_mlist(Subject,Subject,0,precomp_repl(iolist_to_binary(Replacement)),
- Mlist).
+ do_mlist(Subject,Subject,0,precomp_repl(Replacement), Mlist).
precomp_repl(<<>>) ->
@@ -545,7 +528,7 @@ process_uparams([],Type) ->
ucompile(RE,Options) ->
try
- re:compile(unicode:characters_to_binary(RE,unicode))
+ re:compile(unicode:characters_to_binary(RE,unicode),Options)
catch
error:AnyError ->
{'EXIT',{new_stacktrace,[{Mod,_,L}|Rest]}} =
@@ -618,18 +601,7 @@ grun(Subject,RE,{Options,NeedClean,OrigRE}) ->
grun2(Subject,RE,{Options,NeedClean}) ->
Unicode = check_for_unicode(RE,Options),
- FlatSubject =
- case is_binary(Subject) of
- true ->
- Subject;
- false ->
- case Unicode of
- true ->
- unicode:characters_to_binary(Subject,unicode);
- false ->
- iolist_to_binary(Subject)
- end
- end,
+ FlatSubject = to_binary(Subject, Unicode),
do_grun(FlatSubject,Subject,Unicode,RE,{Options,NeedClean}).
do_grun(FlatSubject,Subject,Unicode,RE,{Options0,NeedClean}) ->
@@ -749,3 +721,10 @@ runopt(global) ->
true;
runopt(_) ->
false.
+
+to_binary(Bin, _IsUnicode) when is_binary(Bin) ->
+ Bin;
+to_binary(Data, true) ->
+ unicode:characters_to_binary(Data,unicode);
+to_binary(Data, false) ->
+ iolist_to_binary(Data).
diff --git a/lib/stdlib/test/Makefile b/lib/stdlib/test/Makefile
index ac8cbba375..9beac93eb8 100644
--- a/lib/stdlib/test/Makefile
+++ b/lib/stdlib/test/Makefile
@@ -110,7 +110,7 @@ COVERFILE=stdlib.cover
make_emakefile:
$(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \
- >> $(EMAKEFILE)
+ > $(EMAKEFILE)
tests debug opt: make_emakefile
erl $(ERL_MAKE_FLAGS) -make
diff --git a/lib/stdlib/test/calendar_SUITE.erl b/lib/stdlib/test/calendar_SUITE.erl
index ea81bb99a9..10fb72c1b1 100644
--- a/lib/stdlib/test/calendar_SUITE.erl
+++ b/lib/stdlib/test/calendar_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(calendar_SUITE).
@@ -48,7 +48,7 @@ gregorian_days(doc) ->
"At the same time valid_date is tested.";
gregorian_days(suite) ->
[];
-gregorian_days(Config) when list(Config) ->
+gregorian_days(Config) when is_list(Config) ->
?line Days = calendar:date_to_gregorian_days({?START_YEAR, 1, 1}),
?line MaxDays = calendar:date_to_gregorian_days({?END_YEAR, 1, 1}),
?line check_gregorian_days(Days, MaxDays).
@@ -60,7 +60,7 @@ gregorian_seconds(doc) ->
"every 2 days + 1 second.";
gregorian_seconds(suite) ->
[];
-gregorian_seconds(Config) when list(Config) ->
+gregorian_seconds(Config) when is_list(Config) ->
?line Secs = calendar:datetime_to_gregorian_seconds({{?START_YEAR, 1, 1},
{0, 0, 0}}),
?line MaxSecs = calendar:datetime_to_gregorian_seconds({{?END_YEAR, 1, 1},
@@ -72,7 +72,7 @@ day_of_the_week(doc) ->
"year ?START_YEAR up to ?END_YEAR.";
day_of_the_week(suite) ->
[];
-day_of_the_week(Config) when list(Config) ->
+day_of_the_week(Config) when is_list(Config) ->
?line Days = calendar:date_to_gregorian_days({?START_YEAR, 1, 1}),
?line MaxDays = calendar:date_to_gregorian_days({?END_YEAR, 1, 1}),
?line DayNumber = calendar:day_of_the_week({?START_YEAR, 1, 1}),
@@ -82,7 +82,7 @@ day_of_the_week_calibrate(doc) ->
"Tests that day_of_the_week for 1997-11-11 is Tuesday (2)";
day_of_the_week_calibrate(suite) ->
[];
-day_of_the_week_calibrate(Config) when list(Config) ->
+day_of_the_week_calibrate(Config) when is_list(Config) ->
?line 2 = calendar:day_of_the_week({1997, 11, 11}).
leap_years(doc) ->
@@ -90,7 +90,7 @@ leap_years(doc) ->
"year ?START_YEAR up to ?END_YEAR.";
leap_years(suite) ->
[];
-leap_years(Config) when list(Config) ->
+leap_years(Config) when is_list(Config) ->
?line check_leap_years(?START_YEAR, ?END_YEAR).
last_day_of_the_month(doc) ->
@@ -98,14 +98,14 @@ last_day_of_the_month(doc) ->
"year ?START_YEAR up to ?END_YEAR.";
last_day_of_the_month(suite) ->
[];
-last_day_of_the_month(Config) when list(Config) ->
+last_day_of_the_month(Config) when is_list(Config) ->
?line check_last_day_of_the_month({?START_YEAR, 1}, {?END_YEAR, 1}).
local_time_to_universal_time_dst(doc) ->
"Tests local_time_to_universal_time_dst for MET";
local_time_to_universal_time_dst(suite) ->
[];
-local_time_to_universal_time_dst(Config) when list(Config) ->
+local_time_to_universal_time_dst(Config) when is_list(Config) ->
case os:type() of
{unix,_} ->
case os:cmd("date '+%Z'") of
@@ -117,7 +117,7 @@ local_time_to_universal_time_dst(Config) when list(Config) ->
_ ->
local_time_to_universal_time_dst_x(Config)
end.
-local_time_to_universal_time_dst_x(Config) when list(Config) ->
+local_time_to_universal_time_dst_x(Config) when is_list(Config) ->
%% Assumes MET (UTC+1 / UTC+2(dst)
?line LtW = {{2003,01,15},{14,00,00}}, % Winter
?line UtW = {{2003,01,15},{13,00,00}}, %
diff --git a/lib/stdlib/test/ets_tough_SUITE.erl b/lib/stdlib/test/ets_tough_SUITE.erl
index e3d44d00b9..4c8d941f13 100644
--- a/lib/stdlib/test/ets_tough_SUITE.erl
+++ b/lib/stdlib/test/ets_tough_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(ets_tough_SUITE).
@@ -40,7 +40,7 @@ fin_per_testcase(_Func, Config) ->
ets:delete(?GLOBAL_PARAMS).
-ex1(Config) when list(Config) ->
+ex1(Config) when is_list(Config) ->
?line ets:new(?GLOBAL_PARAMS,[named_table,public]),
?line ets:insert(?GLOBAL_PARAMS,{a,set}),
?line ets:insert(?GLOBAL_PARAMS,{b,set}),
@@ -269,7 +269,7 @@ show_entries(Fd) ->
start(DbName) ->
case gen_server:start_link(ets_tough_SUITE,{DbName,no_dump_dir},[]) of
- {ok,Pid} when pid(Pid) ->
+ {ok,Pid} when is_pid(Pid) ->
{ok, Pid};
Other ->
Other
@@ -283,7 +283,7 @@ start(DbName) ->
start(DbName,DumpDir) ->
case gen_server:start_link(ets_tough_SUITE,
{DbName,{dump_dir,DumpDir}},[]) of
- {ok,Pid} when pid(Pid) ->
+ {ok,Pid} when is_pid(Pid) ->
{ok, Pid};
Other ->
Other
@@ -1075,7 +1075,7 @@ phys_read_len(Fd) ->
phys_read_entry(Fd,Len) ->
case io:get_chars(Fd,'',Len) of
- L when list(L), length(L) == Len ->
+ L when is_list(L), length(L) == Len ->
{ok,binary_to_term(list_to_binary(L))};
Other ->
{error,{read_term,Other}}
diff --git a/lib/stdlib/test/filelib_SUITE.erl b/lib/stdlib/test/filelib_SUITE.erl
index c9c6054f7b..d54741051f 100644
--- a/lib/stdlib/test/filelib_SUITE.erl
+++ b/lib/stdlib/test/filelib_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2005-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -21,7 +21,7 @@
-export([all/1,init_per_testcase/2,fin_per_testcase/2,
wildcard_one/1,wildcard_two/1,wildcard_errors/1,
- fold_files/1,otp_5960/1]).
+ fold_files/1,otp_5960/1,ensure_dir_eexist/1]).
-import(lists, [foreach/2]).
@@ -38,7 +38,8 @@ fin_per_testcase(_Case, Config) ->
ok.
all(suite) ->
- [wildcard_one,wildcard_two,wildcard_errors,fold_files,otp_5960].
+ [wildcard_one,wildcard_two,wildcard_errors,fold_files,otp_5960,
+ ensure_dir_eexist].
wildcard_one(Config) when is_list(Config) ->
?line {ok,OldCwd} = file:get_cwd(),
@@ -223,7 +224,9 @@ otp_5960(Config) when is_list(Config) ->
?line Name1 = filename:join(Dir, name1),
?line Name2 = filename:join(Dir, name2),
?line ok = filelib:ensure_dir(Name1), % parent is created
+ ?line ok = filelib:ensure_dir(Name1), % repeating it should be OK
?line ok = filelib:ensure_dir(Name2), % parent already exists
+ ?line ok = filelib:ensure_dir(Name2), % repeating it should be OK
?line Name3 = filename:join(Name1, name3),
?line {ok, FileInfo} = file:read_file_info(Dir),
case os:type() of
@@ -239,3 +242,16 @@ otp_5960(Config) when is_list(Config) ->
?line ok = file:write_file_info(Dir, #file_info{mode=Mode}),
ok
end.
+
+ensure_dir_eexist(Config) when is_list(Config) ->
+ ?line PrivDir = ?config(priv_dir, Config),
+ ?line Dir = filename:join(PrivDir, ensure_dir_eexist),
+ ?line Name = filename:join(Dir, "same_name_as_file_and_dir"),
+ ?line ok = filelib:ensure_dir(Name),
+ ?line ok = file:write_file(Name, <<"some string\n">>),
+
+ %% There already is a file with the name of the directory
+ %% we want to create.
+ ?line NeedFile = filename:join(Name, "file"),
+ ?line {error, eexist} = filelib:ensure_dir(NeedFile),
+ ok.
diff --git a/lib/stdlib/test/fixtable_SUITE.erl b/lib/stdlib/test/fixtable_SUITE.erl
index 9f21308ad4..1940ee147e 100644
--- a/lib/stdlib/test/fixtable_SUITE.erl
+++ b/lib/stdlib/test/fixtable_SUITE.erl
@@ -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%
%%
%%%----------------------------------------------------------------------
@@ -83,7 +83,7 @@ fixbag(doc) ->
"incorrect lookups"];
fixbag(suite) ->
[];
-fixbag(Config) when list(Config) ->
+fixbag(Config) when is_list(Config) ->
?line T = ets:new(x,[bag]),
?line ets:insert(T,{a,1}),
?line ets:insert(T,{a,2}),
@@ -101,7 +101,7 @@ insert_same_key(doc) ->
["Check correct behaviour if a key is deleted and reinserted during fixation."];
insert_same_key(suite) ->
[];
-insert_same_key(Config) when list(Config) ->
+insert_same_key(Config) when is_list(Config) ->
?line {ok,Dets1} = dets:open_file(?DETS_TMP1,
[{file, dets_filename(?DETS_TMP1,Config)}]),
?line Ets1 = ets:new(ets,[]),
@@ -180,7 +180,7 @@ owner_dies(doc) ->
["Check correct behaviour if the table owner dies."];
owner_dies(suite) ->
[];
-owner_dies(Config) when list(Config) ->
+owner_dies(Config) when is_list(Config) ->
?line P1 = start_commander(),
?line Ets1 = command(P1,{ets,new,[ets,[]]}),
?line command(P1,{ets,safe_fixtable,[Ets1,true]}),
@@ -236,7 +236,7 @@ other_process_closes(doc) ->
other_process_closes(suite) ->
[];
-other_process_closes(Config) when list(Config) ->
+other_process_closes(Config) when is_list(Config) ->
?line {ok,Dets} = dets:open_file(?DETS_TMP1,
[{file, dets_filename(tmp1,Config)}]),
?line P2 = start_commander(),
@@ -265,7 +265,7 @@ other_process_deletes(doc) ->
"deletes an ets table"];
other_process_deletes(suite) ->
[];
-other_process_deletes(Config) when list(Config) ->
+other_process_deletes(Config) when is_list(Config) ->
?line Ets = ets:new(ets,[public]),
?line P = start_commander(),
?line ets:safe_fixtable(Ets,true),
@@ -282,7 +282,7 @@ multiple_fixes(doc) ->
["Check that multiple safe_fixtable keeps the reference counter."];
multiple_fixes(suite) ->
[];
-multiple_fixes(Config) when list(Config) ->
+multiple_fixes(Config) when is_list(Config) ->
?line {ok,Dets} = dets:open_file(?DETS_TMP1,
[{file, dets_filename(?DETS_TMP1,Config)}]),
?line Ets = ets:new(ets,[]),
@@ -317,7 +317,7 @@ multiple_processes(doc) ->
"counted OK"];
multiple_processes(suite) ->
[];
-multiple_processes(Config) when list(Config) ->
+multiple_processes(Config) when is_list(Config) ->
?line {ok,Dets} = dets:open_file(?DETS_TMP1,[{file,
dets_filename(?DETS_TMP1,
Config)}]),
@@ -370,7 +370,7 @@ multiple_processes(Tab, Mod) ->
%%% Helpers
-dets_filename(Base, Config) when atom(Base) ->
+dets_filename(Base, Config) when is_atom(Base) ->
dets_filename(atom_to_list(Base) ++ ".dat", Config);
dets_filename(Basename, Config) ->
PrivDir = ?config(priv_dir,Config),
diff --git a/lib/stdlib/test/format_SUITE.erl b/lib/stdlib/test/format_SUITE.erl
index 2c415894f4..1c9e953003 100644
--- a/lib/stdlib/test/format_SUITE.erl
+++ b/lib/stdlib/test/format_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(format_SUITE).
@@ -45,7 +45,7 @@ hang_1(doc) ->
["Bad args can hang (OTP-2400)"];
hang_1(suite) ->
[];
-hang_1(Config) when list(Config) ->
+hang_1(Config) when is_list(Config) ->
?line _ = (catch io:format(a, "", [])),
?line _ = (catch io:format({}, "", [])),
ok.
diff --git a/lib/stdlib/test/gen_event_SUITE.erl b/lib/stdlib/test/gen_event_SUITE.erl
index dc5ddebf53..8cbffaca56 100644
--- a/lib/stdlib/test/gen_event_SUITE.erl
+++ b/lib/stdlib/test/gen_event_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(gen_event_SUITE).
@@ -33,7 +33,7 @@ all(suite) -> {req, [stdlib], [start, test_all, hibernate]}.
start(doc) -> [];
start(suite) -> [];
-start(Config) when list(Config) ->
+start(Config) when is_list(Config) ->
OldFl = process_flag(trap_exit, true),
?line {ok, Pid0} = gen_event:start(), %anonymous
@@ -175,7 +175,7 @@ test_all(suite) -> [add_handler, add_sup_handler, delete_handler,
add_handler(doc) -> [];
add_handler(suite) -> [];
-add_handler(Config) when list(Config) ->
+add_handler(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line {error, my_error} =
gen_event:add_handler(my_dummy_handler, dummy_h, make_error),
@@ -196,7 +196,7 @@ add_handler(Config) when list(Config) ->
add_sup_handler(doc) -> [];
add_sup_handler(suite) -> [];
-add_sup_handler(Config) when list(Config) ->
+add_sup_handler(Config) when is_list(Config) ->
?line {ok,Pid} = gen_event:start({local, my_dummy_handler}),
?line {error, my_error} =
gen_event:add_sup_handler(my_dummy_handler, dummy_h, make_error),
@@ -238,7 +238,7 @@ add_sup_handler(Config) when list(Config) ->
delete_handler(doc) -> [];
delete_handler(suite) -> [];
-delete_handler(Config) when list(Config) ->
+delete_handler(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]),
?line {error, module_not_found} =
@@ -270,7 +270,7 @@ delete_handler(Config) when list(Config) ->
swap_handler(doc) -> [];
swap_handler(suite) -> [];
-swap_handler(Config) when list(Config) ->
+swap_handler(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]),
?line {error, non_existing} =
@@ -299,7 +299,7 @@ swap_handler(Config) when list(Config) ->
swap_sup_handler(doc) -> [];
swap_sup_handler(suite) -> [];
-swap_sup_handler(Config) when list(Config) ->
+swap_sup_handler(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]),
?line {error, non_existing} =
@@ -341,7 +341,7 @@ swap_sup_handler(Config) when list(Config) ->
notify(doc) -> [];
notify(suite) -> [];
-notify(Config) when list(Config) ->
+notify(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]),
Event = {event, self()},
@@ -457,7 +457,7 @@ notify(Config) when list(Config) ->
sync_notify(doc) -> [];
sync_notify(suite) -> [];
-sync_notify(Config) when list(Config) ->
+sync_notify(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]),
Event = {event, self()},
@@ -576,7 +576,7 @@ sync_notify(Config) when list(Config) ->
call(doc) -> [];
call(suite) -> [];
-call(Config) when list(Config) ->
+call(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]),
?line ok = gen_event:add_handler(my_dummy_handler, {dummy_h, 1}, [self()]),
@@ -718,7 +718,7 @@ flush() ->
info(doc) -> [];
info(suite) -> [];
-info(Config) when list(Config) ->
+info(Config) when is_list(Config) ->
?line {ok,_} = gen_event:start({local, my_dummy_handler}),
?line ok = gen_event:add_handler(my_dummy_handler, dummy_h, [self()]),
Info = {info, self()},
diff --git a/lib/stdlib/test/io_proto_SUITE.erl b/lib/stdlib/test/io_proto_SUITE.erl
index 46407193d7..59aa175c73 100644
--- a/lib/stdlib/test/io_proto_SUITE.erl
+++ b/lib/stdlib/test/io_proto_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2009-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(io_proto_SUITE).
@@ -48,9 +48,12 @@
-ifdef(debug).
-define(format(S, A), io:format(S, A)).
-define(dbg(Data),io:format(standard_error, "DBG: ~p\r\n",[Data])).
+-define(RM_RF(Dir),begin io:format(standard_error, "Not Removed: ~p\r\n",[Dir]),
+ ok end).
-else.
-define(format(S, A), ok).
-define(dbg(Data),noop).
+-define(RM_RF(Dir),rm_rf(Dir)).
-endif.
@@ -197,6 +200,15 @@ setopts_getopts(Config) when is_list(Config) ->
{getline_re, ".*<<\"hej\\\\n\">>"}
],[],[],"-oldshell"),
ok.
+
+
+get_lc_ctype() ->
+ case {os:type(),os:version()} of
+ {{unix,sunos},{5,N,_}} when N =< 8 ->
+ "iso_8859_1";
+ _ ->
+ "ISO-8859-1"
+ end.
unicode_options(suite) ->
[];
@@ -369,7 +381,7 @@ unicode_options(Config) when is_list(Config) ->
{getline,
binary_to_list(unicode:characters_to_binary(
[1024],unicode,utf8))}
- ],[],"LC_CTYPE=\"ISO-8859-1\"; export LC_CTYPE; "),
+ ],[],"LC_CTYPE=\""++get_lc_ctype()++"\"; export LC_CTYPE; "),
?line rtnode([{putline,""},
{putline, "2."},
{getline_re, ".*2."},
@@ -384,7 +396,7 @@ unicode_options(Config) when is_list(Config) ->
{getline_re,
".*"++binary_to_list(unicode:characters_to_binary(
[1024],unicode,utf8))}
- ],[],"LC_CTYPE=\"ISO-8859-1\"; export LC_CTYPE; ",
+ ],[],"LC_CTYPE=\""++get_lc_ctype()++"\"; export LC_CTYPE; ",
" -oldshell "),
ok.
@@ -974,7 +986,7 @@ answering_machine1(OthNode,OthReg,Me) ->
{putline, TestDataUtf},
{getline_re, ".*Okej"}
- ],Me,"LC_CTYPE=\"ISO-8859-1\"; export LC_CTYPE; "),
+ ],Me,"LC_CTYPE=\""++get_lc_ctype()++"\"; export LC_CTYPE; "),
O = list_to_atom(OthReg),
O ! {self(),done},
ok.
@@ -1045,7 +1057,7 @@ answering_machine2(OthNode,OthReg,Me) ->
{putline, TestDataUtf},
{getline_re, ".*Okej"}
- ],Me,"LC_CTYPE=\"ISO-8859-1\"; export LC_CTYPE; "," -oldshell "),
+ ],Me,"LC_CTYPE=\""++get_lc_ctype()++"\"; export LC_CTYPE; "," -oldshell "),
O = list_to_atom(OthReg),
O ! {self(),done},
ok.
@@ -1087,7 +1099,9 @@ read_modes_gl_1(_Config,Machine) ->
[MyNodeList, "io_proto_suite", N2List]),
?line GL = receive X when is_pid(X) -> X end,
+ ?dbg({group_leader,X}),
%% get_line
+ ?line receive after 500 -> ok end, % Dont clash with the new shell...
?line "Hej\n" = io:get_line(GL,"Prompt\n"),
?line io:setopts(GL,[binary]),
?line io:format(GL,"Okej~n",[]),
@@ -1287,7 +1301,7 @@ rtnode(Commands,Nodename,ErlPrefix,Extra) ->
?line ok
end,
?line wait_for_runerl_server(SPid),
- ?line ok = rm_rf(Tempdir),
+ ?line ok = ?RM_RF(Tempdir),
?line ok = Res
end
end.
@@ -1308,7 +1322,7 @@ timeout(normal) ->
%% stop_noshell_node(Node) ->
%% test_server:stop_node(Node).
-
+-ifndef(debug).
rm_rf(Dir) ->
try
{ok,List} = file:list_dir(Dir),
@@ -1324,7 +1338,7 @@ rm_rf(Dir) ->
catch
_:Exception -> {error, {Exception,Dir}}
end.
-
+-endif.
get_and_put(_CPid,[],_) ->
ok;
@@ -1527,6 +1541,8 @@ start_runerl_node(RunErl,Erl,Tempdir,Nodename,Extra) ->
" "++Extra
end,
spawn(fun() ->
+ ?dbg(RunErl++" "++Tempdir++"/ "++Tempdir++" \""++
+ Erl++XArg++XXArg++"\""),
os:cmd(RunErl++" "++Tempdir++"/ "++Tempdir++" \""++
Erl++XArg++XXArg++"\"")
end).
diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl
index cf0926b7fa..79a0a9af89 100644
--- a/lib/stdlib/test/ms_transform_SUITE.erl
+++ b/lib/stdlib/test/ms_transform_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2003-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(ms_transform_SUITE).
@@ -56,7 +56,7 @@ andalso_orelse(suite) ->
[];
andalso_orelse(doc) ->
["Tests that andalso and orelse are allowed in guards."];
-andalso_orelse(Config) when list(Config) ->
+andalso_orelse(Config) when is_list(Config) ->
?line setup(Config),
?line [{{'$1','$2'},
[{'and',{is_integer,'$1'},{'>',{'+','$1',5},'$2'}}],
@@ -93,7 +93,7 @@ bitsyntax(suite) ->
[];
bitsyntax(doc) ->
["Tests that bitsyntax works and does not work where appropriate"];
-bitsyntax(Config) when list(Config) ->
+bitsyntax(Config) when is_list(Config) ->
?line setup(Config),
?line [{'_',[],
[<<0,27,0,27>>]}] =
@@ -131,7 +131,7 @@ record_defaults(suite) ->
[];
record_defaults(doc) ->
["Tests that record defaults works"];
-record_defaults(Config) when list(Config) ->
+record_defaults(Config) when is_list(Config) ->
?line setup(Config),
?line [{{<<27>>,{a,5,'$1',hej,hej}},
[],
@@ -146,7 +146,7 @@ basic_ets(suite) ->
[];
basic_ets(doc) ->
["Tests basic ets:fun2ms"];
-basic_ets(Config) when list(Config) ->
+basic_ets(Config) when is_list(Config) ->
?line setup(Config),
?line [{{a,b},[],[true]}] = compile_and_run(
<<"ets:fun2ms(fun({a,b}) -> true end)">>),
@@ -167,7 +167,7 @@ basic_dbg(suite) ->
[];
basic_dbg(doc) ->
["Tests basic ets:fun2ms"];
-basic_dbg(Config) when list(Config) ->
+basic_dbg(Config) when is_list(Config) ->
?line setup(Config),
?line [{[a,b],[],[{message,banan},{return_trace}]}] =
compile_and_run(<<"dbg:fun2ms(fun([a,b]) -> message(banan), ",
@@ -186,7 +186,7 @@ from_shell(suite) ->
[];
from_shell(doc) ->
["Test calling of ets/dbg:fun2ms from the shell"];
-from_shell(Config) when list(Config) ->
+from_shell(Config) when is_list(Config) ->
?line setup(Config),
?line Fun = do_eval("fun({a,b}) -> true end"),
?line [{{a,b},[],[true]}] = apply(ets,fun2ms,[Fun]),
@@ -203,7 +203,7 @@ records(suite) ->
[];
records(doc) ->
["Tests expansion of records in fun2ms"];
-records(Config) when list(Config) ->
+records(Config) when is_list(Config) ->
?line setup(Config),
?line RD = <<"-record(t, {"
"t1 = [],"
@@ -253,7 +253,7 @@ record_index(suite) ->
[];
record_index(doc) ->
["Tests expansion of records in fun2ms, part 2"];
-record_index(Config) when list(Config) ->
+record_index(Config) when is_list(Config) ->
?line setup(Config),
?line RD = <<"-record(a,{a,b}).">>,
?line [{{2},[],[true]}] = compile_and_run(RD,
@@ -268,7 +268,7 @@ top_match(suite) ->
[];
top_match(doc) ->
["Tests matching on top level in head to give alias for object()"];
-top_match(Config) when list(Config) ->
+top_match(Config) when is_list(Config) ->
?line setup(Config),
?line RD = <<"-record(a,{a,b}).">>,
?line [{{a,3,'_'},[],['$_']}] =
@@ -295,7 +295,7 @@ multipass(suite) ->
[];
multipass(doc) ->
["Tests that multi-defined fields in records give errors."];
-multipass(Config) when list(Config) ->
+multipass(Config) when is_list(Config) ->
?line setup(Config),
?line RD = <<"-record(a,{a,b}).">>,
?line expect_failure(RD,<<"ets:fun2ms(fun(A) -> #a{a=2,a=3} end)">>),
@@ -319,7 +319,7 @@ old_guards(suite) ->
[];
old_guards(doc) ->
["Tests that old type tests in guards are translated"];
-old_guards(Config) when list(Config) ->
+old_guards(Config) when is_list(Config) ->
?line setup(Config),
Tests = [
{atom,is_atom},
@@ -382,7 +382,7 @@ autoimported(suite) ->
autoimported(doc) ->
["Tests use of autoimported bif's used like erlang:'+'(A,B) in guards"
" and body."];
-autoimported(Config) when list(Config) ->
+autoimported(Config) when is_list(Config) ->
?line setup(Config),
Allowed = [
{abs,1},
@@ -582,7 +582,7 @@ float_1_function(suite) ->
[];
float_1_function(doc) ->
["OTP-5297. The function float/1."];
-float_1_function(Config) when list(Config) ->
+float_1_function(Config) when is_list(Config) ->
?line setup(Config),
RunMS = fun(L, MS) ->
ets:match_spec_run(L, ets:match_spec_compile(MS))
diff --git a/lib/stdlib/test/queue_SUITE.erl b/lib/stdlib/test/queue_SUITE.erl
index ec3080baa0..2cd6b52311 100644
--- a/lib/stdlib/test/queue_SUITE.erl
+++ b/lib/stdlib/test/queue_SUITE.erl
@@ -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%
%%
-module(queue_SUITE).
@@ -45,7 +45,7 @@ do(doc) ->
[""];
do(suite) ->
[];
-do(Config) when list(Config) ->
+do(Config) when is_list(Config) ->
?line L = [{in, 1},
{in, 2},
{out, {value, 1}},
@@ -66,7 +66,7 @@ to_list(doc) ->
["OTP-2701"];
to_list(suite) ->
[];
-to_list(Config) when list(Config) ->
+to_list(Config) when is_list(Config) ->
?line E = queue:new(),
?line Q = do_queue(E, [{in, 1},
{in, 2},
@@ -104,7 +104,7 @@ io_test(doc) ->
"Test input and output";
io_test(suite) ->
[];
-io_test(Config) when list(Config) ->
+io_test(Config) when is_list(Config) ->
E = queue:new(),
do_io_test(E),
ok.
@@ -284,7 +284,7 @@ op_test(doc) ->
"Test operations on whole queues";
op_test(suite) ->
[];
-op_test(Config) when list(Config) ->
+op_test(Config) when is_list(Config) ->
do_op_test(fun id/1),
ok.
@@ -382,7 +382,7 @@ error(doc) ->
"Test queue errors";
error(suite) ->
[];
-error(Config) when list(Config) ->
+error(Config) when is_list(Config) ->
do_error(fun id/1, illegal_queue),
do_error(fun id/1, {[],illegal_queue}),
do_error(fun id/1, {illegal_queue,[17]}),
@@ -449,7 +449,7 @@ oops(doc) ->
"Test queue errors";
oops(suite) ->
[];
-oops(Config) when list(Config) ->
+oops(Config) when is_list(Config) ->
?line N = 3142,
?line Optab = optab(),
?line Seed0 = random:seed0(),
diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl
index 98eb66d1fb..fa50ba3b7a 100644
--- a/lib/stdlib/test/re_SUITE.erl
+++ b/lib/stdlib/test/re_SUITE.erl
@@ -1,29 +1,29 @@
%%
%% %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%
%%
-module(re_SUITE).
--export([all/1, pcre/1,compile_options/1,run_options/1,combined_options/1,replace_autogen/1,global_capture/1,replace_return/1,split_autogen/1,split_options/1,split_specials/1,error_handling/1]).
+-export([all/1, pcre/1,compile_options/1,run_options/1,combined_options/1,replace_autogen/1,global_capture/1,replace_input_types/1,replace_return/1,split_autogen/1,split_options/1,split_specials/1,error_handling/1]).
-include("test_server.hrl").
-include_lib("kernel/include/file.hrl").
-all(suite) -> [pcre,compile_options,run_options,combined_options,replace_autogen,global_capture,replace_return,split_autogen,split_options,split_specials,error_handling].
+all(suite) -> [pcre,compile_options,run_options,combined_options,replace_autogen,global_capture,replace_input_types,replace_return,split_autogen,split_options,split_specials,error_handling].
pcre(doc) ->
["Run all applicable tests from the PCRE testsuites."];
@@ -268,7 +268,17 @@ global_capture(Config) when is_list(Config) ->
?line {match,[[{3,5},{5,3}],[{11,4},{12,3}]]} = re:run("ABC�bcdABCabcdA",".(?<FOO>bcd)",[global,{capture,all,index},unicode]),
?t:timetrap_cancel(Dog),
ok.
-
+
+replace_input_types(doc) ->
+ ["Tests replace with different input types"];
+replace_input_types(Config) when is_list(Config) ->
+ Dog = ?t:timetrap(?t:minutes(3)),
+ ?line <<"abcd">> = re:replace("abcd","Z","X",[{return,binary},unicode]),
+ ?line <<"abcd">> = re:replace("abcd","\x{400}","X",[{return,binary},unicode]),
+ ?line <<"a",208,128,"cd">> = re:replace(<<"abcd">>,"b","\x{400}",[{return,binary},unicode]),
+ ?t:timetrap_cancel(Dog),
+ ok.
+
replace_return(doc) ->
["Tests return options of replace together with global searching"];
replace_return(Config) when is_list(Config) ->
@@ -289,6 +299,10 @@ replace_return(Config) when is_list(Config) ->
?line <<"iXk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\9X",[{return,binary}]),
?line <<"jXk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\10X",[{return,binary}]),
?line <<"Xk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\11X",[{return,binary}]),
+ ?line "a\x{400}bcX" = re:replace("a\x{400}bcd","d","X",[global,{return,list},unicode]),
+ ?line <<"a",208,128,"bcX">> = re:replace("a\x{400}bcd","d","X",[global,{return,binary},unicode]),
+ ?line "a\x{400}bcd" = re:replace("a\x{400}bcd","Z","X",[global,{return,list},unicode]),
+ ?line <<"a",208,128,"bcd">> = re:replace("a\x{400}bcd","Z","X",[global,{return,binary},unicode]),
?t:timetrap_cancel(Dog),
ok.
diff --git a/lib/stdlib/test/re_SUITE_data/mod_testoutput8 b/lib/stdlib/test/re_SUITE_data/mod_testoutput8
new file mode 100644
index 0000000000..b7e7b02d6c
--- /dev/null
+++ b/lib/stdlib/test/re_SUITE_data/mod_testoutput8
@@ -0,0 +1,877 @@
+/-- Do not use the \x{} construct except with patterns that have the --/
+/-- /8 option set, because PCRE doesn't recognize them as UTF-8 unless --/
+No match
+/-- that option is set. However, the latest Perls recognize them always. --/
+No match
+
+\x{100}ab/8
+ \x{100}ab
+ 0: \x{100}ab
+
+/a\x{100}*b/8
+ ab
+ 0: ab
+ a\x{100}b
+ 0: a\x{100}b
+ a\x{100}\x{100}b
+ 0: a\x{100}\x{100}b
+
+/a\x{100}+b/8
+ a\x{100}b
+ 0: a\x{100}b
+ a\x{100}\x{100}b
+ 0: a\x{100}\x{100}b
+ *** Failers
+No match
+ ab
+No match
+
+/\bX/8
+ Xoanon
+ 0: X
+ +Xoanon
+ 0: X
+ \x{300}Xoanon
+ 0: X
+ *** Failers
+No match
+ YXoanon
+No match
+
+/\BX/8
+ YXoanon
+ 0: X
+ *** Failers
+No match
+ Xoanon
+No match
+ +Xoanon
+No match
+ \x{300}Xoanon
+No match
+
+/X\b/8
+ X+oanon
+ 0: X
+ ZX\x{300}oanon
+ 0: X
+ FAX
+ 0: X
+ *** Failers
+No match
+ Xoanon
+No match
+
+/X\B/8
+ Xoanon
+ 0: X
+ *** Failers
+No match
+ X+oanon
+No match
+ ZX\x{300}oanon
+No match
+ FAX
+No match
+
+/[^a]/8
+ abcd
+ 0: b
+ a\x{100}
+ 0: \x{100}
+
+/^[abc\x{123}\x{400}-\x{402}]{2,3}\d/8
+ ab99
+ 0: ab9
+ \x{123}\x{123}45
+ 0: \x{123}\x{123}4
+ \x{400}\x{401}\x{402}6
+ 0: \x{400}\x{401}\x{402}6
+ *** Failers
+No match
+ d99
+No match
+ \x{123}\x{122}4
+No match
+ \x{400}\x{403}6
+No match
+ \x{400}\x{401}\x{402}\x{402}6
+No match
+
+/abc/8
+ �]
+Error -10
+ �
+Error -10
+ ���
+Error -10
+ ���\?
+No match
+
+/a.b/8
+ acb
+ 0: acb
+ a\x7fb
+ 0: a\x{7f}b
+ a\x{100}b
+ 0: a\x{100}b
+ *** Failers
+No match
+ a\nb
+No match
+
+/^[a\x{c0}]/8
+ *** Failers
+No match
+ \x{100}
+No match
+
+/(?<=aXb)cd/8
+ aXbcd
+ 0: cd
+
+/(?<=a\x{100}b)cd/8
+ a\x{100}bcd
+ 0: cd
+
+/(?<=a\x{100000}b)cd/8
+ a\x{100000}bcd
+ 0: cd
+
+/(?:\x{100}){3}b/8
+ \x{100}\x{100}\x{100}b
+ 0: \x{100}\x{100}\x{100}b
+ *** Failers
+No match
+ \x{100}\x{100}b
+No match
+
+/\x{ab}/8
+ \x{ab}
+ 0: \x{ab}
+ \xc2\xab
+ 0: \x{ab}
+ *** Failers
+No match
+ \x00{ab}
+No match
+
+/^[^a]{2}/8
+ \x{100}bc
+ 0: \x{100}b
+
+/^[^a]{2,}/8
+ \x{100}bcAa
+ 0: \x{100}bcA
+
+/^[^a]{2,}?/8
+ \x{100}bca
+ 0: \x{100}b
+
+/^[^a]{2}/8i
+ \x{100}bc
+ 0: \x{100}b
+
+/^[^a]{2,}/8i
+ \x{100}bcAa
+ 0: \x{100}bc
+
+/^[^a]{2,}?/8iU
+ \x{100}bca
+ 0: \x{100}bc
+
+/\x{100}{0,0}/8
+ abcd
+ 0:
+
+/\x{100}?/8
+ abcd
+ 0:
+ \x{100}\x{100}
+ 0: \x{100}
+
+/\x{100}{0,3}/8
+ \x{100}\x{100}
+ 0: \x{100}\x{100}
+ \x{100}\x{100}\x{100}\x{100}
+ 0: \x{100}\x{100}\x{100}
+
+/\x{100}*/8
+ abce
+ 0:
+ \x{100}\x{100}\x{100}\x{100}
+ 0: \x{100}\x{100}\x{100}\x{100}
+
+/\x{100}{1,1}/8
+ abcd\x{100}\x{100}\x{100}\x{100}
+ 0: \x{100}
+
+/\x{100}{1,3}/8
+ abcd\x{100}\x{100}\x{100}\x{100}
+ 0: \x{100}\x{100}\x{100}
+
+/\x{100}+/8
+ abcd\x{100}\x{100}\x{100}\x{100}
+ 0: \x{100}\x{100}\x{100}\x{100}
+
+/\x{100}{3}/8
+ abcd\x{100}\x{100}\x{100}XX
+ 0: \x{100}\x{100}\x{100}
+
+/\x{100}{3,5}/8
+ abcd\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}XX
+ 0: \x{100}\x{100}\x{100}\x{100}\x{100}
+
+/\x{100}{3,}/8
+ abcd\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}XX
+ 0: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+
+/(?<=a\x{100}{2}b)X/8
+ Xyyya\x{100}\x{100}bXzzz
+ 0: X
+
+/\D*/8
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/\D*/8
+ \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 0: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+
+/\D/8
+ 1X2
+ 0: X
+ 1\x{100}2
+ 0: \x{100}
+
+/>\S/8
+ > >X Y
+ 0: >X
+ > >\x{100} Y
+ 0: >\x{100}
+
+/\d/8
+ \x{100}3
+ 0: 3
+
+/\s/8
+ \x{100} X
+ 0:
+
+/\D+/8
+ 12abcd34
+ 0: abcd
+ *** Failers
+ 0: *** Failers
+ 1234
+No match
+
+/\d+/8
+ 12abcd34
+ 0: 12
+ *** Failers
+No match
+
+/\d{2,3}/8
+ 12abcd34
+ 0: 12
+ 1234abcd
+ 0: 123
+ *** Failers
+No match
+ 1.4
+No match
+
+/\S+/8
+ 12abcd34
+ 0: 12abcd34
+ *** Failers
+ 0: ***
+ \ \
+No match
+
+/>\s+</8
+ 12> <34
+ 0: > <
+ *** Failers
+No match
+
+/>\s{2,3}</8
+ ab> <cd
+ 0: > <
+ ab> <ce
+ 0: > <
+ *** Failers
+No match
+ ab> <cd
+No match
+
+/>\s{2,3}?</8
+ ab> <cd
+ 0: > <
+ ab> <ce
+ 0: > <
+ *** Failers
+No match
+ ab> <cd
+No match
+
+/\w+/8
+ 12 34
+ 0: 12
+ *** Failers
+ 0: Failers
+ +++=*!
+No match
+
+/\w{2,3}/8
+ ab cd
+ 0: ab
+ abcd ce
+ 0: abc
+ *** Failers
+ 0: Fai
+ a.b.c
+No match
+
+/\W+/8
+ 12====34
+ 0: ====
+ *** Failers
+ 0: ***
+ abcd
+No match
+
+/\W{2,3}/8
+ ab====cd
+ 0: ===
+ ab==cd
+ 0: ==
+ *** Failers
+ 0: ***
+ a.b.c
+No match
+
+/\W{2,3}?/8U
+ ab====cd
+ 0: ===
+ ab==cd
+ 0: ==
+ *** Failers
+ 0: ***
+ a.b.c
+No match
+
+/[\x{100}]/8
+ \x{100}
+ 0: \x{100}
+ Z\x{100}
+ 0: \x{100}
+ \x{100}Z
+ 0: \x{100}
+ *** Failers
+No match
+
+/[Z\x{100}]/8
+ Z\x{100}
+ 0: Z
+ \x{100}
+ 0: \x{100}
+ \x{100}Z
+ 0: \x{100}
+ *** Failers
+No match
+
+/[\x{100}\x{200}]/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ *** Failers
+No match
+
+/[\x{100}-\x{200}]/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{111}cd
+ 0: \x{111}
+ *** Failers
+No match
+
+/[z-\x{200}]/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{111}cd
+ 0: \x{111}
+ abzcd
+ 0: z
+ ab|cd
+ 0: |
+ *** Failers
+No match
+
+/[Q\x{100}\x{200}]/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ Q?
+ 0: Q
+ *** Failers
+No match
+
+/[Q\x{100}-\x{200}]/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{111}cd
+ 0: \x{111}
+ Q?
+ 0: Q
+ *** Failers
+No match
+
+/[Qz-\x{200}]/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{111}cd
+ 0: \x{111}
+ abzcd
+ 0: z
+ ab|cd
+ 0: |
+ Q?
+ 0: Q
+ *** Failers
+No match
+
+/[\x{100}\x{200}]{1,3}/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}\x{100}\x{200}
+ *** Failers
+No match
+
+/[\x{100}\x{200}]{1,3}?/8U
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}\x{100}\x{200}
+ *** Failers
+No match
+
+/[Q\x{100}\x{200}]{1,3}/8
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}\x{100}\x{200}
+ *** Failers
+No match
+
+/[Q\x{100}\x{200}]{1,3}?/8U
+ ab\x{100}cd
+ 0: \x{100}
+ ab\x{200}cd
+ 0: \x{200}
+ ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}\x{100}\x{200}
+ *** Failers
+No match
+
+/(?<=[\x{100}\x{200}])X/8
+ abc\x{200}X
+ 0: X
+ abc\x{100}X
+ 0: X
+ *** Failers
+No match
+ X
+No match
+
+/(?<=[Q\x{100}\x{200}])X/8
+ abc\x{200}X
+ 0: X
+ abc\x{100}X
+ 0: X
+ abQX
+ 0: X
+ *** Failers
+No match
+ X
+No match
+
+/(?<=[\x{100}\x{200}]{3})X/8
+ abc\x{100}\x{200}\x{100}X
+ 0: X
+ *** Failers
+No match
+ abc\x{200}X
+No match
+ X
+No match
+
+/[^\x{100}\x{200}]X/8
+ AX
+ 0: AX
+ \x{150}X
+ 0: \x{150}X
+ \x{500}X
+ 0: \x{500}X
+ *** Failers
+No match
+ \x{100}X
+No match
+ \x{200}X
+No match
+
+/[^Q\x{100}\x{200}]X/8
+ AX
+ 0: AX
+ \x{150}X
+ 0: \x{150}X
+ \x{500}X
+ 0: \x{500}X
+ *** Failers
+No match
+ \x{100}X
+No match
+ \x{200}X
+No match
+ QX
+No match
+
+/[^\x{100}-\x{200}]X/8
+ AX
+ 0: AX
+ \x{500}X
+ 0: \x{500}X
+ *** Failers
+No match
+ \x{100}X
+No match
+ \x{150}X
+No match
+ \x{200}X
+No match
+
+/[z-\x{100}]/8i
+ z
+ 0: z
+ Z
+ 0: Z
+ \x{100}
+ 0: \x{100}
+ *** Failers
+No match
+ \x{102}
+No match
+ y
+No match
+
+/[\xFF]/
+ >\xff<
+ 0: \xff
+
+/[\xff]/8
+ >\x{ff}<
+ 0: \x{ff}
+
+/[^\xFF]/
+ XYZ
+ 0: X
+
+/[^\xff]/8
+ XYZ
+ 0: X
+ \x{123}
+ 0: \x{123}
+
+/^[ac]*b/8
+ xb
+No match
+
+/^[ac\x{100}]*b/8
+ xb
+No match
+
+/^[^x]*b/8i
+ xb
+No match
+
+/^[^x]*b/8
+ xb
+No match
+
+/^\d*b/8
+ xb
+No match
+
+/^\x{85}$/8i
+ \x{85}
+ 0: \x{85}
+
+/^abc./mgx8<any>
+ abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/abc.$/mgx8<any>
+ abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
+ 0: abc1
+ 0: abc2
+ 0: abc3
+ 0: abc4
+ 0: abc5
+ 0: abc6
+ 0: abc7
+ 0: abc8
+ 0: abc9
+
+/^a\Rb/8<bsr_unicode>
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0cb
+ 0: a\x{0c}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x{2028}b
+ 0: a\x{2028}b
+ a\x{2029}b
+ 0: a\x{2029}b
+ ** Failers
+No match
+ a\n\rb
+No match
+
+/^a\R*b/8<bsr_unicode>
+ ab
+ 0: ab
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}\x0cb
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+
+/^a\R+b/8<bsr_unicode>
+ a\nb
+ 0: a\x{0a}b
+ a\rb
+ 0: a\x{0d}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x0bb
+ 0: a\x{0b}b
+ a\x0c\x{2028}\x{2029}b
+ 0: a\x{0c}\x{2028}\x{2029}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}\x0cb
+ 0: a\x{0a}\x{0d}\x{85}\x{0c}b
+ ** Failers
+No match
+ ab
+No match
+
+/^a\R{1,3}b/8<bsr_unicode>
+ a\nb
+ 0: a\x{0a}b
+ a\n\rb
+ 0: a\x{0a}\x{0d}b
+ a\n\r\x{85}b
+ 0: a\x{0a}\x{0d}\x{85}b
+ a\r\n\r\nb
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}b
+ a\r\n\r\n\r\nb
+ 0: a\x{0d}\x{0a}\x{0d}\x{0a}\x{0d}\x{0a}b
+ a\n\r\n\rb
+ 0: a\x{0a}\x{0d}\x{0a}\x{0d}b
+ a\n\n\r\nb
+ 0: a\x{0a}\x{0a}\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\n\n\n\rb
+No match
+ a\r
+No match
+
+/\h+\V?\v{3,4}/8
+ \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}\x{0d}
+
+/\V?\v{3,4}/8
+ \x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+ 0: X\x{0a}\x{0b}\x{0c}\x{0d}
+
+/\h+\V?\v{3,4}/8
+ >\x09\x20\x{a0}X\x0a\x0a\x0a<
+ 0: \x{09} \x{a0}X\x{0a}\x{0a}\x{0a}
+
+/\V?\v{3,4}/8
+ >\x09\x20\x{a0}X\x0a\x0a\x0a<
+ 0: X\x{0a}\x{0a}\x{0a}
+
+/\H\h\V\v/8
+ X X\x0a
+ 0: X X\x{0a}
+ X\x09X\x0b
+ 0: X\x{09}X\x{0b}
+ ** Failers
+No match
+ \x{a0} X\x0a
+No match
+
+/\H*\h+\V?\v{3,4}/8
+ \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}\x{0d}
+ \x09\x20\x{a0}\x0a\x0b\x0c\x0d\x0a
+ 0: \x{09} \x{a0}\x{0a}\x{0b}\x{0c}\x{0d}
+ \x09\x20\x{a0}\x0a\x0b\x0c
+ 0: \x{09} \x{a0}\x{0a}\x{0b}\x{0c}
+ ** Failers
+No match
+ \x09\x20\x{a0}\x0a\x0b
+No match
+
+/\H\h\V\v/8
+ \x{3001}\x{3000}\x{2030}\x{2028}
+ 0: \x{3001}\x{3000}\x{2030}\x{2028}
+ X\x{180e}X\x{85}
+ 0: X\x{180e}X\x{85}
+ ** Failers
+No match
+ \x{2009} X\x0a
+No match
+
+/\H*\h+\V?\v{3,4}/8
+ \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
+ 0: \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x{0c}\x{0d}
+ \x09\x{205f}\x{a0}\x0a\x{2029}\x0c\x{2028}\x0a
+ 0: \x{09}\x{205f}\x{a0}\x{0a}\x{2029}\x{0c}\x{2028}
+ \x09\x20\x{202f}\x0a\x0b\x0c
+ 0: \x{09} \x{202f}\x{0a}\x{0b}\x{0c}
+ ** Failers
+No match
+ \x09\x{200a}\x{a0}\x{2028}\x0b
+No match
+
+/a\Rb/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\x{85}b
+No match
+ a\x0bb
+No match
+
+/a\Rb/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x0bb
+ 0: a\x{0b}b
+ ** Failers
+No match
+ a\x{85}b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/a\R?b/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\x{85}b
+No match
+ a\x0bb
+No match
+
+/a\R?b/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x0bb
+ 0: a\x{0b}b
+ ** Failers
+No match
+ a\x{85}b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/ End of testinput 8 /
diff --git a/lib/stdlib/test/re_testoutput1_replacement_test.erl b/lib/stdlib/test/re_testoutput1_replacement_test.erl
index b20db3f9c3..69cb140e0d 100644
--- a/lib/stdlib/test/re_testoutput1_replacement_test.erl
+++ b/lib/stdlib/test/re_testoutput1_replacement_test.erl
@@ -1,23 +1,24 @@
%%
%% %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%
%%
-module(re_testoutput1_replacement_test).
-compile(export_all).
+-compile(no_native).
-include("test_server.hrl").
%% This file is generated by running run_pcre_tests:gen_repl_test("re_SUITE_data/testoutput1")
run() ->
diff --git a/lib/stdlib/test/re_testoutput1_split_test.erl b/lib/stdlib/test/re_testoutput1_split_test.erl
index 7e2d3f79ec..e86a04b008 100644
--- a/lib/stdlib/test/re_testoutput1_split_test.erl
+++ b/lib/stdlib/test/re_testoutput1_split_test.erl
@@ -1,23 +1,24 @@
%%
%% %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%
%%
-module(re_testoutput1_split_test).
-compile(export_all).
+-compile(no_native).
-include("test_server.hrl").
%% This file is generated by running run_pcre_tests:gen_split_test("re_SUITE_data/testoutput1")
join([]) -> [];
diff --git a/lib/stdlib/test/run_pcre_tests.erl b/lib/stdlib/test/run_pcre_tests.erl
index 0ef3986918..78b4803fc8 100644
--- a/lib/stdlib/test/run_pcre_tests.erl
+++ b/lib/stdlib/test/run_pcre_tests.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(run_pcre_tests).
@@ -25,7 +25,7 @@ test(RootDir) ->
erts_debug:set_internal_state(available_internal_state,true),
io:format("oldlimit: ~p~n",[ erts_debug:set_internal_state(re_loop_limit,10)]),
Testfiles0 = ["testoutput1", "testoutput2", "testoutput3", "testoutput4",
- "testoutput5", "testoutput6", "testoutput10"],
+ "testoutput5", "testoutput6","mod_testoutput8","testoutput10"],
Testfiles = [ filename:join([RootDir,FN]) || FN <- Testfiles0 ],
Res = [ begin io:format("~s~n",[X]), t(X) end || X <- Testfiles ],
io:format("limit was: ~p~n",[ erts_debug:set_internal_state(re_loop_limit,default)]),
@@ -42,12 +42,14 @@ t(OneFile,Num) ->
put(error_limit,Num),
put(skipped,0),
Res =
- [test(Structured,true,index),
- test(Structured,false,index),
- test(Structured,true,binary),
- test(Structured,false,binary),
- test(Structured,true,list),
- test(Structured,false,list)],
+ [test(Structured,true,index,false),
+ test(Structured,false,index,false),
+ test(Structured,true,index,true),
+ test(Structured,false,index,true),
+ test(Structured,true,binary,false),
+ test(Structured,false,binary,false),
+ test(Structured,true,list,false),
+ test(Structured,false,list,false)],
{lists:sum(Res),length(Structured)*6,get(skipped)}.
@@ -63,11 +65,21 @@ pick_exec_options([Opt|T]) ->
pick_exec_options([]) ->
{[],[]}.
-test([],_,_) ->
+test([],_,_,_) ->
0;
-test([{RE,Line,Options0,Tests}|T],PreCompile,XMode) ->
+test([{RE0,Line,Options0,Tests}|T],PreCompile,XMode,REAsList) ->
%io:format("."),
%case RE of <<>> -> io:format("Empty re:~w~n",[Line]); _ -> ok end,
+ Unicode = lists:member(unicode,Options0),
+ RE = case REAsList of
+ true ->
+ if
+ Unicode -> unicode:characters_to_list(RE0);
+ true -> binary_to_list(RE0)
+ end;
+ false ->
+ RE0
+ end,
{Options,ExecOptions} = pick_exec_options(Options0),
{Cres, Xopt} = case PreCompile of
true ->
@@ -80,7 +92,7 @@ test([{RE,Line,Options0,Tests}|T],PreCompile,XMode) ->
%erlang:display({testrun,RE,P,Tests,ExecOptions,Xopt,XMode}),
case (catch testrun(RE,P,Tests,ExecOptions,Xopt,XMode)) of
N when is_integer(N) ->
- N + test(T,PreCompile,XMode);
+ N + test(T,PreCompile,XMode,REAsList);
limit ->
io:format("Error limit reached.~n"),
1;
@@ -91,12 +103,12 @@ test([{RE,Line,Options0,Tests}|T],PreCompile,XMode) ->
_ ->
put(skipped,1)
end,
- test(T,PreCompile,XMode)
+ test(T,PreCompile,XMode,REAsList)
end;
{error,Err} ->
io:format("Compile error(~w): ~w~n",[Line,Err]),
case get(error_limit) of
- infinite -> 1 + test(T,PreCompile,XMode);
+ infinite -> 1 + test(T,PreCompile,XMode,REAsList);
X ->
case X-1 of
Y when Y =< 0 ->
@@ -104,7 +116,7 @@ test([{RE,Line,Options0,Tests}|T],PreCompile,XMode) ->
1;
Y ->
put(error_limit,Y),
- 1 + test(T,PreCompile,XMode)
+ 1 + test(T,PreCompile,XMode,REAsList)
end
end
end.
@@ -549,6 +561,8 @@ tr_option($N) ->
[no_auto_capture];
tr_option($8) ->
[unicode];
+tr_option($U) ->
+ [ungreedy];
tr_option($g) ->
[{exec_option,g}];
tr_option(_) ->
@@ -973,6 +987,7 @@ gen_split_test(OneFile) ->
{ok,F}= file:open(ErlFileName,[write]),
io:format(F,"-module(~s).~n",[ErlModule]),
io:format(F,"-compile(export_all).~n",[]),
+ io:format(F,"-compile(no_native).~n",[]),
io:format(F,"-include(\"test_server.hrl\").~n",[]),
%io:format(F,"-define(line,erlang:display(?LINE),).~n",[]),
io:format(F,"%% This file is generated by running ~w:gen_split_test(~p)~n",
@@ -1054,6 +1069,7 @@ gen_repl_test(OneFile) ->
{ok,F}= file:open(ErlFileName,[write]),
io:format(F,"-module(~s).~n",[ErlModule]),
io:format(F,"-compile(export_all).~n",[]),
+ io:format(F,"-compile(no_native).~n",[]),
io:format(F,"-include(\"test_server.hrl\").~n",[]),
io:format(F,"%% This file is generated by running ~w:gen_repl_test(~p)~n",
[?MODULE,OneFile]),
diff --git a/lib/stdlib/test/select_SUITE.erl b/lib/stdlib/test/select_SUITE.erl
index 54664fbb00..6900f1a8f5 100644
--- a/lib/stdlib/test/select_SUITE.erl
+++ b/lib/stdlib/test/select_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -79,14 +79,14 @@ select_test(suite) ->
[];
select_test(doc) ->
["Tests select in numerous ways"];
-select_test(Config) when list(Config) ->
+select_test(Config) when is_list(Config) ->
do_test(Config).
return_values(suite) ->
[];
return_values(doc) ->
["Tests return values in specific situations for select/3 and select/1"];
-return_values(Config) when list(Config) ->
+return_values(Config) when is_list(Config) ->
do_return_values().
-endif.
@@ -279,7 +279,7 @@ cmp_ms_to_fun({Mod,Tab}, MS, Fun1, Fun2, ChunkSize) ->
MSRes = lists:sort(chunked_select(Mod,Tab,MS,ChunkSize)),
FunRes0 = table_foldl(Fun1,[],{Mod,Tab}),
FunRes = case Fun2 of
- F when function(F) ->
+ F when is_function(F) ->
FunRes1 = table_foldl(F,[],{Mod,Tab}),
lists:merge(FunRes0,FunRes1);
[] ->
diff --git a/lib/stdlib/test/slave_SUITE.erl b/lib/stdlib/test/slave_SUITE.erl
index 3b737af64d..5c1282fe9b 100644
--- a/lib/stdlib/test/slave_SUITE.erl
+++ b/lib/stdlib/test/slave_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(slave_SUITE).
@@ -31,7 +31,7 @@ all(suite) ->
[t_start_link, start_link_nodedown, t_start, errors].
t_start_link(suite) -> [];
-t_start_link(Config) when list(Config) ->
+t_start_link(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(20)),
%% Define useful variables.
@@ -81,7 +81,7 @@ t_start_link(Config) when list(Config) ->
%% Test that slave:start_link() works when the master exits.
start_link_nodedown(suite) -> [];
-start_link_nodedown(Config) when list(Config) ->
+start_link_nodedown(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(20)),
%% Define useful variables.
@@ -109,7 +109,7 @@ start_a_slave(ReplyTo, Host, Name) ->
%% Test slave:start().
t_start(suite) -> [];
-t_start(Config) when list(Config) ->
+t_start(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(20)),
%% Define useful variables.
@@ -160,7 +160,7 @@ t_start(Config) when list(Config) ->
%% in slave is 32 seconds).
errors(suite) -> [];
-errors(Config) when list(Config) ->
+errors(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(50)),
?line process_flag(trap_exit, true),
diff --git a/lib/stdlib/test/sofs_SUITE.erl b/lib/stdlib/test/sofs_SUITE.erl
index 0849e0f59c..d60cfc6895 100644
--- a/lib/stdlib/test/sofs_SUITE.erl
+++ b/lib/stdlib/test/sofs_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2001-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(sofs_SUITE).
@@ -115,7 +115,7 @@ sofs(suite) ->
from_term_1(suite) -> [];
from_term_1(doc) -> [""];
-from_term_1(Conf) when list(Conf) ->
+from_term_1(Conf) when is_list(Conf) ->
%% would go wrong: projection(1,from_term([{2,b},{1,a,b}])),
?line {'EXIT', {badarg, _}} = (catch from_term([], {atom,'_',atom})),
@@ -203,7 +203,7 @@ from_term_1(Conf) when list(Conf) ->
set_1(suite) -> [];
set_1(doc) -> [""];
-set_1(Conf) when list(Conf) ->
+set_1(Conf) when is_list(Conf) ->
%% set/1
?line {'EXIT', {badarg, _}} = (catch set(a)),
?line {'EXIT', {badarg, _}} = (catch set({a})),
@@ -235,7 +235,7 @@ set_1(Conf) when list(Conf) ->
from_sets_1(suite) -> [];
from_sets_1(doc) -> [""];
-from_sets_1(Conf) when list(Conf) ->
+from_sets_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
%% unordered
@@ -272,7 +272,7 @@ from_sets_1(Conf) when list(Conf) ->
relation_1(suite) -> [];
relation_1(doc) -> [""];
-relation_1(Conf) when list(Conf) ->
+relation_1(Conf) when is_list(Conf) ->
%% relation/1
?line eval(relation([]), from_term([], [{atom,atom}])),
?line eval(from_term([{a}]), relation([{a}])),
@@ -305,7 +305,7 @@ relation_1(Conf) when list(Conf) ->
a_function_1(suite) -> [];
a_function_1(doc) -> [""];
-a_function_1(Conf) when list(Conf) ->
+a_function_1(Conf) when is_list(Conf) ->
%% a_function/1
?line eval(a_function([]), from_term([], [{atom,atom}])),
?line eval(a_function([{a,b},{a,b},{b,c}]), from_term([{a,b},{b,c}])),
@@ -352,7 +352,7 @@ a_function_1(Conf) when list(Conf) ->
family_1(suite) -> [];
family_1(doc) -> [""];
-family_1(Conf) when list(Conf) ->
+family_1(Conf) when is_list(Conf) ->
%% family/1
?line eval(family([]), from_term([],[{atom,[atom]}])),
?line {'EXIT', {badarg, _}} = (catch family(a)),
@@ -413,7 +413,7 @@ family_1(Conf) when list(Conf) ->
projection(suite) -> [];
projection(doc) -> [""];
-projection(Conf) when list(Conf) ->
+projection(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
@@ -535,7 +535,7 @@ projection(Conf) when list(Conf) ->
substitution(suite) -> [];
substitution(doc) -> [""];
-substitution(Conf) when list(Conf) ->
+substitution(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
@@ -633,7 +633,7 @@ substitution(Conf) when list(Conf) ->
restriction(suite) -> [];
restriction(doc) -> [""];
-restriction(Conf) when list(Conf) ->
+restriction(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([], 2),
@@ -752,7 +752,7 @@ restriction(Conf) when list(Conf) ->
drestriction(suite) -> [];
drestriction(doc) -> [""];
-drestriction(Conf) when list(Conf) ->
+drestriction(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([], 2),
@@ -869,7 +869,7 @@ drestriction(Conf) when list(Conf) ->
strict_relation_1(suite) -> [];
strict_relation_1(doc) -> [""];
-strict_relation_1(Conf) when list(Conf) ->
+strict_relation_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([], 2),
?line eval(strict_relation(E), E),
@@ -890,7 +890,7 @@ strict_relation_1(Conf) when list(Conf) ->
extension(suite) -> [];
extension(doc) -> [""];
-extension(Conf) when list(Conf) ->
+extension(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([], 2),
?line EF = family([]),
@@ -933,7 +933,7 @@ lextension(R, S, C) ->
weak_relation_1(suite) -> [];
weak_relation_1(doc) -> [""];
-weak_relation_1(Conf) when list(Conf) ->
+weak_relation_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([], 2),
?line eval(weak_relation(E), E),
@@ -966,7 +966,7 @@ weak_relation_1(Conf) when list(Conf) ->
to_sets_1(suite) -> [];
to_sets_1(doc) -> [""];
-to_sets_1(Conf) when list(Conf) ->
+to_sets_1(Conf) when is_list(Conf) ->
?line {'EXIT', {badarg, _}} = (catch to_sets(from_term(a))),
?line {'EXIT', {function_clause, _}} = (catch to_sets(a)),
%% unordered
@@ -988,8 +988,8 @@ to_sets_1(Conf) when list(Conf) ->
specification(suite) -> [];
specification(doc) -> [""];
-specification(Conf) when list(Conf) ->
- Fun = {external, fun(I) when integer(I) -> true; (_) -> false end},
+specification(Conf) when is_list(Conf) ->
+ Fun = {external, fun(I) when is_integer(I) -> true; (_) -> false end},
?line [1,2,3] = to_external(specification(Fun, set([a,1,b,2,c,3]))),
Fun2 = fun(S) -> is_subset(S, set([1,3,5,7,9])) end,
@@ -1014,7 +1014,7 @@ specification(Conf) when list(Conf) ->
union_1(suite) -> [];
union_1(doc) -> [""];
-union_1(Conf) when list(Conf) ->
+union_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([], 2),
?line {'EXIT', {badarg, _}} = (catch union(ER)),
@@ -1044,7 +1044,7 @@ union_1(Conf) when list(Conf) ->
intersection_1(suite) -> [];
intersection_1(doc) -> [""];
-intersection_1(Conf) when list(Conf) ->
+intersection_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line {'EXIT', {badarg, _}} = (catch intersection(from_term([a,b]))),
?line {'EXIT', {badarg, _}} = (catch intersection(E)),
@@ -1068,7 +1068,7 @@ intersection_1(Conf) when list(Conf) ->
difference(suite) -> [];
difference(doc) -> [""];
-difference(Conf) when list(Conf) ->
+difference(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line {'EXIT', {type_mismatch, _}} =
(catch difference(relation([{a,b}]), relation([{a,b,c}]))),
@@ -1089,7 +1089,7 @@ difference(Conf) when list(Conf) ->
symdiff(suite) -> [];
symdiff(doc) -> [""];
-symdiff(Conf) when list(Conf) ->
+symdiff(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line {'EXIT', {type_mismatch, _}} =
(catch symdiff(relation([{a,b}]), relation([{a,b,c}]))),
@@ -1114,7 +1114,7 @@ symdiff(Conf) when list(Conf) ->
symmetric_partition(suite) -> [];
symmetric_partition(doc) -> [""];
-symmetric_partition(Conf) when list(Conf) ->
+symmetric_partition(Conf) when is_list(Conf) ->
?line E = set([]),
?line S1 = set([1,2,3,4]),
?line S2 = set([3,4,5,6]),
@@ -1148,7 +1148,7 @@ symmetric_partition(Conf) when list(Conf) ->
is_sofs_set_1(suite) -> [];
is_sofs_set_1(doc) -> [""];
-is_sofs_set_1(Conf) when list(Conf) ->
+is_sofs_set_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line true = is_sofs_set(E),
?line true = is_sofs_set(from_term([a])),
@@ -1159,7 +1159,7 @@ is_sofs_set_1(Conf) when list(Conf) ->
is_set_1(suite) -> [];
is_set_1(doc) -> [""];
-is_set_1(Conf) when list(Conf) ->
+is_set_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line true = is_set(E),
?line true = is_set(from_term([a])),
@@ -1177,7 +1177,7 @@ is_set_1(Conf) when list(Conf) ->
is_equal(suite) -> [];
is_equal(doc) -> [""];
-is_equal(Conf) when list(Conf) ->
+is_equal(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line true = is_equal(E, E),
?line false = is_equal(from_term([a]), E),
@@ -1212,7 +1212,7 @@ is_equal(Conf) when list(Conf) ->
is_subset(suite) -> [];
is_subset(doc) -> [""];
-is_subset(Conf) when list(Conf) ->
+is_subset(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line true = is_subset(E, E),
?line true = is_subset(set([a,c,e]), set([a,b,c,d,e])),
@@ -1230,7 +1230,7 @@ is_subset(Conf) when list(Conf) ->
is_a_function_1(suite) -> [];
is_a_function_1(doc) -> [""];
-is_a_function_1(Conf) when list(Conf) ->
+is_a_function_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([], 2),
?line {'EXIT', {badarg, _}} = (catch is_a_function(set([a,b]))),
@@ -1254,7 +1254,7 @@ is_a_function_1(Conf) when list(Conf) ->
is_disjoint(suite) -> [];
is_disjoint(doc) -> [""];
-is_disjoint(Conf) when list(Conf) ->
+is_disjoint(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line {'EXIT', {type_mismatch, _}} =
(catch is_disjoint(relation([{a,1}]), set([a,b]))),
@@ -1268,7 +1268,7 @@ is_disjoint(Conf) when list(Conf) ->
join(suite) -> [];
join(doc) -> [""];
-join(Conf) when list(Conf) ->
+join(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line {'EXIT', {badarg, _}} = (catch join(relation([{a,1}]), 3, E, 5)),
@@ -1306,7 +1306,7 @@ join(Conf) when list(Conf) ->
canonical(suite) -> [];
canonical(doc) -> [""];
-canonical(Conf) when list(Conf) ->
+canonical(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line {'EXIT', {badarg, _}} =
(catch canonical_relation(set([a,b]))),
@@ -1318,7 +1318,7 @@ canonical(Conf) when list(Conf) ->
relation_to_family_1(suite) -> [];
relation_to_family_1(doc) -> [""];
-relation_to_family_1(Conf) when list(Conf) ->
+relation_to_family_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = family([]),
?line eval(relation_to_family(E), E),
@@ -1333,7 +1333,7 @@ relation_to_family_1(Conf) when list(Conf) ->
domain_1(suite) -> [];
domain_1(doc) -> [""];
-domain_1(Conf) when list(Conf) ->
+domain_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line {'EXIT', {badarg, _}} = (catch domain(relation([],3))),
@@ -1355,7 +1355,7 @@ domain_1(Conf) when list(Conf) ->
range_1(suite) -> [];
range_1(doc) -> [""];
-range_1(Conf) when list(Conf) ->
+range_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line {'EXIT', {badarg, _}} = (catch range(relation([],3))),
@@ -1367,7 +1367,7 @@ range_1(Conf) when list(Conf) ->
inverse_1(suite) -> [];
inverse_1(doc) -> [""];
-inverse_1(Conf) when list(Conf) ->
+inverse_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line {'EXIT', {badarg, _}} = (catch inverse(relation([],3))),
@@ -1391,7 +1391,7 @@ inverse_1(Conf) when list(Conf) ->
converse_1(suite) -> [];
converse_1(doc) -> [""];
-converse_1(Conf) when list(Conf) ->
+converse_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line {'EXIT', {badarg, _}} = (catch converse(relation([],3))),
@@ -1407,7 +1407,7 @@ converse_1(Conf) when list(Conf) ->
no_elements_1(suite) -> [];
no_elements_1(doc) -> [""];
-no_elements_1(Conf) when list(Conf) ->
+no_elements_1(Conf) when is_list(Conf) ->
?line 0 = no_elements(empty_set()),
?line 0 = no_elements(set([])),
?line 1 = no_elements(from_term([a])),
@@ -1419,7 +1419,7 @@ no_elements_1(Conf) when list(Conf) ->
image(suite) -> [];
image(doc) -> [""];
-image(Conf) when list(Conf) ->
+image(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line eval(image(E, E), E),
@@ -1441,7 +1441,7 @@ image(Conf) when list(Conf) ->
inverse_image(suite) -> [];
inverse_image(doc) -> [""];
-inverse_image(Conf) when list(Conf) ->
+inverse_image(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line eval(inverse_image(E, E), E),
@@ -1468,7 +1468,7 @@ inverse_image(Conf) when list(Conf) ->
composite_1(suite) -> [];
composite_1(doc) -> [""];
-composite_1(Conf) when list(Conf) ->
+composite_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = a_function([]),
?line eval(composite(E, E), E),
@@ -1520,7 +1520,7 @@ composite_1(Conf) when list(Conf) ->
relative_product_1(suite) -> [];
relative_product_1(doc) -> [""];
-relative_product_1(Conf) when list(Conf) ->
+relative_product_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line eval(relative_product1(E, E), E),
@@ -1548,7 +1548,7 @@ relative_product_1(Conf) when list(Conf) ->
relative_product_2(suite) -> [];
relative_product_2(doc) -> [""];
-relative_product_2(Conf) when list(Conf) ->
+relative_product_2(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
@@ -1597,7 +1597,7 @@ relative_product_2(Conf) when list(Conf) ->
product_1(suite) -> [];
product_1(doc) -> [""];
-product_1(Conf) when list(Conf) ->
+product_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line eval(product(E, E), E),
?line eval(product(relation([]), E), E),
@@ -1625,7 +1625,7 @@ product_1(Conf) when list(Conf) ->
partition_1(suite) -> [];
partition_1(doc) -> [""];
-partition_1(Conf) when list(Conf) ->
+partition_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line Id = fun(A) -> A end,
@@ -1671,7 +1671,7 @@ partition_1(Conf) when list(Conf) ->
partition_3(suite) -> [];
partition_3(doc) -> [""];
-partition_3(Conf) when list(Conf) ->
+partition_3(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
@@ -1818,7 +1818,7 @@ lpartition(F, S1, S2) ->
multiple_relative_product(suite) -> [];
multiple_relative_product(doc) -> [""];
-multiple_relative_product(Conf) when list(Conf) ->
+multiple_relative_product(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line T = relation([{a,1},{a,11},{b,2},{c,3},{c,33},{d,4}]),
@@ -1842,7 +1842,7 @@ multiple_relative_product(Conf) when list(Conf) ->
digraph(suite) -> [];
digraph(doc) -> [""];
-digraph(Conf) when list(Conf) ->
+digraph(Conf) when is_list(Conf) ->
?line T0 = ets:all(),
?line E = empty_set(),
?line R = relation([{a,b},{b,c},{c,d},{d,a}]),
@@ -1901,7 +1901,7 @@ digraph(Conf) when list(Conf) ->
constant_function(suite) -> [];
constant_function(doc) -> [""];
-constant_function(Conf) when list(Conf) ->
+constant_function(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line C = from_term(3),
?line eval(constant_function(E, C), E),
@@ -1913,7 +1913,7 @@ constant_function(Conf) when list(Conf) ->
misc(suite) -> [];
misc(doc) -> [""];
-misc(Conf) when list(Conf) ->
+misc(Conf) when is_list(Conf) ->
% find "relational" part of relation:
?line S = relation([{a,b},{b,c},{b,d},{c,d}]),
Id = fun(A) -> A end,
@@ -1943,7 +1943,7 @@ sofs_family(suite) ->
family_specification(suite) -> [];
family_specification(doc) -> [""];
-family_specification(Conf) when list(Conf) ->
+family_specification(Conf) when is_list(Conf) ->
E = empty_set(),
%% internal
?line eval(family_specification({sofs, is_set}, E), E),
@@ -1963,7 +1963,7 @@ family_specification(Conf) when list(Conf) ->
(catch family_specification(Fun3, F3)),
%% external
- IsList = {external, fun(L) when list(L) -> true; (_) -> false end},
+ IsList = {external, fun(L) when is_list(L) -> true; (_) -> false end},
?line eval(family_specification(IsList, E), E),
?line eval(family_specification(IsList, F1), F1),
MF = {external, fun(L) -> lists:member(3, L) end},
@@ -1975,7 +1975,7 @@ family_specification(Conf) when list(Conf) ->
family_domain_1(suite) -> [];
family_domain_1(doc) -> [""];
-family_domain_1(Conf) when list(Conf) ->
+family_domain_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = from_term([{a,[]},{b,[]}],[{atom,[{atom,atom}]}]),
?line EF = from_term([{a,[]},{b,[]}],[{atom,[atom]}]),
@@ -2001,7 +2001,7 @@ family_domain_1(Conf) when list(Conf) ->
family_range_1(suite) -> [];
family_range_1(doc) -> [""];
-family_range_1(Conf) when list(Conf) ->
+family_range_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = from_term([{a,[]},{b,[]}],[{atom,[{atom,atom}]}]),
?line EF = from_term([{a,[]},{b,[]}],[{atom,[atom]}]),
@@ -2023,7 +2023,7 @@ family_range_1(Conf) when list(Conf) ->
family_to_relation_1(suite) -> [];
family_to_relation_1(doc) -> [""];
-family_to_relation_1(Conf) when list(Conf) ->
+family_to_relation_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line ER = relation([]),
?line EF = family([]),
@@ -2037,7 +2037,7 @@ family_to_relation_1(Conf) when list(Conf) ->
union_of_family_1(suite) -> [];
union_of_family_1(doc) -> [""];
-union_of_family_1(Conf) when list(Conf) ->
+union_of_family_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = from_term([{a,[]},{b,[]}],[{atom,[atom]}]),
?line eval(union_of_family(E), E),
@@ -2052,7 +2052,7 @@ union_of_family_1(Conf) when list(Conf) ->
intersection_of_family_1(suite) -> [];
intersection_of_family_1(doc) -> [""];
-intersection_of_family_1(Conf) when list(Conf) ->
+intersection_of_family_1(Conf) when is_list(Conf) ->
?line EF = from_term([{a,[]},{b,[]}],[{atom,[atom]}]),
?line eval(intersection_of_family(EF), set([])),
?line FR = from_term([{a,[1,2,3]},{b,[2,3]},{c,[3,4,5]}]),
@@ -2066,7 +2066,7 @@ intersection_of_family_1(Conf) when list(Conf) ->
family_projection(suite) -> [];
family_projection(doc) -> [""];
-family_projection(Conf) when list(Conf) ->
+family_projection(Conf) when is_list(Conf) ->
SSType = [{atom,[[atom]]}],
SRType = [{atom,[{atom,atom}]}],
?line E = empty_set(),
@@ -2127,7 +2127,7 @@ family_projection(Conf) when list(Conf) ->
family_difference(suite) -> [];
family_difference(doc) -> [""];
-family_difference(Conf) when list(Conf) ->
+family_difference(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = family([]),
?line F9 = from_term([{b,[b,c]}]),
@@ -2164,7 +2164,7 @@ family_difference(Conf) when list(Conf) ->
family_intersection_1(suite) -> [];
family_intersection_1(doc) -> [""];
-family_intersection_1(Conf) when list(Conf) ->
+family_intersection_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = family([]),
?line ES = from_term([], [{atom,[[atom]]}]),
@@ -2184,7 +2184,7 @@ family_intersection_1(Conf) when list(Conf) ->
family_intersection_2(suite) -> [];
family_intersection_2(doc) -> [""];
-family_intersection_2(Conf) when list(Conf) ->
+family_intersection_2(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = family([]),
?line F1 = from_term([{a,[1,2]},{b,[4,5]},{c,[7,8]},{d,[10,11]}]),
@@ -2215,7 +2215,7 @@ family_intersection_2(Conf) when list(Conf) ->
family_union_1(suite) -> [];
family_union_1(doc) -> [""];
-family_union_1(Conf) when list(Conf) ->
+family_union_1(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = family([]),
?line ES = from_term([], [{atom,[[atom]]}]),
@@ -2230,7 +2230,7 @@ family_union_1(Conf) when list(Conf) ->
family_union_2(suite) -> [];
family_union_2(doc) -> [""];
-family_union_2(Conf) when list(Conf) ->
+family_union_2(Conf) when is_list(Conf) ->
?line E = empty_set(),
?line EF = family([]),
?line F1 = from_term([{a,[1,2]},{b,[4,5]},{c,[7,8]},{d,[10,11]}]),
@@ -2259,7 +2259,7 @@ family_union_2(Conf) when list(Conf) ->
partition_family(suite) -> [];
partition_family(doc) -> [""];
-partition_family(Conf) when list(Conf) ->
+partition_family(Conf) when is_list(Conf) ->
?line E = empty_set(),
%% set of ordered sets
diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl
index b5d9ca44bf..f25e877289 100644
--- a/lib/stdlib/test/supervisor_SUITE.erl
+++ b/lib/stdlib/test/supervisor_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%% Description: Tests supervisor.erl
@@ -89,7 +89,7 @@ sup_start_normal(doc) ->
["Tests that the supervisor process starts correctly and that it "
"can be terminated gracefully."];
sup_start_normal(suite) -> [];
-sup_start_normal(Config) when list(Config) ->
+sup_start_normal(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {ok, Pid} = start({ok, {{one_for_one, 2, 3600}, []}}),
?line exit(Pid, shutdown),
@@ -107,7 +107,7 @@ sup_start_normal(Config) when list(Config) ->
sup_start_ignore_init(doc) ->
["Tests what happens if init-callback returns ignore"];
sup_start_ignore_init(suite) -> [];
-sup_start_ignore_init(Config) when list(Config) ->
+sup_start_ignore_init(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line ignore = start(ignore),
@@ -127,7 +127,7 @@ sup_start_ignore_init(Config) when list(Config) ->
sup_start_ignore_child(doc) ->
["Tests what happens if init-callback returns ignore"];
sup_start_ignore_child(suite) -> [];
-sup_start_ignore_child(Config) when list(Config) ->
+sup_start_ignore_child(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {ok, _Pid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, [ignore]},
@@ -146,7 +146,7 @@ sup_start_ignore_child(Config) when list(Config) ->
sup_start_error_return(doc) ->
["Tests what happens if init-callback returns a invalid value"];
sup_start_error_return(suite) -> [];
-sup_start_error_return(Config) when list(Config) ->
+sup_start_error_return(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {error, Term} = start(invalid),
@@ -165,7 +165,7 @@ sup_start_error_return(Config) when list(Config) ->
sup_start_fail(doc) ->
["Tests what happens if init-callback fails"];
sup_start_fail(suite) -> [];
-sup_start_fail(Config) when list(Config) ->
+sup_start_fail(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {error, Term} = start(fail),
@@ -192,7 +192,7 @@ sup_stop_infinity(doc) ->
"for children of type supervisor"];
sup_stop_infinity(suite) -> [];
-sup_stop_infinity(Config) when list(Config) ->
+sup_stop_infinity(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {ok, Pid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []},
@@ -230,7 +230,7 @@ sup_stop_timeout(doc) ->
["See sup_stop/1 when Shutdown = 1000"];
sup_stop_timeout(suite) -> [];
-sup_stop_timeout(Config) when list(Config) ->
+sup_stop_timeout(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {ok, Pid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []},
@@ -278,7 +278,7 @@ sup_stop_brutal_kill(doc) ->
["See sup_stop/1 when Shutdown = brutal_kill"];
sup_stop_brutal_kill(suite) -> [];
-sup_stop_brutal_kill(Config) when list(Config) ->
+sup_stop_brutal_kill(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {ok, Pid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []},
@@ -327,7 +327,7 @@ extra_return(doc) ->
"and restart_child/2"];
extra_return(suite) -> [];
-extra_return(Config) when list(Config) ->
+extra_return(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child = {child1, {supervisor_1, start_child, [extra_return]},
permanent, 1000,
@@ -367,7 +367,7 @@ child_adm(doc)->
"restart_child/2, which_children/1. Only correct childspecs are used, "
"handling of incorrect childspecs is tested in child_specs/1"];
child_adm(suite) -> [];
-child_adm(Config) when list(Config) ->
+child_adm(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -430,7 +430,7 @@ child_adm_simple(doc) ->
"restart_child/2 are not valid for a simple_one_for_one supervisor "
"check that the correct error message is returned."];
child_adm_simple(suite) -> [];
-child_adm_simple(Config) when list(Config) ->
+child_adm_simple(Config) when is_list(Config) ->
Child = {child, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
?line {ok, _Pid} = start({ok, {{simple_one_for_one, 2, 3600}, [Child]}}),
@@ -467,7 +467,7 @@ child_adm_simple(Config) when list(Config) ->
child_specs(doc) ->
["Tests child specs, invalid formats should be rejected."];
child_specs(suite) -> [];
-child_specs(Config) when list(Config) ->
+child_specs(Config) when is_list(Config) ->
process_flag(trap_exit, true),
?line {ok, _Pid} = start({ok, {{one_for_one, 2, 3600}, []}}),
?line {error, _} = supervisor:start_child(sup_test, hej),
@@ -526,7 +526,7 @@ normal_termination(suite) ->
permanent_normal(doc) ->
["A permanent child should always be restarted"];
permanent_normal(suite) -> [];
-permanent_normal(Config) when list(Config) ->
+permanent_normal(Config) when is_list(Config) ->
?line {ok, _SupPid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -548,7 +548,7 @@ transient_normal(doc) ->
["A transient child should not be restarted if it exits with "
"reason normal"];
transient_normal(suite) -> [];
-transient_normal(Config) when list(Config) ->
+transient_normal(Config) when is_list(Config) ->
?line {ok, _SupPid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []}, transient, 1000,
worker, []},
@@ -564,7 +564,7 @@ transient_normal(Config) when list(Config) ->
temporary_normal(doc) ->
["A temporary process should never be restarted"];
temporary_normal(suite) -> [];
-temporary_normal(Config) when list(Config) ->
+temporary_normal(Config) when is_list(Config) ->
?line {ok, _SupPid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []}, temporary, 1000,
worker, []},
@@ -586,7 +586,7 @@ abnormal_termination(suite) ->
permanent_abnormal(doc) ->
["A permanent child should always be restarted"];
permanent_abnormal(suite) -> [];
-permanent_abnormal(Config) when list(Config) ->
+permanent_abnormal(Config) when is_list(Config) ->
?line {ok, _SupPid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -608,7 +608,7 @@ transient_abnormal(doc) ->
["A transient child should be restarted if it exits with "
"reason abnormal"];
transient_abnormal(suite) -> [];
-transient_abnormal(Config) when list(Config) ->
+transient_abnormal(Config) when is_list(Config) ->
?line {ok, _SupPid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []}, transient, 1000,
worker, []},
@@ -631,7 +631,7 @@ transient_abnormal(Config) when list(Config) ->
temporary_abnormal(doc) ->
["A temporary process should never be restarted"];
temporary_abnormal(suite) -> [];
-temporary_abnormal(Config) when list(Config) ->
+temporary_abnormal(Config) when is_list(Config) ->
?line {ok, _SupPid} = start({ok, {{one_for_one, 2, 3600}, []}}),
Child1 = {child1, {supervisor_1, start_child, []}, temporary, 1000,
worker, []},
@@ -653,7 +653,7 @@ restart_one_for_one(suite) -> [one_for_one, one_for_one_escalation].
one_for_one(doc) ->
["Test the one_for_one base case."];
one_for_one(suite) -> [];
-one_for_one(Config) when list(Config) ->
+one_for_one(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child1 = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -697,7 +697,7 @@ one_for_one(Config) when list(Config) ->
one_for_one_escalation(doc) ->
["Test restart escalation on a one_for_one supervisor."];
one_for_one_escalation(suite) -> [];
-one_for_one_escalation(Config) when list(Config) ->
+one_for_one_escalation(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child1 = {child1, {supervisor_1, start_child, [error]},
permanent, 1000,
@@ -737,7 +737,7 @@ restart_one_for_all(suite) ->
one_for_all(doc) ->
["Test the one_for_all base case."];
one_for_all(suite) -> [];
-one_for_all(Config) when list(Config) ->
+one_for_all(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child1 = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -788,7 +788,7 @@ one_for_all(Config) when list(Config) ->
one_for_all_escalation(doc) ->
["Test restart escalation on a one_for_all supervisor."];
one_for_all_escalation(suite) -> [];
-one_for_all_escalation(Config) when list(Config) ->
+one_for_all_escalation(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child1 = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -830,7 +830,7 @@ restart_simple_one_for_one(suite) ->
simple_one_for_one(doc) ->
["Test the simple_one_for_one base case."];
simple_one_for_one(suite) -> [];
-simple_one_for_one(Config) when list(Config) ->
+simple_one_for_one(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child = {child, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -872,7 +872,7 @@ simple_one_for_one_extra(doc) ->
["Tests automatic restart of children "
"who's start function return extra info."];
simple_one_for_one_extra(suite) -> [];
-simple_one_for_one_extra(Config) when list(Config) ->
+simple_one_for_one_extra(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child = {child, {supervisor_1, start_child, [extra_info]},
permanent, 1000, worker, []},
@@ -912,7 +912,7 @@ simple_one_for_one_extra(Config) when list(Config) ->
simple_one_for_one_escalation(doc) ->
["Test restart escalation on a simple_one_for_one supervisor."];
simple_one_for_one_escalation(suite) -> [];
-simple_one_for_one_escalation(Config) when list(Config) ->
+simple_one_for_one_escalation(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child = {child, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -947,7 +947,7 @@ restart_rest_for_one(suite) -> [rest_for_one, rest_for_one_escalation].
rest_for_one(doc) ->
["Test the rest_for_one base case."];
rest_for_one(suite) -> [];
-rest_for_one(Config) when list(Config) ->
+rest_for_one(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child1 = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -1018,7 +1018,7 @@ rest_for_one(Config) when list(Config) ->
rest_for_one_escalation(doc) ->
["Test restart escalation on a rest_for_one supervisor."];
rest_for_one_escalation(suite) -> [];
-rest_for_one_escalation(Config) when list(Config) ->
+rest_for_one_escalation(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child1 = {child1, {supervisor_1, start_child, []}, permanent, 1000,
worker, []},
@@ -1052,7 +1052,7 @@ rest_for_one_escalation(Config) when list(Config) ->
child_unlink(doc)-> ["Test that the supervisor does not hang forever if "
"the child unliks and then is terminated by the supervisor."];
child_unlink(suite) -> [];
-child_unlink(Config) when list(Config) ->
+child_unlink(Config) when is_list(Config) ->
?line {ok, SupPid} = start({ok, {{one_for_one, 2, 3600}, []}}),
@@ -1081,7 +1081,7 @@ tree(doc) ->
["Test a basic supervison tree."];
tree(suite) ->
[];
-tree(Config) when list(Config) ->
+tree(Config) when is_list(Config) ->
process_flag(trap_exit, true),
Child1 = {child1, {supervisor_1, start_child, []},
diff --git a/lib/stdlib/test/tar_SUITE.erl b/lib/stdlib/test/tar_SUITE.erl
index af687ed2e1..7646f4c249 100644
--- a/lib/stdlib/test/tar_SUITE.erl
+++ b/lib/stdlib/test/tar_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(tar_SUITE).
@@ -183,7 +183,7 @@ atomic(doc) ->
"and uncompressed archives."
"Also test the 'cooked' option."];
atomic(suite) -> [];
-atomic(Config) when list(Config) ->
+atomic(Config) when is_list(Config) ->
?line ok = file:set_cwd(?config(priv_dir, Config)),
?line DataFiles = data_files(),
?line Names = [Name || {Name,_,_} <- DataFiles],
@@ -369,7 +369,7 @@ try_bad(Name0, Reason, Config) ->
case catch erl_tar:format_error(Reason) of
{'EXIT', CrashReason} ->
test_server:fail({format_error, crashed, CrashReason});
- String when list(String) ->
+ String when is_list(String) ->
io:format("format_error(~p) -> ~s", [Reason, String]);
Other ->
test_server:fail({format_error, returned, Other})
@@ -413,7 +413,7 @@ try_error(M, F, A, Error) ->
case catch erl_tar:format_error(Error) of
{'EXIT', FReason} ->
test_server:fail({format_error, crashed, FReason});
- String when list(String) ->
+ String when is_list(String) ->
io:format("format_error(~p) -> ~s", [Error, String]);
Other ->
test_server:fail({format_error, returned, Other})
@@ -431,7 +431,7 @@ remove_prefix(_, Result) ->
extract_from_binary(doc) ->
"Test extracting a tar archive from a binary.";
-extract_from_binary(Config) when list(Config) ->
+extract_from_binary(Config) when is_list(Config) ->
?line DataDir = ?config(data_dir, Config),
?line PrivDir = ?config(priv_dir, Config),
?line Long = filename:join(DataDir, "no_fancy_stuff.tar"),
diff --git a/lib/stdlib/test/timer_SUITE.erl b/lib/stdlib/test/timer_SUITE.erl
index 86d8612b56..5f38c91c64 100644
--- a/lib/stdlib/test/timer_SUITE.erl
+++ b/lib/stdlib/test/timer_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(timer_SUITE).
@@ -271,7 +271,7 @@ collect(N, {E,A,B}, I) ->
print_report ->
print_report({E,A,B,I}),
collect(N,{E,A,B}, I);
- {Pid, get_report} when pid(Pid) ->
+ {Pid, get_report} when is_pid(Pid) ->
Pid ! {report, {E, A, B, I}},
collect(N,{E,A,B}, I);
reset ->
diff --git a/lib/stdlib/test/unicode_SUITE.erl b/lib/stdlib/test/unicode_SUITE.erl
index 706445005c..141ac64606 100644
--- a/lib/stdlib/test/unicode_SUITE.erl
+++ b/lib/stdlib/test/unicode_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(unicode_SUITE).
@@ -276,7 +276,7 @@ ex_latin1(Config) when is_list(Config) ->
unicode:characters_to_list(make_unaligned(MissingLastByte),unicode),
?line DoubleSize16 = byte_size(DoubleUtf16),
- ?line DoubleUtf16_2 = erlang:concat_binary([DoubleUtf16,<<16#FFFFF/utf16-big>>]),
+ ?line DoubleUtf16_2 = list_to_binary([DoubleUtf16,<<16#FFFFF/utf16-big>>]),
?line DoubleSize16_2 = byte_size(DoubleUtf16_2),
?line AllBut1_16 = DoubleSize16 - 1,
?line AllBut2_16_2 = DoubleSize16_2 - 2,
@@ -884,15 +884,15 @@ utf8_to_list_bsyntax(<<C/utf8,R/binary>>) ->
list_to_utf8_bsyntax(List,unicode) ->
FList = flatx(List),
- erlang:concat_binary([ if
- is_binary(E) ->
- E;
- true ->
- <<E/utf8>>
- end || E <- FList ]);
+ list_to_binary([ if
+ is_binary(E) ->
+ E;
+ true ->
+ <<E/utf8>>
+ end || E <- FList ]);
list_to_utf8_bsyntax(List,latin1) ->
FList = flatb(List),
- erlang:concat_binary([ <<E/utf8>> || E <- FList ]).
+ list_to_binary([ <<E/utf8>> || E <- FList ]).
@@ -954,15 +954,15 @@ utf16_big_to_list_bsyntax(<<C/utf16-big,R/binary>>) ->
list_to_utf16_big_bsyntax(List,{utf16,big}) ->
FList = flatx(List),
- erlang:concat_binary([ if
- is_binary(E) ->
- E;
- true ->
- <<E/utf16-big>>
- end || E <- FList ]);
+ list_to_binary([ if
+ is_binary(E) ->
+ E;
+ true ->
+ <<E/utf16-big>>
+ end || E <- FList ]);
list_to_utf16_big_bsyntax(List,latin1) ->
FList = flatb(List),
- erlang:concat_binary([ <<E/utf16-big>> || E <- FList ]).
+ list_to_binary([ <<E/utf16-big>> || E <- FList ]).
utf16_little_to_list_bsyntax(<<>>) ->
@@ -972,15 +972,15 @@ utf16_little_to_list_bsyntax(<<C/utf16-little,R/binary>>) ->
list_to_utf16_little_bsyntax(List,{utf16,little}) ->
FList = flatx(List),
- erlang:concat_binary([ if
- is_binary(E) ->
- E;
- true ->
- <<E/utf16-little>>
- end || E <- FList ]);
+ list_to_binary([ if
+ is_binary(E) ->
+ E;
+ true ->
+ <<E/utf16-little>>
+ end || E <- FList ]);
list_to_utf16_little_bsyntax(List,latin1) ->
FList = flatb(List),
- erlang:concat_binary([ <<E/utf16-little>> || E <- FList ]).
+ list_to_binary([ <<E/utf16-little>> || E <- FList ]).
@@ -991,15 +991,15 @@ utf32_big_to_list_bsyntax(<<C/utf32-big,R/binary>>) ->
list_to_utf32_big_bsyntax(List,{utf32,big}) ->
FList = flatx(List),
- erlang:concat_binary([ if
- is_binary(E) ->
- E;
- true ->
- <<E/utf32-big>>
- end || E <- FList ]);
+ list_to_binary([ if
+ is_binary(E) ->
+ E;
+ true ->
+ <<E/utf32-big>>
+ end || E <- FList ]);
list_to_utf32_big_bsyntax(List,latin1) ->
FList = flatb(List),
- erlang:concat_binary([ <<E/utf32-big>> || E <- FList ]).
+ list_to_binary([ <<E/utf32-big>> || E <- FList ]).
utf32_little_to_list_bsyntax(<<>>) ->
@@ -1009,15 +1009,15 @@ utf32_little_to_list_bsyntax(<<C/utf32-little,R/binary>>) ->
list_to_utf32_little_bsyntax(List,{utf32,little}) ->
FList = flatx(List),
- erlang:concat_binary([ if
- is_binary(E) ->
- E;
- true ->
- <<E/utf32-little>>
- end || E <- FList ]);
+ list_to_binary([ if
+ is_binary(E) ->
+ E;
+ true ->
+ <<E/utf32-little>>
+ end || E <- FList ]);
list_to_utf32_little_bsyntax(List,latin1) ->
FList = flatb(List),
- erlang:concat_binary([ <<E/utf32-little>> || E <- FList ]).
+ list_to_binary([ <<E/utf32-little>> || E <- FList ]).
diff --git a/lib/stdlib/test/win32reg_SUITE.erl b/lib/stdlib/test/win32reg_SUITE.erl
index 3ad58eba03..c8cc82f61e 100644
--- a/lib/stdlib/test/win32reg_SUITE.erl
+++ b/lib/stdlib/test/win32reg_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(win32reg_SUITE).
@@ -37,7 +37,7 @@ fini(Config) when is_list(Config) ->
Config.
long(doc) -> "Test long keys and entries (OTP-3446).";
-long(Config) when list(Config) ->
+long(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(10)),
?line LongKey = "software\\" ++
@@ -61,7 +61,7 @@ long(Config) when list(Config) ->
?line test_server:timetrap_cancel(Dog),
ok.
-evil_write(Config) when list(Config) ->
+evil_write(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(10)),
?line Key = "Software\\Ericsson\\Erlang",
diff --git a/lib/stdlib/test/zip_SUITE.erl b/lib/stdlib/test/zip_SUITE.erl
index 55cbd277ef..12ca655000 100644
--- a/lib/stdlib/test/zip_SUITE.erl
+++ b/lib/stdlib/test/zip_SUITE.erl
@@ -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%
%%
-module(zip_SUITE).
@@ -181,7 +181,7 @@ atomic(doc) ->
["Test the 'atomic' operations: zip/unzip/list_dir, on archives."
"Also test the 'cooked' option."];
atomic(suite) -> [];
-atomic(Config) when list(Config) ->
+atomic(Config) when is_list(Config) ->
ok = file:set_cwd(?config(priv_dir, Config)),
DataFiles = data_files(),
Names = [Name || {Name,_,_} <- DataFiles],
@@ -209,7 +209,7 @@ openzip_api(doc) ->
["Test the openzip_open/2, openzip_get/1, openzip_get/2, openzip_close/1 "
"and openzip_list_dir/1 functions."];
openzip_api(suite) -> [];
-openzip_api(Config) when list(Config) ->
+openzip_api(Config) when is_list(Config) ->
ok = file:set_cwd(?config(priv_dir, Config)),
DataFiles = data_files(),
Names = [Name || {Name, _, _} <- DataFiles],
@@ -248,7 +248,7 @@ zip_api(doc) ->
["Test the zip_open/2, zip_get/1, zip_get/2, zip_close/1 "
"and zip_list_dir/1 functions."];
zip_api(suite) -> [];
-zip_api(Config) when list(Config) ->
+zip_api(Config) when is_list(Config) ->
ok = file:set_cwd(?config(priv_dir, Config)),
DataFiles = data_files(),
Names = [Name || {Name, _, _} <- DataFiles],
@@ -550,7 +550,7 @@ aliases(Config) when is_list(Config) ->
unzip_from_binary(doc) ->
["Test extracting a zip archive from a binary."];
-unzip_from_binary(Config) when list(Config) ->
+unzip_from_binary(Config) when is_list(Config) ->
DataDir = ?config(data_dir, Config),
PrivDir = ?config(priv_dir, Config),
ExtractDir = filename:join(PrivDir, "extract_from_binary"),
@@ -626,7 +626,7 @@ delete_all_in(Dir) ->
compress_control(doc) ->
["Test control of which files that should be compressed"];
compress_control(suite) -> [];
-compress_control(Config) when list(Config) ->
+compress_control(Config) when is_list(Config) ->
ok = file:set_cwd(?config(priv_dir, Config)),
Dir = "compress_control",
Files = [
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:
diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl
index cedbd1ef19..ddb491be6c 100644
--- a/lib/wx/test/wx_class_SUITE.erl
+++ b/lib/wx/test/wx_class_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%%-------------------------------------------------------------------
%%% File : wx_class_SUITE.erl
@@ -113,12 +113,14 @@ treeCtrl(Config) ->
Frame = wxFrame:new(Wx, ?wxID_ANY, "Frame"),
Panel = wxPanel:new(Frame, []),
Tree = ?mt(wxTreeCtrl,wxTreeCtrl:new(Panel, [{style , ?wxTR_HAS_BUTTONS}])),
- Root = ?mt(wxTreeItemId, wxTreeCtrl:addRoot(Tree, "Root", [])),
- Item1 = ?mt(wxTreeItemId, wxTreeCtrl:appendItem(Tree, Root, "Item1", [])),
- ?m(ok, wxTreeCtrl:setItemData(Tree, Item1, {data, item1})),
- Item2 = ?mt(wxTreeItemId, wxTreeCtrl:appendItem(Tree, Root, "Item2", [])),
- ?m(ok, wxTreeCtrl:setItemData(Tree, Item2, {data, item2})),
- Item3 = ?mt(wxTreeItemId, wxTreeCtrl:appendItem(Tree, Root, "Item3", [])),
+ Root = wxTreeCtrl:addRoot(Tree, "Root", []),
+ ?m(true, is_integer(Root)),
+ Item1 = wxTreeCtrl:appendItem(Tree, Root, "Item1", []),
+ ?m(true, is_integer(Item1)),
+ ?m(ok, wxTreeCtrl:setItemData(Tree, Item1, {data, item1})),
+ Item2 = wxTreeCtrl:appendItem(Tree, Root, "Item2", []),
+ ?m(ok, wxTreeCtrl:setItemData(Tree, Item2, {data, item2})),
+ Item3 = wxTreeCtrl:appendItem(Tree, Root, "Item3", []),
?m(ok, wxTreeCtrl:setItemData(Tree, Item3, {data, item3})),
Sizer = wxBoxSizer:new(?wxVERTICAL),
@@ -373,7 +375,7 @@ radioBox(Config) ->
io:format("TrSortRadioBox ~p ~n", [TrSortRadioBox]),
%% If I uncomment any of these lines, it will crash
- ?m(_, catch wxControlWithItems:setClientData(TrSortRadioBox, 0, timestamp)),
+ io:format("~p~n", [catch wxControlWithItems:setClientData(TrSortRadioBox, 0, timestamp)]),
%?m(_, wxListBox:append(TrSortRadioBox, "Session Id", session_id)),
%?m(_, wxListBox:insert(TrSortRadioBox, "Session Id", 0, session_id)),
diff --git a/lib/wx/test/wx_xtra_SUITE.erl b/lib/wx/test/wx_xtra_SUITE.erl
index 6f21c60d14..d5888bbf94 100644
--- a/lib/wx/test/wx_xtra_SUITE.erl
+++ b/lib/wx/test/wx_xtra_SUITE.erl
@@ -69,10 +69,11 @@ destroy_app_test(N) when N > 0 ->
Wx = ?mr(wx_ref, wx:new()),
Frame = wxFrame:new(Wx, 1, "Destroy"),
?m(ok, wxFrame:destroy(Frame)),
- wx:destroy(),
receive
Msg -> Msg
- after 150 -> destroy_app_test(N-1)
+ after 150 ->
+ wx:destroy(),
+ destroy_app_test(N-1)
end;
destroy_app_test(_) ->
receive
@@ -184,7 +185,7 @@ menu_item_debug(Config) ->
Frame = wxFrame:new(Wx, -1, "Button Fix"),
wxFrame:connect(Frame, close_window),
- FramePanel = wxPanel:new(Frame),
+ wxPanel:new(Frame),
create_menus(Frame),
wxWindow:show(Frame),
wx_test_lib:wx_destroy(Frame,Config).
diff --git a/lib/wx/test/wxt.erl b/lib/wx/test/wxt.erl
index a346a6bdb8..1f5b1cc3b1 100644
--- a/lib/wx/test/wxt.erl
+++ b/lib/wx/test/wxt.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%%-------------------------------------------------------------------
%%% File : wxt.erl
@@ -58,16 +58,16 @@ user(Mod,Tc) when is_atom(Tc) ->
%% 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 atom(Suite0) ->
+resolve(Suite0) when is_atom(Suite0) ->
case alias(Suite0) of
- Suite when atom(Suite) ->
+ Suite when is_atom(Suite) ->
{Suite, all};
{Suite, Case} ->
{Suite, Case}
end;
-resolve({Suite0, Case}) when atom(Suite0), atom(Case) ->
+resolve({Suite0, Case}) when is_atom(Suite0), is_atom(Case) ->
case alias(Suite0) of
- Suite when atom(Suite) ->
+ Suite when is_atom(Suite) ->
{Suite, Case};
{Suite, Case2} ->
{Suite, Case2}
diff --git a/lib/xmerl/doc/src/Makefile b/lib/xmerl/doc/src/Makefile
index e26e77eb96..100a2feb0a 100644
--- a/lib/xmerl/doc/src/Makefile
+++ b/lib/xmerl/doc/src/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%
#
include $(ERL_TOP)/make/target.mk
@@ -126,7 +126,7 @@ pdf: $(TOP_PDF_FILE)
html: gifs $(HTML_REF_MAN_FILE)
$(XMERL_XML_FILES):
- docb_gen $(XMERL_DIR)/$(@:%.xml=%.erl)
+ escript $(DOCGEN)/priv/bin/xml_from_edoc.escript $(XMERL_DIR)/$(@:%.xml=%.erl)
man: $(MAN3_FILES) $(MAN6_FILES)
diff --git a/make/otp.mk.in b/make/otp.mk.in
index 902def5fd8..9f0486a609 100644
--- a/make/otp.mk.in
+++ b/make/otp.mk.in
@@ -236,33 +236,44 @@ DOCGEN=$(ERL_TOP)/lib/erl_docgen
$(MAN1DIR)/%.1:: %.xml
date=`date +"%B %e %Y"`; \
- xsltproc --output "$@" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
$(MAN2DIR)/%.2:: %.xml
date=`date +"%B %e %Y"`; \
- xsltproc --output "$@" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
$(MAN3DIR)/%.3:: %.xml
date=`date +"%B %e %Y"`; \
- xsltproc --output "$@" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+# left for compatability
$(MAN4DIR)/%.4:: %.xml
date=`date +"%B %e %Y"`; \
- xsltproc --output "$@" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+$(MAN4DIR)/%.5:: %.xml
+ date=`date +"%B %e %Y"`; \
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+
+# left for compatability
$(MAN6DIR)/%.6:: %_app.xml
date=`date +"%B %e %Y"`; \
- xsltproc --output "$@" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+
+$(MAN6DIR)/%.7:: %_app.xml
+ date=`date +"%B %e %Y"`; \
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
$(MAN9DIR)/%.9:: %.xml
date=`date +"%B %e %Y"`; \
- xsltproc --output "$@" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
+ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $<
.xmlsrc.xml:
- $(DOCGEN)/priv/bin/codeline_preprocessing.escript $< $@
+ escript $(DOCGEN)/priv/bin/codeline_preprocessing.escript $< $@
.fo.pdf:
$(FOP) -fo $< -pdf $@
+
diff --git a/system/AD.html b/system/AD.html
deleted file mode 100644
index 695f3b40aa..0000000000
--- a/system/AD.html
+++ /dev/null
@@ -1,307 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>AMENDMENT DIRECTIVE, OTP</TITLE>
-</HEAD>
-<BODY BGCOLOR="#FFFFFF">
-<CENTER>
-<A HREF="http://otp.ericsson.se"><IMG BORDER=0 ALT="[OTP]" SRC="http://otp.ericsson.se/pics/banner/min_head.gif"></A>
-<H1>AMENDMENT DIRECTIVE, OTP</H1>
-<FONT SIZE="+1">
-1/177 82 - APN 181 01I<BR>
-UAB/F Kenneth Lundin, Lars Thors�n, Morgan Eriksson<BR>
-961023<BR>
-</FONT>
-</CENTER>
-<BLOCKQUOTE>
-<H2>Table of Contents</H2>
-1 <A HREF="#1">Introduction</A><BR>
-1.1 <A HREF="#1.1">Purpose</A><BR>
-1.2 <A HREF="#1.2">Revision History</A><BR>
-2 <A HREF="#2">Product Identities</A><BR>
-3 <A HREF="#3">Document Survey</A><BR>
-4 <A HREF="#4">Implemented Change requests</A><BR>
-5 <A HREF="#5">Implemented Trouble Reports</A><BR>
-6 <A HREF="#6">Installation Instructions</A><BR>
-6.1 <A HREF="#6.1">Separate (optional) Installation of XNTP (Network Time Protocol)</A><BR>
-7 <A HREF="#7">Some useful notes</A><BR>
-8 <A HREF="#8">Known problems in this release</A><BR>
-9 <A HREF="#9">References</A><BR>
-
-<A NAME="1"><!-- Empty --></A><H2>1 Introduction</H2>
-<P><A NAME="1.1"><!-- Empty --></A><H3>1.1 Purpose</H3>
-<P>This update release, OTP P1H, contains a fix for the erl_call problems in OTP P1G.<A NAME="1.2"><!-- Empty --></A><H3>1.2 Revision History</H3>
-<P>Rev.A:Kenneth Lundin 1996-05-31<BR>
-
-Rev.B:Lars Thors�n 1996-06-04<BR>
-
-Rev.C:Kenneth Lundin 1996-06-14<BR>
-
-Rev.D:Kenneth Lundin 1996-08-28<BR>
-
-Rev.E:Lars Thors�n 1996-09-12<BR>
-
-Rev.F:Kenneth Lundin 1996-09-13<BR>
-
-Rev.G:Morgan Ericsson 1996-10-08<BR>
-
-Rev.H:Kenneth Lundin 1996-10-14<BR>
-
-Rev.I:Morgan Eriksson 1996-10-23<BR>
-<P>The exact changes between revisions of this document can be generated from our ClearCase repository upon request , or a simple unix "diff" can be used.<A NAME="2"><!-- Empty --></A><H2>2 Product Identities</H2>
-<P><P><TABLE BORDER=1>
-<TR>
-<TD><B>Product Name</B></TD>
-<TD><B>Product Number</B></TD>
-<TD><B>R-state</B></TD>
-</TR>
-<TR>
-<TD>OTP</TD>
-<TD>APN 181 01</TD>
-<TD>P1H</TD>
-</TR>
-<TR>
-<TD>ERTS (sunos4)</TD>
-<TD>CXC 138 10/1</TD>
-<TD>P1G</TD>
-</TR>
-<TR>
-<TD>ERTS (sunos5)</TD>
-<TD>CXC 138 10/2</TD>
-<TD>P1G</TD>
-</TR>
-<TR>
-<TD>SASL (BOS) (sunos4)</TD>
-<TD>CXC 138 11/1</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>SASL (BOS) (sunos5)</TD>
-<TD>CXC 138 11/2</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>MNESIA</TD>
-<TD>CXC 138 12/1</TD>
-<TD>P1E</TD>
-</TR>
-<TR>
-<TD>SNMPEA</TD>
-<TD>CXC 138 13/1</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>ERLDEV (Compiler & Debugger)</TD>
-<TD>CXC 138 15/1</TD>
-<TD>P1C</TD>
-</TR>
-<TR>
-<TD>DEVTOOLS (sunos4)</TD>
-<TD>CXC 138 16/1</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>DEVTOOLS (sunos5)</TD>
-<TD>CXC 138 16/2</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>XLATETOOLS (sunos4)</TD>
-<TD>CXC 138 17/1</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>XLATETOOLS (sunos5)</TD>
-<TD>CXC 138 17/2</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>CPO Solaris (XNTP)</TD>
-<TD>CXC 138 46/1</TD>
-<TD>P1A</TD>
-</TR>
-</TABLE>
-<A NAME="3"><!-- Empty --></A><H2>3 Document Survey</H2>
-<P><P><TABLE BORDER=1>
-<TR>
-<TD><B>Document name</B></TD>
-<TD><B>Document number</B></TD>
-<TD>Rev</TD>
-</TR>
-<TR>
-<TD>Systems Overview</TD>
-<TD>1551-APN 181 01</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools Introduction</TD>
-<TD>EPK-95:030/1</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools User's Guide</TD>
-<TD>EPK-95:030/2</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools</TD>
-<TD>EPK-95:030/3</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Distributed Erlang User's Guide</TD>
-<TD>EPK-95:030/4</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools Examples</TD>
-<TD>EPK-95:030/5</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>User's Guide to the Erlang Interface Library</TD>
-<TD>3/1553-CNA 121 16</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Interface Library Examples</TD>
-<TD>1/198 17-CNA 121 16</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Programmer's Guide to the Erlang Interface Library</TD>
-<TD>2/198 17-CNA 121 16</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>OTP Erlang User's guide</TD>
-<TD>1553-CNA 121 17</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>The Mnesia Query Language Mnemosyne</TD>
-<TD>1553-CNA 121 18</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>SNMPEA User's Guide</TD>
-<TD>1553-CNA 121 19</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>SNMPEA Reference Guide</TD>
-<TD>1551-CNA 121 19</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>User's Guide to the Interface Generator</TD>
-<TD>1553-CNA 121 38</TD>
-<TD>A</TD>
-</TR>
-</TABLE>
-<P>A complete browseable document survey is available at the OTP WWW-server http://otp.ericsson.se and can also be found in the release at $OTP_ROOT/doc/all.html when the
-release file is un-tar:ed at $OTP_ROOT.<A NAME="4"><!-- Empty --></A><H2>4 Implemented Change requests</H2>
-<P>-<A NAME="5"><!-- Empty --></A><H2>5 Implemented Trouble Reports</H2>
-<P><P><TABLE BORDER=1>
-<TR>
-<TD><B>Block</B></TD>
-<TD><B>TR id</B></TD>
-<TD><B>Slogan</B></TD>
-</TR>
-<TR>
-<TD>ERTS</TD>
-<TD>-</TD>
-<TD>erl_call crashes (Segmentation fault) has now been fixed</TD>
-</TR>
-</TABLE>
-<A NAME="6"><!-- Empty --></A><H2>6 Installation Instructions</H2>
-<P>The release is delivered as a compressed tar-file <B>otp_APN18101_P1H.&#60;target&#62;.tar.Z</B>, where &#60;target&#62; is substituted with <B>sunos4</B> or <B>sunos5</B>.<P>Then the following steps shall be performed at installation time:<UL>
-<LI>Create a new directory $OTP_INSTALL_DIR where OTP can be installed.
-<PRE>mkdir $OTP_INSTALL_DIR
-cd $OTP_INSTALL_DIR
-uncompress $XXX/otp_APN18101_P1H.&lt;target&gt;.tar.Z
-tar xvfp $XXX/otp_APN18101_P1H.&lt;target&gt;.tar</PRE>
-
-<LI>Run the OTP installscript and answer the questions.
-<PRE>./Install $OTP_INSTALL_DIR</PRE>
-<BR>The Install command will ask a number of questions during the installation.
-<B>OBS!</B> When installing on a system where DNS is not used you
-should answer <B>NO</B> on the question "WILL YOU USE DNS?"
-
-<LI>Prepare the OTP man pages.
-<PRE>mkdir man/cat1 man/cat3
-./format_man_pages</PRE>
-
-<LI>Update the erl_interface library with ranlib (sunos4 only).
-<PRE>cd $OTP_INSTALL_DIR/usr/lib
-ranlib liberl_interface.a</PRE>
-
-</UL>
-<P>Add $OTP_INSTALL_DIR/bin to the path variable and $OTP_INSTALL_DIR/man to the MANPATH variable.<P>Where <B>$XXX</B> denotes the path at which otp_APN18101_P1H.&#60;target&#62;.tar resides.
-<A NAME="6.1"><!-- Empty --></A><H3>6.1 Separate (optional) Installation of XNTP (Network Time Protocol)</H3>
-<P>XNTP (Network Time Protocol) <B>for use in an embedded system running Sunos5</B> is
-delivered in this release. The XNTP resides in the tar-file xntp_CXC_13846_P1A.sunos5.tar.Z and can be fetched with Netscape from the same place as the other OTP deliverables.<UL>
-<LI>Create a new directory $XNTP_DIR where the XNTP distribution can be loaded.
-<PRE>mkdir $XNTP_DIR
-cd $XNTP_DIR
-uncompress $XXX/xntp_CXC_13846_P1A.sunos5.tar.Z
-tar xvf $XXX/xntp_CXC_13846_P1A.sunos5.tar.Z</PRE>
-
-<LI>Read the README-file which is included, below follows information which
-is partly the same as can be found at the end of the README file.
-
-<LI>Note, the xntp3.5a.export subdirectory is not needed for installation.
-
-<BR>Create a suitable configuration file based on the samples in the
-'config' directory, and copy it to /etc/ntp.conf.
-
-<LI>Create a directory for the binaries and copy them there:<BR>
-
-<PRE>mkdir -p /opt/xntp/bin
-cp bin/* /opt/xntp/bin</PRE>
-<BR>Note!, if you prefer another installation directory for the binaries, you have to edit one line in the "Run Commands" script xntp (located in the init directory):
-<PRE>BINDIR=&lt;your new bindir&gt;</PRE>
-
-<LI>Install the "Run Commands" script:<BR>
-
-<PRE>cp init/xntp /etc/init.d/xntp&lt;br&gt;
-ln /etc/init.d/xntp /etc/rc0.d/K57xntp
-ln /etc/init.d/xntp /etc/rc1.d/K57xntp
-ln /etc/init.d/xntp /etc/rc2.d/S78xntp</PRE>
-
-<LI>Modify the /etc/system file (you probably want to save the original):<BR>
-
-<PRE>cat init/system &gt;&gt; /etc/system</PRE>
-
-</UL>
-<P>Where <B>$XXX</B> denotes the path at which xntp_CXC13846_P1A.sunos5.tar.Z resides.<A NAME="7"><!-- Empty --></A><H2>7 Some useful notes</H2>
-<P>To make it possible to browse Framemaker documents through Netscape the files
-.mime.types and .mailcap should be modified (see below). The modifications
-can be made as systems defaults if they are placed in e.g /usr/local/lib/netscape (see Netscape Handbook for details) or as personal defaults if placed in the
-users $HOME directory.<P>.mime.types<P><PRE>application/x-maker fm</PRE>
-<P>
-.mailcap<P><PRE>application/x-maker; fmclient -f %s</PRE>
-<A NAME="8"><!-- Empty --></A><H2>8 Known problems in this release</H2>
-<P><UL>
-<LI>In the manual-page for module code, the returned value of the function
-which is described to be String but in reality it is an Atom (for compatibility
-reasons). In the next release the return type will however be String as it says
-in the manual-page.
-
-<LI>On SunOS4.x platforms, the format_man_pages script (executed as a part of installation) will cause following error messages for missing manual sections:
-<BR>
-<PRE>opendir:man{2,4,5,6,7,8,l,n}: No such file or directory</PRE>
-<BR>These messages should be ignored.
-
-</UL>
-<A NAME="9"><!-- Empty --></A><H2>9 References</H2>
-<P><I>Nothing to reference</I>
-</BLOCKQUOTE>
-<CENTER>
-<HR>
-<P><FONT SIZE=-1>
-Copyright &copy; 1996 <A HREF="http://otp.ericsson.se">Open Telecom Platform</A><BR>
-<!--#include virtual="/ssi/otp_footer.html"-->
-</FONT>
-</CENTER>
-</BODY>
-</HTML>
diff --git a/system/AD.sgml b/system/AD.sgml
deleted file mode 100644
index e7fc9755ed..0000000000
--- a/system/AD.sgml
+++ /dev/null
@@ -1,367 +0,0 @@
-<!doctype report PUBLIC "-//Stork//DTD report//EN">
-
-<report>
- <header>
- <title>AMENDMENT DIRECTIVE, OTP</title>
- <prepared>ETX/B/SFP Kenneth Lundin, Lars Thors&#233;n, Morgan Eriksson</prepared>
- <responsible></responsible>
- <docno>1/177 82 - APN 181 01</docno>
- <approved>ETX/B/SF Torbj&ouml;rn Johnson</approved>
- <checked></checked>
- <date>961023</date>
- <rev>I</rev>
- <file>tr1c.sgml</file>
- </header>
-
-<section>
-<title>Introduction</title>
-<p>
-<section><title>Purpose</title>
-<p>
-This update release, OTP P1H, contains a fix for the erl_call problems in OTP P1G.
-</section>
-
-<section><title>Revision History</title>
-<p>
-Rev.A:Kenneth Lundin 1996-05-31<br>
-Rev.B:Lars Thors&#233;n 1996-06-04<br>
-Rev.C:Kenneth Lundin 1996-06-14<br>
-Rev.D:Kenneth Lundin 1996-08-28<br>
-Rev.E:Lars Thors&#233;n 1996-09-12<br>
-Rev.F:Kenneth Lundin 1996-09-13<br>
-Rev.G:Morgan Ericsson 1996-10-08<br>
-Rev.H:Kenneth Lundin 1996-10-14<br>
-Rev.I:Morgan Eriksson 1996-10-23<br>
-<p>
-The exact changes between revisions of this document can be generated from our ClearCase repository upon request , or a simple unix "diff" can be used.
-</section>
-</section>
-<section><title>Product Identities</title>
-<p>
-<table>
-<row>
-<cell><b>Product Name</b></cell>
-<cell><b>Product Number</b></cell>
-<cell><b>R-state</b></cell>
-</row>
-<row>
-<cell>OTP</cell>
-<cell>APN 181 01</cell>
-<cell>P1H</cell>
-</row>
-<row>
-<cell>ERTS (sunos4)</cell>
-<cell>CXC 138 10/1</cell>
-<cell>P1G</cell>
-</row>
-<row>
-<cell>ERTS (sunos5)</cell>
-<cell>CXC 138 10/2</cell>
-<cell>P1G</cell>
-</row>
-<row>
-<cell>SASL (BOS) (sunos4)</cell>
-<cell>CXC 138 11/1</cell>
-<cell>P1D</cell>
-</row>
-<row>
-<cell>SASL (BOS) (sunos5)</cell>
-<cell>CXC 138 11/2</cell>
-<cell>P1D</cell>
-</row>
-<row>
-<cell>MNESIA</cell>
-<cell>CXC 138 12/1</cell>
-<cell>P1E</cell>
-</row>
-<row>
-<cell>SNMPEA</cell>
-<cell>CXC 138 13/1</cell>
-<cell>P1D</cell>
-</row>
-<row>
-<cell>ERLDEV (Compiler & Debugger)</cell>
-<cell>CXC 138 15/1</cell>
-<cell>P1C</cell>
-</row>
-<row>
-<cell>DEVTOOLS (sunos4)</cell>
-<cell>CXC 138 16/1</cell>
-<cell>P1D</cell>
-</row>
-<row>
-<cell>DEVTOOLS (sunos5)</cell>
-<cell>CXC 138 16/2</cell>
-<cell>P1D</cell>
-</row>
-<row>
-<cell>XLATETOOLS (sunos4)</cell>
-<cell>CXC 138 17/1</cell>
-<cell>P1D</cell>
-</row>
-<row>
-<cell>XLATETOOLS (sunos5)</cell>
-<cell>CXC 138 17/2</cell>
-<cell>P1D</cell>
-</row>
-<row>
-<cell>CPO Solaris (XNTP)</cell>
-<cell>CXC 138 46/1</cell>
-<cell>P1A</cell>
-</row>
-</table>
-</section>
-<section><title>Document Survey</title>
-<p>
-<table>
-<row>
-<cell><b>Document name</b></cell>
-<cell><b>Document number</b></cell>
-<cell>Rev</cell>
-</row>
-<row>
-<cell>Systems Overview</cell>
-<cell>1551-APN 181 01</cell>
-<cell>A</cell>
-</row>
-<row>
-<cell>Erlang Tools Introduction</cell>
-<cell>EPK-95:030/1</cell>
-<cell>A</cell>
-</row>
-<row>
-<cell>Erlang Tools User's Guide</cell>
-<cell>EPK-95:030/2</cell>
-<cell>A</cell>
-</row>
-<row>
-<cell>Erlang Tools</cell>
-<cell>EPK-95:030/3</cell>
-<cell>A</cell>
-</row>
-<row>
-<cell>Distributed Erlang User's Guide</cell>
-<cell>EPK-95:030/4</cell>
-<cell>A</cell>
-</row>
-<row>
-<cell>Erlang Tools Examples</cell>
-<cell>EPK-95:030/5</cell>
-<cell>A</cell>
-</row>
-
-<row>
-<cell>User's Guide to the Erlang Interface Library</cell>
-<cell>3/1553-CNA 121 16</cell>
-<cell>A</cell>
-</row>
-<row>
-<cell>Erlang Interface Library Examples</cell>
-<cell>1/198 17-CNA 121 16</cell>
-<cell>A</cell>
-</row>
-<row>
-<cell>Programmer's Guide to the Erlang Interface Library</cell>
-<cell>2/198 17-CNA 121 16</cell>
-<cell>A</cell>
-</row>
-
-<row>
-<cell>OTP Erlang User's guide</cell>
-<cell>1553-CNA 121 17</cell>
-<cell>A</cell>
-</row>
-
-<row>
-<cell>The Mnesia Query Language Mnemosyne</cell>
-<cell>1553-CNA 121 18</cell>
-<cell>A</cell>
-</row>
-
-<row>
-<cell>SNMPEA User's Guide</cell>
-<cell>1553-CNA 121 19</cell>
-<cell>A</cell>
-</row>
-
-<row>
-<cell>SNMPEA Reference Guide</cell>
-<cell>1551-CNA 121 19</cell>
-<cell>A</cell>
-</row>
-
-<row>
-<cell>User's Guide to the Interface Generator</cell>
-<cell>1553-CNA 121 38</cell>
-<cell>A</cell>
-</row>
-
-</table>
-
-<p>
-A complete browseable document survey is available at the OTP WWW-server http://otp.ericsson.se and can also be found in the release at $OTP_ROOT/doc/all.html when the
-release file is un-tar:ed at $OTP_ROOT.
-</section>
-<section><title>Implemented Change requests</title>
-<p>
--
-</section>
-<section><title>Implemented Trouble Reports</title>
-<p>
-<table>
-<row>
-<cell><b>Block</b></cell>
-<cell><b>TR id</b></cell>
-<cell><b>Slogan</b></cell>
-</row>
-<row>
-<cell>ERTS</cell>
-<cell>-</cell>
-<cell>
-erl_call crashes (Segmentation fault) has now been fixed
-</cell>
-</row>
-</table>
-</section>
-<section><title>Installation Instructions</title>
-<p>
-The release is delivered as a compressed tar-file <b>otp_APN18101_P1H.&lt;target&gt;.tar.Z</b>, where &lt;target&gt; is substituted with <b>sunos4</b> or <b>sunos5</b>.
-<p>
-Then the following steps shall be performed at installation time:
-</p>
-<list>
-<item><p>Create a new directory $OTP_INSTALL_DIR where OTP can be installed.
-<code>
-mkdir $OTP_INSTALL_DIR
-cd $OTP_INSTALL_DIR
-uncompress $XXX/otp_APN18101_P1H.<target>.tar.Z
-tar xvfp $XXX/otp_APN18101_P1H.<target>.tar
-</code>
-</item>
-<item><p>Run the OTP installscript and answer the questions.
-<code>
-./Install $OTP_INSTALL_DIR
-</code>
-<p>
-The Install command will ask a number of questions during the installation.
-<b>OBS!</b> When installing on a system where DNS is not used you
-should answer <b>NO</b> on the question "WILL YOU USE DNS?"
-</item>
-<item><p>Prepare the OTP man pages.
-<code>
-mkdir man/cat1 man/cat3
-./format_man_pages
-</code>
-<item><p>Update the erl_interface library with ranlib (sunos4 only).
-<code>
-cd $OTP_INSTALL_DIR/usr/lib
-ranlib liberl_interface.a
-</code>
-</item>
-</list>
-<p>
-Add $OTP_INSTALL_DIR/bin to the path variable and $OTP_INSTALL_DIR/man to the MANPATH variable.
-<p>
-Where <b>$XXX</b> denotes the path at which otp_APN18101_P1H.&lt;target&gt;.tar resides.
-
-<section><title>Separate (optional) Installation of XNTP (Network Time Protocol)</title>
-<p>
-XNTP (Network Time Protocol) <b>for use in an embedded system running Sunos5</b> is
-delivered in this release. The XNTP resides in the tar-file xntp_CXC_13846_P1A.sunos5.tar.Z and can be fetched with Netscape from the same place as the other OTP deliverables.
-<list>
-<item><p>Create a new directory $XNTP_DIR where the XNTP distribution can be loaded.
-<code>
-mkdir $XNTP_DIR
-cd $XNTP_DIR
-uncompress $XXX/xntp_CXC_13846_P1A.sunos5.tar.Z
-tar xvf $XXX/xntp_CXC_13846_P1A.sunos5.tar.Z
-</code>
-</item>
-<item><p>Read the README-file which is included, below follows information which
-is partly the same as can be found at the end of the README file.</item>
-<item><p>Note, the xntp3.5a.export subdirectory is not needed for installation.
-
-<p>Create a suitable configuration file based on the samples in the
-'config' directory, and copy it to /etc/ntp.conf.</item>
-
-<item><p>Create a directory for the binaries and copy them there:<br>
-<code>
-mkdir -p /opt/xntp/bin
-cp bin/* /opt/xntp/bin
-</code>
-<p>Note!, if you prefer another installation directory for the binaries, you have to edit one line in the "Run Commands" script xntp (located in the init directory):
-<code>
-BINDIR=<your new bindir>;
-</code>
-</item>
-
-<item><p>Install the "Run Commands" script:<br>
-<code>
-cp init/xntp /etc/init.d/xntp<br>
-ln /etc/init.d/xntp /etc/rc0.d/K57xntp
-ln /etc/init.d/xntp /etc/rc1.d/K57xntp
-ln /etc/init.d/xntp /etc/rc2.d/S78xntp
-</code>
-</item>
-
-<item><p>Modify the /etc/system file (you probably want to save the original):<br>
-<code>
-cat init/system >> /etc/system
-</code>
-</item>
-
-</list>
-<p>
-Where <b>$XXX</b> denotes the path at which xntp_CXC13846_P1A.sunos5.tar.Z resides.
-</section>
-</section>
-
-<section><title>Some useful notes</title>
-<p>
-To make it possible to browse Framemaker documents through Netscape the files
-.mime.types and .mailcap should be modified (see below). The modifications
-can be made as systems defaults if they are placed in e.g /usr/local/lib/netscape (see Netscape Handbook for details) or as personal defaults if placed in the
-users $HOME directory.
-<p>
-.mime.types
-<p>
-<pre>
-application/x-maker fm
-</pre>
-<p>
-
-.mailcap
-<p>
-<pre>
-application/x-maker; fmclient -f %s
-</pre>
-</section>
-<section><title>Known problems in this release</title>
-<p>
-<list>
-<item><p>In the manual-page for module code, the returned value of the function
-which is described to be String but in reality it is an Atom (for compatibility
-reasons). In the next release the return type will however be String as it says
-in the manual-page.</item>
-<item><p>On SunOS4.x platforms, the format_man_pages script (executed as a part of installation) will cause following error messages for missing manual sections:
-<p><code>opendir:man{2,4,5,6,7,8,l,n}: No such file or directory</code>
-<p>These messages should be ignored.
-</item>
-
-</list>
-</section>
-<section><title>References</title>
-<p>
-<i>Nothing to reference</i>
-
-</section>
-</report>
-
-
-
-
-
-
-
-
-
diff --git a/system/ADbeam.html b/system/ADbeam.html
deleted file mode 100644
index abb80c9f0a..0000000000
--- a/system/ADbeam.html
+++ /dev/null
@@ -1,261 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>AMENDMENT DIRECTIVE, OTP-BEAM
- </TITLE>
-</HEAD>
-<BODY BGCOLOR="#FFFFFF">
-<TABLE WIDTH=100%>
-<TR>
-<TD ROWSPAN=2 WIDTH=50%><IMG ALT="Ericsson" SRC="http://otp.ericsson.se/pics/logo/elogo.gif"></TD>
-<TD VALIGN=TOP WIDTH=50%><BR><BR></TD>
-</TR>
-<TR>
-<TD VALIGN=TOP WIDTH=50%><B>OTP Report</B></TD>
-</TR>
-</TABLE><CENTER>
-<TABLE BORDER CELLSPACING=0 CELLPADDING=2 WIDTH=100%>
-<TR>
-<TD VALIGN=TOP WIDTH=30% COLSPAN=3>
-<FONT SIZE=1>Uppgjord - <I>Prepared</I></FONT><BR>
-<FONT SIZE=3>UAB/F Kenneth Lundin, Lars Thors�n
-</FONT>
-</TD>
-<TD VALIGN=TOP WIDTH=20% COLSPAN=2 NOWRAP>
-<FONT SIZE=1>Faktaansvarig - <I>Subject responsible</I></FONT><BR>
-<FONT SIZE=3> </FONT><BR>
-</TD>
-<TD VALIGN=TOP WIDTH=50% COLSPAN=5>
-<FONT SIZE=1>Nr - <I>No</I></FONT><BR>
-<FONT SIZE=3>3/177 82 - APN 181 01
-</FONT>
-</TD>
-</TR>
-<TR>
-<TD VALIGN=TOP WIDTH=40% COLSPAN=4 NOWRAP>
-<FONT SIZE=1>Dokansv/Godk - <I>Doc respons/Approved</I></FONT><BR>
-<FONT SIZE=3>ETX/B/DU Torbj&ouml;rn Johnsson
-</FONT>
-</TD>
-<TD VALIGN=TOP WIDTH=10%>
-<FONT SIZE=1>Kontr - <I>Checked</I></FONT><BR>
-<FONT SIZE=3> </FONT>
-</TD>
-<TD VALIGN=TOP WIDTH=20% COLSPAN=2 NOWRAP>
-<FONT SIZE=1>Datum - <I>Date</I></FONT><BR>
-<FONT SIZE=3>960828
-</FONT></TD>
-<TD VALIGN=TOP WIDTH=10%><FONT SIZE=1>Rev</FONT><BR>
-<FONT SIZE=3>D
-</FONT>
-</TD>
-<TD VALIGN=TOP WIDTH=20% COLSPAN=2>
-<FONT SIZE=1>File</FONT><BR>
-<FONT SIZE=3>tr1c.sgml
-<BR></FONT>
-</TD>
-</TR>
-</TABLE><P>
-<A HREF="http://otp.ericsson.se/">
-<STRONG>OTP</STRONG></A> /
-<STRONG>...</STRONG> /
-<A HREF="../
- ">
-<STRONG>Up</STRONG></A> /
-<P><B><FONT SIZE=8>AMENDMENT DIRECTIVE, OTP-BEAM
-</FONT></B>
-</CENTER>
-<HR>
-<H2>Introduction</H2>
-<P>
-<H3>Purpose</H3>
-<P>This is a first prototype release of the OTP-BEAM system for SunOS5.
-This version is intended to be used for various capacity measurements and the functionality is comparable to that of OTP rev P1D (APN 181 01 P1D).
-
-<H3>Revision History</H3>
-<P>Rev.A:Kenneth Lundin 1996-08-28<BR>
-
-<P>The exact changes between revisions of this document can be generated from our ClearCase repository upon request , or a simple unix "diff" can be used.
-<H2>Product Identities</H2>
-<P><CENTER><TABLE BORDER=1>
-<TR>
-<TH>Product Name</TH>
-<TH>Product Number</TH>
-<TH>R-state</TH>
-</TR>
-<TR>
-<TD>OTP</TD>
-<TD>APN 181 01</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>ERTS (sunos5-beam)</TD>
-<TD>CXC 138 10/3</TD>
-<TD>P1D</TD>
-</TR>
-<TR>
-<TD>SASL (BOS) (sunos5-beam)</TD>
-<TD>CXC 138 11/3</TD>
-<TD>P1C</TD>
-</TR>
-<TR>
-<TD>MNESIA</TD>
-<TD>CXC 138 12/1</TD>
-<TD>P1C</TD>
-</TR>
-<TR>
-<TD>SNMPEA</TD>
-<TD>CXC 138 13/1</TD>
-<TD>P1C</TD>
-</TR>
-<TR>
-<TD>ERLDEV (Compiler & Debugger)</TD>
-<TD>CXC 138 15/1</TD>
-<TD>P1B</TD>
-</TR>
-<TR>
-<TD>DEVTOOLS (sunos5-beam)</TD>
-<TD>CXC 138 16/3</TD>
-<TD>P1C</TD>
-</TR>
-<TR>
-<TD>XLATETOOLS (sunos5-beam)</TD>
-<TD>CXC 138 17/3</TD>
-<TD>P1C</TD>
-</TR>
-</TABLE></CENTER>
-
-<H2>Document Survey</H2>
-<P><CENTER><TABLE BORDER=1>
-<TR>
-<TH>Document name</TH>
-<TH>Document number</TH>
-<TH>Rev</TH>
-</TR>
-<TR>
-<TD>Systems Overview</TD>
-<TD>1551-APN 181 01</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools Introduction</TD>
-<TD>EPK-95:030/1</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools User's Guide</TD>
-<TD>EPK-95:030/2</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools</TD>
-<TD>EPK-95:030/3</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Distributed Erlang User's Guide</TD>
-<TD>EPK-95:030/4</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Tools Examples</TD>
-<TD>EPK-95:030/5</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>User's Guide to the Erlang Interface Library</TD>
-<TD>3/1553-CNA 121 16</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Erlang Interface Library Examples</TD>
-<TD>1/198 17-CNA 121 16</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Programmer's Guide to the Erlang Interface Library</TD>
-<TD>2/198 17-CNA 121 16</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>OTP Erlang User's guide</TD>
-<TD>1553-CNA 121 17</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>Mnesia Users Guide (changed name and much improved)</TD>
-<TD>1553-CNA 121 18</TD>
-<TD>PB1</TD>
-</TR>
-<TR>
-<TD>SNMPEA User's Guide</TD>
-<TD>1553-CNA 121 19</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>SNMPEA Reference Guide</TD>
-<TD>1551-CNA 121 19</TD>
-<TD>A</TD>
-</TR>
-<TR>
-<TD>User's Guide to the Interface Generator</TD>
-<TD>1553-CNA 121 38</TD>
-<TD>A</TD>
-</TR>
-</TABLE></CENTER>
-
-
-<P>A complete browseable document survey is available at the OTP WWW-server http://otp.ericsson.se and can also be found in the release at $OTP_ROOT/doc/all.html when the
-release file is un-tar:ed at $OTP_ROOT.
-<H2>Implemented Change requests</H2>
-<P>Comparable in functionality with OTP 181 01 P1D (jam).
-
-<H2>Implemented Trouble Reports</H2>
-<P>This is the first version.
-
-<H2>Installation Instructions</H2>
-<P><B>OBS! The installation path selected below must not be the same as the one used for an OTP -jam system. </B>
-<P>The release is delivered as a compressed tar-file
-<B>otp_APN18101_beam_P1D.&lt;target&gt;.tar.Z</B>,
-where &lt;target&gt; is substituted with <B>sunos5</B>.
-<P>Then the following steps shall be performed at installation time:
-<UL>
-<LI>mkdir <I>&lt;installation path&gt;</I>
-<LI>cd <I>&lt;installation path&gt;</I>
-<LI>uncompress $XXX/otp_APN18101_beam_P1D.&lt;target&gt;.tar.Z
-<LI>tar xvfp $XXX/otp_APN18101_beam_P1D.&lt;target&gt;.tar
-<LI>./Install <I>&lt;installation path&gt;</I><BR>
-The Install command will ask a number of questions during the installation.<BR>
-<B>OBS!</B> When installing on a system where DNS is not used you
-should answer <B>NO</B> on the question "WILL YOU USE DNS?"
-<LI>mkdir man/cat1 man/cat3
-<LI>./format_man_pages
-<LI>cd <I>&lt;installation path&gt;</I>/usr/lib and run ranlib on liberl_interface.a (only sunos4)
-</UL>
-
-Add <I>&lt;installation path&gt;</I>/bin to the path variable and <I>&lt;installation path&gt;</I>/man to the MANPATH variable.
-<P>Where $XXX denotes the path at which otp_APN18101_beam_P1D.&lt;target&gt;.tar resides.
-<H2>Some useful notes</H2>
-<P>To make it possible to browse Framemaker documents through Netscape the files
-.mime.types and .mailcap should be modified (see below). The modifications
-can be made as systems defaults if they are placed in e.g /usr/local/lib/netscape (see Netscape Handbook for details) or as personal defaults if placed in the
-users $HOME directory.
-<P>.mime.types
-<P>
-<PRE>application/x-maker fm</PRE>
-
-<P>
-.mailcap
-<P>
-<PRE>application/x-maker; fmclient -f %s</PRE>
-
-<H2>Known problems in this release</H2>
-<P><UL>
-<LI>Some html-links may still be faulty.
-</UL>
-
-<H2>References</H2>
-<P><I>Nothing to reference</I>
-
-
-</BODY>
-</HTML> \ No newline at end of file
diff --git a/system/ADbeam.sgml b/system/ADbeam.sgml
deleted file mode 100644
index 63995fe26e..0000000000
--- a/system/ADbeam.sgml
+++ /dev/null
@@ -1,246 +0,0 @@
-<!doctype report PUBLIC "-//Stork//DTD tr1c//EN">
-
-<report>
- <header>
- <title>AMENDMENT DIRECTIVE, OTP-BEAM
- <prepared>ETX/B/DUP Kenneth Lundin, Lars Thors&#233;n
- <responsible>
- <docno>3/177 82 - APN 181 01
- <approved>ETX/B/DU Torbj&ouml;rn Johnsson
- <checked>
- <date>960828
- <rev>D
- <file>tr1c.sgml
- <parent>../
- </header>
-
- <section>
-<h1>Introduction</h1>
-<p>
-<h2>Purpose</h2>
-<p>
-This is a first prototype release of the OTP-BEAM system for SunOS5.
-This version is intended to be used for various capacity measurements and the functionality is comparable to that of OTP rev P1D (APN 181 01 P1D).
-
-<h2>Revision History</h2>
-<p>
-Rev.A:Kenneth Lundin 1996-08-28<br>
-
-<p>
-The exact changes between revisions of this document can be generated from our ClearCase repository upon request , or a simple unix "diff" can be used.
-<h1>Product Identities</h1>
-<p>
-<table>
-<row>
-<hcell>Product Name
-<hcell>Product Number
-<hcell>R-state
-</row>
-<row>
-<cell>OTP
-<cell>APN 181 01
-<cell>P1D
-</row>
-<row>
-<cell>ERTS (sunos5-beam)
-<cell>CXC 138 10/3
-<cell>P1D
-</row>
-<row>
-<cell>SASL (BOS) (sunos5-beam)
-<cell>CXC 138 11/3
-<cell>P1C
-</row>
-<row>
-<cell>MNESIA
-<cell>CXC 138 12/1
-<cell>P1C
-</row>
-<row>
-<cell>SNMPEA
-<cell>CXC 138 13/1
-<cell>P1C
-</row>
-<row>
-<cell>ERLDEV (Compiler & Debugger)
-<cell>CXC 138 15/1
-<cell>P1B
-</row>
-<row>
-<cell>DEVTOOLS (sunos5-beam)
-<cell>CXC 138 16/3
-<cell>P1C
-</row>
-<row>
-<cell>XLATETOOLS (sunos5-beam)
-<cell>CXC 138 17/3
-<cell>P1C
-</row>
-</table>
-<h1>Document Survey</h1>
-<p>
-<table>
-<row>
-<hcell>Document name
-<hcell>Document number
-<hcell>Rev
-</row>
-<row>
-<cell>Systems Overview
-<cell>1551-APN 181 01
-<cell>A
-</row>
-<row>
-<cell>Erlang Tools Introduction
-<cell>EPK-95:030/1
-<cell>A
-</row>
-<row>
-<cell>Erlang Tools User's Guide
-<cell>EPK-95:030/2
-<cell>A
-</row>
-<row>
-<cell>Erlang Tools
-<cell>EPK-95:030/3
-<cell>A
-</row>
-<row>
-<cell>Distributed Erlang User's Guide
-<cell>EPK-95:030/4
-<cell>A
-</row>
-<row>
-<cell>Erlang Tools Examples
-<cell>EPK-95:030/5
-<cell>A
-</row>
-
-<row>
-<cell>User's Guide to the Erlang Interface Library
-<cell>3/1553-CNA 121 16
-<cell>A
-</row>
-<row>
-<cell>Erlang Interface Library Examples
-<cell>1/198 17-CNA 121 16
-<cell>A
-</row>
-<row>
-<cell>Programmer's Guide to the Erlang Interface Library
-<cell>2/198 17-CNA 121 16
-<cell>A
-</row>
-
-<row>
-<cell>OTP Erlang User's guide
-<cell>1553-CNA 121 17
-<cell>A
-</row>
-
-<row>
-<cell>Mnesia Users Guide (changed name and much improved)
-<cell>1553-CNA 121 18
-<cell>PB1
-</row>
-
-<row>
-<cell>SNMPEA User's Guide
-<cell>1553-CNA 121 19
-<cell>A
-</row>
-
-<row>
-<cell>SNMPEA Reference Guide
-<cell>1551-CNA 121 19
-<cell>A
-</row>
-
-<row>
-<cell>User's Guide to the Interface Generator
-<cell>1553-CNA 121 38
-<cell>A
-</row>
-
-</table>
-
-<p>
-A complete browseable document survey is available at the OTP WWW-server http://otp.ericsson.se and can also be found in the release at $OTP_ROOT/doc/all.html when the
-release file is un-tar:ed at $OTP_ROOT.
-<h1>Implemented Change requests</h1>
-<p>
-Comparable in functionality with OTP 181 01 P1D (jam).
-
-<h1>Implemented Trouble Reports</h1>
-<p>
-This is the first version.
-
-<h1>Installation Instructions</h1>
-<p>
-<b>OBS! The installation path selected below must not be the same as the one used for an OTP -jam system. </b>
-<p>
-The release is delivered as a compressed tar-file
-<b>otp_APN18101_beam_P1D.&lt;target&gt;.tar.Z</b>,
-where &lt;target&gt; is substituted with <b>sunos5</b>.
-<p>
-Then the following steps shall be performed at installation time:
-<list>
-<item>mkdir <i>&lt;installation path&gt;</i>
-<item>cd <i>&lt;installation path&gt;</i>
-<item>uncompress $XXX/otp_APN18101_beam_P1D.&lt;target&gt;.tar.Z
-<item>tar xvfp $XXX/otp_APN18101_beam_P1D.&lt;target&gt;.tar
-<item>./Install <i>&lt;installation path&gt;</i><br>
-The Install command will ask a number of questions during the installation.<br>
-<b>OBS!</b> When installing on a system where DNS is not used you
-should answer <b>NO</b> on the question "WILL YOU USE DNS?"
-<item>mkdir man/cat1 man/cat3
-<item>./format_man_pages
-<item>cd <i>&lt;installation path&gt;</i>/usr/lib and run ranlib on liberl_interface.a (only sunos4)
-</list>
-Add <i>&lt;installation path&gt;</i>/bin to the path variable and <i>&lt;installation path&gt;</i>/man to the MANPATH variable.
-<p>
-Where $XXX denotes the path at which otp_APN18101_beam_P1D.&lt;target&gt;.tar resides.
-<h1>Some useful notes</h1>
-<p>
-To make it possible to browse Framemaker documents through Netscape the files
-.mime.types and .mailcap should be modified (see below). The modifications
-can be made as systems defaults if they are placed in e.g /usr/local/lib/netscape (see Netscape Handbook for details) or as personal defaults if placed in the
-users $HOME directory.
-<p>
-.mime.types
-<p>
-<pre>
-application/x-maker fm
-</pre>
-<p>
-
-.mailcap
-<p>
-<pre>
-application/x-maker; fmclient -f %s
-</pre>
-<h1>Known problems in this release</h1>
-<p>
-<list>
-<item>Some html-links may still be faulty.
-</list>
-<h1>References</h1>
-<p>
-<i>Nothing to reference</i>
-
- </section>
-</report>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/system/doc/book.xml b/system/doc/book.xml
deleted file mode 100644
index d1ec093019..0000000000
--- a/system/doc/book.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE book SYSTEM "book.dtd">
-
-<book xmlns:xi="http://www.w3.org/2001/XInclude">
- <header titlestyle="normal">
- <copyright>
- <year>1997</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <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
- 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>Erlang/OTP System Documentation</title>
- <prepared>OTP Team</prepared>
- <docno></docno>
- <date>2009-08-21</date>
- <rev>A</rev>
- <file>book.xml</file>
- </header>
- <insidecover>
- </insidecover>
- <pagetext></pagetext>
- <preamble>
- <contents level="2"></contents>
- </preamble>
- <parts lift="no">
- <xi:include href="installation_guide/part.xml"/>
- <xi:include href="system_principles/part.xml"/>
- <xi:include href="embedded/part.xml"/>
- <xi:include href="getting_started/part.xml"/>
- <xi:include href="reference_manual/part.xml"/>
- <xi:include href="getting_started/part.xml"/>
- <xi:include href="efficiency_guide/part.xml"/>
- <xi:include href="tutorial/part.xml"/>
- <xi:include href="design_principles/part.xml"/>
- <xi:include href="oam/part.xml"/>
- </parts>
- <listofterms></listofterms>
- <index></index>
-</book>
-
diff --git a/system/doc/extensions/Makefile b/system/doc/extensions/Makefile
deleted file mode 100644
index cfc506f7e8..0000000000
--- a/system/doc/extensions/Makefile
+++ /dev/null
@@ -1,142 +0,0 @@
-# ``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 via the world wide web 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.
-#
-# The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-# AB. All Rights Reserved.''
-#
-# $Id$
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include $(ERL_TOP)/erts/vsn.mk
-#VSN=$(SYSTEM_VSN)
-
-# ----------------------------------------------------
-# Include dependency
-# ----------------------------------------------------
-
-include make.dep
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/doc/extensions
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-XML_PART_FILES = part.xml
-XML_CHAPTER_FILES = \
- funs.xml \
- macros.xml \
- misc.xml \
- include.xml \
- records.xml \
- list_comprehensions.xml \
- bit_syntax.xml
-
-BOOK_FILES = book.xml
-
-GIF_FILES = note.gif
-
-PS_FILES =
-
-# ----------------------------------------------------
-
-HTML_FILES = \
- $(XML_PART_FILES:%.xml=%.html)
-
-HTMLDIR = .
-EXTRA_FILES = $(DEFAULT_GIF_FILES) \
- $(DEFAULT_HTML_FILES) \
- $(XML_CHAPTER_FILES:%.xml=%.html)
-
-TEX_FILES_BOOK = \
- $(BOOK_FILES:%.xml=%.tex)
-TEX_FILES_USERS_GUIDE = \
- $(XML_CHAPTER_FILES:%.xml=%.tex)
-
-TOP_PDF_FILE = extensions-$(VSN).pdf
-TOP_PS_FILE = extensions-$(VSN).ps
-
-$(TOP_PDF_FILE): book.dvi $(ERL_TOP)/erts/vsn.mk
- $(DVI2PS) $(DVIPS_FLAGS) -f $< | $(DISTILL) $(DISTILL_FLAGS) > $@
-
-$(TOP_PS_FILE): book.dvi $(ERL_TOP)/erts/vsn.mk
- $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-XML_FLAGS +=
-DVIPS_FLAGS +=
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-ifeq ($(DOCTYPE),pdf)
-docs: pdf
-else
-ifeq ($(DOCTYPE),ps)
-docs: ps
-else
-docs: html
-endif
-endif
-
-pdf: $(TOP_PDF_FILE)
-
-ps: $(TOP_PS_FILE)
-
-html: $(HTML_FILES) $(GIF_FILES)
-
-debug opt:
-
-clean_tex:
- -rm -f $(TEX_FILES_USERS_GUIDE) $(TEX_FILES_BOOK)
-
-clean:
- rm -f *.html $(TEX_FILES_USERS_GUIDE)
- rm -f $(TOP_PS_FILES)
- rm -f errs core *~ $(LATEX_CLEAN)
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-ifeq ($(DOCTYPE),pdf)
-release_docs_spec: pdf
- $(INSTALL_DIR) $(RELEASE_PATH)/pdf
- $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf
-else
-ifeq ($(DOCTYPE),ps)
-release_docs_spec: ps
- $(INSTALL_DIR) $(RELEASE_PATH)/ps
- $(INSTALL_DATA) $(TOP_PS_FILE) $(RELEASE_PATH)/ps
-else
-release_docs_spec: docs
- $(INSTALL_DIR) $(RELSYSDIR)
- $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \
- $(RELSYSDIR)
-endif
-endif
-
-release_spec:
-
-
-
diff --git a/system/doc/extensions/bit_syntax.xml b/system/doc/extensions/bit_syntax.xml
deleted file mode 100644
index d86f73cd9a..0000000000
--- a/system/doc/extensions/bit_syntax.xml
+++ /dev/null
@@ -1,403 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2000</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <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
- 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>The Bit Syntax</title>
- <prepared>Bj&ouml;rn Gustavsson</prepared>
- <responsible>Bjarne D&auml;cker</responsible>
- <docno>1</docno>
- <approved>Bjarne D&auml;Ker</approved>
- <checked></checked>
- <date>00-06-21</date>
- <rev>PA1</rev>
- <file>bit_syntax.sgml</file>
- </header>
- <p>This section describes the "bit syntax" which was added to
- the Erlang language in release 5.0 (R7).
- Compared to the original bit syntax prototype
- by Claes Wikstr&ouml;m and Tony Rogvall (presented on the
- Erlang User's Conference 1999), this implementation differs
- primarily in the following respects,
- </p>
- <list type="ordered">
- <item>
- <p>the character pairs '&lt;&lt;' and '&gt;&gt;' are used to delimit
- a binary patterns and constructor (not '&lt;' and '&gt;' as in
- the prototype),
- </p>
- </item>
- <item>
- <p>the tail syntax ('|Variable') has been eliminated,
- </p>
- </item>
- <item>
- <p>all size expressions must be bound,
- </p>
- </item>
- <item>
- <p>a type <c>unit:U</c> has been added,
- </p>
- </item>
- <item>
- <p>lists and tuples cannot be generated
- </p>
- </item>
- <item>
- <p>there are no paddings whatsoever.
- </p>
- </item>
- </list>
-
- <section>
- <title>Introduction</title>
- <p>In Erlang a Bin is used for constructing binaries and
- matching binary patterns. A Bin is written with the
- following syntax:</p>
- <code type="none"><![CDATA[
- <<E1, E2, ... En>>
- ]]></code>
- <p>A Bin is a low-level sequence of bytes. The purpose of a
- Bin is to be able to, from a high level,
- <em>construct</em> a binary,
- </p>
- <code type="none"><![CDATA[
- Bin = <<E1, E2, ... En>>
- ]]></code>
- <p>in which case all elements must be bound, or to
- <em>match</em> a binary,
- </p>
- <code type="none"><![CDATA[
- <<E1, E2, ... En>> = Bin
- ]]></code>
- <p>where <c>Bin</c> is bound, and where the elements are bound or unbound,
- as in any match.
- </p>
- <p>Each element specifies a certain <em>segment</em> of the binary.
- A segment is is a set of contiguous bits of the binary (not
- necessarily on a byte boundary). The first element specifies
- the initial segment, the second element specifies the following
- segment etc.
- </p>
- <p>The following examples illustrate how binaries are constructed
- or matched, and how elements and tails are specified.
- </p>
-
- <section>
- <title>Examples</title>
- <p><em>Example 1: </em>A binary can be constructed from a set of
- constants or a string literal:</p>
- <code type="none"><![CDATA[
- Bin11 = <<1, 17, 42>>,
- Bin12 = <<"abc">>
- ]]></code>
- <p>yields binaries of size 3; <c>binary_to_list(Bin11)</c>
- evaluates to <c>[1, 17, 42]</c>, and
- <c>binary_to_list(Bin12)</c> evaluates to <c>[97, 98, 99]</c>.
- </p>
- <p><em>Example 2: </em>Similarly, a binary can be constructed
- from a set of bound variables:</p>
- <code type="none"><![CDATA[
- A = 1, B = 17, C = 42,
- Bin2 = <<A, B, C:16>>
- ]]></code>
- <p>yields a binary of size 4, and <c>binary_to_list(Bin2)</c>
- evaluates to <c>[1, 17, 00, 42]</c> too. Here we used a
- <em>size expression</em> for the variable <c>C</c> in order to
- specify a 16-bits segment of <c>Bin2</c>.
- </p>
- <p><em>Example 3: </em>A Bin can also be used for matching: if
- <c>D</c>, <c>E</c>, and <c>F</c> are unbound variables, and
- <c>Bin2</c> is bound as in the former example,</p>
- <code type="none"><![CDATA[
- <<D:16, E, F/binary>> = Bin2
- ]]></code>
- <p>yields <c>D = 273</c>, <c>E = 00</c>, and F binds to a binary
- of size 1: <c>binary_to_list(F) = [42]</c>.
- </p>
- <p><em>Example 4: </em>The following is a more elaborate example
- of matching, where <c>Dgram</c> is bound to the consecutive
- bytes of an IP datagram of IP protocol version 4, and where we
- want to extract the header and the data of the datagram:</p>
- <code type="none"><![CDATA[
- -define(IP_VERSION, 4).
- -define(IP_MIN_HDR_LEN, 5).
-
- DgramSize = byte_size(Dgram),
- case Dgram of
- <<?IP_VERSION:4, HLen:4, SrvcType:8, TotLen:16,
- ID:16, Flgs:3, FragOff:13,
- TTL:8, Proto:8, HdrChkSum:16,
- SrcIP:32,
- DestIP:32, RestDgram/binary>> when HLen >= 5, 4*HLen =< DgramSize ->
- OptsLen = 4*(HLen - ?IP_MIN_HDR_LEN),
- <<Opts:OptsLen/binary,Data/binary>> = RestDgram,
- ...
- end.
- ]]></code>
- <p>Here the segment corresponding to the <c>Opts</c> variable
- has a <em>type modifier</em> specifying that <c>Opts</c> should
- bind to a binary. All other variables have the default type
- equal to unsigned integer.
- </p>
- <p>An IP datagram header is of variable length, and its length -
- measured in the number of 32-bit words - is given in the segment
- corresponding to <c>HLen</c>, the minimum value of which is
- 5. It is the segment corresponding to <c>Opts</c> that is
- variable: if <c>HLen</c> is equal to 5, <c>Opts</c> will be an
- empty binary.
- </p>
- <p>The tail variables <c>RestDgram</c> and <c>Data</c> bind to
- binaries, as all tail variables do. Both may bind to empty
- binaries.
- </p>
- <p>If the first 4-bits segment of <c>Dgram</c> is not equal to
- 4, or if <c>HLen</c> is less than 5, or if the size of
- <c>Dgram</c> is less than <c>4*HLen</c>, the match of
- <c>Dgram</c> fails.
- </p>
- </section>
- </section>
-
- <section>
- <title>A Lexical Note</title>
- <p>Note that "<c><![CDATA[B=<<1>>]]></c>" will be interpreted as
- "<c><![CDATA[B =< ;<1>>]]></c>", which is a syntax error.
- The correct way to write the expression is "<c><![CDATA[B = <<1>>]]></c>".</p>
- </section>
-
- <section>
- <title>Segments</title>
- <p>Each segment has the following general syntax:</p>
- <p><c>Value:Size/TypeSpecifierList</c></p>
- <p>Both the <c>Size</c> and the <c>TypeSpecifier</c> or both may be
- omitted; thus the following variations are allowed:
- </p>
- <p><c>Value</c></p>
- <p><c>Value:Size</c></p>
- <p><c>Value/TypeSpecifierList</c></p>
- <p>Default values will be used for missing specifications. The default
- values are described in the section "Defaults" below.
- </p>
- <p>Used in binary construction, the <c>Value</c> part is any expression.
- Used in binary matching, the <c>Value</c> part must be a literal or
- variable. You can read more about the <c>Value</c> part in the
- sections about constructing binaries and matching binaries.
- </p>
- <p>The <c>Size</c> part of the segment multiplied by the unit in the
- <c>TypeSpecifierList</c> (described below) gives the number of bits
- for the segment. In construction, <c>Size</c> is any expression that
- evaluates to an integer. In matching, <c>Size</c> must be a constant
- expression or a variable.
- </p>
- <p>The <c>TypeSpecifierList</c> is a list of type specifiers separated by
- hyphens.
- </p>
- <taglist>
- <tag>Type</tag>
- <item>The type can be <c>integer</c>, <c>float</c>, or <c>binary</c>.</item>
- <tag>Signedness</tag>
- <item>The signedness specification can be either <c>signed</c>
- or <c>unsigned</c>. Note that signedness only matters for matching.</item>
- <tag>Endianness</tag>
- <item>The endianness specification can be either <c>big</c>,
- <c>little</c>, or <c>native</c>. Native-endian means that
- the endian will be resolved at load time to be either
- big-endian or little-endian, depending on what is "native"
- for the CPU that the Erlang machine is run on.</item>
- <tag>Unit</tag>
- <item>The unit size is given as <c>unit:IntegerLiteral</c>.
- The allowed range is 1-256. It will be multiplied by the <c>Size</c>
- specifier to give the effective size of the segment.</item>
- </taglist>
- <p>Example:
- </p>
- <code type="none">
-X:4/little-signed-integer-unit:8
- </code>
- <p>This element has a total size of 4*8 = 32 bits, and it contains a
- signed integer in little-endian order.</p>
- </section>
-
- <section>
- <title>Defaults</title>
- <p>The default type for a segment is <c>integer</c>. The default type
- does <em>not</em> depend on the value, even if the value is a literal.
- For instance, the default type in '<c><![CDATA[<<3.14>>]]></c>' is <c>integer</c>,
- not <c>float</c>.
- </p>
- <p>The default <c>Size</c> depends on the type.
- For <c>integer</c> it is 8. For <c>float</c> it is 64.
- For <c>binary</c> it is all of the binary. In matching, this default
- value is only valid for the very last element. All other binary elements
- in matching must have a size specification.
- </p>
- <p>The default unit depends on the the type.
- For <c>integer</c> and <c>float</c> it is 1.
- For <c>binary</c> it is 8.
- </p>
- <p>The default signedness is <c>unsigned</c>.
- </p>
- <p>The default endianness is <c>big</c>.</p>
- </section>
-
- <section>
- <title>Constructing Binaries</title>
- <p>This section describes the rules for constructing binaries using
- the bit syntax. Unlike when constructing lists or tuples, the construction
- of a binary can fail with a <c>badarg</c> exception.
- </p>
- <p>There can be zero or more segments in a binary to be constructed.
- The expression '<c><![CDATA[<<>>]]></c>' constructs a zero length binary.
- </p>
- <p>Each segment in a binary can consist of zero or more bits.
- There are no alignment rules for individual segments, but the total
- number of bits in all segments must be evenly divisible by 8,
- or in other words, the resulting binary must consist of a whole number
- of bytes. An <c>badarg</c> exception will be thrown if the resulting
- binary is not byte-aligned. Example:
- </p>
- <code type="none"><![CDATA[
-<<X:1,Y:6>>
- ]]></code>
- <p>The total number of bits is 7, which is not evenly divisible by 8;
- thus, there will be <c>badarg</c> exception (and a compiler warning
- as well). The following example
- </p>
- <code type="none"><![CDATA[
-<<X:1,Y:6,Z:1>>
- ]]></code>
- <p>will successfully construct a binary of 8 bits, or one byte. (Provided
- that all of X, Y and Z are integers.)
- </p>
- <p>As noted earlier, segments have the following general syntax:
- </p>
- <p><c>Value:Size/TypeSpecifierList</c></p>
- <p>When constructing binaries, <c>Value</c> and <c>Size</c> can be
- any Erlang expression. However, for syntactical reasons,
- both <c>Value</c> and <c>Size</c> must be enclosed in parenthesis
- if the expression consists of anything more than a single literal
- or variable. The following gives a compiler syntax error:
- </p>
- <code type="none"><![CDATA[
-<<X+1:8>>
- ]]></code>
- <p>This expression must be rewritten to
- </p>
- <code type="none"><![CDATA[
-<<(X+1):8>>
- ]]></code>
- <p>in order to be accepted by the compiler.
- </p>
-
- <section>
- <title>Including Literal Strings</title>
- <p>As syntactic sugar, an literal string may be written instead of a
- element.</p>
- <code type="none"><![CDATA[
-<<"hello">> ]]></code>
- <p>which is syntactic sugar for</p>
- <code type="none"><![CDATA[
-<<$h,$e,$l,$l,$o>> ]]></code>
- </section>
- </section>
-
- <section>
- <title>Matching Binaries</title>
- <p>This section describes the rules for matching binaries using the
- bit syntax.
- </p>
- <p>There can be zero or more segments in a binary binary pattern.
- A binary pattern can occur in every place patterns are allowed, also
- inside other patterns. Binary patterns cannot be nested.
- </p>
- <p>The pattern '<c><![CDATA[<<>>]]></c>' matches a zero length binary.
- </p>
- <p>Each segment in a binary can consist of zero or more bits.
- </p>
- <p>A segment of type <c>binary</c> must have a size evenly divisible by 8.
- </p>
- <p>This means that the following head will never match:</p>
- <code type="none"><![CDATA[
-foo(<<X:7/binary,Y:1/binary>>) -> ]]></code>
- <p>As noted earlier, segments have the following general syntax:
- </p>
- <p><c>Value:Size/TypeSpecifierList</c></p>
- <p>When matching <c>Value</c> value must be either a variable or an integer
- or floating point literal. Expressions are not allowed.
- </p>
- <p><c>Size</c> must be an integer literal, or a previously bound variable.
- Note that the following is not allowed:</p>
- <code type="none"><![CDATA[
-foo(N, <<X:N,T/binary>>) ->
- {X,T}. ]]></code>
- <p>The two occurrences of <c>N</c> are not related. The compiler
- will complain that the <c>N</c> in the size field is unbound.
- </p>
- <p>The correct way to write this example is like this:</p>
- <code type="none"><![CDATA[
-foo(N, Bin) ->
- <<X:N,T/binary>> = Bin,
- {X,T}. ]]></code>
-
- <section>
- <title>Getting the Rest of the Binary</title>
- <p>To match out the rest of binary, specify a binary field without size:</p>
- <code type="none"><![CDATA[
-foo(<<A:8,Rest/binary>>) -> ]]></code>
- <p>As always, the size of the tail must be evenly divisible by 8.
- </p>
- </section>
- </section>
-
- <section>
- <title>Traps and Pitfalls</title>
- <p>Assume that we need a function that creates a binary out of a
- list of triples of integers. A first (inefficient) version of such
- a function could look like this:</p>
- <code type="none"><![CDATA[
-triples_to_bin(T) ->
- triples_to_bin(T, <<>>).
-
-triples_to_bin([{X,Y,Z} | T], Acc) ->
- triples_to_bin(T, <<Acc/binary, X:32, Y:32, Z:32>>); % inefficient
-triples_to_bin([], Acc) ->
- Acc. ]]></code>
- <p>The reason for the inefficiency of this function is that for
- each triple, the binary constructed so far (<c>Acc</c>) is copied.
- (Note: The original bit syntax prototype avoided the copy operation
- by using segmented binaries, which are not implemented in R7.)
- </p>
- <p>The efficient way to write this function in R7 is:</p>
- <code type="none"><![CDATA[
-triples_to_bin(T) ->
- triples_to_bin(T, []).
-
-triples_to_bin([{X,Y,Z} | T], Acc) ->
- triples_to_bin(T, [<<X:32, Y:32, Z:32>> | Acc]);
-triples_to_bin([], Acc) ->
- list_to_binary(lists:reverse(Acc)). ]]></code>
- <p>Note that <c>list_to_binary/1</c> handles deep lists of binaries
- and small integers. (This fact was previously undocumented.)
- </p>
- </section>
-</chapter>
-
diff --git a/system/doc/extensions/book.xml b/system/doc/extensions/book.xml
deleted file mode 100644
index ffdbe6cb44..0000000000
--- a/system/doc/extensions/book.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE book SYSTEM "book.dtd">
-
-<book>
- <header titlestyle="normal">
- <copyright>
- <year>1997</year>
- <year>2007</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <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
- 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.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>Erlang Extensions Since 4.4</title>
- <prepared>OTP Team</prepared>
- <docno></docno>
- <date>1997-05-21</date>
- <rev></rev>
- <file>book.sgml</file>
- </header>
- <insidecover>
- </insidecover>
- <pagetext>Erlang Extensions Since 4.4</pagetext>
- <preamble>
- <contents level="2"></contents>
- </preamble>
- <parts lift="no">
- <include file="part"></include>
- </parts>
- <listofterms></listofterms>
- <index></index>
-</book>
-
diff --git a/system/doc/extensions/fun_test.erl b/system/doc/extensions/fun_test.erl
deleted file mode 100644
index 8472fd87f8..0000000000
--- a/system/doc/extensions/fun_test.erl
+++ /dev/null
@@ -1,17 +0,0 @@
-%1
--module(fun_test).
--export([t1/0, t2/0, t3/0, t4/0, double/1]).
--import(lists, [map/2]).
-
-t1() -> map(fun(X) -> 2 * X end, [1,2,3,4,5]).
-
-t2() -> map(fun double/1, [1,2,3,4,5]).
-
-t3() -> map({?MODULE, double}, [1,2,3,4,5]).
-
-double(X) -> X * 2.
-%1
-
-
-t4() ->
- "hello world".
diff --git a/system/doc/extensions/funparse.erl b/system/doc/extensions/funparse.erl
deleted file mode 100644
index 5e23c90df9..0000000000
--- a/system/doc/extensions/funparse.erl
+++ /dev/null
@@ -1,74 +0,0 @@
--module(funparse).
--compile(export_all).
--import(lists, [reverse/1]).
-
-%17
-%% > hof:parse([a,c]).
-%% {ok,{'and',{'or',1,{const,a}},{'or',1,{const,c}}}}
-%% > hof:parse([a,d]).
-%% {ok,{'and',{'or',1,{const,a}},{'or',2,{const,d}}}}
-%% > hof:parse([b,c]).
-%% {ok,{'and',{'or',2,{const,b}},{'or',1,{const,c}}}}
-%% > hof:parse([b,d]).
-%% {ok,{'and',{'or',2,{const,b}},{'or',2,{const,d}}}}
-%% > hof:parse([a,b]).
-%% fail
-%17
-
-%% Grammar = (a | b) & (c | d)
-
-%12
-parse(List) ->
- (grammar())(List).
-%12
-
-%13
-grammar() ->
- pand(
- por(pconst(a), pconst(b)),
- por(pconst(c), pconst(d))).
-%13
-
-%14
-pconst(X) ->
- fun (T) ->
- case T of
- [X|T1] -> {ok, {const, X}, T1};
- _ -> fail
- end
- end.
-%14
-
-%15
-por(P1, P2) ->
- fun (T) ->
- case P1(T) of
- {ok, R, T1} ->
- {ok, {'or',1,R}, T1};
- fail ->
- case P2(T) of
- {ok, R1, T1} ->
- {ok, {'or',2,R1}, T1};
- fail ->
- fail
- end
- end
- end.
-%15
-
-%16
-pand(P1, P2) ->
- fun (T) ->
- case P1(T) of
- {ok, R1, T1} ->
- case P2(T1) of
- {ok, R2, T2} ->
- {ok, {'and', R1, R2}};
- fail ->
- fail
- end;
- fail ->
- fail
- end
- end.
-%16
diff --git a/system/doc/extensions/funs.xml b/system/doc/extensions/funs.xml
deleted file mode 100644
index f9c003c8ee..0000000000
--- a/system/doc/extensions/funs.xml
+++ /dev/null
@@ -1,486 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>1997</year>
- <year>2007</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <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
- 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.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>Programming with Funs</title>
- <prepared>Joe Armstrong</prepared>
- <responsible>Bjarne D&auml;cker</responsible>
- <docno>1</docno>
- <approved>Bjarne D&auml;Ker</approved>
- <checked></checked>
- <date>96-01-16</date>
- <rev>PA1</rev>
- <file>funs.sgml</file>
- </header>
- <p>This section introduces functional objects (Funs). That is a new data type introduced in Erlang 4.4. Functions which takes Funs as arguments, or which return Funs are called higher order functions.</p>
- <list type="bulleted">
- <item>Funs can be passed as arguments to other functions, just like lists or tuples</item>
- <item>functions can be written which return Funs, just like any other data object.</item>
- </list>
-
- <section>
- <title>Higher Order Functions </title>
- <p>Funs encourages us to encapsulate common patterns of design into functional forms called higher order functions. These functions not only shortens programs, but also produce clearer programs because the intended meaning of the program is explicitly rather than implicitly stated.</p>
- <p>The concepts of higher order functions and procedural abstraction are introduced with two brief examples.</p>
-
- <section>
- <title>Example 1 - map</title>
- <p>If we want to double every element in a list, we could write a function named <c>double</c>:</p>
- <code type="none">
-
-double([H|T]) -> [2*H|double(T)];
-double([]) -> [] </code>
- <p>This function obviously doubles the argument entered as input as follows:</p>
- <pre>
-
-> <input>double([1,2,3,4]).</input>
-[2,4,6,8] </pre>
- <p>We now add the function <c>add_one</c>, which adds one to every element in a list:</p>
- <code type="none">
-
-add_one([H|T]) -> [H+1|add_one(T)];
-add_one([]) -> []. </code>
- <p>These functions, <c>double</c> and <c>add_one</c>, have a very similar structure. We can exploit this fact and write a function <c>map</c> which expresses this similarity:</p>
- <codeinclude file="funs1.erl" tag="%1" type="erl"></codeinclude>
- <p>We can now express the functions <c>double</c> and <c>add_one</c> in terms of <c>map</c> as follows:</p>
- <code type="none">
-
-double(L) -> map(fun(X) -> 2*X end, L).
-add_one(L) -> map(fun(X) -> 1 + X end, L). </code>
- <p><c>map(F, List)</c> is a function which takes a function <c>F</c> and a list <c>L</c> as arguments and
- returns the new list which is obtained by applying <c>F</c> to each of the elements in <c>L</c>.</p>
- <p>The process of abstracting out the common features of a number of different programs is called procedural abstraction. Procedural abstraction can be used in order to write several different functions which have a similar structure, but differ only in some minor detail. This is done as follows:</p>
- <list type="ordered">
- <item>write one function which represents the common features of these functions</item>
- <item>parameterize the difference in terms of functions which are passed as arguments to the common function.</item>
- </list>
- </section>
-
- <section>
- <title>Example 2 - foreach</title>
- <p>This example illustrates procedural abstraction. Initially, we show the following two examples written as conventional functions:</p>
- <list type="ordered">
- <item>all elements of a list are printed onto a stream</item>
- <item>a message is broadcast to a list of processes.</item>
- </list>
- <code type="none">
-
-print_list(Stream, [H|T]) ->
- io:format(Stream, "~p~n", [H]),
- print_list(Stream, T);
-print_on_list(Stream, []) ->
- true. </code>
- <code type="none">
-
-broadcast(Msg, [Pid|Pids]) ->
- Pid ! Msg,
- broadcast(Msg, Pids);
-broadcast(_, []) ->
- true. </code>
- <p>Both these functions have a very similar structure. They both iterate over a list doing something to each element in the list. The "something" has to be carried round as an extra argument to the function which does this.</p>
- <p>The function <c>foreach</c> expresses this similarity:</p>
- <codeinclude file="funs1.erl" tag="%2" type="erl"></codeinclude>
- <p>Using <c>foreach</c>, <c>print_on_list</c> becomes:</p>
- <code type="none">
-
-foreach(fun(H) -> io:format(S, "~p~n~,[H]) end, L) </code>
- <p><c>broadcast</c> becomes:</p>
- <code type="none">
-
-foreach(fun(Pid) -> Pid ! M end, L) </code>
- <p><c>foreach</c> is evaluated for its side-effect and not its value. <c>foreach(Fun ,L)</c> calls <c>Fun(X)</c> for each element <c>X</c> in <c>L</c> and the processing occurs in the order in which the elements were defined in <c>L</c>. <c>map</c> does not define the order in which its elements are processed.</p>
- </section>
- </section>
-
- <section>
- <title>Advantages of Higher Order Functions</title>
- <p>Programming with higher order functions, such as <c>map</c> and <c>foreach</c>, has a number of advantages:</p>
- <list type="bulleted">
- <item>It is much easier to understand the program and the intention of the programmer is clearly expressed in the code. The statement <c>foreach(fun(X) -></c> clearly indicates that the intention of this program is to do something to each element in the list <c>L</c>. We also know that the function which is passed as the first argument of <c>foreach</c> takes one argument <c>X</c>, which will be successively bound to each of the elements in <c>L</c>.</item>
- <item>Functions which take Funs as arguments are much easier to re-use than other functions. </item>
- </list>
- </section>
-
- <section>
- <title>The Syntax of Funs</title>
- <p>Funs are written with the syntax:</p>
- <code type="none">
-
-F = fun (Arg1, Arg2, ... ArgN) ->
- ...
- end </code>
- <p>This creates an anonymous function of <c>N</c> arguments and binds it to the variable <c>F</c>.</p>
- <p>If we have already written a function in the same module and wish to pass this function as an argument, we can use the following syntax:</p>
- <code type="none">
-
-F = fun FunctionName/Arity </code>
- <p>With this form of function reference, the function which is referred to does not need to be exported from the module.</p>
- <p>We can also refer to a function defined in a different module with the following syntax:</p>
- <code type="none">
-
-F = {Module, FunctionName} </code>
- <p>In this case, the function must be exported from the module in question.</p>
- <p>The follow program illustrates the different ways of creating Funs:</p>
- <codeinclude file="fun_test.erl" tag="%1" type="erl"></codeinclude>
- <p>We can evaluate the fun <c>F</c> with the syntax:</p>
- <code type="none">
-
-F(Arg1, Arg2, ..., Argn) </code>
- <p>To check whether a term is a Fun, use the test <c>function/1</c>
- in a guard. Example:</p>
- <code type="none">
-f(F, Args) when function(F) ->
- apply(F, Args);
-f(N, _) when integer(N) ->
- N. </code>
- <p>Funs are a distinct type. The BIFs erlang:fun_info/1,2 can
- be used to retrieve information about a fun, and the BIF
- erlang:fun_to_list/1 returns a textual representation of a fun.
- The check_process_code/2 BIF returns true if the
- process contains funs that depend on the old version of
- a module.</p>
- <note>
- <p>In OTP R5 and earlier releases, funs were represented
- using tuples.</p>
- </note>
- </section>
-
- <section>
- <title>Variable Bindings within a Fun</title>
- <p>The scope rules for variables which occur in Funs are as follows:</p>
- <list type="bulleted">
- <item>All variables which occur in the head of a Fun are assumed to be "fresh" variables.</item>
- <item>Variables which are defined before the Fun, and which occur in function calls or guard tests within the Fun, have the values they had outside the Fun.</item>
- <item>No variables may be exported from a Fun.</item>
- </list>
- <p>The following examples illustrate these rules:</p>
- <code type="none">
-
-print_list(File, List) ->
- {ok, Stream} = file:open(File, write),
- foreach(fun(X) -> io:format(Stream,"~p~n",[X]) end, List),
- file:close(Stream). </code>
- <p>In the above example, the variable <c>X</c> which is defined in the head of the Fun is a new variable. The value of the variable <c>Stream</c> which is used within within the Fun gets its value from the
- <c>file:open</c> line.</p>
- <p>Since any variable which occurs in the head of a Fun is considered a new variable it would be equally valid to write:</p>
- <code type="none">
-
-print_list(File, List) ->
- {ok, Stream} = file:open(File, write),
- foreach(fun(File) ->
- io:format(Stream,"~p~n",[File])
- end, List),
- file:close(Stream). </code>
- <p>In this example, <c>File</c> is used as the new variable instead of <c>X</c>. This is rather silly since code in the body of the Fun cannot refer to the variable <c>File</c> which is defined outside the Fun. Compiling this example will yield the diagnostic:</p>
- <code type="none">
-
-./FileName.erl:Line: Warning: variable 'File'
- shadowed in 'lambda head' </code>
- <p>This reminds us that the variable <c>File</c> which is defined inside the Fun collides with the variable <c>File</c> which is defined outside the Fun.</p>
- <p>The rules for importing variables into a Fun has the consequence that certain pattern matching operations have to be moved into guard expressions and cannot be written in the head of the Fun. For example, we might write the following code if we intend the first clause of <c>F</c> to be evaluated when the value of its argument is <c>Y</c>:</p>
- <code type="none">
-
-f(...) ->
- Y = ...
- map(fun(X) when X == Y ->
- ;
- (_) ->
- ...
- end, ...)
- ... </code>
- <p>instead of</p>
- <code type="none">
-
-f(...) ->
- Y = ...
- map(fun(Y) ->
- ;
- (_) ->
- ...
- end, ...)
- ... </code>
- </section>
-
- <section>
- <title>Funs and the Module Lists</title>
- <p>The following examples show a dialogue with the Erlang shell. All the higher order functions discussed are exported from the module <c>lists</c>.</p>
-
- <section>
- <title>map</title>
- <codeinclude file="funs1.erl" tag="%1" type="erl"></codeinclude>
- <p><c>map</c> takes a function of one argument and a list of terms. It returns the list obtained by applying the function to every argument in the list.</p>
- <pre>
-
-1> <input>Double = fun(X) -> 2 * X end.</input>
-#Fun&lt;erl_eval>
-2><input>lists:map(Double, [1,2,3,4,5]).</input>
-[2,4,6,8,10] </pre>
- <p>When a new Fun is defined in the shell, the value of the Fun is printed as <c><![CDATA[Fun#<erl_eval>]]></c></p>
- </section>
-
- <section>
- <title>any</title>
- <codeinclude file="funs1.erl" tag="%4" type="erl"></codeinclude>
- <p><c>any</c> takes a predicate <c>P</c> of one argument and a list of terms. A predicate is a function which returns <c>true</c> or <c>false</c>. <c>any</c> is true if there is a term <c>X</c> in the list such that <c>P(X)</c> is <c>true</c>.</p>
- <p>We define a predicate <c>Big(X)</c> which is <c>true</c> if its argument is greater that 10.</p>
- <pre>
-
-3> <input>Big = fun(X) -> if X > 10 -> true; true -> false end end.</input>
-#Fun&lt;erl_eval>
-4><input>lists:any(Big, [1,2,3,4]).</input>
-false.
-5> <input>lists:any(Big, [1,2,3,12,5]).</input>
-true. </pre>
- </section>
-
- <section>
- <title>all</title>
- <codeinclude file="funs1.erl" tag="%3" type="erl"></codeinclude>
- <p><c>all</c> has the same arguments as <c>any</c>. It is true if the predicate applied to all elements in the list is true.</p>
- <pre>
-
-6><input>lists:all(Big, [1,2,3,4,12,6]).</input>
-false
-7><input>lists:all(Big, [12,13,14,15]).</input>
-true </pre>
- </section>
-
- <section>
- <title>foreach</title>
- <codeinclude file="funs1.erl" tag="%2" type="erl"></codeinclude>
- <p><c>foreach</c> takes a function of one argument and a list of terms. The function is applied to each argument in the list. <c>foreach</c> returns <c>ok</c>. It is used for its side-effect only.</p>
- <pre>
-
-8> <input>lists:foreach(fun(X) -> io:format("~w~n",[X]) end, [1,2,3,4]).</input>
-1
-2
-3
-4
-true </pre>
- </section>
-
- <section>
- <title>foldl</title>
- <codeinclude file="funs1.erl" tag="%8" type="erl"></codeinclude>
- <p><c>foldl</c> takes a function of two arguments, an accumulator and a list. The function is called with two arguments. The first argument is the successive elements in the list, the second argument is the accumulator. The function must return a new accumulator which is used the next time the function is called.</p>
- <p>If we have a list of lists <c>L = ["I","like","Erlang"]</c>, then we can sum the lengths of all the strings in <c>L</c> as follows:</p>
- <pre>
-
-9> <input>L = ["I","like","Erlang"].</input>
-["I","like","Erlang"]
-10> <input>lists:foldl(fun(X, Sum) -> length(X) + Sum end, 0, L).</input>
-11 </pre>
- <p><c>foldl</c> works like a <c>while</c> loop in an imperative language:</p>
- <code type="none">
-
- L = ["I","like","Erlang"],
- Sum = 0,
- while( L != []){
- Sum += length(head(L)),
- L = tail(L)
- end </code>
- </section>
-
- <section>
- <title>mapfoldl</title>
- <codeinclude file="funs1.erl" tag="%10" type="erl"></codeinclude>
- <p><c>mapfoldl</c> simultaneously maps and folds over a list. The following example shows how to change all letters in <c>L</c> to upper case and count them.</p>
- <p>First upcase:</p>
- <pre>
-
-11> <input>Upcase = fun(X) when $a =&lt; X, X =&lt; $z -> X + $A - $a;</input>
-<input>(X) -> X</input>
-<input>end.</input>
-#Fun&lt;erl_eval>
-12> <input>Upcase_word =</input>
-<input>fun(X) -></input>
-<input>lists:map(Upcase, X)</input>
-<input>end.</input>
-#Fun&lt;erl_eval>
-13><input>Upcase_word("Erlang").</input>
-"ERLANG"
-14><input>lists:map(Upcase_word, L).</input>
-["I","LIKE","ERLANG"] </pre>
- <p>Now we can do the fold and the map at the same time:</p>
- <pre>
-
-14> <input>lists:mapfoldl(fun(Word, Sum) -></input>
-14> <input>{Upcase_word(Word), Sum + length(Word)}</input>
-14> <input>end, 0, L).</input>
-{["I","LIKE","ERLANG"],11} </pre>
- </section>
-
- <section>
- <title>filter</title>
- <codeinclude file="funs1.erl" tag="%9" type="erl"></codeinclude>
- <p><c>filter</c> takes a predicate of one argument and a list and returns all element in the list which satisfy the predicate.</p>
- <pre>
-
-15><input>lists:filter(Big, [500,12,2,45,6,7]).</input>
-[500,12,45] </pre>
- <p>When we combine maps and filters we can write very succinct and obviously correct code. For example, suppose we want to define a set difference function. We want to define <c>diff(L1, L2)</c> to be the difference between the lists <c>L1</c> and <c>L2</c>.
- This is the list of all elements in L1 which are not contained in L2. This code can be written as follows:</p>
- <code type="none">
-
-diff(L1, L2) ->
- filter(fun(X) -> not member(X, L2) end, L1). </code>
- <p>The AND intersection of the list <c>L1</c> and <c>L2</c> is also easily defined:</p>
- <code type="none">
-
-intersection(L1,L2) -> filter(fun(X) -> member(X,L1) end, L2). </code>
- </section>
-
- <section>
- <title>takewhile</title>
- <codeinclude file="funs1.erl" tag="%5" type="erl"></codeinclude>
- <p><c>takewhile(P, L)</c> takes elements <c>X</c> from a list <c>L</c> as long as the predicate <c>P(X)</c> is true.</p>
- <pre>
-
-16><input>lists:takewhile(Big, [200,500,45,5,3,45,6]).</input>
-[200,500,45] </pre>
- </section>
-
- <section>
- <title>dropwhile</title>
- <codeinclude file="funs1.erl" tag="%6" type="erl"></codeinclude>
- <p><c>dropwhile</c> is the complement of <c>takewhile</c>.</p>
- <pre>
-
-17> <input>lists:dropwhile(Big, [200,500,45,5,3,45,6]).</input>
-[5,3,45,6] </pre>
- </section>
-
- <section>
- <title>splitlist</title>
- <codeinclude file="funs1.erl" tag="%7" type="erl"></codeinclude>
- <p><c>splitlist(P, L)</c> splits the list <c>L</c> into the two sub-lists <c>{L1, L2}</c>, where <c>L = takewhile(P, L)</c> and <c>L2 = dropwhile(P, L)</c>.</p>
- <pre>
-
-18><input>lists:splitlist(Big, [200,500,45,5,3,45,6]).</input>
-{[200,500,45],[5,3,45,6]} </pre>
- </section>
-
- <section>
- <title>first</title>
- <codeinclude file="funs1.erl" tag="%11" type="erl"></codeinclude>
- <p><c>first</c> returns <c>{true, R}</c>, where <c>R</c> is the first element in a list satisfying a predicate or <c>false</c>:</p>
- <pre>
-
-19><input>lists:first(Big, [1,2,45,6,123]).</input>
-{true,45}
-20><input>lists:first(Big, [1,2,4,5]). </input>
-false </pre>
- </section>
- </section>
-
- <section>
- <title>Funs which Return Funs</title>
- <p>So far, this section has only described functions which take Funs as arguments. It is also possible to write more powerful functions which themselves return Funs. The following examples illustrate these type of functions.</p>
-
- <section>
- <title>Simple Higher Order Functions</title>
- <p><c>Adder(X)</c> is a function which, given <c>X</c>, returns a new function <c>G</c> such that <c>G(K)</c> returns <c>K + X</c>.</p>
- <pre>
-
-21> <input>Adder = fun(X) -> fun(Y) -> X + Y end end.</input>
-#Fun&lt;erl_eval>
-22> <input>Add6 = Adder(6).</input>
-#Fun&lt;erl_eval>
-23><input>Add6(10).</input>
-16 </pre>
- </section>
-
- <section>
- <title>Infinite Lists</title>
- <p>The idea is to write something like:</p>
- <code type="none">
-
--module(lazy).
--export([ints_from/1]).
-ints_from(N) ->
- fun() ->
- [N|ints_from(N+1)]
- end. </code>
- <p>Then we can proceed as follows:</p>
- <code type="none"><![CDATA[
-
-24> XX = lazy:ints_from(1).
-#Fun<lazy>
-25> XX().
-[1|#Fun<lazy>]
-26> hd(XX()).
-1
-27> Y = tl(XX()).
-#Fun<lazy>
-28> hd(Y()).
-2 ]]></code>
- <p>etc. - this is an example of "lazy embedding"</p>
- </section>
-
- <section>
- <title>Parsing</title>
- <p>The following examples show parsers of the following type:</p>
- <pre>
-Parser(Toks) -> {ok, Tree, Toks1} | fail </pre>
- <p><c>Toks</c> is the list of tokens to be parsed. A successful parse returns <c>{ok, Tree, Toks1}</c>, where <c>Tree</c> is a parse tree and <c>Toks1</c> is a tail of <c>Tree</c> which contains symbols encountered after the structure which was correctly parsed. Otherwise <c>fail</c> is returned.</p>
- <p>The example which follows illustrates a simple, functional parser which parses the grammar:</p>
- <pre>
-(a | b) &amp; (c | d) </pre>
- <p>The following code defines a function <c>pconst(X)</c> in the module <c>funparse</c>, which returns a Fun which parses a list of tokens.</p>
- <codeinclude file="funparse.erl" tag="%14" type="erl"></codeinclude>
- <p>This function can be used as follows:</p>
- <pre>
-29><input>P1 = funparse:pconst(a).</input>
-#Fun&lt;hof>
-30> <input>P1([a,b,c]).</input>
-{ok,{const,a},[b,c]}
-31> <input>P1([x,y,z]).</input>
-fail </pre>
- <p>Next, we define the two higher order functions <c>pand</c> and <c>por</c> which combine primitive parsers to produce more complex parsers. Firstly <c>pand</c>:</p>
- <codeinclude file="funparse.erl" tag="%16" type="erl"></codeinclude>
- <p>Given a parser <c>P1</c> for grammar <c>G1</c>, and a parser <c>P2</c> for grammar <c>G2</c>, <c>pand(P1, P2)</c>
- returns a parser for the grammar which consists of sequences of tokens which satisfy <c>G1</c> followed by sequences of tokens which satisfy <c>G2</c>.</p>
- <p><c>por(P1, P2)</c> returns a parser for the language described by the grammar <c>G1</c> or <c>G2</c>.</p>
- <codeinclude file="funparse.erl" tag="%15" type="erl"></codeinclude>
- <p>The original problem was to parse the grammar <c><![CDATA[(a | b) & (c | d)]]></c>. The following code addresses this problem: </p>
- <codeinclude file="funparse.erl" tag="%13" type="erl"></codeinclude>
- <p>The following code adds a parser interface to the grammar:</p>
- <codeinclude file="funparse.erl" tag="%12" type="erl"></codeinclude>
- <p>We can test this parser as follows:</p>
- <pre>
-
-32> <input>funparse:parse([a,c]).</input>
-{ok,{'and',{'or',1,{const,a}},{'or',1,{const,c}}}}
-33> <input>funparse:parse([a,d]).</input>
-{ok,{'and',{'or',1,{const,a}},{'or',2,{const,d}}}}
-34> <input>funparse:parse([b,c]).</input>
-{ok,{'and',{'or',2,{const,b}},{'or',1,{const,c}}}}
-35> <input>funparse:parse([b,d]).</input>
-{ok,{'and',{'or',2,{const,b}},{'or',2,{const,d}}}}
-36> <input>funparse:parse([a,b]).</input>
-fail </pre>
- </section>
- </section>
-</chapter>
-
diff --git a/system/doc/extensions/funs1.erl b/system/doc/extensions/funs1.erl
deleted file mode 100644
index b1a3e21525..0000000000
--- a/system/doc/extensions/funs1.erl
+++ /dev/null
@@ -1,125 +0,0 @@
--module(funs1).
--compile(export_all).
--import(lists, [reverse/1]).
-
-%1
-map(F, [H|T]) -> [F(H)|map(F, T)];
-map(F, []) -> [].
-%1
-
-%2
-foreach(F, [H|T]) ->
- F(H),
- foreach(F, T);
-foreach(F, []) ->
- ok.
-%2
-%
-%3
-all(Pred, [H|T]) ->
- case Pred(H) of
- true -> all(Pred, T);
- false -> false
- end;
-all(Pred, []) ->
- true.
-%3
-%4
-any(Pred, [H|T]) ->
- case Pred(H) of
- true -> true;
- false -> any(Pred, T)
- end;
-any(Pred, []) ->
- false.
-%4
-%5
-takewhile(Pred, [H|T]) ->
- case Pred(H) of
- true -> [H|takewhile(Pred, T)];
- false -> []
- end;
-takewhile(Pred, []) ->
- [].
-%5
-%6
-dropwhile(Pred, [H|T]) ->
- case Pred(H) of
- true -> dropwhile(Pred, T);
- false -> [H|T]
- end;
-dropwhile(Pred, []) ->
- [].
-%6
-%7
-splitlist(Pred, L) ->
- splitlist(Pred, L, []).
-
-splitlist(Pred, [H|T], L) ->
- case Pred(H) of
- true -> splitlist(Pred, T, [H|L]);
- false -> {reverse(L), [H|T]}
- end;
-splitlist(Pred, [], L) ->
- {reverse(L), []}.
-%7
-
-flatmap(F, [Hd|Tail]) ->
- F(Hd) ++ flatmap(F, Tail);
-flatmap(F, []) -> [].
-
-%8
-foldl(F, Accu, [Hd|Tail]) ->
- foldl(F, F(Hd, Accu), Tail);
-foldl(F, Accu, []) -> Accu.
-%8
-%
-foldr(F, Accu, [Hd|Tail]) ->
- F(Hd, foldr(F, Accu, Tail));
-foldr(F, Accu, []) -> Accu.
-%9
-filter(F, [H|T]) ->
- case F(H) of
- true -> [H|filter(F, T)];
- false -> filter(F, T)
- end;
-filter(F, []) -> [].
-%9
-%10
-mapfoldl(F, Accu0, [Hd|Tail]) ->
- {R,Accu1} = F(Hd, Accu0),
- {Rs,Accu2} = mapfoldl(F, Accu1, Tail),
- {[R|Rs], Accu2};
-mapfoldl(F, Accu, []) -> {[], Accu}.
-%10
-mapfoldr(F, Accu0, [Hd|Tail]) ->
- {Rs,Accu1} = mapfoldr(F, Accu0, Tail),
- {R,Accu2} = F(Hd, Accu1),
- {[R|Rs],Accu2};
-mapfoldr(F, Accu, []) -> {[], Accu}.
-%11
-first(Pred, [H|T]) ->
- case Pred(H) of
- true ->
- {true, H};
- false ->
- first(Pred, T)
- end;
-first(Pred, []) ->
- false.
-%11
-%
-compose(F, G) ->
- fun(X) ->
- F(G(X))
- end.
-
-%20
-iterate(N, F) ->
- iterate(N, N+1, F).
-
-iterate(Stop, Stop, _) ->
- [];
-iterate(N, Stop, Fun) ->
- [Fun(N)|iterate(N+1, Stop, Fun)].
-%20
diff --git a/system/doc/extensions/include.xml b/system/doc/extensions/include.xml
deleted file mode 100644
index cd78644b95..0000000000
--- a/system/doc/extensions/include.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>1999</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <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
- 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>Includes</title>
- <prepared>Arndt Jonasson</prepared>
- <docno>1</docno>
- <date>99-01-25</date>
- <rev>PA1</rev>
- <file>include.sgml</file>
- </header>
- <p>There are two directives which can be used in Erlang source
- files to cause the compiler to temporarily read input from another
- source. They are typically used to provide macro definitions and
- record definitions from header files. It is recommended to use the
- file name extension <c>".hrl"</c> for files which are meant to be
- included (the 'h' can be read as "header").</p>
- <p>When locating header files a list of directory names, the
- compiler include path, is used. In short the list contains the current
- working directory of the file server, the base name of the compiled
- file, and the directories given by the include option, in that order.
- See <c>erlc(1)</c> and <c>compile(3)</c> for the details of the
- compiler include path.</p>
-
- <section>
- <title>The -include Directive</title>
- <p>The first action taken by the <c>-include</c> directive is to
- check if the format of the first path component of the specified
- filename is <c>$VAR</c>, for some string <c>VAR</c>. If that is the
- case, the value of the environment variable <c>VAR</c> as returned by
- <c>os:getenv(VAR)</c> is substituted for the first path component. If
- <c>os:getenv/1</c> returns <c>false</c>, the first path component is
- left as is. If the filename is absolute (possibly after variable
- substitution), the header file with that name is included. Otherwise,
- the specified header file is searched for in the directories in the
- compiler include path, starting with the first directory in the list.
- The first file found while traversing the list is included. Examples:</p>
- <code type="none">
- -include("my_records.hrl").
- -include("incdir/more_records.hrl").
- -include("/home/users/proj/recs.hrl").
- -include("$PROJ_ROOT/app1/defs.hrl"). </code>
- </section>
-
- <section>
- <title>The -include_lib Directive</title>
- <p>The <c>-include_lib</c> directive first tries to find the
- specified header file using the procedure employed for the
- <c>-include</c> directive. If no header file can be found by searching
- the compiler include path, the first path component of the specified
- filename (possibly after variable substitution) is regarded as the
- name of an application, and the directory of the current version of
- the application is searched. Example:</p>
- <code type="none">
- -include_lib("mnesia/include/mnemosyne.hrl"). </code>
- <p>The compiler is instructed to look for the directory where the
- current version of the <c>mnesia</c> application is installed, that is
- <c>code:lib_dir(mnesia)</c>, and then search the subdirectory
- <c>include</c> for the file <c>mnemosyne.hrl</c>.</p>
- </section>
-</chapter>
-
diff --git a/system/doc/extensions/list_comprehensions.erl b/system/doc/extensions/list_comprehensions.erl
deleted file mode 100644
index 21ac562aa5..0000000000
--- a/system/doc/extensions/list_comprehensions.erl
+++ /dev/null
@@ -1,118 +0,0 @@
--module(t).
--author('[email protected]').
-
-%%-export([test/2]).
--compile(export_all).
-
-%% Odd numbers.
-
-%%foo(L) -> [ X || X <- L, (X > X-1) == (X /= X-1) ].
-
-bar(L) -> [ X || X <- L, integer(X), gt(X, 3) ].
-
-bar(L, M) -> [ Y || X <- L, integer(X), gt(X, 3),
- Y <- M, float(Y), gt(X, Y)
- ].
-
-baz(L) -> [ X || X <- L, atom(X) ].
-
-buz(L, Min) -> [ X || Min > 3, X <- L, X >= Min ].
-
-gt(X, Y) when X > Y -> true;
-gt(X, Y) -> false.
-
-%% Turn a list into a set.
-make_set([]) -> [];
-make_set([H|T]) ->
- [H|[
- Y || Y <- make_set(T),
- Y =/= H
- ]].
-
-%% Return the Pythagorean triangles with sides
-%% of total length less than N
-pyth(N) ->
- [ {A,B,C} ||
- A <- lists:seq(1,N),
- B <- lists:seq(1,N),
- C <- lists:seq(1,N),
- A+B+C =< N,
- A*A+B*B == C*C
- ].
-
-%% Cut the search space a bit..
-pyth2(N) ->
- [ {A,B,C} ||
- A <- lists:seq(1,N),
- B <- lists:seq(1,N-A+1),
- C <- lists:seq(1,N-A-B+2),
- A+B+C =< N,
- A*A+B*B == C*C ].
-
-%% Return the Cartesian product
-cp() ->
- [ {X,Y} ||
- X <- a(),
- Y <- b()
- ].
-
-cp(A,B) when list(A),list(B) ->
- [ {X,Y} ||
- X <- A,
- Y <- B
- ].
-
-%a() -> 1/0.
-a() -> [a,b].
-b() -> [1,2,3].
-
-%% Return all permutations of a list
-perms([]) -> [[]];
-perms(L) -> [ [H|T] || H <- L, T <- perms(L--[H]) ].
-
-%% Quick sort
-sort([X|Xs]) ->
- sort([ Y || Y <- Xs, Y < X ]) ++
- [X] ++
- sort([ Y || Y <- Xs, Y >= X ]);
-sort([]) -> [].
-
-%% Vector addition
-vecAdd(Xs,Ys) ->
- [ X+Y || {X,Y} <- zip(Xs,Ys) ].
-
-zip([X|Xs],[Y|Ys]) -> [{X,Y}|zip(Xs,Ys)];
-zip([],[]) -> [].
-
-qsort([X|Xs]) ->
- qsort(lt(X,Xs))
- ++ [X] ++
- qsort(ge(X,Xs));
-qsort([]) -> [].
-
-lt(X,[H|T]) when X>H -> [H|lt(X,T)];
-lt(X,[_|T]) -> lt(X,T);
-lt(_,[]) -> [].
-
-ge(X,[H|T]) when X=<H -> [H|ge(X,T)];
-ge(X,[_|T]) -> ge(X,T);
-ge(_,[]) -> [].
-
-test(1,N) -> statistics(runtime),test1(N),statistics(runtime);
-test(2,N) -> statistics(runtime),test2(N),statistics(runtime);
-test(3,N) -> statistics(runtime),test3(N),statistics(runtime).
-
-test1(0) -> true;
-test1(N) ->
- sort([21,12,45,1,3,87,55,77,11,20,6,99,91,13,14,15,66,62,69,71,67,82,83,84,87,86,85]),
- test1(N-1).
-
-test2(0) -> true;
-test2(N) ->
- qsort([21,12,45,1,3,87,55,77,11,20,6,99,91,13,14,15,66,62,69,71,67,82,83,84,87,86,85]),
- test2(N-1).
-
-test3(0) -> true;
-test3(N) ->
- lists:sort([21,12,45,1,3,87,55,77,11,20,6,99,91,13,14,15,66,62,69,71,67,82,83,84,87,86,85]),
- test3(N-1).
diff --git a/system/doc/extensions/list_comprehensions.xml b/system/doc/extensions/list_comprehensions.xml
deleted file mode 100644
index 30e32da79c..0000000000
--- a/system/doc/extensions/list_comprehensions.xml
+++ /dev/null
@@ -1,205 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>1997</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <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
- 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>List Comprehensions</title>
- <prepared>Joe Armstrong</prepared>
- <responsible>Bjarne D&auml;cker</responsible>
- <docno>1</docno>
- <approved>Bjarne D&auml;Ker</approved>
- <checked></checked>
- <date>96-09-10</date>
- <rev>PA1</rev>
- <file>list_comprehensions.sgml</file>
- </header>
- <p>List comprehensions are a feature of many modern functional programming languages. Subject to certain rules, they provide a succinct notation for generating elements in a list.</p>
- <p>List comprehensions are analogous to set comprehensions
- in Zermelo-Frankel set theory and are called ZF expressions in
- Miranda. They are analogous to the <c>setof</c> and
- <c>findall</c> predicates in Prolog.</p>
- <p>List comprehensions are written with the following syntax:
- </p>
- <code type="none">
-
-[Expression || Qualifier1, Qualifier2, ...] </code>
- <p><c>Expression</c> is an arbitrary expression, and each <c>Qualifier</c> is either a generator or a filter.</p>
- <list type="bulleted">
- <item>A <em>generator</em> written as <c><![CDATA[Pattern <- ListExpr]]></c>. <c>ListExpr</c> must be an expression which evaluates to a list of terms.</item>
- <item>A <em>filter</em> is either a predicate or a boolean expression. A predicate is a function which returns <c>true</c> or <c>false</c>.</item>
- </list>
-
- <section>
- <title>Examples of List Comprehensions</title>
- <p>We start with a simple example:</p>
- <code type="none"><![CDATA[
-
-> [X || X <- [1,2,a,3,4,b,5,6], X > 3].
-[a,4,b,5,6] ]]></code>
- <p>This should be read as follows:</p>
- <quote>
- <p>The list of X such that X is taken from the list <c>[1,2,a,...]</c> and X is greater than 3.</p>
- </quote>
- <p>The notation <c><![CDATA[X <- [1,2,a,...]]]></c> is a generator and the expression <c>X > 3</c> is a filter.</p>
- <p>An additional filter can be added in order to restrict the result to integers:</p>
- <code type="none"><![CDATA[
-
-> [X || X <- [1,2,a,3,4,b,5,6], integer(X), X > 3].
-[4,5,6] ]]></code>
- <p>Generators can be combined. For example, the Cartesian product of two lists can be written as follows:</p>
- <code type="none"><![CDATA[
-
-> [{X, Y} || X <- [1,2,3], Y <- [a,b]].
-[{1,a},{1,b},{2,a},{2,b},{3,a},{3,b}] ]]></code>
-
- <section>
- <title>Quick Sort</title>
- <p>The well known quick sort routine can be written as follows:</p>
- <code type="none"><![CDATA[
-
-sort([Pivot|T]) ->
- sort([ X || X <- T, X < Pivot]) ++
- [Pivot] ++
- sort([ X || X <- T, X >= Pivot]);
-sort([]) -> []. ]]></code>
- <p>The expression <c><![CDATA[[X || X <- T, X < Pivot]]]></c> is the list of all elements in <c>T</c>, which are less than <c>Pivot</c>.</p>
- <p><c><![CDATA[[X || X <- T, X >= Pivot]]]></c> is the list of all elements in <c>T</c>, which are greater or equal to <c>Pivot</c>.</p>
- <p>To sort a list, we isolate the first element in the list and split the list into two sub-lists. The first sub-list contains all elements which are smaller than the first element in the list, the second contains all elements which are greater than or equal to the first element in the list. We then sort the sub-lists and combine the results.</p>
- </section>
-
- <section>
- <title>Permutations</title>
- <p>The following example generates all permutations of the elements in a list:</p>
- <code type="none"><![CDATA[
-
-perms([]) -> [[]];
-perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. ]]></code>
- <p>We take take <c>H</c> from <c>L</c> in all possible ways. The result is the set of all lists <c>[H|T]</c>, where <c>T</c> is the set of all possible permutations of <c>L</c> with <c>H</c> removed.</p>
- <code type="none">
-
-> perms([b,u,g]).
-[[b,u,g],[b,g,u],[u,b,g],[u,g,b],[g,b,u],[g,u,b]] </code>
- </section>
-
- <section>
- <title>Pythagorean Triplets</title>
- <p>Pythagorean triplets are sets of integers <c>{A,B,C}</c> such that <c>A**2 + B**2 = C**2</c>.</p>
- <p>The function <c>pyth(N)</c> generates a list of all integers <c>{A,B,C}</c> such that <c>A**2 + B**2 = C**2</c> and where the sum of the sides is less than <c>N</c>.</p>
- <code type="none"><![CDATA[
-
-pyth(N) ->
- [ {A,B,C} ||
- A <- lists:seq(1,N),
- B <- lists:seq(1,N),
- C <- lists:seq(1,N),
- A+B+C =< N,
- A*A+B*B == C*C
- ]. ]]></code>
- <pre>
-
-> <input>pyth(3).</input>
-[].
-> <input>pyth(11).</input>
-[].
-><input>pyth(12).</input>
-[{3,4,5},{4,3,5}]
-> <input>pyth(50).</input>
-[{3,4,5},
- {4,3,5},
- {5,12,13},
- {6,8,10},
- {8,6,10},
- {8,15,17},
- {9,12,15},
- {12,5,13},
- {12,9,15},
- {12,16,20},
- {15,8,17},
- {16,12,20}]</pre>
- <p>The following code reduces the search space and is more efficient:</p>
- <code type="none"><![CDATA[
-
-pyth1(N) ->
- [{A,B,C} ||
- A <- lists:seq(1,N),
- B <- lists:seq(1,N-A+1),
- C <- lists:seq(1,N-A-B+2),
- A+B+C =< N,
- A*A+B*B == C*C ]. ]]></code>
- </section>
-
- <section>
- <title>Simplifications with List Comprehensions</title>
- <p>As an example, list comprehensions can be used to simplify some of the functions in <c>lists.erl</c>:</p>
- <code type="none"><![CDATA[
-
-append(L) -> [X || L1 <- L, X <- L1].
-map(Fun, L) -> [Fun(X) || X <- L].
-filter(Pred, L) -> [X || X <- L, Pred(X)]. ]]></code>
- </section>
- </section>
-
- <section>
- <title>Variable Bindings in List Comprehensions</title>
- <p>The scope rules for variables which occur in list comprehensions are as follows:</p>
- <list type="bulleted">
- <item>all variables which occur in a generator pattern are assumed to be "fresh" variables</item>
- <item>any variables which are defined before the list comprehension and which are used in filters have the values they had before the list comprehension</item>
- <item>no variables may be exported from a list comprehension.</item>
- </list>
- <p>As an example of these rules, suppose we want to write the function <c>select</c>, which selects certain elements from a list of tuples. We might write <c><![CDATA[select(X, L) -> [Y || {X, Y} <- L].]]></c> with the intention of extracting all tuples from <c>L</c> where the first item is <c>X</c>.</p>
- <p>Compiling this yields the following diagnostic:</p>
- <code type="none">
-
-./FileName.erl:Line: Warning: variable 'X' shadowed in generate </code>
- <p>This diagnostic warns us that the variable <c>X</c> in the pattern is not the same variable as the variable <c>X</c> which occurs in the function head.</p>
- <p>Evaluating <c>select</c> yields the following result:</p>
- <pre>
-
-> <input>select(b,[{a,1},{b,2},{c,3},{b,7}]).</input>
-[1,2,3,7] </pre>
- <p>This result is not what we wanted. To achieve the desired effect we must write <c>select</c> as follows:</p>
- <code type="none"><![CDATA[
-
-select(X, L) -> [Y || {X1, Y} <- L, X == X1]. ]]></code>
- <p>The generator now contains unbound variables and the test has been moved into the filter. This now works as expected:</p>
- <pre>
-
-> <input>select(b,[{a,1},{b,2},{c,3},{b,7}]).</input>
-[2,7] </pre>
- <p>One consequence of the rules for importing variables into a list comprehensions is that certain pattern matching operations have to be moved into the filters and cannot be written directly in the generators. To illustrate this, do <em>not</em> write as follows:</p>
- <code type="none"><![CDATA[
-
-f(...) ->
- Y = ...
- [ Expression || PatternInvolving Y <- Expr, ...]
- ... ]]></code>
- <p>Instead, write as follows:</p>
- <code type="none"><![CDATA[
-
-f(...) ->
- Y = ...
- [ Expression || PatternInvolving Y1 <- Expr, Y == Y1, ...]
- ...
- ]]></code>
- </section>
-</chapter>
-
diff --git a/system/doc/extensions/list_comrehensions.erl b/system/doc/extensions/list_comrehensions.erl
deleted file mode 100644
index f6a23b5dca..0000000000
--- a/system/doc/extensions/list_comrehensions.erl
+++ /dev/null
@@ -1,75 +0,0 @@
--module(zf).
-
--compile(export_all).
-
-
-%% Odd numbers.
-
-%%foo(L) -> [ X || X <- L, (X > X-1) == (X /= X-1) ].
-
-boo() -> [X||X <- [1,2,a,3,4,b,5,6], X > 3].
-boo1() -> [X||X <- [1,2,a,3,4,b,5,6], integer(X),X > 3].
-boo2() -> [{X,Y} || X <- [1,2,3], Y <- [a,b]].
-
-bar(L) -> [ X || X <- L, integer(X), gt(X, 3) ].
-
-bar(L, M) -> [ Y || X <- L, integer(X), gt(X, 3),
- Y <- M, float(Y), gt(X, Y)
- ].
-
-baz(L) -> [ X || X <- L, atom(X) ].
-
-buz(L, Min) -> [ X || Min > 3, X <- L, X >= Min ].
-
-gt(X, Y) when X > Y -> true;
-gt(X, Y) -> false.
-
-
-%% Return the Pythagorean triangles with sides
-%% of total length less than N
-pyth(N) ->
- [ {A,B,C} ||
- A <- lists:seq(1,N),
- B <- lists:seq(1,N),
- C <- lists:seq(1,N),
- A+B+C =< N,
- A*A+B*B == C*C
- ].
-
-%% Cut the search space a bit..
-pyth2(N) ->
- [ {A,B,C} ||
- A <- lists:seq(1,N),
- B <- lists:seq(1,N-A+1),
- C <- lists:seq(1,N-A-B+2),
- A+B+C =< N,
- A*A+B*B == C*C ].
-
-%% Return the Cartesian product
-
-cp(A,B) ->
- [ {X,Y} ||
- X <- A,
- Y <- B
- ].
-
-%% Return all permutations of a list
-perms([]) -> [[]];
-perms(L) -> [ [H|T] || H <- L, T <- perms(L--[H]) ].
-
-%% Quick sort
-sort([X|Xs]) ->
- sort([ Y || Y <- Xs, Y < X ]) ++
- [X] ++
- sort([ Y || Y <- Xs, Y >= X ]);
-sort([]) -> [].
-
-%% append
-
-append(L) -> [X||L1<-L,X<-L1].
-
-map(Fun, L) -> [Fun(X)||X<-L].
-
-filter(Pred, L) -> [X||X<-L,Pred(X)].
-
-select(X, L) -> [Y || {X1,Y} <- L, X == X1].
diff --git a/system/doc/extensions/macros.xml b/system/doc/extensions/macros.xml
deleted file mode 100644
index feb3de6102..0000000000
--- a/system/doc/extensions/macros.xml
+++ /dev/null
@@ -1,177 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>1997</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <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
- 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>Macros</title>
- <prepared>Joe Armstrong</prepared>
- <responsible>Bjarne D&auml;cker</responsible>
- <docno>1</docno>
- <approved>Bjarne D&auml;Ker</approved>
- <checked></checked>
- <date>96-09-10</date>
- <rev>PA1</rev>
- <file>macros.sgml</file>
- </header>
- <p>Macros in Erlang are written with the following syntax:</p>
- <code type="none">
-
--define(Const, Replacement).
--define(Fun(Var1, Var2,.., Var), Replacement). </code>
- <p>Macros are expanded when the syntax <c>?MacroName</c> is encountered.</p>
- <p>Consider the macro definition:</p>
- <code type="none">
-
--define(timeout, 200). </code>
- <p>The expression <c>?timeout</c>, which can occur anywhere in the code which follows the macro definition, will be replaced by <c>200</c>.</p>
- <p>Macros with arguments are written as follows:</p>
- <code type="none">
-
- -define(macro1(X, Y), {a, X, b, Y}). </code>
- <p>This type of macro can be used as follows:</p>
- <code type="none">
-
-bar(X) ->
- ?macro1(a, b),
- ?macro1(X, 123) </code>
- <p>This expands to:</p>
- <code type="none">
-
-bar(X) ->
- {a,a,b,b},
- {a,X,b,123}. </code>
-
- <section>
- <title>Macros and Tokens</title>
- <p>Macro expansion works at a token level. We might define a macro as follows:</p>
- <code type="none">
-
--define(macro2(X, Y), {a,X,b,Y). </code>
- <p>The replacement value of the macro is not a valid Erlang term because the closing right curly bracket is missing. <c>macro2</c> expands into a sequence of tokens <c>{</c>, <c>a</c>, <c>X</c> which are then pasted into the place where the macro is used.</p>
- <p>We might use this macro as follows:</p>
- <code type="none">
-
-bar() ->
- ?macro2(x,y)}. </code>
- <p>This will expand into the valid sequence of tokens <c>{a,x,y,b}</c> before being parsed and compiled.</p>
- <note>
- <p>It is good programming practise to ensure that the replacement text of a macro is a valid Erlang syntactic form.</p>
- </note>
- </section>
-
- <section>
- <title>Pre-Defined Macros</title>
- <p>The following macros are pre-defined:</p>
- <taglist>
- <tag><c>?MODULE</c>. </tag>
- <item>This macro returns the name of the current module.
- </item>
- <tag><c>?MODULE_STRING</c>. </tag>
- <item>This macro returns the name of the current module, as a string.</item>
- <tag><c>?FILE</c>.</tag>
- <item>This macro returns the current file name.</item>
- <tag><c>?LINE</c>.</tag>
- <item>This macro returns the current line number.</item>
- <tag><c>?MACHINE</c>.</tag>
- <item>This macro returns the current machine name,
- <c>'BEAM'</c>,</item>
- </taglist>
- </section>
-
- <section>
- <title>Stringifying Macro Arguments</title>
- <p>The construction <c>??Arg</c> for an argument to a macro expands to a
- string containing the tokens of the argument, similar to the
- <c>#arg</c> stringifying construction in C. This was added in Erlang
- 5.0 (OTP R7A).</p>
- <p>Example:</p>
- <code type="none">
--define(TESTCALL(Call), io:format("Call ~s: ~w~n", [??Call, Call])).
-
-?TESTCALL(myfunction(1,2)),
-?TESTCALL(you:function(2,1)).</code>
- <p>results in</p>
- <code type="none">
-io:format("Call ~s: ~w~n",["myfunction ( 1 , 2 )",m:myfunction(1,2)]),
-io:format("Call ~s: ~w~n",["you : function ( 2 , 1 )",you:function(2,1)]).</code>
- </section>
-
- <section>
- <title>Flow Control in Macros</title>
- <p>The following macro directives are supplied:</p>
- <taglist>
- <tag>-undef(Macro).</tag>
- <item>Causes the macro to behave as if it had never been defined.</item>
- <tag>-ifdef(Macro).</tag>
- <item>Do the following lines if <c>Macro</c> is defined.</item>
- <tag>-ifndef(Macro).</tag>
- <item>Do the following lines if <c>Macro</c> is not defined.</item>
- <tag>-else.</tag>
- <item>"else" macro</item>
- <tag>-endif.</tag>
- <item>"endif" macro.</item>
- </taglist>
- <p>The conditional macros must be properly nested. They are usually grouped as follows:</p>
- <code type="none">
-
--ifdef(debug)
--define(....)
--else
--define(...)
--endif </code>
- <p>The following example illustrates this grouping:</p>
- <code type="none">
-
--define(debug, true).
--ifdef(debug).
--define(trace(Str, X), io:format("Mod:~w line:~w ~p ~p~n",
- [?MODULE,?LINE, Str, X])).
--else.
--define(trace(X, Y), true).
--endif. </code>
- <p>Given these definitions, the expression <c>?trace("X=", X).</c> in line 10 of the module <c>foo</c> expands to:</p>
- <code type="none">
-
-io:format("Mod:~w line:~w ~p ~p~n",[foo,100,"X=",[X]]), </code>
- <p>If we remove the <c>-define(debug, true).</c> line, then the same expression expands to <c>true</c>.</p>
- </section>
-
- <section>
- <title>A Macro Expansion Utility</title>
- <p>The following code can be used to expand a macro and display the result:</p>
- <code type="none">
-
--module(mexpand).
--export([file/1]).
--import(lists, [foreach/2]).
-file(File) ->
- case epp:parse_file(File ++ ".erl", [],[]) of
- {ok, L} ->
- {ok, Stream} = file:open(File ++ ".out", write),
- foreach(fun(X) ->
- io:format(Stream,"~s~n",[erl_pp:form(X)])
- end, L),
- file:close(Stream)
- end.</code>
- <p>Alternatively, we can compile the file with the <c>'P'</c> option. <c>compile:file(File, ['P'])</c> produces a list file <c>File.P</c>, in which the result of any macro expansions can be seen.</p>
- </section>
-</chapter>
-
diff --git a/system/doc/extensions/make.dep b/system/doc/extensions/make.dep
deleted file mode 100644
index fdac959667..0000000000
--- a/system/doc/extensions/make.dep
+++ /dev/null
@@ -1,21 +0,0 @@
-# ----------------------------------------------------
-# >>>> Do not edit this file <<<<
-# This file was automaticly generated by
-# /home/otp/bin/docdepend
-# ----------------------------------------------------
-
-
-# ----------------------------------------------------
-# TeX files that the DVI file depend on
-# ----------------------------------------------------
-
-book.dvi: bit_syntax.tex book.tex funs.tex include.tex \
- list_comprehensions.tex macros.tex misc.tex \
- part.tex records.tex
-
-# ----------------------------------------------------
-# Source inlined when transforming from source to LaTeX
-# ----------------------------------------------------
-
-funs.tex: fun_test.erl funparse.erl funs1.erl
-
diff --git a/system/doc/extensions/mexpand.erl b/system/doc/extensions/mexpand.erl
deleted file mode 100644
index 261f99da46..0000000000
--- a/system/doc/extensions/mexpand.erl
+++ /dev/null
@@ -1,16 +0,0 @@
--module(mexpand).
-
--export([file/1]).
-
--import(lists, [foreach/2]).
-
-file(File) ->
- case epp:parse_file(File ++ ".erl", [],[]) of
- {ok, L} ->
- {ok, Stream} = file:open(File ++ ".out", write),
- foreach(fun(X) ->
- io:format(Stream,"~s~n",
- [erl_pp:form(X)])
- end, L),
- file:close(Stream)
- end.
diff --git a/system/doc/extensions/misc.xml b/system/doc/extensions/misc.xml
deleted file mode 100644
index 576f705278..0000000000
--- a/system/doc/extensions/misc.xml
+++ /dev/null
@@ -1,310 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>1999</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <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
- 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>Miscellaneous</title>
- <prepared>Arndt Jonasson</prepared>
- <docno>1</docno>
- <date>99-01-25</date>
- <rev>PA1</rev>
- <file>misc.sgml</file>
- </header>
- <p>In this chapter, a number of miscellaneous features of Erlang
- are described.</p>
-
- <section>
- <title>Token Syntax</title>
- <p>In Erlang 4.8 (OTP R5A) the syntax of Erlang tokens have been
- extended to allow the use of the full ISO-8859-1 (Latin-1) character
- set. This is noticeable in the following ways:</p>
- <list type="bulleted">
- <item>All the Latin-1 printable characters can be used and are shown without
- the escape backslash convention.</item>
- <item>Atoms and variables can use all Latin-1 letters.</item>
- </list>
- <p>The new characters from Latin-1 have the following
- classifications in Erlang:</p>
- <table>
- <row>
- <cell align="left" valign="middle"><em>Octal</em></cell>
- <cell align="left" valign="middle"><em>Decimal</em></cell>
- <cell align="left" valign="middle">&nbsp;</cell>
- <cell align="left" valign="middle"><em>Class</em></cell>
- </row>
- <row>
- <cell align="left" valign="middle">200 - 237</cell>
- <cell align="left" valign="middle">128 - 159</cell>
- <cell align="left" valign="middle">&nbsp;</cell>
- <cell align="left" valign="middle">Control characters</cell>
- </row>
- <row>
- <cell align="left" valign="middle">240 - 277</cell>
- <cell align="left" valign="middle">160 - 191</cell>
- <cell align="right" valign="middle">- &iquest;</cell>
- <cell align="left" valign="middle">Punctuation characters</cell>
- </row>
- <row>
- <cell align="left" valign="middle">300 - 326</cell>
- <cell align="left" valign="middle">192 - 214</cell>
- <cell align="center" valign="middle">&Agrave; - &Ouml;</cell>
- <cell align="left" valign="middle">Uppercase letters</cell>
- </row>
- <row>
- <cell align="center" valign="middle">327</cell>
- <cell align="center" valign="middle">215</cell>
- <cell align="center" valign="middle">&times;</cell>
- <cell align="left" valign="middle">Punctuation character</cell>
- </row>
- <row>
- <cell align="left" valign="middle">330 - 336</cell>
- <cell align="left" valign="middle">216 - 222</cell>
- <cell align="center" valign="middle">&Oslash; - &THORN;</cell>
- <cell align="left" valign="middle">Uppercase letters</cell>
- </row>
- <row>
- <cell align="left" valign="middle">337 - 366</cell>
- <cell align="left" valign="middle">223 - 246</cell>
- <cell align="center" valign="middle">&szlig; - &ouml;</cell>
- <cell align="left" valign="middle">Lowercase letters</cell>
- </row>
- <row>
- <cell align="center" valign="middle">367</cell>
- <cell align="center" valign="middle">247</cell>
- <cell align="center" valign="middle">&divide;</cell>
- <cell align="left" valign="middle">Punctuation character</cell>
- </row>
- <row>
- <cell align="left" valign="middle">370 - 377</cell>
- <cell align="left" valign="middle">248 - 255</cell>
- <cell align="center" valign="middle">&oslash; - &yuml;</cell>
- <cell align="left" valign="middle">Lowercase letters</cell>
- </row>
- <tcaption>Character classes</tcaption>
- </table>
- </section>
-
- <section>
- <title>String Concatenation</title>
- <p>Two adjacent string literals are concatenated into one. This is done already
- at compile-time, and doesn't incur any runtime overhead. Example:</p>
- <code type="none">
- "string" "42" </code>
- <p>is equivalent to</p>
- <code type="none">
- "string42" </code>
- <p>This feature is convenient in at least two situations:</p>
- <list type="bulleted">
- <item>when one of the
- strings is the result of a macro expansion;</item>
- <item>when a string is very
- long, and would otherwise either have to wrap, making the source code
- harder to read, or force the use of some runtime append operation.</item>
- </list>
- </section>
-
- <section>
- <title>The ++ list Concatenation Operator</title>
- <p>Since list concatenation is a very common operation, it is convenient
- to have a terse way of expressing it. The ++ operator appends its second
- argument to its first. Example:
- </p>
- <code type="none">
- X = [1,2,3],
- Y = [4,5],
- X ++ Y. </code>
- <p>results in <c>[1,2,3,4,5]</c>.</p>
- <p>The ++ operator has precedence between the binary '+' operator and
- the comparison operators.
- </p>
- </section>
-
- <section>
- <title>The - - list Subtraction Operator</title>
- <p>The - - operator produces a list which is a copy of the first
- argument, subjected to the following procedure: for each element in
- the second argument, its first occurrence in the first argument is
- removed.</p>
- <code type="none">
- X = [1,2,3,2,1,2],
- Y = [2,1,2],
- X -- Y. </code>
- <p>results in <c>[3,1,2]</c>.</p>
- <p>The - - operator has precedence between the binary '+' operator and
- the comparison operators.
- </p>
- </section>
-
- <section>
- <title>Bitwise Operator bnot</title>
- <p>Apart from the binary bitwise operators <c>band</c>, <c>bor</c>
- and <c>bxor</c>, there is a unary operator <c>bnot</c> with the same
- precedence as the other unary operators + and -, i.e., higher than
- the binary operators. Example:</p>
- <code type="none">
- bnot 7. </code>
- <p>returns -8.
- </p>
- </section>
-
- <section>
- <title>Logical Operators</title>
- <p>The atoms <c>true</c> and <c>false</c> are usually used for representing
- Boolean values. With the binary operators <c>and</c>, <c>or</c> and
- <c>xor</c>, and the unary operator <c>not</c>, Boolean values can be
- combined. Example:</p>
- <code type="none">
-
- M1 = lists:member(A, List1),
- M2 = lists:member(A, List2),
- M1 and M2.</code>
- <p>Note that the operators are strict, i.e., they always evaluate both
- their arguments.</p>
- <p><c>not</c> has the same priority as the other unary operators. The
- binary logical operators have precedence between the <c>=</c> operator
- and the comparison operators, the <c>and</c> operator having higher
- precedence than <c>or</c> and <c>xor</c>.
- </p>
- </section>
-
- <section>
- <title>Match Operator = In Patterns</title>
- <p>This extension was added in Erlang 4.8 (OTP R5A).</p>
- <p>The = operator is also called the `match' operator. The match operator
- can now be used in a pattern, so that <c>P1 = P2</c> is a valid pattern,
- where both <c>P1</c> and <c>P2</c> are patterns. This compound pattern
- when matched against a term causes the term to be matched against both
- <c>P1</c> and <c>P2</c>.</p>
- <p>One use for this construction is to avoid reconstructing a term which
- was part of an argument to a function. Example:</p>
- <code type="none">
- f({'+',X,Y}=T) -> {X+Y,T}.</code>
- <p>It also makes it possible to rewrite the construction</p>
- <code type="none">
- f(X) when X == #rec{x=1, y=a} -> ... </code>
- <p>as</p>
- <code type="none">
- f(#rec{x=1, y=a} = X) -> ... </code>
- <p>In the absence of optimization for the former case, the
- latter case is more efficient.
- </p>
- </section>
-
- <section>
- <title>Literal String Prefix in Patterns</title>
- <p>This extension was added in Erlang 4.8 (OTP R5A).</p>
- <p>A new construction is allowed in patterns, namely a literal
- string as the first operand of the ++ operator. Example:</p>
- <code type="none">
- f("prefix" ++ L) -> ... </code>
- <p>This is syntactic sugar for the equivalent, but harder to read</p>
- <code type="none">
- f([$p,$r,$e,$f,$i,$x | L]) -> ... </code>
- </section>
-
- <section>
- <title>Disjunctions in Guards</title>
- <p>This extension was added in Erlang 4.9 (OTP R6A).</p>
- <p>A new construction is allowed in guards, the disjunction operator
- ';'. The construction is syntactic sugar which removes the bother of
- writing the same body after several guards.</p>
- <code type="none">
- f(X) when xxx ; yyy ; zzz ->
- pop(X).</code>
- <p>This is syntactic sugar for the equivalent</p>
- <code type="none">
- f(X) when xxx ->
- pop(X);
- f(X) when yyy ->
- pop(X);
- f(X) when zzz ->
- pop(X). </code>
- <p>The abstract format has been changed accordingly to contain a list of
- (conjunctive) guards where there was previously only one guard.
- </p>
- </section>
-
- <section>
- <title>Expressions in Patterns</title>
- <p>This extension was added in Erlang 5.0 (OTP R7A).</p>
- <p>An arithmetic expression can be used within a pattern, if it uses
- only numeric or bitwise operators, and if its value can be evaluated
- to a constant at compile-time. This is especially useful when the
- expression is defined by a macro.
- </p>
- <p>Example:</p>
- <code type="none">
- case X of
- {1+2, T} -> T
- end.</code>
- </section>
-
- <section>
- <title>Boolean expresions in guards</title>
- <p>This extension was added in Erlang 5.1 (OTP R8).</p>
- <p>In guards, the use of <c>and</c>, <c>or</c> and <c>not</c> is
- now allowed. Guard expressions can combine these with
- parenthesis. This allows for more elaborate guards than what
- may be given with <c>,</c> and <c>;</c>.</p>
- <note>
- <p>The guard expressions written with these operators are boolean
- expressions, and the boolean functions <c>is_list</c>,
- <c>is_integer</c> etc. should be used, rather than
- <c>list</c>, <c>integer</c> etc.</p>
- </note>
- <p>Example 1:</p>
- <code type="none">
- f(X) when not (is_tuple(X) or is_list(X)) ->
- ... </code>
- <p>Example 2:</p>
- <code type="none"><![CDATA[
- g(A, B) when (A > 0) and (B > 0) and not (A*A < B*B) ->
- ... ]]></code>
- </section>
-
- <section>
- <title>Short-circuit boolean expressions</title>
- <p>This extension was added in Erlang 5.1 (OTP R8).</p>
- <p>In a boolean expression it is unnecessary to always evaluate all
- terms. If the first term gives a result that determines the
- result, the second term is not needed. In Erlang two new
- keywords handles boolean expressions without evaluating both
- terms, if it's unnecessary. (This is called short-curcuit
- boolean evaluation.)</p>
- <p>The keyword <c>andalso</c> is a short-curcuit version of
- <c>and</c>. The keyword <c>orelse</c> is a short-curcuit version
- of <c>or</c>. They can be used in boolean expressions (not
- guards) instead of <c>and</c> and <c>or</c>.</p>
- <p>Example 1:</p>
- <code type="none">
- case A >= -1.0 andalso math:sqrt(A+1) > B of </code>
- <p>This will work even if <c>A</c> is less than <c>-1.0</c>, since
- in that case, the second term (after <c>andalso</c>) is never
- evaluated. (Of course, the same effects could have been done
- using guards. In guards, evaluation is always short-circuited,
- since guard tests are known to be free of side-effects.)</p>
- <p>Example 2:</p>
- <code type="none">
- OnlyOne = is_atom(L) orelse
- (is_list(L) andalso length(L) == 1), </code>
- </section>
-</chapter>
-
diff --git a/system/doc/extensions/part.xml b/system/doc/extensions/part.xml
deleted file mode 100644
index 56fd2c09a6..0000000000
--- a/system/doc/extensions/part.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE part SYSTEM "part.dtd">
-
-<part>
- <header>
- <copyright>
- <year>1997</year>
- <year>2007</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <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
- 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.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>Erlang Extensions Since 4.4</title>
- <prepared>OTP Team</prepared>
- <docno></docno>
- <date>1997-02-21</date>
- <rev>E</rev>
- <file>part.sgml</file>
- </header>
- <description>
- <p>This chapter describes extensions made to the Erlang language
- since version 4.4 (where nothing is said to the contrary, an extension
- was added in version 4.4).
- The chapter contains the following sections:
- </p>
- <list type="bulleted">
- <item>Records</item>
- <item>Functional Objects (Funs)</item>
- <item>List Comprehensions</item>
- <item>Macros</item>
- <item>File inclusion</item>
- <item>Bit syntax</item>
- <item>Miscellaneous</item>
- </list>
- </description>
- <include file="records"></include>
- <include file="funs"></include>
- <include file="list_comprehensions"></include>
- <include file="macros"></include>
- <include file="include"></include>
- <include file="bit_syntax"></include>
- <include file="misc"></include>
-</part>
-
diff --git a/system/doc/extensions/records.xml b/system/doc/extensions/records.xml
deleted file mode 100644
index 21ec73ab77..0000000000
--- a/system/doc/extensions/records.xml
+++ /dev/null
@@ -1,284 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>1997</year>
- <year>2007</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <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
- 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.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>Records</title>
- <prepared>Joe Armstrong</prepared>
- <responsible>Bjarne D&auml;cker</responsible>
- <docno>1</docno>
- <approved>Bjarne D&auml;Ker</approved>
- <checked></checked>
- <date>96-09-10</date>
- <rev>PA1</rev>
- <file>records.sgml</file>
- </header>
- <p>A record is a data structure intended for storing a fixed number of related data items. It is
- similar to a <c>struct</c> in C, or a <c>record</c> in Pascal. </p>
- <p>The main advantage of using records instead of tuples is that fields in a record are accessed by name, whereas fields in a tuple are accessed by position. To illustrate these differences, suppose that we want to represent a person with the <em>tuple</em><c>{Name, Address, Phone}</c>.</p>
- <p>We must remember that the <c>Name</c> field is the first element of the tuple, the <c>Address</c> field is the second element, and so on, in order to write functions which manipulate this data. For example, to extract data from a variable <c>P</c> which contains such a tuple we might write the following code and then use pattern matching to extract the relevant fields.</p>
- <code type="none">
-
-Name = element(1, P),
-Address = element(2, P),
-... </code>
- <p>Code like this is difficult to read and understand and errors occur if we get the numbering of the elements in the tuple wrong. If we change the data representation by re-ordering the fields, or by adding or removing a field, then all references to the person tuple, wherever they occur, must be checked and possibly modified.</p>
- <p><em>Records</em> allow us to refer to the fields by name and not position. We use a record instead of a tuple to store the data . If we write a record definition of the type shown below, we can then refer to the fields of the record by name.</p>
- <code type="none">
-
--record(person, {name, phone, address}). </code>
- <p>For example, if <c>P</c> is now a variable whose value is a <c>person</c> record, we can code as follows in order to access the name and address fields of the records.</p>
- <code type="none">
-
-Name = P#person.name,
-Address = P#person.address,
-... </code>
- <p>In the following sections we describe the different operations which can be performed on records:</p>
-
- <section>
- <title>Defining a Record</title>
- <p>A record is defined with the following syntax:</p>
- <code type="none">
-
--record(RecordName, {Field1 [= DefaultValue1],
- Field2 [= DefaultValue2],
- ...,
- FieldN [= DefaultValueN]}). </code>
- <p>The record name and field names must be atoms. The optional default values, which are terms, are used if no value is supplied for a field when a new instance of the record is created. If the default value is not supplied, then the atom <c>undefined</c> is assumed.</p>
- <p>For example, in the following record definition, the address field is <c>undefined</c>.</p>
- <pre>
--record(person, {name = "", phone = [], address}). </pre>
- <p>This definition of a person will be used in many of the examples which follow.</p>
- </section>
-
- <section>
- <title>Including a Record Definition</title>
- <p>If the record is used in several modules, its definition should be placed in a <c>.hrl</c> header file. Each module which uses the record definition should have a <c>-include(FileName).</c> statement. For example:</p>
- <code type="none">
-
--include("my_data_structures.hrl"). </code>
- <note>
- <p>The definition of the record must come before it is used.</p>
- </note>
- </section>
-
- <section>
- <title>Creating a Record</title>
- <p>A new record is created with the following syntax:</p>
- <code type="none">
-
-#RecordName{Field1=Expr1,
- ...,
- FieldM=ExprM}. </code>
- <p>If any of the fields is omitted, then the default value supplied in the record definition is used. For example:</p>
- <pre>
-> #person{phone = [0,8,2,3,4,3,1,2], name = "Robert"}.
-{person, "Robert", [0,8,2,3,4,3,1,2], undefined}. </pre>
- <p>There is a new feature introduced in Erlang 5.1 (OTP release
- R8), with which you can set a value to all fields in a record,
- overriding the defaults in the record specification. The special
- field <c>_</c>, means "all fields not explicitly specified".</p>
- <pre>
-> #person{name = "Jakob", _ = '_'}
-{person, "Jakob", '_', '_'} </pre>
- <p>It is primarily intended to be used in <c>ets:match/2</c> and
- <c>mnesia:match_object/3</c>, to set record fields to the atom
- <c>'_'</c>. (This is a wildcard in <c>ets:match/2</c>.)</p>
- </section>
-
- <section>
- <title>Selectors</title>
- <p>The following syntax is used to select an individual field from a record:</p>
- <code type="none">
-
-Variable#RecordName.Field </code>
- <note>
- <p>The values contained in record names and fields must be constants, not variables.</p>
- </note>
- <note>
- <p>For the purposes of illustration, we will demonstrate the use of records using an imaginary dialogue with the Erlang shell. Currently the Erlang evaluator does not support records so you may not be able to reproduce this dialogue.</p>
- </note>
- <pre>
-
-> <input>P = #person{name = "Joe", phone = [0,8,2,3,4,3,1,2]}.</input>
-{person, "Joe", [0,8,2,3,4,3,1,2], undefined}
-> <input>P#person.name.</input>
-"Joe" </pre>
- <note>
- <p>Selectors for records are allowed in guards.</p>
- </note>
- </section>
-
- <section>
- <title>Updating a Record</title>
- <p>The following syntax is used to create a new copy of the record with some of the fields changed. Only the fields to be changed need to be referred to, all other fields retain their old values.</p>
- <code type="none">
-
-OldVariable#RecordName{Field1 = NewValue1,
- ...,
- FieldM = NewValueM} </code>
- <p>For example:</p>
- <pre>
-> P1 = #person{name="Joe", phone=[1,2,3], address="A street"}.
-{person, "Joe", [1,2,3], "A street"}
-> P2 = P1#person{name="Robert"}.
-{person, "Robert", [1,2,3], "A street"} </pre>
- </section>
-
- <section>
- <title>Type Testing</title>
- <p>The following guard test is used to test the type of a record:</p>
- <code type="none">
-
-record(Variable, RecordName) </code>
- <p>The following example shows that the guard succeeds if <c>P</c> is record of type <c>person</c>.</p>
- <pre>
-foo(P) when record(P, person) -> a_person;
-foo(_) -> not_a_person. </pre>
- <note>
- <p>This test checks that <c>P</c> is a tuple of arity <c>N + 1</c>, where <c>N</c> is the number
- of fields in the record, and the first element in the tuple is the atom <c>person</c>.</p>
- </note>
- </section>
-
- <section>
- <title>Pattern Matching</title>
- <p>Matching can be used in combination with records as shown in the following example:</p>
- <pre>
-> P = #person{name="Joe", phone=[0,0,7], address="A street"}.
-{person, "Joe", [0,0,7], "A street"}
-> #person{name = Name} = P, Name.
-"Joe" </pre>
- <p>The following function takes a list of <c>person</c> records and searches for the phone number of a person with a particular name:</p>
- <code type="none">
-
-find_phone([#person{name=Name, phone=Phone} | _], Name) ->
- {found, Phone};
-find_phone([_| T], Name) ->
- find_phone(T, Name);
-find_phone([], Name) ->
- not_found. </code>
- <note>
- <p>The fields referred to in the pattern can be given in any order.</p>
- </note>
- </section>
-
- <section>
- <title>Nested Records</title>
- <p>The value of a field in a record might be an instance of a record. Retrieval of nested data can be done stepwise, or in a single step, as shown in the following example:</p>
- <pre>
--record(name, {first = "Robert", last = "Ericsson"}).
--record(person, {name = #name{}, phone}).
-
-demo() ->
- P = #person{name= #name{first="Robert",last="Virding"}, phone=123},
- First = (P#person.name)#name.first. </pre>
- <note>
- <p>In this example, <c>demo()</c> evaluates to <c>"Robert"</c>.</p>
- </note>
- </section>
-
- <section>
- <title>Internal Representation of Records</title>
- <p>It is often desirable to write generic functions which will work on any record, not just a record of a particular type. For this reason, records are represented internally as tuples and the ordering of the fields in the tuple is strictly defined.</p>
- <p>For example, the record <c>-record(person, {name, phone, address}).</c> is represented internally by the tuple <c>{person, X, Y, Z}</c>.</p>
- <p>The arity of the tuple is one more than the number of fields in the tuple. The first element of the tuple is the name of the record, and the elements of the tuple are the fields in the record. The variables <c>X</c>, <c>Y</c> and <c>Z</c> will store the data contained in the record fields.</p>
- <p>The following two functions determine the indices in the tuple which refer to the named fields in the record:</p>
- <list type="bulleted">
- <item><c>record_info(fields, Rec) -> [Names]</c>. This function returns the names of the fields in the record <c>Rec</c>. For example, <c>record_info(fields, person)</c> evaluates to <c>[name, address, phone]</c>.</item>
- <item><c>record_info(size, Rec) -> Size</c>. This function returns the size of the record <c>Rec</c> when represented as a tuple, which is one more than the number of fields. For example, <c>record_info(size, person)</c> returns <c>4</c>.</item>
- </list>
- <p>In addition, <c>#Rec.Name</c> returns the index in the tuple representation of <c>Name</c> of the record <c>Rec</c>.</p>
- <note>
- <p><c>Name</c> must be an atom.</p>
- </note>
- <p>For example, the following test function <c>test()</c> might return the result shown:</p>
- <pre>
-test() ->
- {record_info(fields, person),
- record_info(size, person),
- #person.name}. </pre>
- <pre>
-> <input>Mod:test().</input>
-{[name,address,phone],4,2} </pre>
- <p>The order in which records map onto tuples is implementation dependent.</p>
- <note>
- <p><c>record_info</c> is a pseudo-function which cannot be exported from the module where it occurs.</p>
- </note>
- </section>
-
- <section>
- <title>Example</title>
- <pre>
-%% File: person.hrl
-
-%%-----------------------------------------------------------
-%% Data Type: person
-%% where:
-%% name: A string (default is undefined).
-%% age: An integer (default is undefined).
-%% phone: A list of integers (default is []).
-%% dict: A dictionary containing various information
-%% about the person.
-%% A {Key, Value} list (default is the empty list).
-%%------------------------------------------------------------
--record(person, {name, age, phone = [], dict = []}).
- </pre>
- <pre>
--module(person).
--include("person.hrl").
--compile(export_all). % For test purposes only.
-
-%% This creates an instance of a person.
-%% Note: The phone number is not supplied so the
-%% default value [] will be used.
-
-make_hacker_without_phone(Name, Age) ->
- #person{name = Name, age = Age,
- dict = [{computer_knowledge, excellent},
- {drinks, coke}]}.
-
-%% This demonstrates matching in arguments
-
-print(#person{name = Name, age = Age,
- phone = Phone, dict = Dict}) ->
- io:format("Name: ~s, Age: ~w, Phone: ~w ~n"
- "Dictionary: ~w.~n", [Name, Age, Phone, Dict]).
-
-%% Demonstrates type testing, selector, updating.
-
-birthday(P) when record(P, person) ->
- P#person{age = P#person.age + 1}.
-
-register_two_hackers() ->
- Hacker1 = make_hacker_without_phone("Joe", 29),
- OldHacker = birthday(Hacker1),
- % The central_register_server should have
- % an interface function for this.
- central_register_server ! {register_person, Hacker1},
- central_register_server ! {register_person,
- OldHacker#person{name = "Robert",
- phone = [0,8,3,2,4,5,3,1]}}. </pre>
- </section>
-</chapter>
-
diff --git a/system/doc/extensions/warning.gif b/system/doc/extensions/warning.gif
deleted file mode 100644
index 96af52360e..0000000000
--- a/system/doc/extensions/warning.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/images/.gitignore b/system/doc/images/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/system/doc/images/.gitignore
+++ /dev/null
diff --git a/system/doc/pics/Makefile b/system/doc/pics/Makefile
deleted file mode 100644
index fc5996259d..0000000000
--- a/system/doc/pics/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Copyright (C) 1996,1997 Ericsson Telecommunications
-# Author: Lars Thorsen
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/doc
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-#
-# Common macros
-#
-
-GIF_FILES= \
- min_head.gif \
- ps.gif
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-
-docs:
-
-pdf:
-
-ps:
-
-debug opt:
-
-
-
-clean:
- @echo "No action" >/dev/null
-
-#
-# Release Targets
-#
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-ifeq ($(DOCTYPE),pdf)
-release_docs_spec: pdf
-else
-ifeq ($(DOCTYPE),ps)
-release_docs_spec: ps
-else
-release_docs_spec: docs
- $(INSTALL_DIR) $(RELSYSDIR)/pics
- $(INSTALL_DATA) $(GIF_FILES) $(RELSYSDIR)/pics
-endif
-endif
-
-release_spec:
diff --git a/system/doc/pics/app.gif b/system/doc/pics/app.gif
deleted file mode 100644
index 345d5795b1..0000000000
--- a/system/doc/pics/app.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/ede.gif b/system/doc/pics/ede.gif
deleted file mode 100644
index 7a51766898..0000000000
--- a/system/doc/pics/ede.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/ede_logo.gif b/system/doc/pics/ede_logo.gif
deleted file mode 100644
index f7c902791b..0000000000
--- a/system/doc/pics/ede_logo.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/min_head.gif b/system/doc/pics/min_head.gif
deleted file mode 100644
index 67948a6378..0000000000
--- a/system/doc/pics/min_head.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/notes.gif b/system/doc/pics/notes.gif
deleted file mode 100644
index e000cca26a..0000000000
--- a/system/doc/pics/notes.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/otp.gif b/system/doc/pics/otp.gif
deleted file mode 100644
index 48c4ca9c02..0000000000
--- a/system/doc/pics/otp.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/otp_logo.gif b/system/doc/pics/otp_logo.gif
deleted file mode 100644
index d1a1f7f72d..0000000000
--- a/system/doc/pics/otp_logo.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/ps.gif b/system/doc/pics/ps.gif
deleted file mode 100644
index 186dfc7e24..0000000000
--- a/system/doc/pics/ps.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/ref_man.gif b/system/doc/pics/ref_man.gif
deleted file mode 100644
index b13c4efd53..0000000000
--- a/system/doc/pics/ref_man.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/pics/user_guide.gif b/system/doc/pics/user_guide.gif
deleted file mode 100644
index e6275a803d..0000000000
--- a/system/doc/pics/user_guide.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/top/bin/otp_man_index b/system/doc/top/bin/otp_man_index
index bb913b25df..57a0f12d32 120000..100755
--- a/system/doc/top/bin/otp_man_index
+++ b/system/doc/top/bin/otp_man_index
@@ -1 +1,106 @@
-../../../../internal_tools/integration/scripts/otp_man_index \ No newline at end of file
+#!/opt/local/bin/perl
+
+use File::Find;
+use strict;
+
+#########################################
+# Usage:
+# $ cd $ERLANG_RELEASE
+# otp_man_index > doc/man_index.html
+#########################################
+
+my (@list,$info);
+
+find(\&wanted,'.');
+
+header();
+
+foreach $info (sort {lc($a->[0]) cmp lc($b->[0])} @list) {
+ my ($module,$application,$dir,$path) = @$info;
+
+ my $idx = -f "$dir/index.html" ? "$dir/index.html" : "$dir/../index.html";
+ # Remove .html extension from module name, if there is one
+ if ($module =~ /(\w+).html$/) {
+ $module = "$1";
+ }
+ print " <TR>\n";
+ print " <TD><A HREF=\"../$path\">$module</A></TD>\n";
+ print " <TD><A HREF=\"../$idx\">$application</A></TD>\n";
+ print " </TR>\n";
+}
+
+footer();
+
+###########################################################################
+
+sub wanted {
+ return unless /\.html$/ and -f $_;
+
+ open(FILE,$_) or die "ERROR: Can't open $File::Find::name: $!\n";
+ my $line;
+
+ while (defined ($line = <FILE>)) {
+ if ($line =~ /<!-- refpage -->/) {
+ close FILE;
+ my $path = $File::Find::name;
+ $path =~ s/\.\///; # Remove './' prefix
+ my $dir = $File::Find::dir;
+ $dir =~ s/\.\///; # Remove './' prefix
+ $dir =~ m&([^/]+)/doc/html$&;
+ my $application = $1;
+ push(@list, [$_,$application,$dir,$path]);
+ return;
+ }
+ }
+ close FILE;
+}
+
+
+sub header {
+ print <<EOS;
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!-- This file was generated by the otp_man_index script -->
+<HTML>
+<HEAD>
+ <link rel="stylesheet" href="otp_doc.css" type="text/css"/>
+ <TITLE>Erlang/OTP Manual Page Index</TITLE>
+</HEAD>
+<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
+ ALINK="#FF0000">
+<CENTER>
+<!-- A HREF="http://www.erlang.org/">
+<img alt="Erlang logo" src="erlang-logo.png"/ >
+</A><BR -->
+<SMALL>
+[<A HREF="index.html">Up</A> |
+<A HREF="http://www.erlang.org/">Erlang</A>]
+</SMALL><BR>
+<P><FONT SIZE="+4">Manual Page Index</FONT><BR>
+</CENTER>
+<CENTER>
+<P>
+<TABLE BORDER=1>
+<TR>
+ <TH>Manual Page</TH><TH>Application</TH>
+</TR>
+EOS
+}
+
+sub footer {
+ my $year = (localtime)[5] + 1900;
+ print <<EOS;
+</TABLE>
+</CENTER>
+<P>
+<CENTER>
+<HR>
+<SMALL>
+Copyright &copy; 1991-$year
+<a href="http://www.ericsson.com/technology/opensource/erlang/">
+Ericsson AB</a>
+</SMALL>
+</CENTER>
+</BODY>
+</HTML>
+EOS
+}
diff --git a/system/doc/top/src/erl_html_tools.erl b/system/doc/top/src/erl_html_tools.erl
index 35a199b08d..d93516768e 120000..100644
--- a/system/doc/top/src/erl_html_tools.erl
+++ b/system/doc/top/src/erl_html_tools.erl
@@ -1 +1,727 @@
-../../../../internal_tools/integration/scripts/make_index/erl_html_tools.erl \ No newline at end of file
+%% ``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 via the world wide web 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.
+%%
+%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
+%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
+%% AB. All Rights Reserved.''
+%%
+-module(erl_html_tools).
+
+%% This file contains tools for updating HTML files in an installed system
+%% depending on the installed applications. Currently the only use is
+%% to update the top index file.
+
+
+%% ------ VERY IMPORTANT ------
+%%
+%% Original location for this file:
+%% /clearcase/otp/internal_tools/integration/scripts/make_index/
+%% When updating this file, copy the source to
+%% /home/otp/patch/share/program/
+%% and place .beam files (compiled with correct release) in all
+%% /home/otp/patch/share/program/<release>
+%% for releases >= R9C
+%%
+%% ----------------------------
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This program generate the top index files for the OTP documentation.
+% Part of the HTML code is in templates, like "index.html.src" and
+% part is written out from this module. So the program and the templates
+% has to match.
+%
+% The templates are searched from the current directory, a directory
+% "templates" relative to the current directory or at RootDir.
+%
+% RootDir is given as an argument or assumed to be code:root_dir(),
+% i.e. the root of the system running this program.
+%
+% The output is put into DestDir or RootDir if not given.
+%
+% The functions to call are
+%
+% top_index()
+% top_index([RootDir])
+% top_index([RootDir,DestDir,OtpRel])
+% top_index(RootDir)
+% top_index(RootDir, DestDir, OtpRel)
+%
+% where RootDir can be a string or an atom.
+%
+%
+% USING THIS SCRIPT FROM THE UNIX COMMAND LINE
+% --------------------------------------------
+% If the Erlang started is the same as the Erlang to create index.html
+% for the use
+%
+% % erl -noshell -s erl_html_tools top_index
+%
+% If you want to create an index for another Erlang installation or
+% documentation located separate from the object code, then use
+%
+% % erl -noshell -s erl_html_tools top_index /path/to/erlang/root
+%
+%
+% COLLECTING INFORMATION
+% ----------------------
+% This script assumes that all applications have an "info" file
+% in their top directory. This file should have some keywords with
+% values defined. The keys are 'group' and 'short' (for "short
+% description). See the OTP applications for examples.
+%
+% Some HTML code is generated by this program, others are taken from
+% the file "index.html.src" that may be located in the patch directory
+% or in the "$ERLANG_ROOT/doc/" directory.
+%
+% The code for creating the top index page assumes all applications
+% have a file "info" with some fields filled in
+%
+% short: Text Short text describing the application
+% group: tag [Heading] Group tag optionally followed by a description.
+% Only one app need to describe the group but
+% more than one can.
+%
+% FIXME: Check that there is documentation for the application, not just
+% an info file.
+% FIXME: Use records, it is now unreadable :-(
+% FIXME: Use a separate URL and URLIndexFile
+% FIXME: Pass the OTP release name as an argument instead of in
+% process dictionary (for elegance).
+
+-export([top_index/0,top_index/1,top_index/3,top_index_silent/3]).
+
+% This is the order groups are inserted into the file. Groups
+% not in this list is inserted in undefined order.
+
+group_order() ->
+ [
+ basic,
+ dat,
+ oam,
+ orb,
+ comm,
+ tools
+ ].
+
+top_index() ->
+ top_index(code:root_dir()).
+
+top_index([RootDir]) when atom(RootDir) ->
+ top_index(atom_to_list(RootDir));
+top_index([RootDir,DestDir,OtpRel])
+ when is_atom(RootDir), is_atom(DestDir), is_atom(OtpRel) ->
+ top_index(atom_to_list(RootDir), atom_to_list(DestDir), atom_to_list(OtpRel));
+top_index(RootDir) ->
+ {_,RelName} = init:script_id(),
+ top_index(RootDir, filename:join(RootDir, "doc"), RelName).
+
+top_index(RootDir, DestDir, OtpRel) ->
+ report("****\nRootDir: ~p", [RootDir]),
+ report("****\nDestDir: ~p", [DestDir]),
+ report("****\nOtpRel: ~p", [OtpRel]),
+
+ put(otp_release, OtpRel),
+
+ Templates = find_templates(["","templates",DestDir]),
+ report("****\nTemplates: ~p", [Templates]),
+ Bases = [{"../lib/", filename:join(RootDir,"lib")},
+ {"../", RootDir}],
+ Groups = find_information(Bases),
+ report("****\nGroups: ~p", [Groups]),
+ process_templates(Templates, DestDir, Groups).
+
+top_index_silent(RootDir, DestDir, OtpRel) ->
+ put(silent,true),
+ Result = top_index(RootDir, DestDir, OtpRel),
+ erase(silent),
+ Result.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Main loop - process templates
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+process_templates([], _DestDir, _Groups) ->
+ report("\n", []);
+process_templates([Template | Templates], DestDir, Groups) ->
+ report("****\nIN-FILE: ~s", [Template]),
+ BaseName = filename:basename(Template, ".src"),
+ case lists:reverse(filename:rootname(BaseName)) of
+ "_"++_ ->
+ %% One template expands to several output files.
+ process_multi_template(BaseName, Template, DestDir, Groups);
+ _ ->
+ %% Standard one-to-one template.
+ OutFile = filename:join(DestDir, BaseName),
+ subst_file("", OutFile, Template, Groups)
+ end,
+ process_templates(Templates, DestDir, Groups).
+
+
+process_multi_template(BaseName0, Template, DestDir, Info) ->
+ Ext = filename:extension(BaseName0),
+ BaseName1 = filename:basename(BaseName0, Ext),
+ [_|BaseName2] = lists:reverse(BaseName1),
+ BaseName = lists:reverse(BaseName2),
+ Groups0 = [{[$_|atom_to_list(G)],G} || G <- group_order()],
+ Groups = [{"",basic}|Groups0],
+ process_multi_template_1(Groups, BaseName, Ext, Template, DestDir, Info).
+
+process_multi_template_1([{Suffix,Group}|Gs], BaseName, Ext, Template, DestDir, Info) ->
+ OutFile = filename:join(DestDir, BaseName++Suffix++Ext),
+ subst_file(Group, OutFile, Template, Info),
+ process_multi_template_1(Gs, BaseName, Ext, Template, DestDir, Info);
+process_multi_template_1([], _, _, _, _, _) -> ok.
+
+subst_file(Group, OutFile, Template, Info) ->
+ report("\nOUTFILE: ~s", [OutFile]),
+ case subst_template(Group, Template, Info) of
+ {ok,Text,_NewInfo} ->
+ case file:open(OutFile, [write]) of
+ {ok, Stream} ->
+ file:write(Stream, Text),
+ file:close(Stream);
+ Error ->
+ error("Can't write to file ~s: ~w", [OutFile,Error])
+ end;
+ Error ->
+ error("Can't write to file ~s: ~w", [OutFile,Error])
+ end.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Find the templates
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+find_templates(SearchPaths) ->
+ find_templates(SearchPaths, SearchPaths).
+
+find_templates([SearchPath | SearchPaths], AllSearchPaths) ->
+ case filelib:wildcard(filename:join(SearchPath, "*.html.src")) of
+ [] ->
+ find_templates(SearchPaths, AllSearchPaths);
+ Result ->
+ Result
+ end;
+find_templates([], AllSearchPaths) ->
+ error("No templates found in ~p",[AllSearchPaths]).
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% This function read all application names and if present all "info" files.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+find_information(Bases) ->
+ Paths = find_application_paths(Bases),
+% report("****\nPaths: ~p", [Paths]),
+ Apps = find_application_infos(Paths),
+% report("****\nApps: ~p", [Apps]),
+ form_groups(Apps).
+
+% The input is a list of tuples of the form
+%
+% IN: [{BaseURL,SearchDir}, ...]
+%
+% and the output is a list
+%
+% OUT: [{Appname,AppVersion,AppPath,IndexUTL}, ...]
+%
+% We know URL ends in a slash.
+
+find_application_paths([]) ->
+ [];
+find_application_paths([{URL,Dir} | Paths]) ->
+ Sub1 = "doc/html/index.html",
+%% Sub2 = "doc/index.html",
+ case file:list_dir(Dir) of
+ {ok, Dirs} ->
+ AppDirs =
+ lists:filter(
+ fun(E) ->
+ is_match(E, "^[A-Za-z0-9_]+-[0-9\\.]+")
+ end, Dirs),
+ AppPaths =
+ lists:map(
+ fun(AppDir) ->
+ {ok,[App,Ver]} = regexp:split(AppDir, "-"),
+ DirPath = filename:join(Dir,AppDir),
+ AppURL = URL ++ AppDir,
+ {App,Ver,DirPath,AppURL ++ "/" ++ Sub1}
+%% case file:read_file_info(
+%% filename:join(DirPath, Sub1)) of
+%% {ok, _} ->
+%% {App,Ver,DirPath,AppURL ++ "/" ++ Sub1};
+%% _ ->
+%% {App,Ver,DirPath,AppURL ++ "/" ++ Sub2}
+%% end
+ end, AppDirs),
+ AppPaths ++ find_application_paths(Paths)
+ end.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Find info for one application.
+% Read the "info" file for each application. Look at "group" and "short".
+% key words.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% IN: [{Appname,AppVersion,AppPath,IndexUTL}, ...]
+% OUT: [{Group,Heading,[{AppName,[{AppVersion,Path,URL,Text} | ...]}
+% | ...]}, ...]
+
+find_application_infos([]) ->
+ [];
+find_application_infos([{App,Ver,AppPath,IndexURL} | Paths]) ->
+ case read_info(filename:join(AppPath,"info")) of
+ {error,_Reason} ->
+ warning("No info for app ~p", [AppPath]),
+ find_application_infos(Paths);
+ Db ->
+ {Group,Heading} =
+ case lists:keysearch("group", 1, Db) of
+ {value, {_, G0}} ->
+ % This value may be in two parts,
+ % tag and desciption
+ case string:str(G0," ") of
+ 0 ->
+ {list_to_atom(G0),""};
+ N ->
+ {list_to_atom(string:substr(G0,1,N-1)),
+ string:substr(G0,N+1)}
+ end;
+ false ->
+ error("No group given",[])
+ end,
+ Text =
+ case lists:keysearch("short", 1, Db) of
+ {value, {_, G1}} ->
+ G1;
+ false ->
+ ""
+ end,
+ [{Group,Heading,{App,{Ver,AppPath,IndexURL,Text}}}
+ | find_application_infos(Paths)]
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Group into one list element for each group name.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% IN : {Group,Heading,{AppName,{AppVersion,Path,URL,Text}}}
+% OUT: {Group,Heading,[{AppName,[{AppVersion,Path,URL,Text} | ...]} | ...]}
+
+form_groups(Apps) ->
+ group_apps(lists:sort(Apps)).
+
+group_apps([{Group,Heading,AppInfo} | Info]) ->
+ group_apps(Info, Group, Heading, [AppInfo]);
+group_apps([]) ->
+ [].
+
+% First description
+group_apps([{Group,"",AppInfo} | Info], Group, Heading, AppInfos) ->
+ group_apps(Info, Group, Heading, [AppInfo | AppInfos]);
+group_apps([{Group,Heading,AppInfo} | Info], Group, "", AppInfos) ->
+ group_apps(Info, Group, Heading, [AppInfo | AppInfos]);
+% Exact match
+group_apps([{Group,Heading,AppInfo} | Info], Group, Heading, AppInfos) ->
+ group_apps(Info, Group, Heading, [AppInfo | AppInfos]);
+% Different descriptions
+group_apps([{Group,_OtherHeading,AppInfo} | Info], Group, Heading, AppInfos) ->
+ warning("Group ~w descriptions differ",[Group]),
+ group_apps(Info, Group, Heading, [AppInfo | AppInfos]);
+group_apps(Info, Group, Heading, AppInfos) ->
+ [{Group,Heading,combine_apps(AppInfos)} | group_apps(Info)].
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Group into one list element for each application name.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% IN : {AppName,{AppVersion,Path,URL,Text}}
+% OUT: {AppName,[{AppVersion,Path,URL,Text} | ...]}
+
+combine_apps(Apps) ->
+ combine_apps(Apps,[],[]).
+
+combine_apps([{AppName,{Vsn1,Path1,URL1,Text1}},
+ {AppName,{Vsn2,Path2,URL2,Text2}} | Apps], AppAcc, Acc) ->
+ combine_apps([{AppName,{Vsn2,Path2,URL2,Text2}} | Apps],
+ [{Vsn1,Path1,URL1,Text1} | AppAcc],
+ Acc);
+combine_apps([{AppName,{Vsn1,Path1,URL1,Text1}},
+ {NewAppName,{Vsn2,Path2,URL2,Text2}} | Apps], AppAcc, Acc) ->
+ App = lists:sort(fun vsncmp/2,[{Vsn1,Path1,URL1,Text1}|AppAcc]),
+ combine_apps([{NewAppName,{Vsn2,Path2,URL2,Text2}} | Apps],
+ [],
+ [{AppName,App}|Acc]);
+combine_apps([{AppName,{Vsn,Path,URL,Text}}], AppAcc, Acc) ->
+ App = lists:sort(fun vsncmp/2,[{Vsn,Path,URL,Text}|AppAcc]),
+ [{AppName,App}|Acc].
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Open a template and fill in the missing parts
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% IN : {Group,Heading,[{AppName,[{AppVersion,Path,URL,Text} | ...]} | ...]}
+% OUT: String that is the HTML code
+
+subst_template(Group, File, Info) ->
+ case file:open(File, read) of
+ {ok,Stream} ->
+ Res = subst_template_1(Group, Stream, Info),
+ file:close(Stream),
+ Res;
+ {error,Reason} ->
+ {error, Reason}
+ end.
+
+subst_template_1(Group, Stream, Info) ->
+ case file:read(Stream, 100000) of
+ {ok, Template} ->
+ Fun = fun(Match, _) -> {subst(Match, Info, Group),Info} end,
+ gsub(Template, "#[A-Za-z0-9]+#", Fun, Info);
+ {error, Reason} ->
+ {error, Reason}
+ end.
+
+get_version(Info) ->
+ case lists:keysearch('runtime', 1, Info) of
+ {value, {_,_,Apps}} ->
+ case lists:keysearch("erts", 1, Apps) of
+ {value, {_,[{Vers,_,_,_} | _]}} ->
+ Vers;
+ _ ->
+ ""
+ end;
+ _ ->
+ ""
+ end.
+
+subst("#release#", _Info, _Group) ->
+ get(otp_release);
+subst("#version#", Info, _Group) ->
+ get_version(Info);
+subst("#copyright#", _Info, _Group) ->
+ "copyright Copyright &copy; 1991-2004";
+subst("#groups#", Info, _Group) ->
+ [
+ "<table border=0 width=\"90%\" cellspacing=3 cellpadding=5>\n",
+ subst_groups(Info),
+ "</table>\n"
+ ];
+subst("#applinks#", Info, Group) ->
+ subst_applinks(Info, Group);
+subst(KeyWord, Info, _Group) ->
+ case search_appname(KeyWord -- "##", Info) of
+ {ok,URL} ->
+ URL;
+ _ ->
+ warning("Can't substitute keyword ~s~n",[KeyWord]),
+ ""
+ end.
+
+search_appname(App, [{_Group,_,Apps} | Groups]) ->
+ case lists:keysearch(App, 1, Apps) of
+ {value, {_,[{_Vers,_Path,URL,_Text} | _]}} ->
+ {ok,lists:sublist(URL, length(URL) - length("/index.html"))};
+ _ ->
+ search_appname(App, Groups)
+ end;
+search_appname(_App, []) ->
+ {error,noapp}.
+
+subst_applinks(Info, Group) ->
+ subst_applinks_1(group_order(), Info, Group).
+
+subst_applinks_1([G|Gs], Info0, Group) ->
+ case lists:keysearch(G, 1, Info0) of
+ {value,{G,Heading,Apps}} ->
+ Info = lists:keydelete(G, 1, Info0),
+ ["\n<li>",Heading,"\n<ul>\n",
+ html_applinks(Apps),"\n</ul></li>\n"|
+ subst_applinks_1(Gs, Info, Group)];
+ false ->
+ warning("No applications in group ~w\n", [G]),
+ subst_applinks_1(Gs, Info0, Group)
+ end;
+subst_applinks_1([], [], _) -> [];
+subst_applinks_1([], Info, _) ->
+ error("Info left:\n", [Info]),
+ [].
+
+html_applinks([{Name,[{_,_,URL,_}|_]}|AppNames]) ->
+ ["<li><a href=\"",URL,"\">",Name,
+ "</a></li>\n"|html_applinks(AppNames)];
+html_applinks([]) -> [].
+
+
+% Info: [{Group,Heading,[{AppName,[{AppVersion,Path,URL,Text} | ..]} | ..]} ..]
+
+subst_groups(Info0) ->
+ {Html1,Info1} = subst_known_groups(group_order(), Info0, ""),
+ {Html2,Info} = subst_unknown_groups(Info1, Html1, []),
+ Fun = fun({_Group,_GText,Applist}, Acc) -> Applist ++ Acc end,
+ case lists:foldl(Fun, [], Info) of
+ [] ->
+ Html2;
+ Apps ->
+ [Html2,group_table("Misc Applications",Apps)]
+ end.
+
+
+subst_known_groups([], Info, Text) ->
+ {Text,Info};
+subst_known_groups([Group | Groups], Info0, Text0) ->
+ case lists:keysearch(Group, 1, Info0) of
+ {value,{_,Heading,Apps}} ->
+ Text = group_table(Heading,Apps),
+ Info = lists:keydelete(Group, 1, Info0),
+ subst_known_groups(Groups, Info, Text0 ++ Text);
+ false ->
+ warning("No applications in group ~w~n",[Group]),
+ subst_known_groups(Groups, Info0, Text0)
+ end.
+
+
+subst_unknown_groups([], Text0, Left) ->
+ {Text0,Left};
+subst_unknown_groups([{Group,"",Apps} | Groups], Text0, Left) ->
+ warning("No text describes ~w",[Group]),
+ subst_unknown_groups(Groups, Text0, [{Group,"",Apps} | Left]);
+subst_unknown_groups([{_Group,Heading,Apps} | Groups], Text0, Left) ->
+ Text = group_table(Heading,Apps),
+ subst_unknown_groups(Groups, Text0 ++ Text, Left).
+
+
+group_table(Heading,Apps) ->
+ [
+ " <tr>\n",
+ " <td colspan=2 class=header>\n",
+ " <font size=\"+1\"><b>",Heading,"</b></font>\n",
+ " </td>\n",
+ " </tr>\n",
+ subst_apps(Apps),
+ " <tr>\n",
+ " <td colspan=2><font size=1>&nbsp;</font></td>\n",
+ " </tr>\n"
+ ].
+
+% Count and split the applications in half to get the right sort
+% order in the table.
+
+subst_apps([{App,VersionInfo} | Apps]) ->
+ [subst_app(App, VersionInfo) | subst_apps(Apps)];
+subst_apps([]) ->
+ [].
+
+
+subst_app(App, [{VSN,_Path,Link,Text}]) ->
+ [
+ " <tr class=app>\n",
+ " <td align=left valign=top>\n",
+ " <table border=0 width=\"100%\" cellspacing=0 cellpadding=0>\n",
+ " <tr class=app>\n",
+ " <td align=left valign=top>\n",
+ " <a href=\"",Link,"\" target=\"_top\">",uc(App),"</a>\n",
+ " <a href=\"",Link,"\" target=\"_top\">",VSN,"</a>\n",
+ " </td>\n",
+ " </tr>\n",
+ " </table>\n"
+ " </td>\n",
+ " <td align=left valign=top>\n",
+ Text,"\n",
+ " </td>\n",
+ " </tr>\n"
+ ];
+subst_app(App, [{VSN,_Path,Link,Text} | VerInfos]) ->
+ [
+ " <tr class=app>\n",
+ " <td align=left valign=top>\n",
+ " <table border=0 width=\"100%\" cellspacing=0 cellpadding=0>\n",
+ " <tr class=app>\n",
+ " <td align=left valign=top>\n",
+ " <a href=\"",Link,"\" target=\"_top\">",uc(App),
+ "</a>&nbsp;&nbsp;<br>\n",
+ " <a href=\"",Link,"\" target=\"_top\">",VSN,"</a>\n",
+ " </td>\n",
+ " <td align=right valign=top width=50>\n",
+ " <table border=0 width=40 cellspacing=0 cellpadding=0>\n",
+ " <tr class=app>\n",
+ " <td align=left valign=top class=appnums>\n",
+ subst_vsn(VerInfos),
+ " </td>\n",
+ " </tr>\n",
+ " </table>\n"
+ " </td>\n",
+ " </tr>\n",
+ " </table>\n"
+ " </td>\n",
+ " <td align=left valign=top>\n",
+ Text,"\n",
+ " </td>\n",
+ " </tr>\n"
+ ].
+
+
+subst_vsn([{VSN,_Path,Link,_Text} | VSNs]) ->
+ [
+ " <font size=\"2\"><a class=anum href=\"",Link,"\" target=\"_top\">",
+ VSN,
+ "</a></font><br>\n",
+ subst_vsn(VSNs)
+ ];
+subst_vsn([]) ->
+ "".
+
+
+% Yes, this is very inefficient an is done for every comarision
+% in the sort but it doesn't matter in this case.
+
+vsncmp({Vsn1,_,_,_}, {Vsn2,_,_,_}) ->
+ L1 = [list_to_integer(N1) || N1 <- string:tokens(Vsn1, ".")],
+ L2 = [list_to_integer(N2) || N2 <- string:tokens(Vsn2, ".")],
+ L1 > L2.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% GENERIC FUNCTIONS, NOT SPECIFIC FOR GENERATING INDEX.HTML
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Read the "info" file into a list of Key/Value pairs
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+read_info(File) ->
+ case file:open(File, read) of
+ {ok,Stream} ->
+ Res =
+ case file:read(Stream,10000) of
+ {ok, Text} ->
+ Lines = string:tokens(Text, "\n\r"),
+ KeyValues0 = lines_to_key_value(Lines),
+ combine_key_value(KeyValues0);
+ {error, Reason} ->
+ {error, Reason}
+ end,
+ file:close(Stream),
+ Res;
+ {error,Reason} ->
+ {error,Reason}
+ end.
+
+combine_key_value([{Key,Value1},{Key,Value2} | KeyValues]) ->
+ combine_key_value([{Key,Value1 ++ "\n" ++ Value2} | KeyValues]);
+combine_key_value([KeyValue | KeyValues]) ->
+ [KeyValue | combine_key_value(KeyValues)];
+combine_key_value([]) ->
+ [].
+
+lines_to_key_value([]) ->
+ [];
+lines_to_key_value([Line | Lines]) ->
+ case regexp:first_match(Line, "^[a-zA-Z_\\-]+:") of
+ nomatch ->
+ case regexp:first_match(Line, "[\041-\377]") of
+ nomatch ->
+ lines_to_key_value(Lines);
+ _ ->
+ warning("skipping line \"~s\"",[Line]),
+ lines_to_key_value(Lines)
+ end;
+ {match, _, Length} ->
+ Value0 = lists:sublist(Line, Length+1, length(Line) - Length),
+ {ok, Value1, _} = regexp:sub(Value0, "^[ \t]*", ""),
+ {ok, Value, _} = regexp:sub(Value1, "[ \t]*$", ""),
+ Key = lists:sublist(Line, Length-1),
+ [{Key,Value} | lines_to_key_value(Lines)]
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Extensions to the 'regexp' module.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+is_match(Ex, Re) ->
+ case regexp:first_match(Ex, Re) of
+ {match, _, _} ->
+ true;
+ nomatch ->
+ false
+ end.
+
+%% -type gsub(String, RegExp, Fun, Acc) -> subres().
+%% Substitute every match of the regular expression RegExp with the
+%% string returned from the function Fun(Match, Acc). Accept pre-parsed
+%% regular expressions. Acc is an argument to the Fun. The Fun should return
+%% a tuple {Replacement, NewAcc}.
+
+gsub(String, RegExp, Fun, Acc) when list(RegExp) ->
+ case regexp:parse(RegExp) of
+ {ok,RE} -> gsub(String, RE, Fun, Acc);
+ {error,E} -> {error,E}
+ end;
+gsub(String, RE, Fun, Acc) ->
+ {match,Ss} = regexp:matches(String, RE),
+ {NewString, NewAcc} = sub_repl(Ss, Fun, Acc, String, 1),
+ {ok,NewString,NewAcc}.
+
+
+% New code that uses fun for finding the replacement. Also uses accumulator
+% to pass argument between the calls to the fun.
+sub_repl([{St,L}|Ss], Fun, Acc0, S, Pos) ->
+ Match = string:substr(S, St, L),
+ {Rep, Acc} = Fun(Match, Acc0),
+ {Rs, NewAcc} = sub_repl(Ss, Fun, Acc, S, St+L),
+ {string:substr(S, Pos, St-Pos) ++ Rep ++ Rs, NewAcc};
+sub_repl([], _Fun, Acc, S, Pos) -> {string:substr(S, Pos), Acc}.
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Error and warnings
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+error(Format, Args) ->
+ io:format("ERROR: " ++ Format ++ "\n", Args),
+ exit(1).
+
+warning(Format, Args) ->
+ case get(silent) of
+ true -> ok;
+ _ -> io:format("WARNING: " ++ Format ++ "\n", Args)
+ end.
+
+report(Format, Args) ->
+ case get(silent) of
+ true -> ok;
+ _ -> io:format(Format ++ "\n", Args)
+ end.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Extensions to the 'string' module.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+uc(String) ->
+ lists:reverse(uc(String, [])).
+
+uc([], Acc) ->
+ Acc;
+uc([H | T], Acc) when is_integer(H), [97] =< H, H =< $z ->
+ uc(T, [H - 32 | Acc]);
+uc([H | T], Acc) ->
+ uc(T, [H | Acc]).
diff --git a/system/doc/top/src/erlresolvelinks.erl b/system/doc/top/src/erlresolvelinks.erl
index 8d277ad17a..a891b67421 120000..100644
--- a/system/doc/top/src/erlresolvelinks.erl
+++ b/system/doc/top/src/erlresolvelinks.erl
@@ -1 +1,144 @@
-../../../../internal_tools/integration/scripts/resolve_links/erlresolvelinks.erl \ No newline at end of file
+-module(erlresolvelinks).
+
+%% ------ VERY IMPORTANT ------
+%%
+%% Original location for this file:
+%% /clearcase/otp/internal_tools/integration/scripts/resolve_links/
+%% When updating this file, copy the source to
+%% /usr/local/otp/patch/share/program/
+%% and place .beam files (compiled with correct release) in all
+%% /usr/local/otp/patch/share/program/<release>
+%% for releases >= R10B
+%%
+%% ----------------------------
+
+-export([make/1, do_make/1, do_make/2, do_make/3]).
+-include_lib("kernel/include/file.hrl").
+
+-define(JAVASCRIPT_NAME, "erlresolvelinks.js").
+
+make([RootDir]) ->
+ do_make(RootDir);
+make([RootDir, DestDir]) ->
+ do_make(RootDir, DestDir);
+make([RootDir, DestDir, Name]) ->
+ do_make(RootDir, DestDir, Name).
+
+do_make(RootDir) ->
+ DestDir = filename:join(RootDir, "doc"),
+ do_make(RootDir, DestDir).
+
+do_make(RootDir, DestDir) ->
+ do_make(RootDir, DestDir, ?JAVASCRIPT_NAME).
+
+do_make(RootDir, DestDir, Name) ->
+ %% doc/Dir
+ %% erts-Vsn
+ %% lib/App-Vsn
+ DocDirs0 = get_dirs(filename:join([RootDir, "doc"])),
+ DocDirs = lists:map(fun(Dir) ->
+ D = filename:join(["doc", Dir]),
+ {D, D} end, DocDirs0),
+
+ ErtsDirs = latest_app_dirs(RootDir, ""),
+ AppDirs = latest_app_dirs(RootDir, "lib"),
+
+ AllAppDirs =
+ lists:map(
+ fun({App, AppVsn}) -> {App, filename:join([AppVsn, "doc", "html"])}
+ end, ErtsDirs ++ AppDirs),
+
+ AllDirs = DocDirs ++ AllAppDirs,
+ {ok, Fd} = file:open(filename:join([DestDir, Name]), [write]),
+ UTC = calendar:universal_time(),
+ io:fwrite(Fd, "/* Generated by ~s at ~w UTC */\n",
+ [atom_to_list(?MODULE), UTC]),
+ io:fwrite(Fd, "function erlhref(ups, app, rest) {\n", []),
+ io:fwrite(Fd, " switch(app) {\n", []),
+ lists:foreach(
+ fun({Tag, Dir}) ->
+ io:fwrite(Fd, " case ~p:\n", [Tag]),
+ io:fwrite(Fd, " location.href=ups + \"~s/\" + rest;\n",
+ [Dir]),
+ io:fwrite(Fd, " break;\n", [])
+ end, AllDirs),
+ io:fwrite(Fd, " default:\n", []),
+ io:fwrite(Fd, " location.href=ups + \"Unresolved\";\n", []),
+ io:fwrite(Fd, " }\n", []),
+ io:fwrite(Fd, "}\n", []),
+ file:close(Fd),
+ ok.
+
+get_dirs(Dir) ->
+ {ok, Files} = file:list_dir(Dir),
+ AFiles =
+ lists:map(fun(File) -> {File, filename:join([Dir, File])} end, Files),
+ lists:zf(fun is_dir/1, AFiles).
+
+is_dir({File, AFile}) ->
+ {ok, FileInfo} = file:read_file_info(AFile),
+ case FileInfo#file_info.type of
+ directory ->
+ {true, File};
+ _ ->
+ false
+ end.
+
+latest_app_dirs(RootDir, Dir) ->
+ ADir = filename:join(RootDir, Dir),
+ RDirs0 = get_dirs(ADir),
+ RDirs1 = lists:filter(fun is_app_dir/1, RDirs0),
+ %% Build a list of {{App, VsnNumList}, AppVsn}
+ SDirs0 =
+ lists:map(fun(AppVsn) ->
+ [App, VsnStr] = string:tokens(AppVsn, "-"),
+ VsnNumList = vsnstr_to_numlist(VsnStr),
+ {{App, VsnNumList}, AppVsn} end,
+ RDirs1),
+ SDirs1 = lists:keysort(1, SDirs0),
+ App2Dirs = lists:foldr(fun({{App, _VsnNumList}, AppVsn}, Acc) ->
+ case lists:keymember(App, 1, Acc) of
+ true ->
+ Acc;
+ false ->
+ [{App, AppVsn}| Acc]
+ end
+ end, [], SDirs1),
+ lists:map(fun({App, AppVsn}) -> {App, filename:join([Dir, AppVsn])} end,
+ App2Dirs).
+
+is_app_dir(Dir) ->
+ case string:tokens(Dir, "-") of
+ [_Name, Rest] ->
+ is_vsnstr(Rest);
+ _ ->
+ false
+ end.
+
+is_vsnstr(Str) ->
+ case string:tokens(Str, ".") of
+ [_] ->
+ false;
+ Toks ->
+ lists:all(fun is_numstr/1, Toks)
+ end.
+
+is_numstr(Cs) ->
+ lists:all(fun(C) when $0 =< C, C =< $9 ->
+ true;
+ (_) ->
+ false
+ end, Cs).
+
+%% We know:
+
+vsnstr_to_numlist(VsnStr) ->
+ lists:map(fun(NumStr) -> list_to_integer(NumStr) end,
+ string:tokens(VsnStr, ".")).
+
+
+
+
+
+
+
diff --git a/system/doc/top/src/permuted_index.erl b/system/doc/top/src/permuted_index.erl
deleted file mode 120000
index e65338a517..0000000000
--- a/system/doc/top/src/permuted_index.erl
+++ /dev/null
@@ -1 +0,0 @@
-../../../../internal_tools/integration/scripts/make_index/permuted_index.erl \ No newline at end of file
diff --git a/system/doc/top/templates/erlang.gif b/system/doc/top/templates/erlang.gif
deleted file mode 100644
index 91fd4b9647..0000000000
--- a/system/doc/top/templates/erlang.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/top/templates/first.html.src b/system/doc/top/templates/first.html.src
deleted file mode 100644
index edef1c0e5c..0000000000
--- a/system/doc/top/templates/first.html.src
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <title>Erlang/OTP #release# Documentation</title>
- <style type="text/css">
-<!--
- BODY { background: white }
-
- BODY { font-family: Verdana, Arial, Helvetica, sans-serif }
- TH { font-family: Verdana, Arial, Helvetica, sans-serif }
- TD { font-family: Verdana, Arial, Helvetica, sans-serif }
- P { font-family: Verdana, Arial, Helvetica, sans-serif }
-
- .header { background: #222; color: #fff }
- .app { background: #ccc }
--->
- </style>
-</head>
-<body bgcolor=white text="#000000" link="#0000ff" vlink="#ff00ff"
- alink="#ff0000">
-<center>
-<p>
-<font size="+1">Welcome to Erlang/OTP, a complete<br>
-development environment<br>
-for concurrent programming.</font>
-</p>
-</center>
-<br>
-<br>
-<br>
-<p><b>
-<font size"+1">
-Some hints that may get you started faster
-</font>
-</b></p>
-
-<ul>
-
-<li>In addition the the documentation here Erlang is described in the book
-<a href="http://www.pragprog.com/titles/jaerlang" target="_top">"Programming Erlang"</a>, ISBN 978-1-934356-00-5 which we really recommend as a start.<br/ >
-The complete language is also described in the <a href="reference_manual/part_frame.html" target="_top">Erlang Reference Manual</a>. An Erlang tutorial can be found in <a href="getting_started/part_frame.html" target="_top">Getting Started With Erlang</a>.
-</li>
-<li>Erlang/OTP is divided into a number of OTP <a
-href="applications.html">applications</a>. An application normally contains
-Erlang <a href="man_index.html">modules</a>. Some OTP applications,
-such as the C interface <em>Erl_Interface</em>, are written in other languages and have no Erlang
-modules.
-
-<p>
-Note that functions that are not imported or prefixed with a module
-name belong to the module
-<a href="#kernel#/erlang.html" target="_top">erlang</a>
-(in the <em>Kernel</em> application).
-</p>
-<p>
-<li>On a Unix system you can view the manual pages from the command
-line using
-<pre>
- % erl -man &lt;module&gt;
-</pre>
-<p>
-
-<li> You can of course use any editor you like to write Erlang
-programs, but if you use Emacs there exists editing support such as
-indentation, syntax highlighting, electric commands, module name
-verification, comment support including paragraph filling, skeletons,
-tags support and more. See the <a href="#tools#/index.html"
-target="_top">Tools</a> application for details.
-<p>
-There is also an
-<a href="http://erlide.sourceforge.net" target="_top">
-Erlang plugin (ErlIde) for Eclipse</a> if you prefer a more graphical
-environment. ErlIde is under development and should at the time
-of writing this be quite stable and useful.
-<li>When developing with Erlang/OTP you usually test your programs
-from the interactive shell (see <a href="getting_started/part_frame.html"
-target="_top">Getting Started With Erlang</a>) where you can call individual
-functions. There is also a number of tools available, such as the graphical <a
-href="#debugger#/index.html" target="_top">Debugger</a>, the process
-manager <a href="#pman#/index.html" target="_top">Pman</a> and table
-viewer <a href="#tv#/index.html" target="_top">TV</a>.
-<p> Also note that there are some shell features like history list
-(control-p and control-n), inline editing (emacs key bindings) and
-module and function name completion (tab) if the module is loaded.
-<p>
-
-<li>OpenSource users can ask questions
-and share experiences on the <a href="http://www.erlang.org/faq.html"
-target="_top">Erlang questions mailing list</a>. <p>
-
-<li>Before asking a question you can browse the <a
-href="http://www.erlang.org/pipermail/erlang-questions/"
-target="_top">mailing list archive</a> and read the <a
-href="http://www.erlang.org/faq/faq.html" target="_top">Frequently
-Asked Questions</a>. <p>
-
-<li>Additional information and links of interest for Erlang programmers can be found on the Erlang Open Source site
-<a href="http://www.erlang.org/" target="_top">http://www.erlang.org</a>.
-<p>
-
-</ul>
-
-</body>
-</html>
diff --git a/system/doc/top/templates/flip_closed.gif b/system/doc/top/templates/flip_closed.gif
deleted file mode 100755
index 9a27c7c25d..0000000000
--- a/system/doc/top/templates/flip_closed.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/top/templates/flip_google.gif b/system/doc/top/templates/flip_google.gif
deleted file mode 100755
index 3f0543c2bb..0000000000
--- a/system/doc/top/templates/flip_google.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/top/templates/flip_open.gif b/system/doc/top/templates/flip_open.gif
deleted file mode 100755
index 9dda60e73a..0000000000
--- a/system/doc/top/templates/flip_open.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/top/templates/flip_static.gif b/system/doc/top/templates/flip_static.gif
deleted file mode 100755
index 2b3ddb5382..0000000000
--- a/system/doc/top/templates/flip_static.gif
+++ /dev/null
Binary files differ
diff --git a/system/doc/top/templates/flipmenu.js b/system/doc/top/templates/flipmenu.js
deleted file mode 100755
index 92a5a58a06..0000000000
--- a/system/doc/top/templates/flipmenu.js
+++ /dev/null
@@ -1,342 +0,0 @@
-// ######################################################################
-
-// ## flipMenu 5.0.0 (c) J. Reijers
-// ## Last modifications: 23 March 2007
-
-// ######################################################################
-
-// ## Degree of indentation from the left.
- flipIndentation = "5px";
-
-// ## Padding inbetween menu items.
- flipVerticalPadding = "4px";
-
-// ## Margin between the left of the browser and the menu.
- flipLeftMargin = "16px";
-
-// ## Margin between the top of the browser and the menu.
- flipTopMargin = "10px";
-
-// ## Allow multiple menus to fold out without closing all the other open ones.
- flipOpenMultipleMenus = false;
-
-// ## Preserve the current state of the menu (requires cookies).
- flipSaveMenuState = true;
-
-// ## Use custom images for bullets
- flipImages = true;
-
-// ## Images to use (specify full path)
- flipImg_open = "flip_open.gif";
- flipImg_closed = "flip_closed.gif";
- flipImg_static = "flip_static.gif";
-
-// ## Initialise all flipMenus onload
- flipInitOnLoad = true;
-
-// ## Message to display in status bar while loading
- flipLoadingMessage = "Loading...";
-
-// ######################################################################
-
-function alterSize(someSize, alterAmount) {
- someSize = String(someSize);
- var tmpNr = parseFloat(someSize.replace(/\D/g, ""));
- var tmpChar = someSize.replace(/\d/g, "");
- return isNaN(tmpNr) ? someSize : ((tmpNr + alterAmount) + tmpChar);
-}
-
-isIE = (String(navigator.appVersion).indexOf("MSIE") > -1);
-if (!isIE) flipIndentation = alterSize(flipIndentation, -16);
-if (!isIE) flipLeftMargin = alterSize(flipLeftMargin, -16);
-
-document.write(
- "<style type=\"text/css\">" +
-
- "ul.flipMenu { margin-top: " + flipTopMargin + "; margin-left: " + flipLeftMargin + "; " + (flipImages ? "" : "list-style-type: none;") + " }" +
- "ul.flipMenu ul, ul.flipMenu li { padding-top: " + flipVerticalPadding + "; margin-left: " + flipIndentation + "; margin-right: 0px; " + (flipImages ? "" : "list-style-type: none;") + " }" +
-
- "li.flipFolderOpen { cursor: pointer; " + (flipImages ? "list-style-image: url(" + flipImg_open + ");" : "") + " }" +
- "li.flipFolderClosed { cursor: pointer; " + (flipImages ? "list-style-image: url(" + flipImg_closed + ");" : "") + " }" +
-
- "</style>"
-);
-
-if (flipImages) {
- aFlipPreloads = [];
- aFlipPreloads[0] = new Image;
- aFlipPreloads[0].src = flipImg_open;
- aFlipPreloads[1] = new Image;
- aFlipPreloads[1].src = flipImg_closed;
- aFlipPreloads[2] = new Image;
- aFlipPreloads[2].src = flipImg_static;
-}
-
-function addEvent(someObj, someEvent, someFunction) {
- if (someObj.addEventListener) { someObj.addEventListener(someEvent, someFunction, true); return true; } else if (someObj.attachEvent) return someObj.attachEvent("on" + someEvent, someFunction); else return false;
-}
-
-function openCloseFlip(theItem, newSetting, openParents) {
- if (theItem.flipID) {
- if (openParents) {
- var tmpItem = theItem;
- while (tmpItem.parentElement || tmpItem.parentNode) {
- tmpItem = (tmpItem.parentElement) ? tmpItem.parentElement : tmpItem.parentNode;
- openCloseFlip(tmpItem, newSetting);
- }
- }
- if ((theItem.className == "flipFolderOpen" && newSetting == "closed") || (theItem.className == "flipFolderClosed" && newSetting == "open")) {
- if (!theItem.childrenInitialised) {
- for (var j = 0; j < theItem.childNodes.length; j++) if (theItem.childNodes[j].nodeName == "UL" && !theItem.childNodes[j].initialised) initFlip(theItem.childNodes[j]);
- theItem.childrenInitialised = true;
- }
- theItem.getElementsByTagName("UL")[0].style.display = (newSetting == "open") ? "" : "none";
- theItem.className = newSetting == "open" ? "flipFolderOpen" : "flipFolderClosed";
- }
- }
-}
-
-function openFlip(theItem, openParents) {
- openCloseFlip(theItem, "open", openParents);
-}
-
-function closeFlip(theItem, closeParents) {
- openCloseFlip(theItem, "closed", closeParents);
-}
-
-function toggleFlip(theElement) {
- if (theElement.flipID) {
- var theItem = theElement;
- var isContained = true;
- } else {
- if (theElement && theElement.button > 0) return false;
- var theItem = (isIE) ? event.srcElement : theElement.target;
-
- var isContained = false;
- if (theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed") isContained = true; else while (theItem.parentElement || theItem.parentNode) {
- if (theItem.className == "flipStatic" || theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed") {
- isContained = (theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed");
- break;
- }
- theItem = (theItem.parentElement) ? theItem.parentElement : theItem.parentNode;
- }
- }
-
- var toOpenFlip = (isContained && theItem.className == "flipFolderClosed");
-
- if (!flipOpenMultipleMenus && (toOpenFlip || theItem.className == "flipStatic")) {
- if (theItem.parentElement || theItem.parentNode) {
- var parentUL = (theItem.parentElement) ? theItem.parentElement : theItem.parentNode;
- for (var i = 0; i < parentUL.childNodes.length; i++) closeFlip(parentUL.childNodes[i]);
- }
- }
-
- if (isContained) {
- if (toOpenFlip) openFlip(theItem); else closeFlip(theItem);
- }
-}
-
-function setAllFlips(startElement, newSetting) {
- if (typeof startElement == "undefined") var startElement = document;
- if (typeof newSetting == "undefined") var newSetting = "closed";
-
- var aUL = startElement.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) {
- var parentFlip = aUL[i].parentElement ? aUL[i].parentElement : aUL[i].parentNode;
- openCloseFlip(parentFlip, newSetting);
- }
-}
-
-function openAllFlips(startElement) {
- setAllFlips(startElement, "open");
-}
-
-function closeAllFlips(startElement) {
- setAllFlips(startElement, "closed");
-}
-
-function initFlip(startElement) {
- if (!document.createElement) return false;
-
- if (!startElement || !startElement.nodeName) {
- var aUL = document.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) {
- if (flipLoadingMessage != "") window.status = flipLoadingMessage + " " + parseInt((i / (aUL.length - 1)) * 100, 10) + "%";
- var curUL = aUL[i];
- if (curUL.className == "flipMenu") {
- initFlip(curUL);
-
- // ## Fix text selecting problem in Mozilla
- curUL.onselectstart = new Function("return false");
- curUL.onmousedown = new Function("return false");
- curUL.onclick = new Function("return true");
- }
- }
-
- if (flipSaveMenuState) loadMenuState();
-
- if (flipLoadingMessage != "") window.status = "";
- return true;
- }
-
- if (startElement.className == "flipMenu") startElement.style.display = "";
-
- if (!startElement.childNodes || startElement.childNodes.length == 0) return false;
-
- if (typeof flipIDCur == "undefined") flipIDCur = 0;
- if (!startElement.initialised) {
- var aUL = startElement.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) aUL[i].style.display = "none";
- }
-
- for (var i = 0; i < startElement.childNodes.length; i++) {
- var curNode = startElement.childNodes[i];
- if (curNode.nodeName == "LI") {
- flipIDCur++;
- curNode.flipID = flipIDCur;
-
- var nodeHasChildren = curNode.getElementsByTagName("UL").length > 0;
- if (nodeHasChildren) {
- if (flipImages && curNode.flipClosed) curNode.style.listStyleImage = "url(" + curNode.flipClosed + ")";
-
- if (curNode.className == null || curNode.className == "") curNode.className = "flipFolderClosed";
- } else {
- curNode.className = "flipStatic";
- if (flipImages && !curNode.style.listStyleImage) {
- if (!curNode.flipStatic) curNode.flipStatic = flipImg_static;
- curNode.style.listStyleImage = "url(" + curNode.flipStatic + ")";
- }
- }
-
- if (!curNode.flipOpen) curNode.flipOpen = flipImg_open;
- if (!curNode.flipClosed) curNode.flipClosed = flipImg_closed;
-
- if (curNode.flipIsOpen) openFlip(curNode);
- }
- }
-
- startElement.initialised = true;
-}
-
-function rootOfFlip(flipID, startElement) {
-
- function containsFlip(startElement, flipID) {
- var flipFound = false;
- var i = 0;
- while (i < startElement.childNodes.length && !flipFound) {
- var curNode = startElement.childNodes[i];
- flipFound = (curNode.flipID == flipID) ? true : containsFlip(curNode, flipID);
- i++;
- }
- return flipFound;
- }
-
- var rootFlip = null;
-
- if (!startElement || !startElement.nodeName) {
- var aUL = document.getElementsByTagName("UL");
- var i = 0;
- while (rootFlip == null && i < aUL.length) {
- var curUL = aUL[i];
- if (curUL.nodeName == "UL" && curUL.className == "flipMenu") rootFlip = rootOfFlip(flipID, curUL);
- i++;
- }
- return rootFlip;
- }
-
- if (startElement.childNodes) for (var i = 0; i < startElement.childNodes.length; i++) {
- var curNode = startElement.childNodes[i];
- if (curNode.flipID == flipID || containsFlip(curNode, flipID)) rootFlip = curNode;
- }
-
- return rootFlip;
-}
-
-function getCookie(cookieName) {
- var allCookies = document.cookie;
- var indexStr = allCookies.indexOf(cookieName + "=");
- if (indexStr == -1) return "";
- indexStr = allCookies.indexOf("=", indexStr) + 1;
- var endStr = allCookies.indexOf(";", indexStr);
- if (endStr == -1) endStr = allCookies.length;
- return unescape(allCookies.substring(indexStr, endStr));
-}
-
-function inArray(someID, someArray) {
- for (var i = 0; i < someArray.length; i++) if (someArray[i] == someID) return true;
- return false;
-}
-
-function getMenuState(startElement) {
- if (!startElement.childNodes || startElement.childNodes.length == 0) return "";
-
- var openItems = "";
- var aUL = startElement.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) {
- var curNode = aUL[i];
- var parentFlip = (curNode.parentElement) ? curNode.parentElement : curNode.parentNode;
- if (curNode.style.display == "" && parentFlip.flipID) openItems += " " + parentFlip.flipID;
- }
- return openItems;
-}
-
-function putMenuState(startElement) {
- if (!startElement.childNodes || startElement.childNodes.length == 0) return false;
-
- var aUL = startElement.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) {
- var curNode = aUL[i];
- var parentFlip = (curNode.parentElement) ? curNode.parentElement : curNode.parentNode;
- if (inArray(parentFlip.flipID, aOpenItems)) {
- openFlip(parentFlip);
- if (typeof prevFlipRoot == "undefined") {
- var testRoot = rootOfFlip(parentFlip.flipID);
- if (testRoot.flipID == parentFlip.flipID) prevFlipRoot = testRoot;
- }
- }
- }
-}
-
-function saveMenuState() {
- if (flipSaveMenuState) {
- var aUL = document.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) {
- var curUL = aUL[i];
- var curID = curUL.id ? curUL.id : i;
- if (curUL.className == "flipMenu") document.cookie = cookiePrefix + curID + "=" + getMenuState(curUL) + ";";
- }
- }
-}
-
-function loadMenuState() {
- var aUL = document.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) {
- var curUL = aUL[i];
- var curID = curUL.id ? curUL.id : i;
- if (curUL.className == "flipMenu") {
- var savedState = String(getCookie(cookiePrefix + curID));
- if (savedState != "") {
- aOpenItems = savedState.split(" ");
- putMenuState(curUL);
- }
- }
- }
-
- addEvent(window, "unload", saveMenuState);
-}
-
-function clearMenuState(flipMenuID) {
- if (typeof flipMenuID == "undefined") {
- var aUL = document.getElementsByTagName("UL");
- for (var i = 0; i < aUL.length; i++) {
- var curUL = aUL[i];
- var curID = curUL.id ? curUL.id : i;
- if (curUL.className == "flipMenu") document.cookie = cookiePrefix + curID + "=;";
- }
- } else document.cookie = cookiePrefix + flipMenuID + "=;";
-}
-
-cookiePrefix = document.location.pathname + "_";
-
-addEvent(document, "click", toggleFlip);
-if (flipInitOnLoad) addEvent(window, "load", initFlip);
diff --git a/system/doc/top/templates/index.html.src b/system/doc/top/templates/index.html.src
index 935bb11c80..257a656316 100644
--- a/system/doc/top/templates/index.html.src
+++ b/system/doc/top/templates/index.html.src
@@ -2,7 +2,7 @@
<!--
%CopyrightBegin%
-Copyright Ericsson AB 2001-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
@@ -169,7 +169,7 @@ Asked Questions</a>. <p>
<center>
<small>
-Copyright &copy; 1999-2009
+Copyright &copy; 1999-2010
<a href="http://www.ericsson.com">Ericsson AB</a>
</small>
</center>
diff --git a/system/doc/top/templates/otp_top.css b/system/doc/top/templates/otp_top.css
deleted file mode 100644
index 1c6d27bd8d..0000000000
--- a/system/doc/top/templates/otp_top.css
+++ /dev/null
@@ -1,53 +0,0 @@
- BODY { background: white }
-
- BODY { font-family: Verdana, Arial, Helvetica, sans-serif }
- TH { font-family: Verdana, Arial, Helvetica, sans-serif }
- TD { font-family: Verdana, Arial, Helvetica, sans-serif }
- P { font-family: Verdana, Arial, Helvetica, sans-serif }
-
- .header { background: #222; color: #fff }
- .top { background: #efe }
- .otp { background: #efe }
- .erlang { background: #ffe }
- .otp2 { background: #efe }
- .app { background: #ffe }
-
- a:link { color: blue; text-decoration: none }
- a:active { color: blue; text-decoration: none }
- a:visited { color: blue; text-decoration: none }
- body {
- margin: 0;
- padding: 0;
- border: 0;
- overflow: scroll;
- height: 100%;
- max-height: 100%
- }
- #container {
- width: 100%;
- margin: 10px auto;
- background-color: #fff;
- }
- #leftnav {
- float: left;
- width: 200px;
- margin: 0;
- padding: 1em;
- }
- #content {
- margin-left: 220px; /* set left value to WidthOfFrameDiv */
- border-left: 1px solid red;
- }
-
- .innertube {
- margin: 15px; /* Magins for inner DIV inside each DIV (to provide padding) */
- }
-
- * html body{ /* IE6 hack */
- padding: 0 0 0 200px; /* Set value to (0 0 0 WidthOfFrameDiv)*/
- }
- * html #maincontent{ /* IE6 hack*/
- height: 100%;
- width: 100%;
- }
-
diff --git a/system/doc/top/templates/system.html.src b/system/doc/top/templates/system.html.src
deleted file mode 100644
index 761bc96ed0..0000000000
--- a/system/doc/top/templates/system.html.src
+++ /dev/null
@@ -1,281 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <title>Erlang/OTP #release#</title>
- <style type="text/css">
-<!--
- BODY { background: white }
-
- BODY { font-family: Verdana, Arial, Helvetica, sans-serif }
- TH { font-family: Verdana, Arial, Helvetica, sans-serif }
- TD { font-family: Verdana, Arial, Helvetica, sans-serif }
- P { font-family: Verdana, Arial, Helvetica, sans-serif }
-
- .header { background: #222; color: #fff }
- .app { background: #ccc }
-
- a.anum:link { color: green; text-decoration: none }
- a.anum:active { color: green; text-decoration: none }
- a.anum:visited { color: green; text-decoration: none }
-
- a:link { text-decoration: none }
- a:active { text-decoration: none }
- a:visited { text-decoration: none }
--->
- </style>
-</head>
-
-<body bgcolor=white text="#000000" link="#0000ff" vlink="#ff00ff"
- alink="#ff0000">
-<center>
-<table border=0 width="90%" cellspacing=3 cellpadding=5>
-
- <tr>
- <td colspan=2 class=header>
- <font size="+1"><b>General</b></font>
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="system_architecture_intro/part_frame.html" target="_top"
- name=system_architecture_intro>
- Introduction
- </a>
- </td>
- <td align=right valign=top width=50>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-About Erlang, OTP, Erlang/OTP and this documentation
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="installation_guide/part_frame.html" target="_top"
- name=installation_guide>
- Installation Guide
- </a>
- </td>
- <td align=right valign=top width=50>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-The Erlang/OTP Installation Guide
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="system_principles/part_frame.html" target="_top"
- name=system_principles>
- System Principles
- </a>
- </td>
- <td align=right valign=top width=20>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-Starting, stopping and configuring the Erlang runtime system
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="embedded/part_frame.html" target="_top" name=embedded>
- Embedded System
- </a>
- </td>
- <td align=right valign=top width=50>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-Erlang in an Embedded System
- </td>
- </tr>
-
- <tr>
- <td colspan=2><font size=1>&nbsp;</font></td>
- </tr>
-
-<!-- ====================================================================== -->
-
- <tr>
- <td colspan=2 class=header>
- <font size="+1"><b>Programming in Erlang</b></font>
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="reference_manual/part_frame.html" target="_top" name=reference_manual>
- Erlang Reference Manual
- </a>
- </td>
- <td align=right valign=top width=50>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-Description of data types, language constructs and more
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="getting_started/part_frame.html" target="_top" name=getting_started>
- Getting Started
- </a>
- </td>
- <td align=right valign=top width=50>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-Getting started with Erlang
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="programming_examples/part_frame.html" target="_top" name=programming_examples>
- Programming Examples
- </a>
- </td>
- <td align=right valign=top width=50>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-Examples of using records, funs, list comprehensions and the bit syntax
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="efficiency_guide/part_frame.html" target="_top" name=efficiency_guide>Efficiency Guide</a>
- </td>
- <td align=right valign=top width=20>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-Learn how to write efficient programs in Erlang
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="tutorial/part_frame.html" target="_top" name=tutorial>Interoperability Tutorial</a>
- </td>
- <td align=right valign=top width=20>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-About interoperating with programs written in other programming languages
- </td>
- </tr>
-
- <tr>
- <td colspan=2><font size=1>&nbsp;</font></td>
- </tr>
-
-<!-- ====================================================================== -->
-
- <tr>
- <td colspan=2 class=header>
- <font size="+1"><b>Working with OTP</b></font>
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="design_principles/part_frame.html" target="_top"
- name=design_principles>
- Design Principles
- </a>
- </td>
- <td align=right valign=top width=20>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-Structure your programs with applications, supervisors and generic behaviors (gen_server, gen_event and gen_fsm).
-Also use the built in error logger.
- </td>
- </tr>
-
- <tr class=app>
- <td align=left valign=top>
- <table border=0 width="100%" cellspacing=0 cellpadding=0>
- <tr class=app>
- <td align=left valign=top>
- <a href="oam/part_frame.html" target="_top" name=oam>OAM Principles</a>
- </td>
- <td align=right valign=top width=20>
- </td>
- </tr>
- </table>
- </td>
- <td align=left valign=top>
-OTP Operation and Management Principles
- </td>
- </tr>
-
- <tr>
- <td colspan=2><font size=1>&nbsp;</font></td>
- </tr>
-
-</table>
-
-</center>
-</body>
-</html>
-
-
diff --git a/system/doc/top/templates/toc_.html.src b/system/doc/top/templates/toc_.html.src
deleted file mode 100644
index 5e79bc0ac8..0000000000
--- a/system/doc/top/templates/toc_.html.src
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <title>Erlang/OTP #release#</title>
- <style type="text/css">
-<!--
- BODY { background: white }
-
- BODY { font-family: Verdana, Arial, Helvetica, sans-serif }
- TH { font-family: Verdana, Arial, Helvetica, sans-serif }
- TD { font-family: Verdana, Arial, Helvetica, sans-serif }
- P { font-family: Verdana, Arial, Helvetica, sans-serif }
-
- .header { background: #222; color: #fff }
- .top { background: #efe }
- .otp { background: #efe }
- .erlang { background: #ffe }
- .otp2 { background: #efe }
- .app { background: #ffe }
-
- a:link { color: blue; text-decoration: none }
- a:active { color: blue; text-decoration: none }
- a:visited { color: blue; text-decoration: none }
--->
- </style>
-</head>
-
-<body bgcolor=white text="#000000" link="#0000ff" vlink="#ff00ff"
- alink="#ff0000">
-<center>
-<font size="+1"><b>Erlang/OTP #release#</b></font><br>
-</center>
-
-<div class=top>
-<small><a href="glossary.html" target=body>Glossary</a> |
-<a href="man_index.html" target=body>Modules</a> |
-<a href="permuted_index/pidxa.html" target=body>Index</a></small>
-<p>
-<small><a href="highlights.html" target=body>Release highlights</a><br>
-<a href="incompatible.html" target=body>Potential incompatibilities</a>
-</small>
-</div>
-
-<p>
-<div class=otp>
-Erlang/OTP
-<br>
-&middot;<small><a href="installation_guide/part_frame.html" target="_top"
- name=installation_guide>Installation Guide</a></small>
-
-<br>
-&middot;<small><a href="system_principles/part_frame.html" target="_top"
- name=system_principles>System Principles</a></small>
-
-<br>
-&middot;<small><a href="embedded/part_frame.html" target="_top" name=embedded>Embedded System</a></small>
-
-</div>
-
-<p>
-<div class=erlang>
-Erlang Programming
-<br>
-&middot;<small><a href="getting_started/part_frame.html" target="_top" name=getting_started>Getting
-Started</a></small>
-
-<br>
-&middot;<small><a href="reference_manual/part_frame.html" target="_top" name=reference_manual>Erlang
-Reference Manual</a></small>
-
-<br>
-&middot;<small><a href="programming_examples/part_frame.html" target="_top" name=programming_examples>Programming
-Examples</a></small>
-
-<br>
-&middot;<small><a href="efficiency_guide/part_frame.html" target="_top" name=efficiency_guide>Efficiency Guide</a></small>
-
-<br>
-&middot;<small><a href="tutorial/part_frame.html" target="_top" name=tutorial>Interoperability Tutorial</a></small>
-</div>
-
-<p>
-<div class=otp2>
-Working with OTP
-<br>
-&middot;<small><a href="design_principles/part_frame.html" target="_top"
- name=design_principles>Design Principles</a>
-</small>
-
-<br>
-&middot;<small><a href="oam/part_frame.html" target="_top" name=oam>OAM Principles</a></small>
-
-</div>
-
-<p>
-<div class=app>
-Applications
-<small>#applinks#</small>
-</div>
-
-<p>
-<a href="http://www.erlang.se/" target=body>http://www.erlang.se</a>
-
-</body>
-</html>