From 334d63651255887a05c0dacebc370ed4b960dc89 Mon Sep 17 00:00:00 2001 From: Vlad Dumitrescu Date: Fri, 11 Nov 2011 15:24:44 +0100 Subject: Improve error message when creating a too long OtpErlangAtom Also print the value that we tried to use for the atom. This helps a lot when debugging and doesn't affect anything when the length is normal. --- lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java index 4d53447164..60eef7a126 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java @@ -53,7 +53,7 @@ public class OtpErlangAtom extends OtpErlangObject implements Serializable, if (atom.length() > maxAtomLength) { throw new java.lang.IllegalArgumentException("Atom may not exceed " - + maxAtomLength + " characters"); + + maxAtomLength + " characters: " + atom); } this.atom = atom; } -- cgit v1.2.3 From a30445c2a40ebc0e449c7b7605fdc202c48e00d8 Mon Sep 17 00:00:00 2001 From: Vlad Dumitrescu Date: Thu, 20 Oct 2011 14:29:59 +0200 Subject: workaround for Java bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6242664 Java 1.5 has a bug where detecting codepoint offsets in strings that are created by String.substring() gives wrong results. The new implementation uses a different method, avoinding the issue. The following code will crash without the fix: final String s = "abcdefg"; final String ss = s.substring(3, 6); final int[] cps = OtpErlangString.stringToCodePoints(ss); --- .../com/ericsson/otp/erlang/OtpErlangString.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java index 23734bf83b..2d3a5a5d1c 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java @@ -154,13 +154,16 @@ public class OtpErlangString extends OtpErlangObject implements Serializable, * Unicode code points */ - public static int[] stringToCodePoints(final String s) { - final int m = s.codePointCount(0, s.length()); - final int [] codePoints = new int[m]; - for (int i = 0, j = 0; j < m; i = s.offsetByCodePoints(i, 1), j++) { - codePoints[j] = s.codePointAt(i); - } - return codePoints; + public static int[] stringToCodePoints(final String s) { + final int m = s.codePointCount(0, s.length()); + final int[] codePoints = new int[m]; + int j = 0; + for (int offset = 0; offset < s.length();) { + final int codepoint = s.codePointAt(offset); + codePoints[j++] = codepoint; + offset += Character.charCount(codepoint); + } + return codePoints; } /** -- cgit v1.2.3 From e01d6f39b940d917ae445d8428b154de87888000 Mon Sep 17 00:00:00 2001 From: Vlad Dumitrescu Date: Sun, 13 Nov 2011 14:58:06 +0100 Subject: add test for Java string bug --- lib/jinterface/test/nc_SUITE.erl | 7 +++++-- lib/jinterface/test/nc_SUITE_data/echo_server.java | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/jinterface/test/nc_SUITE.erl b/lib/jinterface/test/nc_SUITE.erl index da54f5bf51..9c88400c2a 100644 --- a/lib/jinterface/test/nc_SUITE.erl +++ b/lib/jinterface/test/nc_SUITE.erl @@ -296,7 +296,8 @@ lists_roundtrip_2(Config) when is_list(Config) -> {[z,23|24],tail3}, {[z|25],tail3}, {"abc123",sub3atom}, - {"abc",sub3atom} + {"abc",sub3atom}, + {"abcdefg",codepointBug} ], Trans = fun ([_|T], tail) -> @@ -308,7 +309,9 @@ lists_roundtrip_2(Config) when is_list(Config) -> (L, tail3) when is_list(L) -> null; ([_,_,_|L], sub3atom) -> - list_to_atom(L) + list_to_atom(L); + (L, codepointBug) -> + L end, OutTrans = fun ({L,Twist}) -> diff --git a/lib/jinterface/test/nc_SUITE_data/echo_server.java b/lib/jinterface/test/nc_SUITE_data/echo_server.java index 0550e4beb1..5ecb5b72a7 100644 --- a/lib/jinterface/test/nc_SUITE_data/echo_server.java +++ b/lib/jinterface/test/nc_SUITE_data/echo_server.java @@ -202,6 +202,12 @@ public class echo_server { final OtpErlangAtom o = new OtpErlangAtom(s.stringValue() .substring(3)); return o; + } else if (atomValue.equals("codepointBug") + && i instanceof OtpErlangString) { + final OtpErlangString s = (OtpErlangString) i; + final String ss = s.stringValue().substring(3, 6); + final int[] cps = OtpErlangString.stringToCodePoints(ss); + return s; } else if (atomValue.equals("utf8")) { if (i instanceof OtpErlangString) { final OtpErlangString s = (OtpErlangString) i; -- cgit v1.2.3 From bc330f609b6ff751eefff4113d54f856832c3f30 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Mon, 31 Oct 2011 13:43:16 +0100 Subject: Correct spelling of "registered" in various places in the source code --- lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java | 2 +- lib/ssl/test/ssl_basic_SUITE.erl | 2 +- lib/stdlib/src/gen_fsm.erl | 2 +- lib/stdlib/src/gen_server.erl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java index 71a419497a..de5e5ee65c 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java @@ -141,7 +141,7 @@ public class OtpMbox { * Get the registered name of this mailbox. * * @return the registered name of this mailbox, or null if the mailbox had - * no registerd name. + * no registered name. */ public String getName() { return name; diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index 527263363c..6b107c3401 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -3924,7 +3924,7 @@ renegotiate(Socket, Data) -> end. renegotiate_reuse_session(Socket, Data) -> - %% Make sure session is registerd + %% Make sure session is registered test_server:sleep(?SLEEP), renegotiate(Socket, Data). diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl index 57734a075c..80866c0806 100644 --- a/lib/stdlib/src/gen_fsm.erl +++ b/lib/stdlib/src/gen_fsm.erl @@ -320,7 +320,7 @@ name_to_pid(Name) -> undefined -> case global:whereis_name(Name) of undefined -> - exit(could_not_find_registerd_name); + exit(could_not_find_registered_name); Pid -> Pid end; diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index af07bc988a..f720ec15f5 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -844,7 +844,7 @@ name_to_pid(Name) -> undefined -> case global:whereis_name(Name) of undefined -> - exit(could_not_find_registerd_name); + exit(could_not_find_registered_name); Pid -> Pid end; -- cgit v1.2.3 From ae32e948df219825ff1e9e214c15733017a9fed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Catalinas=20Jim=C3=A9nez?= Date: Sat, 14 Jan 2012 18:26:50 +0100 Subject: Set `font-family: Courier, monospace' in OTP doc CSS This should be much better for everybody, I left Courier as the primary original font and also added monospace as secondary for people like me which in Linux haven't it installed. It should be more pleasant to read typespecs and code examples. Also adds minor cosmetic changes to the CSS. --- lib/erl_docgen/priv/css/otp_doc.css | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/erl_docgen/priv/css/otp_doc.css b/lib/erl_docgen/priv/css/otp_doc.css index 97d8c2df74..c56de378f4 100644 --- a/lib/erl_docgen/priv/css/otp_doc.css +++ b/lib/erl_docgen/priv/css/otp_doc.css @@ -1,6 +1,5 @@ - - -body { +/* standard OTP style sheet */ +body { background: white; font-family: Verdana, Arial, Helvetica, sans-serif; margin: 0; @@ -11,7 +10,6 @@ body { max-height: 100%; } - th { font-family: Verdana, Arial, Helvetica, sans-serif } td { font-family: Verdana, Arial, Helvetica, sans-serif } p { font-family: Verdana, Arial, Helvetica, sans-serif } @@ -33,8 +31,7 @@ a:visited { color: blue; text-decoration: none } background-color: #fff; } - -#leftnav { +#leftnav { position: fixed; float: left; top: 0; @@ -47,8 +44,7 @@ a:visited { color: blue; text-decoration: none } border-right: 1px solid red; } - -#content { +#content { margin-left: 240px; /* set left value to WidthOfFrameDiv */ } @@ -57,7 +53,6 @@ a:visited { color: blue; text-decoration: none } padding-top: 50px; /* Magins for inner DIV inside each DIV (to provide padding) */ } - .innertube { margin: 15px; /* Magins for inner DIV inside each DIV (to provide padding) */ @@ -66,16 +61,15 @@ a:visited { color: blue; text-decoration: none } .footer { margin: 15px; /* Magins for inner DIV inside each DIV (to provide padding) */ - } -span.bold_code { font-family: courier;font-weight: bold} -span.code { font-family: courier;font-weight: normal} + +span.bold_code { font-family: Courier, monospace; font-weight: bold } +span.code { font-family: Courier, monospace; font-weight: normal } .note, .warning { border: solid black 1px; margin: 1em 3em; } - .note .label { background: #30d42a; color: white; @@ -102,16 +96,15 @@ span.code { font-family: courier;font-weight: normal} font-size: 90%; padding: 5px 10px; } - -.example { +.example { background-color:#eeeeff; padding: 0px 10px; -} +} -pre { font-family: courier; font-weight: normal } +pre { font-family: Courier, monospace; font-weight: normal } .REFBODY { margin-left: 13mm } .REFTYPES { margin-left: 8mm } -footer { } +footer { } -- cgit v1.2.3 From 62ca2e3374ed5dd004ad9f905a35bdbabab6a6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Catalinas=20Jim=C3=A9nez?= Date: Sat, 4 Feb 2012 15:04:04 +0100 Subject: Fix typo in `compile' doc: unmatched parenthesis --- lib/compiler/doc/src/compile.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index 522c1dc411..0f8abf1ccf 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -333,7 +333,7 @@ module.beam: module.erl \ {d,Macro,Value}

Defines a macro Macro to have the value - Value. The default is true).

+ Value. The default is true.

{parse_transform,Module} -- cgit v1.2.3 From b9f1047d366e255459b339f20f7ce408313b3186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Catalinas=20Jim=C3=A9nez?= Date: Sun, 5 Feb 2012 01:13:27 +0100 Subject: Fix the type spec from the doc of binary:part/3 As the doc explains, the Len of part() can be negative. --- lib/stdlib/doc/src/binary.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/stdlib/doc/src/binary.xml b/lib/stdlib/doc/src/binary.xml index 88ce77e0d0..7ce2defb72 100644 --- a/lib/stdlib/doc/src/binary.xml +++ b/lib/stdlib/doc/src/binary.xml @@ -505,7 +505,7 @@ Subject = binary() Pos = integer() >= 0 - Len = integer() >= 0 + Len = integer()

The same as part(Subject, {Pos, Len}).

-- cgit v1.2.3 From 62004e925dc5a5f043d8a7017a27b044c29b9ece Mon Sep 17 00:00:00 2001 From: Henrik Nord Date: Mon, 13 Feb 2012 11:20:20 +0100 Subject: Make dialyzer recognize the process_flag option sensitive add missing specs to documentation --- lib/hipe/cerl/erl_bif_types.erl | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 825d79bb3c..845df0ca61 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -1195,11 +1195,13 @@ type(erlang, process_flag, 2, Xs) -> case t_atom_vals(Flag) of ['error_handler'] -> t_atom(); ['min_heap_size'] -> t_non_neg_integer(); + ['min_bin_vheap_size'] -> t_non_neg_integer(); ['scheduler'] -> t_non_neg_integer(); ['monitor_nodes'] -> t_boolean(); ['priority'] -> t_process_priority_level(); ['save_calls'] -> t_non_neg_integer(); ['trap_exit'] -> t_boolean(); + ['sensitive'] -> t_boolean(); List when is_list(List) -> T_process_flag_returns; unknown -> @@ -1496,6 +1498,8 @@ type(erlang, system_flag, 2, Xs) -> t_non_neg_fixnum(); ['min_heap_size'] -> t_non_neg_fixnum(); + ['min_bin_vheap_size'] -> + t_non_neg_fixnum(); ['multi_scheduling'] -> t_system_multi_scheduling(); ['schedulers_online'] -> @@ -1539,8 +1543,12 @@ type(erlang, system_info, 1, Xs) -> t_list(t_tuple([t_atom(), t_list(t_tuple([t_atom(), t_any()]))]))]); + ['build_type'] -> + t_system_build_type_return(); ['break_ignored'] -> t_boolean(); + ['c_compiler_used'] -> + t_tuple([t_atom(), t_any()]); ['cpu_topology'] -> t_system_cpu_topology(); ['compat_rel'] -> @@ -1553,6 +1561,8 @@ type(erlang, system_info, 1, Xs) -> t_binary(); ['dist_ctrl'] -> t_list(t_tuple([t_atom(), t_sup([t_pid(), t_port])])); + ['driver_version'] -> + t_string(); %% elib_malloc is intentionally not included, %% because it scheduled for removal in R15. ['endian'] -> @@ -1566,7 +1576,9 @@ type(erlang, system_info, 1, Xs) -> ['heap_sizes'] -> t_list(t_integer()); ['heap_type'] -> - t_sup([t_atom('private'), t_atom('hybrid')]); + t_sup([t_atom('private'), + t_atom('shared'), + t_atom('hybrid')]); ['hipe_architecture'] -> t_atoms(['amd64', 'arm', 'powerpc', 'ppc64', 'undefined', 'ultrasparc', 'x86']); @@ -1574,12 +1586,20 @@ type(erlang, system_info, 1, Xs) -> t_binary(); ['internal_cpu_topology'] -> %% Undocumented internal feature t_internal_cpu_topology(); + ['kernel_poll'] -> + t_boolean(); ['loaded'] -> t_binary(); ['logical_processors'] -> t_non_neg_fixnum(); ['machine'] -> t_string(); + ['min_heap_size'] -> + t_tuple([t_atom('min_heap_size'), + t_non_neg_integer()]); + ['min_bin_vheap_size'] -> + t_tuple([t_atom('min_bin_vheap_size'), + t_non_neg_integer()]); ['multi_scheduling'] -> t_system_multi_scheduling(); ['multi_scheduling_blockers'] -> @@ -1594,6 +1614,8 @@ type(erlang, system_info, 1, Xs) -> t_non_neg_fixnum(), t_non_neg_fixnum()]), t_string()); + ['otp_release'] -> + t_string(); ['process_count'] -> t_non_neg_fixnum(); ['process_limit'] -> @@ -1623,6 +1645,8 @@ type(erlang, system_info, 1, Xs) -> t_non_neg_fixnum(); ['trace_control_word'] -> t_integer(); + ['update_cpu_info'] -> + t_sup([t_atom('changed'), t_atom('unchanged')]); ['version'] -> t_string(); ['wordsize'] -> @@ -3738,8 +3762,13 @@ arg_types(erlang, pre_loaded, 0) -> arg_types(erlang, process_display, 2) -> [t_pid(), t_atom('backtrace')]; arg_types(erlang, process_flag, 2) -> - [t_sup([t_atom('trap_exit'), t_atom('error_handler'), - t_atom('min_heap_size'), t_atom('priority'), t_atom('save_calls'), + [t_sup([t_atom('trap_exit'), + t_atom('error_handler'), + t_atom('min_heap_size'), + t_atom('min_bin_vheap_size'), + t_atom('priority'), + t_atom('save_calls'), + t_atom('sensitive'), t_atom('scheduler'), % undocumented t_atom('monitor_nodes'), % undocumented t_tuple([t_atom('monitor_nodes'), t_list()])]), % undocumented @@ -3852,6 +3881,7 @@ arg_types(erlang, system_flag, 2) -> t_atom('display_items'), % undocumented t_atom('fullsweep_after'), t_atom('min_heap_size'), + t_atom('min_bin_vheap_size'), t_atom('multi_scheduling'), t_atom('schedulers_online'), t_atom('scheduler_bind_type'), @@ -4724,6 +4754,7 @@ t_spawn_options() -> t_atom('monitor'), t_tuple([t_atom('priority'), t_process_priority_level()]), t_tuple([t_atom('min_heap_size'), t_fixnum()]), + t_tuple([t_atom('min_bin_vheap_size'), t_fixnum()]), t_tuple([t_atom('fullsweep_after'), t_fixnum()])]). t_spawn_opt_return(List) -> @@ -4812,6 +4843,17 @@ t_system_profile_return() -> t_sup(t_atom('undefined'), t_tuple([t_sup(t_pid(), t_port()), t_system_profile_options()])). +t_system_build_type_return() -> + t_sup([t_atom('opt'), + t_atom('debug'), + t_atom('purify'), + t_atom('quantify'), + t_atom('purecov'), + t_atom('gcov'), + t_atom('valgrind'), + t_atom('gprof'), + t_atom('lcnt')]). + %% ===================================================================== %% These are used for the built-in functions of 'ets' %% ===================================================================== -- cgit v1.2.3