aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/doc/src/erl.xml20
-rw-r--r--erts/doc/src/erlang.xml8
-rw-r--r--erts/doc/src/notes.xml2
-rw-r--r--erts/emulator/beam/big.c9
-rw-r--r--erts/emulator/beam/big.h4
-rw-r--r--erts/emulator/beam/erl_db_util.c4
-rw-r--r--erts/emulator/beam/erl_gc.c2
-rw-r--r--erts/emulator/beam/erl_init.c4
-rw-r--r--erts/emulator/beam/erl_port_task.c5
-rw-r--r--erts/emulator/beam/erl_process.c19
-rw-r--r--erts/emulator/beam/erl_process.h1
-rw-r--r--erts/emulator/beam/erl_term.h3
-rw-r--r--erts/emulator/beam/erl_vm.h3
-rwxr-xr-xerts/emulator/beam/global.h14
-rw-r--r--erts/emulator/beam/utils.c21
-rw-r--r--erts/emulator/drivers/common/inet_drv.c23
-rw-r--r--erts/emulator/test/match_spec_SUITE.erl9
-rw-r--r--erts/etc/unix/cerl.src7
-rw-r--r--erts/test/z_SUITE.erl4
-rw-r--r--lib/common_test/doc/src/run_test_chapter.xml2
-rw-r--r--lib/compiler/src/beam_except.erl10
-rw-r--r--lib/compiler/test/beam_except_SUITE.erl10
-rw-r--r--lib/crypto/doc/src/crypto.xml24
-rw-r--r--lib/crypto/src/Makefile7
-rw-r--r--lib/crypto/src/crypto.app.src14
-rw-r--r--lib/crypto/src/crypto_app.erl39
-rw-r--r--lib/crypto/src/crypto_server.erl68
-rw-r--r--lib/crypto/src/crypto_sup.erl39
-rw-r--r--lib/debugger/priv/erlang_bug.pngbin2632 -> 4723 bytes
-rwxr-xr-xlib/diameter/bin/diameterc4
-rw-r--r--lib/diameter/doc/src/diameter_make.xml18
-rw-r--r--lib/diameter/doc/src/diameter_sctp.xml36
-rw-r--r--lib/diameter/doc/src/seealso.ent3
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl10
-rw-r--r--lib/diameter/src/base/diameter_service.erl5
-rw-r--r--lib/diameter/src/base/diameter_stats.erl5
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl14
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl21
-rw-r--r--lib/diameter/src/compiler/diameter_dict_util.erl37
-rw-r--r--lib/diameter/src/compiler/diameter_make.erl14
-rw-r--r--lib/diameter/src/diameter.appup.src83
-rw-r--r--lib/diameter/src/transport/diameter_sctp.erl27
-rw-r--r--lib/diameter/test/diameter_compiler_SUITE.erl9
-rw-r--r--lib/diameter/vsn.mk4
-rw-r--r--lib/erl_interface/src/connect/ei_connect.c1
-rw-r--r--lib/inets/doc/src/notes.xml18
-rw-r--r--lib/kernel/test/sendfile_SUITE.erl20
-rw-r--r--lib/observer/priv/erlang_observer.pngbin2679 -> 3698 bytes
-rw-r--r--lib/odbc/doc/src/notes.xml18
-rw-r--r--lib/odbc/vsn.mk2
-rw-r--r--lib/ssh/doc/src/ssh.xml2
-rw-r--r--lib/ssl/doc/src/notes.xml36
-rw-r--r--lib/ssl/doc/src/ssl.xml4
-rw-r--r--lib/ssl/src/ssl.erl8
-rw-r--r--lib/ssl/src/ssl_handshake.erl10
-rw-r--r--lib/ssl/src/ssl_internal.hrl5
-rw-r--r--lib/ssl/test/ssl_basic_SUITE.erl50
-rw-r--r--lib/syntax_tools/doc/src/notes.xml32
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl6
-rw-r--r--lib/syntax_tools/vsn.mk2
-rw-r--r--lib/wx/api_gen/gen_util.erl10
-rw-r--r--lib/wx/api_gen/wx_gen_cpp.erl14
-rw-r--r--lib/wx/api_gen/wxapi.conf4
-rw-r--r--lib/wx/c_src/Makefile.in7
-rw-r--r--lib/wx/c_src/gen/wxe_events.cpp10
-rw-r--r--lib/wx/c_src/gen/wxe_funcs.cpp13
-rw-r--r--lib/wx/c_src/wxe_callback_impl.cpp (renamed from lib/wx/c_src/wxePrintout.cpp)71
-rw-r--r--lib/wx/c_src/wxe_callback_impl.h75
-rw-r--r--lib/wx/c_src/wxe_driver.c4
-rw-r--r--lib/wx/c_src/wxe_driver.h3
-rw-r--r--lib/wx/c_src/wxe_events.h14
-rw-r--r--lib/wx/c_src/wxe_gl.cpp17
-rw-r--r--lib/wx/c_src/wxe_gl.h25
-rw-r--r--lib/wx/c_src/wxe_helpers.cpp95
-rw-r--r--lib/wx/c_src/wxe_helpers.h122
-rw-r--r--lib/wx/c_src/wxe_impl.cpp461
-rw-r--r--lib/wx/c_src/wxe_impl.h218
-rw-r--r--lib/wx/c_src/wxe_main.cpp163
-rw-r--r--lib/wx/c_src/wxe_memory.h61
-rw-r--r--lib/wx/doc/src/notes.xml16
-rw-r--r--lib/wx/include/wx.hrl10
-rw-r--r--lib/wx/priv/erlang-logo128.pngbin0 -> 6268 bytes
-rw-r--r--lib/wx/priv/erlang-logo32.pngbin1608 -> 1291 bytes
-rw-r--r--lib/wx/priv/erlang-logo64.pngbin4149 -> 2647 bytes
-rw-r--r--lib/wx/src/gen/wxInitDialogEvent.erl64
-rw-r--r--lib/wx/test/wx_basic_SUITE.erl16
-rw-r--r--lib/wx/test/wx_event_SUITE.erl40
-rw-r--r--lib/wx/vsn.mk2
-rw-r--r--lib/xmerl/doc/src/notes.xml29
-rw-r--r--system/doc/design_principles/spec_proc.xml2
-rw-r--r--system/doc/getting_started/seq_prog.xml4
91 files changed, 1404 insertions, 1045 deletions
diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml
index 2aa247e293..e737727941 100644
--- a/erts/doc/src/erl.xml
+++ b/erts/doc/src/erl.xml
@@ -1153,18 +1153,18 @@
<tag><marker id="+spp"><c>+spp Bool</c></marker></tag>
<item>
<p>Set default scheduler hint for port parallelism. If set to
- <c>true</c>, the VM will schedule port tasks when it by this can
- improve the parallelism in the system. If set to <c>false</c>,
- the VM will try to perform port tasks immediately and by this
- improve latency at the expense of parallelism. If this
- flag has not been passed, the default scheduler hint for port
- parallelism is currently <c>false</c>. The default used can be
- inspected in runtime by calling
- <seealso marker="erlang#system_info_port_parallelism">erlang:system_info(port_parallelism)</seealso>.
+ <c>true</c>, the VM will schedule port tasks when doing so will
+ improve parallelism in the system. If set to <c>false</c>, the VM
+ will try to perform port tasks immediately, improving latency at the
+ expense of parallelism. If this flag has not been passed, the
+ default scheduler hint for port parallelism is currently
+ <c>false</c>. The default used can be inspected in runtime by
+ calling <seealso
+ marker="erlang#system_info_port_parallelism">erlang:system_info(port_parallelism)</seealso>.
The default can be overriden on port creation by passing the
<seealso marker="erlang#open_port_parallelism">parallelism</seealso>
- option to
- <seealso marker="erlang#open_port/2">open_port/2</seealso></p>.
+ option to <seealso
+ marker="erlang#open_port/2">open_port/2</seealso></p>.
</item>
<tag><marker id="sched_thread_stack_size"><c><![CDATA[+sss size]]></c></marker></tag>
<item>
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 124302a2cb..ea753cfaaf 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -3011,11 +3011,11 @@ os_prompt% </pre>
<tag><marker id="open_port_parallelism"><c>{parallelism, Boolean}</c></marker></tag>
<item>
<p>Set scheduler hint for port parallelism. If set to <c>true</c>,
- the VM will schedule port tasks when it by this can improve the
+ the VM will schedule port tasks when doing so will improve
parallelism in the system. If set to <c>false</c>, the VM will
- try to perform port tasks immediately and by this improving the
- latency at the expense of parallelism. The default can be set on
- system startup by passing the
+ try to perform port tasks immediately, improving latency at the
+ expense of parallelism. The default can be set on system startup
+ by passing the
<seealso marker="erl#+spp">+spp</seealso> command line argument
to <seealso marker="erl">erl(1)</seealso>.
</p>
diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml
index 8c008c493e..b4ebef72f4 100644
--- a/erts/doc/src/notes.xml
+++ b/erts/doc/src/notes.xml
@@ -257,7 +257,7 @@
processes before the BIF returns, or fail with an
exception due to the port not being open. </p><p> The
synchronous port BIFs are: </p> <list> <item><seealso
- marker="erlang#port_close/1/"><c>port_close/1</c></seealso></item>
+ marker="erlang#port_close/1"><c>port_close/1</c></seealso></item>
<item><seealso
marker="erlang#port_command/2"><c>port_command/2</c></seealso></item>
<item><seealso
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c
index 2b27b111d8..41a041eba6 100644
--- a/erts/emulator/beam/big.c
+++ b/erts/emulator/beam/big.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2014. 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
@@ -1603,9 +1603,11 @@ big_to_double(Wterm x, double* resp)
/*
* Logic has been copied from erl_bif_guard.c and slightly
* modified to use a static instead of dynamic heap
+ *
+ * HALFWORD: Return relative term with 'heap' as base.
*/
Eterm
-double_to_big(double x, Eterm *heap)
+double_to_big(double x, Eterm *heap, Uint hsz)
{
int is_negative;
int ds;
@@ -1633,9 +1635,10 @@ double_to_big(double x, Eterm *heap)
sz = BIG_NEED_SIZE(ds); /* number of words including arity */
hp = heap;
- res = make_big(hp);
+ res = make_big_rel(hp, heap);
xp = (ErtsDigit*) (hp + 1);
+ ASSERT(ds < hsz);
for (i = ds - 1; i >= 0; i--) {
ErtsDigit d;
diff --git a/erts/emulator/beam/big.h b/erts/emulator/beam/big.h
index 1a7b14170f..d80111822e 100644
--- a/erts/emulator/beam/big.h
+++ b/erts/emulator/beam/big.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2014. 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
@@ -141,7 +141,7 @@ Eterm big_lshift(Eterm, Sint, Eterm*);
int big_comp (Wterm, Wterm);
int big_ucomp (Eterm, Eterm);
int big_to_double(Wterm x, double* resp);
-Eterm double_to_big(double, Eterm*);
+Eterm double_to_big(double, Eterm*, Uint hsz);
Eterm small_to_big(Sint, Eterm*);
Eterm uint_to_big(Uint, Eterm*);
Eterm uword_to_big(UWord, Eterm*);
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index ef3749a2c4..a358ecf326 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1998-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1998-2014. 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
@@ -1838,7 +1838,7 @@ restart:
ep = termp;
break;
case matchArrayBind: /* When the array size is unknown. */
- ASSERT(termp);
+ ASSERT(termp || arity==0);
n = *pc++;
variables[n].term = dpm_array_to_list(psp, termp, arity);
break;
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index 8ff6f9a3b9..ab8448e8a1 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -1157,7 +1157,7 @@ do_minor(Process *p, Uint new_sz, Eterm* objv, int nobj)
old_htop = sweep_one_area(OLD_HTOP(p), old_htop, heap, heap_size);
}
OLD_HTOP(p) = old_htop;
- HIGH_WATER(p) = (HEAP_START(p) != HIGH_WATER(p)) ? n_heap : n_htop;
+ HIGH_WATER(p) = n_htop;
if (MSO(p).first) {
sweep_off_heap(p, 0);
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index 1d4f617746..19088fd913 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -1439,8 +1439,10 @@ erl_start(int argc, char **argv)
}
else if (has_prefix("cl", sub_param)) {
arg = get_arg(sub_param+2, argv[i+1], &i);
- if (sys_strcmp("true", arg) == 0)
+ if (sys_strcmp("true", arg) == 0) {
erts_sched_compact_load = 1;
+ erts_sched_balance_util = 0;
+ }
else if (sys_strcmp("false", arg) == 0)
erts_sched_compact_load = 0;
else {
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 547a42beb2..d4108067d0 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -877,6 +877,11 @@ enqueue_port(ErtsRunQueue *runq, Port *pp)
ASSERT(runq->ports.start && runq->ports.end);
erts_smp_inc_runq_len(runq, &runq->ports.info, ERTS_PORT_PRIO_LEVEL);
+
+#ifdef ERTS_SMP
+ if (runq->halt_in_progress)
+ erts_non_empty_runq(runq);
+#endif
}
static ERTS_INLINE Port *
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 2f383f4c01..74cd84a998 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -7603,19 +7603,13 @@ Process *schedule(Process *p, int calls)
#ifdef ERTS_SMP
ErtsMigrationPaths *mps;
ErtsMigrationPath *mp;
-
-#ifdef ERTS_SMP
- {
- ErtsProcList *pnd_xtrs = rq->procs.pending_exiters;
- if (erts_proclist_fetch(&pnd_xtrs, NULL)) {
- rq->procs.pending_exiters = NULL;
- erts_smp_runq_unlock(rq);
- handle_pending_exiters(pnd_xtrs);
- erts_smp_runq_lock(rq);
- }
-
+ ErtsProcList *pnd_xtrs = rq->procs.pending_exiters;
+ if (erts_proclist_fetch(&pnd_xtrs, NULL)) {
+ rq->procs.pending_exiters = NULL;
+ erts_smp_runq_unlock(rq);
+ handle_pending_exiters(pnd_xtrs);
+ erts_smp_runq_lock(rq);
}
-#endif
if (rq->check_balance_reds <= 0)
check_balance(rq);
@@ -7702,6 +7696,7 @@ Process *schedule(Process *p, int calls)
flags = ERTS_RUNQ_FLGS_GET_NOB(rq);
if (flags & ERTS_RUNQ_FLG_SUSPENDED) {
non_empty_runq(rq);
+ flags |= ERTS_RUNQ_FLG_NONEMPTY;
goto continue_check_activities_to_run_known_flags;
}
}
diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h
index 6155f99b85..24832d59b5 100644
--- a/erts/emulator/beam/erl_process.h
+++ b/erts/emulator/beam/erl_process.h
@@ -542,7 +542,6 @@ struct ErtsSchedulerData_ {
Eterm tmp_heap[TMP_HEAP_SIZE];
int num_tmp_heap_used;
Eterm beam_emu_tmp_heap[BEAM_EMU_TMP_HEAP_SIZE];
- Eterm cmp_tmp_heap[CMP_TMP_HEAP_SIZE];
Eterm erl_arith_tmp_heap[ERL_ARITH_TMP_HEAP_SIZE];
#endif
ErtsSchedulerSleepInfo *ssi;
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h
index 953edf79ea..50d3e63c58 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2000-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2000-2014. 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
@@ -1126,6 +1126,7 @@ extern unsigned tag_val_def(Wterm);
#define make_tuple_rel make_boxed_rel
#define make_external_rel make_boxed_rel
#define make_internal_ref_rel make_boxed_rel
+#define make_big_rel make_boxed_rel
#define binary_val_rel(RTERM, BASE) binary_val(rterm2wterm(RTERM, BASE))
#define list_val_rel(RTERM, BASE) list_val(rterm2wterm(RTERM, BASE))
diff --git a/erts/emulator/beam/erl_vm.h b/erts/emulator/beam/erl_vm.h
index 337422eead..b7de8208ad 100644
--- a/erts/emulator/beam/erl_vm.h
+++ b/erts/emulator/beam/erl_vm.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2014. 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
@@ -46,7 +46,6 @@
heap data on the C stack or if we use the buffers in the scheduler data. */
#define TMP_HEAP_SIZE 128 /* Number of Eterm in the schedulers
small heap for transient heap data */
-#define CMP_TMP_HEAP_SIZE 32 /* cmp wants its own tmp-heap... */
#define ERL_ARITH_TMP_HEAP_SIZE 4 /* as does erl_arith... */
#define BEAM_EMU_TMP_HEAP_SIZE 2 /* and beam_emu... */
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index c183c519ff..83a8911a36 100755
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -371,9 +371,9 @@ extern int stackdump_on_exit;
*/
typedef struct {
- UWord* start;
- UWord* sp;
- UWord* end;
+ Eterm* start;
+ Eterm* sp;
+ Eterm* end;
ErtsAlcType_t alloc_type;
}ErtsEStack;
@@ -384,7 +384,7 @@ void erl_grow_estack(ErtsEStack*, Eterm* def_stack);
#define ESTK_DEF_STACK(s) ESTK_CONCAT(s,_default_estack)
#define DECLARE_ESTACK(s) \
- UWord ESTK_DEF_STACK(s)[DEF_ESTACK_SIZE]; \
+ Eterm ESTK_DEF_STACK(s)[DEF_ESTACK_SIZE]; \
ErtsEStack s = { \
ESTK_DEF_STACK(s), /* start */ \
ESTK_DEF_STACK(s), /* sp */ \
@@ -418,8 +418,8 @@ do {\
if (s.start == ESTK_DEF_STACK(s)) {\
UWord _wsz = ESTACK_COUNT(s);\
(dst)->start = erts_alloc(s.alloc_type,\
- DEF_ESTACK_SIZE * sizeof(UWord));\
- memcpy((dst)->start, s.start,_wsz*sizeof(UWord));\
+ DEF_ESTACK_SIZE * sizeof(Eterm));\
+ memcpy((dst)->start, s.start,_wsz*sizeof(Eterm));\
(dst)->sp = (dst)->start + _wsz;\
(dst)->end = (dst)->start + DEF_ESTACK_SIZE;\
(dst)->alloc_type = s.alloc_type;\
@@ -495,7 +495,7 @@ typedef struct {
#define DEF_WSTACK_SIZE (16)
-void erl_grow_wstack(ErtsWStack*, Eterm* def_stack);
+void erl_grow_wstack(ErtsWStack*, UWord* def_stack);
#define WSTK_CONCAT(a,b) a##b
#define WSTK_DEF_STACK(s) WSTK_CONCAT(s,_default_wstack)
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 7f8bdcb2ca..e0776cf67d 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -2688,11 +2688,6 @@ tailrecur_ne:
{
FloatDef f1, f2;
Eterm big;
-#if HEAP_ON_C_STACK
- Eterm big_buf[CMP_TMP_HEAP_SIZE]; /* If HEAP_ON_C_STACK */
-#else
- Eterm *big_buf = erts_get_scheduler_data()->cmp_tmp_heap;
-#endif
#if HALFWORD_HEAP
Wterm aw = is_immed(a) ? a : rterm2wterm(a,a_base);
Wterm bw = is_immed(b) ? b : rterm2wterm(b,b_base);
@@ -2703,6 +2698,8 @@ tailrecur_ne:
#define MAX_LOSSLESS_FLOAT ((double)((1LL << 53) - 2))
#define MIN_LOSSLESS_FLOAT ((double)(((1LL << 53) - 2)*-1))
#define BIG_ARITY_FLOAT_MAX (1024 / D_EXP) /* arity of max float as a bignum */
+ Eterm big_buf[BIG_NEED_SIZE(BIG_ARITY_FLOAT_MAX)];
+
b_tag = tag_val_def(bw);
switch(_NUMBER_CODE(a_tag, b_tag)) {
@@ -2718,8 +2715,9 @@ tailrecur_ne:
/* Float is within the no loss limit */
f1.fd = signed_val(aw);
j = float_comp(f1.fd, f2.fd);
+ }
#if ERTS_SIZEOF_ETERM == 8
- } else if (f2.fd > (double) (MAX_SMALL + 1)) {
+ else if (f2.fd > (double) (MAX_SMALL + 1)) {
/* Float is a positive bignum, i.e. bigger */
j = -1;
} else if (f2.fd < (double) (MIN_SMALL - 1)) {
@@ -2730,7 +2728,7 @@ tailrecur_ne:
j = signed_val(aw) - (Sint) f2.fd;
}
#else
- } else {
+ else {
/* If float is positive it is bigger than small */
j = (f2.fd > 0.0) ? -1 : 1;
}
@@ -2764,8 +2762,8 @@ tailrecur_ne:
j = float_comp(f1.fd, f2.fd);
}
} else {
- big = double_to_big(f2.fd, big_buf);
- j = big_comp(aw, big);
+ big = double_to_big(f2.fd, big_buf, sizeof(big_buf)/sizeof(Eterm));
+ j = big_comp(aw, rterm2wterm(big,big_buf));
}
if (_NUMBER_CODE(a_tag, b_tag) == FLOAT_BIG) {
j = -j;
@@ -2777,8 +2775,9 @@ tailrecur_ne:
/* Float is within the no loss limit */
f2.fd = signed_val(bw);
j = float_comp(f1.fd, f2.fd);
+ }
#if ERTS_SIZEOF_ETERM == 8
- } else if (f1.fd > (double) (MAX_SMALL + 1)) {
+ else if (f1.fd > (double) (MAX_SMALL + 1)) {
/* Float is a positive bignum, i.e. bigger */
j = 1;
} else if (f1.fd < (double) (MIN_SMALL - 1)) {
@@ -2789,7 +2788,7 @@ tailrecur_ne:
j = (Sint) f1.fd - signed_val(bw);
}
#else
- } else {
+ else {
/* If float is positive it is bigger than small */
j = (f1.fd > 0.0) ? 1 : -1;
}
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 80937dfcc8..4a861b121c 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -854,9 +854,10 @@ static int my_strncasecmp(const char *s1, const char *s2, size_t n)
#define INET_IFNAMSIZ 16
/* INET Ignore states */
-#define INET_IGNORE_NONE 0
-#define INET_IGNORE_READ 1
-#define INET_IGNORE_WRITE 1 << 1
+#define INET_IGNORE_NONE 0
+#define INET_IGNORE_READ (1 << 0)
+#define INET_IGNORE_WRITE (1 << 1)
+#define INET_IGNORE_PASSIVE (1 << 2)
/* Max length of Erlang Term Buffer (for outputting structured terms): */
#ifdef HAVE_SCTP
@@ -8307,11 +8308,19 @@ static ErlDrvSSizeT inet_ctl(inet_descriptor* desc, int cmd, char* buf,
if (*buf == 1 && !desc->is_ignored) {
sock_select(desc, (FD_READ|FD_WRITE|FD_CLOSE|ERL_DRV_USE_NO_CALLBACK), 0);
- desc->is_ignored = INET_IGNORE_READ;
+ if (desc->active)
+ desc->is_ignored = INET_IGNORE_READ;
+ else
+ desc->is_ignored = INET_IGNORE_PASSIVE;
} else if (*buf == 0 && desc->is_ignored) {
- int flags = (FD_READ|FD_CLOSE|((desc->is_ignored & INET_IGNORE_WRITE)?FD_WRITE:0));
+ int flags = FD_CLOSE;
+ if (desc->is_ignored & INET_IGNORE_READ)
+ flags |= FD_READ;
+ if (desc->is_ignored & INET_IGNORE_WRITE)
+ flags |= FD_WRITE;
desc->is_ignored = INET_IGNORE_NONE;
- sock_select(desc, flags, 1);
+ if (flags != FD_CLOSE)
+ sock_select(desc, flags, 1);
} else
return ctl_error(EINVAL, rbuf, rsize);
@@ -8988,6 +8997,8 @@ static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd,
driver_set_timer(desc->inet.port, timeout);
if (!INETP(desc)->is_ignored)
sock_select(INETP(desc),(FD_READ|FD_CLOSE),1);
+ else
+ INETP(desc)->is_ignored |= INET_IGNORE_READ;
}
}
return ctl_reply(INET_REP_OK, tbuf, 2, rbuf, rsize);
diff --git a/erts/emulator/test/match_spec_SUITE.erl b/erts/emulator/test/match_spec_SUITE.erl
index bcc46d78ba..330bef7104 100644
--- a/erts/emulator/test/match_spec_SUITE.erl
+++ b/erts/emulator/test/match_spec_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2014. 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
@@ -25,6 +25,7 @@
trace_control_word/1, silent/1, silent_no_ms/1, silent_test/1,
ms_trace2/1, ms_trace3/1, boxed_and_small/1,
destructive_in_test_bif/1, guard_exceptions/1,
+ empty_list/1,
unary_plus/1, unary_minus/1, moving_labels/1]).
-export([fpe/1]).
-export([otp_9422/1]).
@@ -60,6 +61,7 @@ all() ->
guard_exceptions, unary_plus, unary_minus, fpe,
moving_labels,
faulty_seq_trace,
+ empty_list,
otp_9422];
true -> [not_run]
end.
@@ -897,6 +899,11 @@ fpe(Config) when is_list(Config) ->
_ -> ok
end.
+empty_list(Config) when is_list(Config) ->
+ Val=[{'$1',[], [{message,'$1'},{message,{caller}},{return_trace}]}],
+ %% Did crash debug VM in faulty assert:
+ erlang:match_spec_test([],Val,trace).
+
moving_labels(Config) when is_list(Config) ->
%% Force an andalso/orelse construction to be moved by placing it
%% in a tuple followed by a constant term. Labels should still
diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index be8343e87e..78fefbea55 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -86,6 +86,7 @@ run_valgrind=no
# Default rootdir
ROOTDIR=%SRC_ROOTDIR%
BINDIR="$ROOTDIR/bin/`$ROOTDIR/erts/autoconf/config.guess`"
+TARGET=%TARGET%
#BINDIR="$ROOTDIR/bin/%TARGET%"
PROGNAME=$ROOTDIR/bin/cerl
EMU=beam
@@ -248,6 +249,12 @@ while [ $# -gt 0 ]; do
done
+if [ ! -f $BINDIR/erlexec -a -f $ROOTDIR/bin/$TARGET/erlexec ]; then
+ # We are in a strange target (I'm looking at you openbsd) where
+ # TARGET != config.guess
+ BINDIR=$ROOTDIR/bin/$TARGET
+fi
+
PATH=$BINDIR:$ROOTDIR/bin:$PATH
EXEC=$BINDIR/erlexec
diff --git a/erts/test/z_SUITE.erl b/erts/test/z_SUITE.erl
index da72b18f05..056561d3db 100644
--- a/erts/test/z_SUITE.erl
+++ b/erts/test/z_SUITE.erl
@@ -116,7 +116,7 @@ find_cerl(false) ->
end;
find_cerl(DBTop) ->
case catch filelib:wildcard(filename:join([DBTop,
- "otp_src_R*",
+ "otp_src_*",
"bin",
"cerl"])) of
[Cerl | _ ] ->
@@ -242,7 +242,7 @@ dump_core(#core_search_conf{ cerl = Cerl }, Core) ->
_ ->
os:cmd(Cerl ++ " -dump " ++ Core)
end,
- ct:log("~s~n~n~s",[Core,Dump]).
+ ct:log("~ts~n~n~ts",[Core,Dump]).
format_core(Conf, {ignore, Core}) ->
diff --git a/lib/common_test/doc/src/run_test_chapter.xml b/lib/common_test/doc/src/run_test_chapter.xml
index 44fe73d24f..a4a77ee400 100644
--- a/lib/common_test/doc/src/run_test_chapter.xml
+++ b/lib/common_test/doc/src/run_test_chapter.xml
@@ -215,7 +215,7 @@
<pre>-exit_status ignore_config</pre>
<p>For more information about the <c>ct_run</c> program, see the
- <seealso marker="ct_run#top">Reference Manual</seealso> and the
+ <seealso marker="ct_run">Reference Manual</seealso> and the
<seealso marker="install_chapter#general">Installation</seealso> chapter.
</p>
</section>
diff --git a/lib/compiler/src/beam_except.erl b/lib/compiler/src/beam_except.erl
index e5ec1bd904..d261809765 100644
--- a/lib/compiler/src/beam_except.erl
+++ b/lib/compiler/src/beam_except.erl
@@ -131,9 +131,13 @@ translate_exception(_, _, _, _) -> no.
fix_block(Is, 0) ->
reverse(Is);
-fix_block(Is0, Words) ->
- [{set,[],[],{alloc,Live,{F1,F2,Needed,F3}}}|Is] = reverse(Is0),
- [{set,[],[],{alloc,Live,{F1,F2,Needed-Words,F3}}}|Is].
+fix_block(Is, Words) ->
+ fix_block_1(reverse(Is), Words).
+
+fix_block_1([{set,[],[],{alloc,Live,{F1,F2,Needed,F3}}}|Is], Words) ->
+ [{set,[],[],{alloc,Live,{F1,F2,Needed-Words,F3}}}|Is];
+fix_block_1([I|Is], Words) ->
+ [I|fix_block_1(Is, Words)].
dig_out_block_fc([{set,[],[],{alloc,Live,_}}|Bl]) ->
case dig_out_fc(Bl, Live-1, nil) of
diff --git a/lib/compiler/test/beam_except_SUITE.erl b/lib/compiler/test/beam_except_SUITE.erl
index bf67eedd5f..d088863c5c 100644
--- a/lib/compiler/test/beam_except_SUITE.erl
+++ b/lib/compiler/test/beam_except_SUITE.erl
@@ -57,6 +57,11 @@ coverage(_) ->
{'EXIT',{undef,[{erlang,error,[a,b,c],_}|_]}} =
(catch erlang:error(a, b, c)),
+
+ {'EXIT',{badarith,[{?MODULE,bar,1,[File,{line,9}]}|_]}} =
+ (catch bar(x)),
+ {'EXIT',{{case_clause,{1}},[{?MODULE,bar,1,[File,{line,9}]}|_]}} =
+ (catch bar(0)),
ok.
-file("fake.erl", 1).
@@ -65,3 +70,8 @@ fc(a) -> %Line 2
fc(L) when length(L) > 2 -> %Line 4
%% Not the same as a "real" function_clause error.
error(function_clause, [L]). %Line 6
+%% Would crash the compiler.
+bar(X) -> %Line 8
+ case {X+1} of %Line 9
+ 1 -> ok %Line 10
+ end. %Line 11
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index aa60bba96a..40f829e704 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -452,17 +452,17 @@
</func>
<func>
- <name>private_decrypt(Type, ChipherText, PrivateKey, Padding) -> PlainText</name>
- <fsummary>Decrypts ChipherText using the private Key.</fsummary>
+ <name>private_decrypt(Type, CipherText, PrivateKey, Padding) -> PlainText</name>
+ <fsummary>Decrypts CipherText using the private Key.</fsummary>
<type>
<v>Type = rsa</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
<v>PrivateKey = rsa_private()</v>
<v>Padding = rsa_pkcs1_padding | rsa_pkcs1_oaep_padding | rsa_no_padding</v>
<v>PlainText = binary()</v>
</type>
<desc>
- <p>Decrypts the <c>ChipherText</c>, encrypted with
+ <p>Decrypts the <c>CipherText</c>, encrypted with
<seealso marker="#public_encrypt-4">public_encrypt/4</seealso> (or equivalent function)
using the <c>PrivateKey</c>, and returns the
plaintext (message digest). This is a low level signature verification operation
@@ -473,7 +473,7 @@
</func>
<func>
- <name>private_encrypt(Type, PlainText, PrivateKey, Padding) -> ChipherText</name>
+ <name>private_encrypt(Type, PlainText, PrivateKey, Padding) -> CipherText</name>
<fsummary>Encrypts PlainText using the private Key.</fsummary>
<type>
<v>Type = rsa</v>
@@ -484,7 +484,7 @@
used, where N is public modulus of the RSA key.</d>
<v>PrivateKey = rsa_private()</v>
<v>Padding = rsa_pkcs1_padding | rsa_no_padding</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
</type>
<desc>
<p>Encrypts the <c>PlainText</c> using the <c>PrivateKey</c>
@@ -496,17 +496,17 @@
</desc>
</func>
<func>
- <name>public_decrypt(Type, ChipherText, PublicKey, Padding) -> PlainText</name>
- <fsummary>Decrypts ChipherText using the public Key.</fsummary>
+ <name>public_decrypt(Type, CipherText, PublicKey, Padding) -> PlainText</name>
+ <fsummary>Decrypts CipherText using the public Key.</fsummary>
<type>
<v>Type = rsa</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
<v>PublicKey = rsa_public() </v>
<v>Padding = rsa_pkcs1_padding | rsa_no_padding</v>
<v>PlainText = binary()</v>
</type>
<desc>
- <p>Decrypts the <c>ChipherText</c>, encrypted with
+ <p>Decrypts the <c>CipherText</c>, encrypted with
<seealso marker="#private_encrypt-4">private_encrypt/4</seealso>(or equivalent function)
using the <c>PrivateKey</c>, and returns the
plaintext (message digest). This is a low level signature verification operation
@@ -517,7 +517,7 @@
</func>
<func>
- <name>public_encrypt(Type, PlainText, PublicKey, Padding) -> ChipherText</name>
+ <name>public_encrypt(Type, PlainText, PublicKey, Padding) -> CipherText</name>
<fsummary>Encrypts PlainText using the public Key.</fsummary>
<type>
<v>Type = rsa</v>
@@ -528,7 +528,7 @@
used, where N is public modulus of the RSA key.</d>
<v>PublicKey = rsa_public()</v>
<v>Padding = rsa_pkcs1_padding | rsa_pkcs1_oaep_padding | rsa_no_padding</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
</type>
<desc>
<p>Encrypts the <c>PlainText</c> (message digest) using the <c>PublicKey</c>
diff --git a/lib/crypto/src/Makefile b/lib/crypto/src/Makefile
index eabfd676c5..c185c159e5 100644
--- a/lib/crypto/src/Makefile
+++ b/lib/crypto/src/Makefile
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1999-2013. All Rights Reserved.
+# Copyright Ericsson AB 1999-2014. 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
@@ -35,11 +35,8 @@ RELSYSDIR = $(RELEASE_PATH)/lib/crypto-$(VSN)
# ----------------------------------------------------
MODULES= \
- crypto_app \
crypto \
- crypto_ec_curves \
- crypto_server \
- crypto_sup
+ crypto_ec_curves
HRL_FILES=
diff --git a/lib/crypto/src/crypto.app.src b/lib/crypto/src/crypto.app.src
index 161ea7c9fe..d3084ff336 100644
--- a/lib/crypto/src/crypto.app.src
+++ b/lib/crypto/src/crypto.app.src
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2014. 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
@@ -17,16 +17,12 @@
%% %CopyrightEnd%
%%
{application, crypto,
- [{description, "CRYPTO version 2"},
+ [{description, "CRYPTO"},
{vsn, "%VSN%"},
{modules, [crypto,
- crypto_ec_curves,
- crypto_app,
- crypto_sup,
- crypto_server]},
- {registered, [crypto_sup, crypto_server]},
+ crypto_ec_curves]},
+ {registered, []},
{applications, [kernel, stdlib]},
- {env, []},
- {mod, {crypto_app, []}}]}.
+ {env, []}]}.
diff --git a/lib/crypto/src/crypto_app.erl b/lib/crypto/src/crypto_app.erl
deleted file mode 100644
index f1ea1406e4..0000000000
--- a/lib/crypto/src/crypto_app.erl
+++ /dev/null
@@ -1,39 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-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%
-%%
-
-%% Purpose : Application master for CRYPTO.
-
--module(crypto_app).
-
--behaviour(application).
-
--export([start/2, stop/1]).
-
-%% start/2(Type, StartArgs) -> {ok, Pid} | {ok, Pid, State} |
-%% {error, Reason}
-%%
-start(_Type, _StartArgs) ->
- crypto_sup:start_link().
-
-%% stop(State) -> void()
-%%
-stop(_State) ->
- ok.
-
-
diff --git a/lib/crypto/src/crypto_server.erl b/lib/crypto/src/crypto_server.erl
deleted file mode 100644
index 89650a9f06..0000000000
--- a/lib/crypto/src/crypto_server.erl
+++ /dev/null
@@ -1,68 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% 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%
-%%
-
-%% Purpose: Provide cryptographic algorithms.
-
--module(crypto_server).
-
--behaviour(gen_server).
-
--export([start_link/0]).
-
-%% Internal exports, call-back functions.
--export([init/1,handle_call/3,handle_cast/2,handle_info/2,code_change/3,
- terminate/2]).
-
-
-%%% --------------------------------------------------------
-%%% Interface Functions.
-%%% --------------------------------------------------------
-
-start_link() ->
- gen_server:start_link({local, crypto_server}, crypto_server, [], []).
-
-init([]) ->
- {ok,[]}.
-
-
-
-%%% --------------------------------------------------------
-%%% The call-back functions.
-%%% --------------------------------------------------------
-
-handle_call(_, _, State) ->
- {noreply, State}.
-
-handle_cast(_, State) ->
- {noreply, State}.
-
-handle_info(_, State) ->
- {noreply, State}.
-
-code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
-
-terminate(_Reason, _State) ->
- [].
-
-
-
-
-
-
diff --git a/lib/crypto/src/crypto_sup.erl b/lib/crypto/src/crypto_sup.erl
deleted file mode 100644
index 8ef58777ab..0000000000
--- a/lib/crypto/src/crypto_sup.erl
+++ /dev/null
@@ -1,39 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-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%
-%%
-
-%% Purpose: Main supervisor in CRYPTO application.
-
--module(crypto_sup).
-
--behaviour(supervisor).
-
--export([start_link/0, init/1]).
-
-start_link() ->
- supervisor:start_link({local, crypto_sup}, crypto_sup, []).
-
-
-%% init([])
-%% Returns: {ok, {SupFlags, [ChildSpec]}}
-%%
-init([]) ->
- Child = {crypto_server, {crypto_server, start_link, []},
- permanent, 2000, worker, [crypto_server]},
- {ok, {{one_for_all, 10, 3600}, [Child]}}.
-
diff --git a/lib/debugger/priv/erlang_bug.png b/lib/debugger/priv/erlang_bug.png
index 87c8279654..200f531484 100644
--- a/lib/debugger/priv/erlang_bug.png
+++ b/lib/debugger/priv/erlang_bug.png
Binary files differ
diff --git a/lib/diameter/bin/diameterc b/lib/diameter/bin/diameterc
index d31f341c36..2c9a8f555c 100755
--- a/lib/diameter/bin/diameterc
+++ b/lib/diameter/bin/diameterc
@@ -4,7 +4,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -74,7 +74,7 @@ compile(#argv{file = File, options = Opts, output = Out}) ->
ok ->
0;
{error, Reason} ->
- error_msg(Reason, []),
+ error_msg(diameter_make:format_error(Reason), []),
1
catch
error: Reason ->
diff --git a/lib/diameter/doc/src/diameter_make.xml b/lib/diameter/doc/src/diameter_make.xml
index e1673378df..13ec5bbfc1 100644
--- a/lib/diameter/doc/src/diameter_make.xml
+++ b/lib/diameter/doc/src/diameter_make.xml
@@ -16,7 +16,7 @@
<header>
<copyright>
<year>2012</year>
-<year>2013</year>
+<year>2014</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -175,6 +175,10 @@ Note that a dictionary's <c>&dict_name;</c>, together with the
The <c>&dict_name;</c> of a literal input dictionary defaults to
<c>dictionary</c>.</p>
+<p>
+A returned error reason can be converted into a readable string using
+&format_error;.</p>
+
</desc>
</func>
@@ -206,6 +210,18 @@ The return value is also a parsed dictionary.</p>
</desc>
</func>
+<!-- ===================================================================== -->
+
+<func>
+<name>format_error(Reason) -> string()</name>
+<fsummary>Turn an error reason into a readable string.</fsummary>
+<desc>
+
+<p>
+Turn an error reason returned by &codec; into a readable string.</p>
+</desc>
+</func>
+
</funcs>
<!-- ===================================================================== -->
diff --git a/lib/diameter/doc/src/diameter_sctp.xml b/lib/diameter/doc/src/diameter_sctp.xml
index fb7075f2cd..6302cb1435 100644
--- a/lib/diameter/doc/src/diameter_sctp.xml
+++ b/lib/diameter/doc/src/diameter_sctp.xml
@@ -15,7 +15,8 @@
<erlref>
<header>
<copyright>
-<year>2011</year><year>2013</year>
+<year>2011</year>
+<year>2014</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -113,7 +114,7 @@ and port respectively.</p>
<p>
Multiple <c>ip</c> options can be specified for a multihomed peer.
If none are specified then the values of <c>Host-IP-Address</c>
-in the <c>#diameter_service{}</c> record are used.
+in the <c>diameter_service</c> record are used.
(In particular, one of these must be specified.)
Option <c>port</c> defaults to 3868 for a listening transport and 0 for a
connecting transport.</p>
@@ -131,25 +132,18 @@ the buffer size.</p>
</warning>
<p>
-diameter_sctp uses the <c>transport_data</c> field of
-the <c>#diameter_packet{}</c> record to communicate the stream on which an
-inbound message has been received, or on which an outbound message
-should be sent: the value will be of the form <c>{stream, Id}</c>
-on an inbound message passed to a &app_handle_request; or
-&app_handle_answer; callback.
-For an outbound message, either <c>undefined</c> (explicitly or
-by receiving the outbound message as a <c>binary()</c>) or a tuple
-should be set in the return value of &app_handle_request;
-(typically by retaining the value passed into this function)
-or &app_prepare_request;.
-The value <c>undefined</c> uses a "next outbound stream" id and
-increments this modulo the total number outbound streams.
-That is, successive values of <c>undefined</c> cycle through all
-outbound streams.</p>
-
-<!-- TODO: Some way of getting at the number of available outbound -->
-<!-- streams. -->
-
+The <c>transport_data</c> field of record <c>diameter_packet</c>
+is used to communicate the stream on which an inbound message
+has been received, or on which an outbound message should be sent.
+The value will be of the form <c>{stream, Id}</c> for an inbound
+message passed to a &app_handle_request; or &app_handle_answer;
+callback.
+For an outbound message, <c>{outstream, Id}</c> in the return value of
+&app_handle_request; or &app_prepare_retransmit; sets the outbound
+stream, the stream id being interpreted modulo the number of outbound
+streams.
+Any other value, or not setting a value, causes successive such sends
+to cycle though all outbound streams.</p>
</desc>
</func>
diff --git a/lib/diameter/doc/src/seealso.ent b/lib/diameter/doc/src/seealso.ent
index 7bf7460351..44541afb9b 100644
--- a/lib/diameter/doc/src/seealso.ent
+++ b/lib/diameter/doc/src/seealso.ent
@@ -4,7 +4,7 @@
%CopyrightBegin%
-Copyright Ericsson AB 2012-2013. All Rights Reserved.
+Copyright Ericsson AB 2012-2014. 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
@@ -117,6 +117,7 @@ significant.
<!ENTITY make_codec '<seealso marker="diameter_make#codec-2">diameter_make:codec/2</seealso>'>
<!ENTITY make_format '<seealso marker="diameter_make#format-1">diameter_make:format/1</seealso>'>
<!ENTITY make_flatten '<seealso marker="diameter_make#flatten-1">diameter_make:flatten/1</seealso>'>
+<!ENTITY make_format_error '<seealso marker="diameter_make#format_error-1">diameter_make:format_error/1</seealso>'>
<!-- diameter_transport -->
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index 282276827f..f76bd96c3c 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -189,11 +189,7 @@ i({Ack, WPid, {M, Ref} = T, Opts, {Mask, Nodes, Dict0, Svc}}) ->
putr(?RESTRICT_KEY, Nodes),
Tmo = proplists:get_value(capx_timeout, Opts, ?EVENT_TIMEOUT),
- ?IS_TIMEOUT(Tmo) orelse ?ERROR({invalid, {capx_timeout, Tmo}}),
OnLengthErr = proplists:get_value(length_errors, Opts, exit),
- lists:member(OnLengthErr, [exit, handle, discard])
- orelse ?ERROR({invalid, {length_errors, OnLengthErr}}),
- %% Error checking is for configuration added in old code.
{TPid, Addrs} = start_transport(T, Rest, Svc),
@@ -782,10 +778,6 @@ set([_|_] = Ans, FailedAvp) ->
result_code(#diameter_header{is_error = true}, _) ->
{3008, []}; %% DIAMETER_INVALID_HDR_BITS
-result_code(_, [Bs|_])
- when is_bitstring(Bs) -> %% from old code
- {3009, []}; %% DIAMETER_INVALID_HDR_BITS
-
result_code(#diameter_header{version = ?DIAMETER_VERSION}, Es) ->
rc(Es);
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index 70e66537ed..1274e0fc48 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -701,8 +701,7 @@ notify(Share, SvcName, T) ->
Nodes = remotes(Share),
[] /= Nodes andalso diameter_peer:notify(Nodes, SvcName, T).
%% Test for the empty list for upgrade reasons: there's no
-%% diameter_peer:notify/3 in old code so no call means no load order
-%% requirement.
+%% diameter_peer:notify/3 in old code.
remotes(false) ->
[];
diff --git a/lib/diameter/src/base/diameter_stats.erl b/lib/diameter/src/base/diameter_stats.erl
index b68d4af11f..8353613d32 100644
--- a/lib/diameter/src/base/diameter_stats.erl
+++ b/lib/diameter/src/base/diameter_stats.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -245,9 +245,6 @@ handle_call({read, Refs, Del}, _From, State) ->
handle_call({read, Refs}, _, State) ->
{reply, read_refs(Refs), State};
-handle_call({flush, Refs}, _From, State) -> %% from old code
- {reply, to_refdict(read(Refs, true)), State};
-
handle_call(Req, From, State) ->
?UNEXPECTED([Req, From]),
{reply, nok, State}.
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 8b6f026b34..7fbb306b02 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2013. All Rights Reserved.
+%% Copyright Ericsson AB 2013-2014. 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
@@ -90,9 +90,6 @@ make_recvdata([SvcName, PeerT, Apps, Mask | _]) ->
peerT = PeerT,
apps = Apps,
sequence = Mask}.
-%% Take a list so that the caller (diameter_service) can be upgraded
-%% first if new members are added. Note that receive_message/4 might
-%% still get an old term from any watchdog started in old code.
%% ---------------------------------------------------------------------------
%% peer_up/1
@@ -305,15 +302,6 @@ errors(_, #diameter_packet{header = #diameter_header{version = V},
when V /= ?DIAMETER_VERSION ->
Pkt#diameter_packet{errors = [5011 | Es]};
-%% DIAMETER_INVALID_AVP_BITS 3009
-%% A request was received that included an AVP whose flag bits are
-%% set to an unrecognized value, or that is inconsistent with the
-%% AVP's definition.
-
-errors(_, #diameter_packet{errors = [Bs | Es]} = Pkt)
- when is_bitstring(Bs) -> %% from old code
- Pkt#diameter_packet{errors = [3009 | Es]};
-
%% DIAMETER_COMMAND_UNSUPPORTED 3001
%% The Request contained a Command-Code that the receiver did not
%% recognize or support. This MUST be used when a Diameter node
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index 9a1c8b6585..53e659e3f6 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -157,8 +157,7 @@ wait(Ref, Pid) ->
config(Opts) ->
Config = proplists:get_value(watchdog_config, Opts, []),
- is_list(Config) orelse config_error({watchdog_config, Config}),
- lists:foldl(fun config/2, #config{}, Config). %% ^ added in old code
+ lists:foldl(fun config/2, #config{}, Config).
config({suspect, N}, Rec)
when ?IS_NATURAL(N) ->
@@ -166,10 +165,7 @@ config({suspect, N}, Rec)
config({okay, N}, Rec)
when ?IS_NATURAL(N) ->
- Rec#config{okay = N};
-
-config(T, _) -> %% added in old code
- config_error(T).
+ Rec#config{okay = N}.
%% start/5
@@ -252,17 +248,6 @@ handle_info(T, #watchdog{} = State) ->
?LOG(stop, T),
event(T, State, State#watchdog{status = down}),
{stop, {shutdown, T}, State}
- end;
-
-handle_info(T, State) -> %% started in old code
- handle_info(T, upgrade(State)).
-
-upgrade(State) ->
- case erlang:append_element(State, #config{}) of
- #watchdog{status = okay, config = #config{suspect = OS}} = S ->
- S#watchdog{num_dwa = OS};
- #watchdog{} = S ->
- S
end.
close({'DOWN', _, process, TPid, {shutdown, Reason}},
diff --git a/lib/diameter/src/compiler/diameter_dict_util.erl b/lib/diameter/src/compiler/diameter_dict_util.erl
index 3941f30e03..136bba16cb 100644
--- a/lib/diameter/src/compiler/diameter_dict_util.erl
+++ b/lib/diameter/src/compiler/diameter_dict_util.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -155,6 +155,8 @@ fmt(grouped_avp_has_wrong_type) ->
"Grouped AVP ~s at line ~p defined with type ~s at line ~p";
fmt(grouped_avp_not_defined) ->
"Grouped AVP ~s on line ~p not defined in @avp_types";
+fmt(grouped_avp_not_grouped) ->
+ "Grouped AVP ~s on line ~p not defined in @grouped";
fmt(grouped_vendor_id_without_flag) ->
"Grouped AVP ~s at line ~p has vendor id "
"but definition at line ~p does not specify V flag";
@@ -401,9 +403,9 @@ read(File) ->
{ok, iolist_to_binary([File])}.
make_dict(Parse, Opts) ->
- make_orddict(pass4(pass3(pass2(pass1(reset(make_dict(Parse),
- Opts))),
- Opts))).
+ Dict = pass3(pass2(pass1(reset(make_dict(Parse), Opts))), Opts),
+ ok = examine(Dict),
+ make_orddict(Dict).
%% make_orddict/1
@@ -1168,7 +1170,7 @@ import_avps(Dict, Opts) ->
Import = inherit(Dict, Opts),
report(imported, Import),
- %% pass4/1 tests that all referenced AVP's are either defined
+ %% examine/1 tests that all referenced AVP's are either defined
%% or imported.
dict:store(import_avps,
@@ -1276,21 +1278,21 @@ dict(Mod) ->
end.
%% ===========================================================================
-%% pass4/1
+%% examine/1
%%
%% Sanity checks.
-pass4(Dict) ->
- dict:fold(fun(K, V, _) -> p4(K, V, Dict) end, ok, Dict),
- Dict.
+examine(Dict) ->
+ dict:fold(fun(K, V, _) -> x(K, V, Dict) end, ok, Dict),
+ ok.
%% Ensure enum AVP's have type Enumerated.
-p4({enum, Name}, [Line | _], Dict)
+x({enum, Name}, [Line | _], Dict)
when is_list(Name) ->
true = is_enumerated_avp(Name, Dict, Line);
%% Ensure all referenced AVP's are either defined locally or imported.
-p4({K, {Name, AvpName}}, [Line | _], Dict)
+x({K, {Name, AvpName}}, [Line | _], Dict)
when (K == grouped orelse K == messages),
is_list(Name),
is_list(AvpName),
@@ -1298,13 +1300,22 @@ p4({K, {Name, AvpName}}, [Line | _], Dict)
true = avp_is_defined(AvpName, Dict, Line);
%% Ditto.
-p4({K, AvpName}, [Line | _], Dict)
+x({K, AvpName}, [Line | _], Dict)
when K == avp_vendor_id;
K == custom_types;
K == codecs ->
true = avp_is_defined(AvpName, Dict, Line);
-p4(_, _, _) ->
+%% Ensure that all local AVP's of type Grouped are also present in @grouped.
+x({avp_types, Name}, [Line | Toks], Dict)
+ when 0 < Line, is_list(Name) ->
+ [{number, _, _Code}, {word, _, Type}, {word, _, _Flags}] = Toks,
+ "Grouped" == Type
+ andalso error == dict:find({grouped, Name}, Dict)
+ andalso ?RETURN(grouped_avp_not_grouped, [Name, Line]),
+ ok;
+
+x(_, _, _) ->
ok.
%% has_enumerated_type/3
diff --git a/lib/diameter/src/compiler/diameter_make.erl b/lib/diameter/src/compiler/diameter_make.erl
index 2f314b7e57..adc7808e49 100644
--- a/lib/diameter/src/compiler/diameter_make.erl
+++ b/lib/diameter/src/compiler/diameter_make.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -33,7 +33,8 @@
-export([codec/2,
codec/1,
format/1,
- flatten/1]).
+ flatten/1,
+ format_error/1]).
-export_type([opt/0]).
@@ -81,8 +82,8 @@ codec(File, Opts) ->
case parse(Dict, Opts) of
{ok, ParseD} ->
make(Path, default(Opts), ParseD);
- {error = E, Reason} ->
- {E, diameter_dict_util:format_error(Reason)}
+ {error, _} = E ->
+ E
end.
codec(File) ->
@@ -115,6 +116,11 @@ flatten([?VERSION = V | Dict]) ->
[grouped, import_groups],
[enum, import_enums]])].
+%% format_error/1
+
+format_error(T) ->
+ diameter_dict_util:format_error(T).
+
%% ===========================================================================
%% flatten/2
diff --git a/lib/diameter/src/diameter.appup.src b/lib/diameter/src/diameter.appup.src
index c7ae8a2828..0d421c229e 100644
--- a/lib/diameter/src/diameter.appup.src
+++ b/lib/diameter/src/diameter.appup.src
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -20,62 +20,37 @@
{"%VSN%",
[
- {"0.9", [{restart_application, diameter}]}, %% R14B03
- {"0.10", [{restart_application, diameter}]}, %% R14B04
- {"1.0", [{restart_application, diameter}]}, %% R15B
- {"1.1", [{restart_application, diameter}]}, %% R15B01
- {"1.2", [{restart_application, diameter}]}, %% R15B02
- {"1.2.1", [{restart_application, diameter}]},
- {"1.3", [{restart_application, diameter}]}, %% R15B03
- {"1.3.1", [{restart_application, diameter}]},
- {"1.4", [{restart_application, diameter}]}, %% R16A
- {"1.4.1", [{restart_application, diameter}]}, %% R16B
+ {"0.9", [{restart_application, diameter}]}, %% R14B03
+ {"0.10", [{restart_application, diameter}]}, %% R14B04
+ {"1.0", [{restart_application, diameter}]}, %% R15B
+ {"1.1", [{restart_application, diameter}]}, %% R15B01
+ {"1.2", [{restart_application, diameter}]}, %% R15B02
+ {"1.2.1", [{restart_application, diameter}]},
+ {"1.3", [{restart_application, diameter}]}, %% R15B03
+ {"1.3.1", [{restart_application, diameter}]},
+ {"1.4", [{restart_application, diameter}]}, %% R16A
+ {"1.4.1", [{restart_application, diameter}]}, %% R16B
{"1.4.1.1", [{restart_application, diameter}]},
- {"1.4.2", [{load_module, diameter_codec}, %% R16B01
- {load_module, diameter_types},
- {load_module, diameter_config},
- {load_module, diameter_capx},
- {load_module, diameter_service},
- {load_module, diameter_peer_fsm},
- {load_module, diameter_watchdog},
- {load_module, diameter}]},
- {"1.4.3", [{load_module, diameter_capx}, %% R16B02
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter_codec},
- {load_module, diameter_types},
- {load_module, diameter_config},
- {load_module, diameter}]},
- {"1.4.4", [{load_module, diameter_capx},
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter_config},
- {load_module, diameter}]}
+ {"1.4.2", [{restart_application, diameter}]}, %% R16B01
+ {"1.4.3", [{restart_application, diameter}]}, %% R16B02
+ {"1.4.4", [{restart_application, diameter}]},
+ {"1.5", [{restart_application, diameter}]} %% R16B03
],
[
- {"0.9", [{restart_application, diameter}]},
- {"0.10", [{restart_application, diameter}]},
- {"1.0", [{restart_application, diameter}]},
- {"1.1", [{restart_application, diameter}]},
- {"1.2", [{restart_application, diameter}]},
- {"1.2.1", [{restart_application, diameter}]},
- {"1.3", [{restart_application, diameter}]},
- {"1.3.1", [{restart_application, diameter}]},
- {"1.4", [{restart_application, diameter}]},
- {"1.4.1", [{restart_application, diameter}]},
+ {"0.9", [{restart_application, diameter}]},
+ {"0.10", [{restart_application, diameter}]},
+ {"1.0", [{restart_application, diameter}]},
+ {"1.1", [{restart_application, diameter}]},
+ {"1.2", [{restart_application, diameter}]},
+ {"1.2.1", [{restart_application, diameter}]},
+ {"1.3", [{restart_application, diameter}]},
+ {"1.3.1", [{restart_application, diameter}]},
+ {"1.4", [{restart_application, diameter}]},
+ {"1.4.1", [{restart_application, diameter}]},
{"1.4.1.1", [{restart_application, diameter}]},
- {"1.4.2", [{restart_application, diameter}]},
- {"1.4.3", [{load_module, diameter_types},
- {load_module, diameter_config},
- {load_module, diameter_codec},
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter_capx},
- {load_module, diameter}]},
- {"1.4.4", [{load_module, diameter_capx},
- {load_module, diameter_config},
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter}]}
+ {"1.4.2", [{restart_application, diameter}]},
+ {"1.4.3", [{restart_application, diameter}]},
+ {"1.4.4", [{restart_application, diameter}]},
+ {"1.5", [{restart_application, diameter}]}
]
}.
diff --git a/lib/diameter/src/transport/diameter_sctp.erl b/lib/diameter/src/transport/diameter_sctp.erl
index 49a530b4eb..f5275e66b5 100644
--- a/lib/diameter/src/transport/diameter_sctp.erl
+++ b/lib/diameter/src/transport/diameter_sctp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -70,14 +70,14 @@
-type connect_option() :: {raddr, inet:ip_address()}
| {rport, inet:port_number()}
- | gen_sctp:open_option().
+ | term(). %% gen_sctp:open_option().
-type match() :: inet:ip_address()
| string()
| [match()].
-type listen_option() :: {accept, match()}
- | gen_sctp:open_option().
+ | term(). %% gen_sctp:open_option().
-type uint() :: non_neg_integer().
@@ -338,9 +338,6 @@ handle_call({{accept, Ref}, Pid}, _, #listener{ref = Ref,
{TPid, NewS} = accept(Ref, Pid, S),
{reply, {ok, TPid}, NewS#listener{count = N+1}};
-handle_call(T, From, {listener,_,_,_,_,_,_} = S) -> % started in old code
- handle_call(T, From, upgrade(S));
-
handle_call(_, _, State) ->
{reply, nok, State}.
@@ -359,10 +356,7 @@ handle_info(T, #transport{} = S) ->
{noreply, #transport{} = t(T,S)};
handle_info(T, #listener{} = S) ->
- {noreply, #listener{} = l(T,S)};
-
-handle_info(T, {listener,_,_,_,_,_,_} = S) -> % started in old code
- handle_info(T, upgrade(S)).
+ {noreply, #listener{} = l(T,S)}.
%% ---------------------------------------------------------------------------
%% # code_change/3
@@ -396,9 +390,6 @@ terminate(_, #listener{socket = Sock}) ->
%% ---------------------------------------------------------------------------
-upgrade(S) ->
- #listener{} = erlang:append_element(S, ?DEFAULT_ACCEPT).
-
putr(Key, Val) ->
put({?MODULE, Key}, Val).
@@ -502,8 +493,6 @@ transition({peeloff, Sock, {sctp, LSock, _RA, _RP, _Data} = Msg, Matches},
= S) ->
ok = accept_peer(Sock, Matches),
transition(Msg, S#transport{socket = Sock});
-transition({peeloff = T, _Sock, _Msg} = T, #transport{} = S) ->% from old code
- transition(erlang:append_element(T, ?DEFAULT_ACCEPT), S);
%% Incoming message.
transition({sctp, _Sock, _RA, _RP, Data}, #transport{socket = Sock} = S) ->
@@ -605,11 +594,13 @@ accept(_, Pid, #listener{ref = Ref, pending = {N,Q}} = S) ->
%% send/2
%% Outbound Diameter message on a specified stream ...
-send(#diameter_packet{bin = Bin, transport_data = {stream, SId}}, S) ->
- send(SId, Bin, S),
+send(#diameter_packet{bin = Bin, transport_data = {outstream, SId}},
+ #transport{streams = {_, OS}}
+ = S) ->
+ send(SId rem OS, Bin, S),
S;
-%% ... or not: rotate through all steams.
+%% ... or not: rotate through all streams.
send(Bin, #transport{streams = {_, OS},
os = N}
= S)
diff --git a/lib/diameter/test/diameter_compiler_SUITE.erl b/lib/diameter/test/diameter_compiler_SUITE.erl
index ed369e8af3..df4dde6240 100644
--- a/lib/diameter/test/diameter_compiler_SUITE.erl
+++ b/lib/diameter/test/diameter_compiler_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -138,6 +138,9 @@
{grouped_avp_not_defined,
"Failed-AVP *.*",
""},
+ {grouped_avp_not_grouped,
+ "Failed-AVP ::=.*\n.*}",
+ ""},
{grouped_vendor_id_without_flag,
"(Failed-AVP .*)>",
"\\1 668>"},
@@ -397,8 +400,8 @@ replace({E, Mods}, Bin) ->
case {E, parse(B, [{include, here()}]), Mods} of
{ok, {ok, Dict}, _} ->
Dict;
- {_, {error, S}, _} ->
- S
+ {_, {error, {E,_} = T}, _} when E /= ok ->
+ diameter_make:format_error(T)
end.
re({RE, Repl}, Bin) ->
diff --git a/lib/diameter/vsn.mk b/lib/diameter/vsn.mk
index 9fda067f2b..54019fa46c 100644
--- a/lib/diameter/vsn.mk
+++ b/lib/diameter/vsn.mk
@@ -2,7 +2,7 @@
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2010-2013. All Rights Reserved.
+# Copyright Ericsson AB 2010-2014. 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
@@ -18,5 +18,5 @@
# %CopyrightEnd%
APPLICATION = diameter
-DIAMETER_VSN = 1.5
+DIAMETER_VSN = 1.6
APP_VSN = $(APPLICATION)-$(DIAMETER_VSN)$(PRE_VSN)
diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c
index 8f1f231b82..c9aa28812c 100644
--- a/lib/erl_interface/src/connect/ei_connect.c
+++ b/lib/erl_interface/src/connect/ei_connect.c
@@ -1161,6 +1161,7 @@ static unsigned int gen_challenge(void)
struct utsname name;
} s;
+ memset(&s, 0, sizeof(s));
gettimeofday(&s.tv, 0);
uname(&s.name);
s.cpu = clock();
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index a6f2933f6a..f77214c589 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -32,7 +32,23 @@
<file>notes.xml</file>
</header>
- <section><title>Inets 5.9.7</title>
+ <section><title>Inets 5.9.8</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Mend max_clients check that was broken and avoid too
+ extensive logging that could cause memory problems.</p>
+ <p>
+ Own Id: OTP-11557 Aux Id: seq12478 </p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Inets 5.9.7</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl
index 4cf4c6489d..24884bada5 100644
--- a/lib/kernel/test/sendfile_SUITE.erl
+++ b/lib/kernel/test/sendfile_SUITE.erl
@@ -33,6 +33,7 @@ all() ->
,t_sendfile_offset
,t_sendfile_sendafter
,t_sendfile_recvafter
+ ,t_sendfile_recvafter_remoteclose
,t_sendfile_sendduring
,t_sendfile_recvduring
,t_sendfile_closeduring
@@ -228,6 +229,25 @@ t_sendfile_recvafter(Config) ->
ok = sendfile_send(Send).
+%% This tests specifically for a bug fixed in 17.0
+t_sendfile_recvafter_remoteclose(Config) ->
+ Filename = proplists:get_value(small_file, Config),
+
+ Send = fun(Sock, SFServer) ->
+ {Size, _Data} = sendfile_file_info(Filename),
+ {ok, Size} = file:sendfile(Filename, Sock),
+
+ %% Make sure the remote end has been closed
+ SFServer ! stop,
+ timer:sleep(100),
+
+ %% In the bug this returned {error,ebadf}
+ {error,closed} = gen_tcp:recv(Sock, 1),
+ -1
+ end,
+
+ ok = sendfile_send({127,0,0,1},Send,0).
+
t_sendfile_sendduring(Config) ->
Filename = proplists:get_value(big_file, Config),
diff --git a/lib/observer/priv/erlang_observer.png b/lib/observer/priv/erlang_observer.png
index 01723d210b..cf900a29e6 100644
--- a/lib/observer/priv/erlang_observer.png
+++ b/lib/observer/priv/erlang_observer.png
Binary files differ
diff --git a/lib/odbc/doc/src/notes.xml b/lib/odbc/doc/src/notes.xml
index 2551637001..b254ca3bc9 100644
--- a/lib/odbc/doc/src/notes.xml
+++ b/lib/odbc/doc/src/notes.xml
@@ -31,7 +31,23 @@
<p>This document describes the changes made to the odbc application.
</p>
- <section><title>ODBC 2.10.18</title>
+ <section><title>ODBC 2.10.19</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Updated configure test for header files sql.h and
+ sqlext.h to function correctly on windows.</p>
+ <p>
+ Own Id: OTP-11574</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>ODBC 2.10.18</title>
<section><title>Improvements and New Features</title>
<list>
diff --git a/lib/odbc/vsn.mk b/lib/odbc/vsn.mk
index 6ac83a7718..d9e2ab26a9 100644
--- a/lib/odbc/vsn.mk
+++ b/lib/odbc/vsn.mk
@@ -1 +1 @@
-ODBC_VSN = 2.10.18
+ODBC_VSN = 2.10.19
diff --git a/lib/ssh/doc/src/ssh.xml b/lib/ssh/doc/src/ssh.xml
index 89d8be850e..5d5f2e5b91 100644
--- a/lib/ssh/doc/src/ssh.xml
+++ b/lib/ssh/doc/src/ssh.xml
@@ -38,7 +38,7 @@
<item>Supported SSH version is 2.0 </item>
<item>Supported MAC algorithms: hmac-sha1</item>
<item>Supported encryption algorithms: aes128-cb and 3des-cbc</item>
- <item>Supports unicode filenames if the emulator and the underlaying OS supports it. See the DESCRIPTION section in <seealso marker="file">file</seealso> for information about this subject</item>
+ <item>Supports unicode filenames if the emulator and the underlaying OS supports it. See the DESCRIPTION section in <seealso marker="kernel:file">file</seealso> for information about this subject</item>
<item>Supports unicode in shell and cli</item>
</list>
diff --git a/lib/ssl/doc/src/notes.xml b/lib/ssl/doc/src/notes.xml
index fb32ccec7b..0b28b1ebd4 100644
--- a/lib/ssl/doc/src/notes.xml
+++ b/lib/ssl/doc/src/notes.xml
@@ -25,7 +25,41 @@
<file>notes.xml</file>
</header>
<p>This document describes the changes made to the SSL application.</p>
- <section><title>SSL 5.3.2</title>
+ <section><title>SSL 5.3.3</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Add missing validation of the server_name_indication
+ option and test for its explicit use. It was not possible
+ to set or disable the default server_name_indication as
+ the validation of the option was missing.</p>
+ <p>
+ Own Id: OTP-11567</p>
+ </item>
+ <item>
+ <p>
+ Elliptic curve selection in server mode now properly
+ selects a curve suggested by the client, if possible, and
+ the fallback alternative is changed to a more widely
+ supported curve.</p>
+ <p>
+ Own Id: OTP-11575</p>
+ </item>
+ <item>
+ <p>
+ Bug in the TLS hello extension handling caused the server
+ to behave as it did not understand secure renegotiation.</p>
+ <p>
+ Own Id: OTP-11595</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>SSL 5.3.2</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml
index 80ef419fb7..910dca3889 100644
--- a/lib/ssl/doc/src/ssl.xml
+++ b/lib/ssl/doc/src/ssl.xml
@@ -460,6 +460,10 @@ fun(srp, Username :: string(), UserState :: term()) ->
</item>
<tag>{log_alert, boolean()}</tag>
<item>If false, error reports will not be displayed.</item>
+ <tag>{honor_cipher_order, boolean()}</tag>
+ <item>If true, use the server's preference for cipher selection. If false
+ (the default), use the client's preference.
+ </item>
</taglist>
</section>
diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl
index a7fd9f5f81..4646468cb6 100644
--- a/lib/ssl/src/ssl.erl
+++ b/lib/ssl/src/ssl.erl
@@ -640,7 +640,8 @@ handle_options(Opts0, _Role) ->
make_next_protocol_selector(
handle_option(client_preferred_next_protocols, Opts, undefined)),
log_alert = handle_option(log_alert, Opts, true),
- server_name_indication = handle_option(server_name_indication, Opts, undefined)
+ server_name_indication = handle_option(server_name_indication, Opts, undefined),
+ honor_cipher_order = handle_option(honor_cipher_order, Opts, false)
},
CbInfo = proplists:get_value(cb_info, Opts, {gen_tcp, tcp, tcp_closed, tcp_error}),
@@ -652,7 +653,8 @@ handle_options(Opts0, _Role) ->
reuse_session, reuse_sessions, ssl_imp,
cb_info, renegotiate_at, secure_renegotiate, hibernate_after,
erl_dist, next_protocols_advertised,
- client_preferred_next_protocols, log_alert, server_name_indication],
+ client_preferred_next_protocols, log_alert,
+ server_name_indication, honor_cipher_order],
SockOpts = lists:foldl(fun(Key, PropList) ->
proplists:delete(Key, PropList)
@@ -840,6 +842,8 @@ validate_option(server_name_indication, disable) ->
disable;
validate_option(server_name_indication, undefined) ->
undefined;
+validate_option(honor_cipher_order, Value) when is_boolean(Value) ->
+ Value;
validate_option(Opt, Value) ->
throw({error, {options, {Opt, Value}}}).
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl
index 2b9bae6e80..487dfc01d9 100644
--- a/lib/ssl/src/ssl_handshake.erl
+++ b/lib/ssl/src/ssl_handshake.erl
@@ -1029,14 +1029,15 @@ cipher_suites(Suites, true) ->
select_session(SuggestedSessionId, CipherSuites, Compressions, Port, #session{ecc = ECCCurve} =
Session, Version,
- #ssl_options{ciphers = UserSuites} = SslOpts, Cache, CacheCb, Cert) ->
+ #ssl_options{ciphers = UserSuites, honor_cipher_order = HCO} = SslOpts,
+ Cache, CacheCb, Cert) ->
{SessionId, Resumed} = ssl_session:server_id(Port, SuggestedSessionId,
SslOpts, Cert,
Cache, CacheCb),
case Resumed of
undefined ->
Suites = available_suites(Cert, UserSuites, Version, ECCCurve),
- CipherSuite = select_cipher_suite(CipherSuites, Suites),
+ CipherSuite = select_cipher_suite(CipherSuites, Suites, HCO),
Compression = select_compression(Compressions),
{new, Session#session{session_id = SessionId,
cipher_suite = CipherSuite,
@@ -1796,6 +1797,11 @@ handle_srp_extension(#srp{username = Username}, Session) ->
%%-------------Misc --------------------------------
+select_cipher_suite(CipherSuites, Suites, false) ->
+ select_cipher_suite(CipherSuites, Suites);
+select_cipher_suite(CipherSuites, Suites, true) ->
+ select_cipher_suite(Suites, CipherSuites).
+
select_cipher_suite([], _) ->
no_suite;
select_cipher_suite([Suite | ClientSuites], SupportedSuites) ->
diff --git a/lib/ssl/src/ssl_internal.hrl b/lib/ssl/src/ssl_internal.hrl
index 0186f9fca2..5a823ec8a4 100644
--- a/lib/ssl/src/ssl_internal.hrl
+++ b/lib/ssl/src/ssl_internal.hrl
@@ -114,7 +114,10 @@
next_protocols_advertised = undefined, %% [binary()],
next_protocol_selector = undefined, %% fun([binary()]) -> binary())
log_alert :: boolean(),
- server_name_indication = undefined
+ server_name_indication = undefined,
+ %% Should the server prefer its own cipher order over the one provided by
+ %% the client?
+ honor_cipher_order = false
}).
-record(config, {ssl, %% SSL parameters
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl
index 1006b23a30..ddc511c652 100644
--- a/lib/ssl/test/ssl_basic_SUITE.erl
+++ b/lib/ssl/test/ssl_basic_SUITE.erl
@@ -110,7 +110,10 @@ options_tests() ->
empty_protocol_versions,
ipv6,
reuseaddr,
- tcp_reuseaddr].
+ tcp_reuseaddr,
+ honor_server_cipher_order,
+ honor_client_cipher_order
+].
api_tests() ->
[connection_info,
@@ -2443,6 +2446,51 @@ tcp_reuseaddr(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
+honor_server_cipher_order() ->
+ [{doc,"Test API honor server cipher order."}].
+honor_server_cipher_order(Config) when is_list(Config) ->
+ ClientCiphers = [{rsa, aes_128_cbc, sha}, {rsa, aes_256_cbc, sha}],
+ ServerCiphers = [{rsa, aes_256_cbc, sha}, {rsa, aes_128_cbc, sha}],
+honor_cipher_order(Config, true, ServerCiphers, ClientCiphers, {rsa, aes_256_cbc, sha}).
+
+honor_client_cipher_order() ->
+ [{doc,"Test API honor server cipher order."}].
+honor_client_cipher_order(Config) when is_list(Config) ->
+ ClientCiphers = [{rsa, aes_128_cbc, sha}, {rsa, aes_256_cbc, sha}],
+ ServerCiphers = [{rsa, aes_256_cbc, sha}, {rsa, aes_128_cbc, sha}],
+honor_cipher_order(Config, false, ServerCiphers, ClientCiphers, {rsa, aes_128_cbc, sha}).
+
+honor_cipher_order(Config, Honor, ServerCiphers, ClientCiphers, Expected) ->
+ ClientOpts = ?config(client_opts, Config),
+ ServerOpts = ?config(server_opts, Config),
+
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+
+ Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {?MODULE, connection_info_result, []}},
+ {options, [{ciphers, ServerCiphers}, {honor_cipher_order, Honor}
+ | ServerOpts]}]),
+ Port = ssl_test_lib:inet_port(Server),
+ Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, self()},
+ {mfa, {?MODULE, connection_info_result, []}},
+ {options, [{ciphers, ClientCiphers}, {honor_cipher_order, Honor}
+ | ClientOpts]}]),
+
+ Version =
+ tls_record:protocol_version(tls_record:highest_protocol_version([])),
+
+ ServerMsg = ClientMsg = {ok, {Version, Expected}},
+
+ ssl_test_lib:check_result(Server, ServerMsg, Client, ClientMsg),
+
+ ssl_test_lib:close(Server),
+ ssl_test_lib:close(Client).
+
+%%--------------------------------------------------------------------
+
hibernate() ->
[{doc,"Check that an SSL connection that is started with option "
"{hibernate_after, 1000} indeed hibernates after 1000ms of "
diff --git a/lib/syntax_tools/doc/src/notes.xml b/lib/syntax_tools/doc/src/notes.xml
index 4b3d578c78..a9d3f68d1d 100644
--- a/lib/syntax_tools/doc/src/notes.xml
+++ b/lib/syntax_tools/doc/src/notes.xml
@@ -31,6 +31,38 @@
<p>This document describes the changes made to the Syntax_Tools
application.</p>
+<section><title>Syntax_Tools 1.6.13</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ In syntax_tools-1.6.12 (OTP R16B03) a bug was introduced
+ which broke reverting of local implicit funs. Implicit
+ funs were mistakenly thought to be using abstract terms
+ for their name and arity. This has now been corrected.
+ (Thanks to Anthony Ramine)</p>
+ <p>
+ Own Id: OTP-11576</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p> The default encoding of Erlang files has been changed
+ from ISO-8859-1 to UTF-8. </p> <p> The encoding of XML
+ files has also been changed to UTF-8. </p>
+ <p>
+ Own Id: OTP-10907</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Syntax_Tools 1.6.12</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index 82be9aa489..4f7f9e83ac 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -512,7 +512,7 @@
%% @see macro/2
%% @see match_expr/2
%% @see module_qualifier/2
-%% @see named_fun_expr/1
+%% @see named_fun_expr/2
%% @see nil/0
%% @see operator/1
%% @see parentheses/1
@@ -5699,7 +5699,7 @@ named_fun_expr_name(Node) ->
%% =====================================================================
%% @doc Returns the list of clause subtrees of a `named_fun_expr' node.
%%
-%% @see named_fun_expr/1
+%% @see named_fun_expr/2
-spec named_fun_expr_clauses(syntaxTree()) -> [syntaxTree()].
@@ -5722,7 +5722,7 @@ named_fun_expr_clauses(Node) ->
%% syntax tree `C' of type `clause' such that
%% `clause_patterns(C)' is a nonempty list.
%%
-%% @see named_fun_expr/1
+%% @see named_fun_expr/2
%% @see named_fun_expr_clauses/1
%% @see clause/3
%% @see clause_patterns/1
diff --git a/lib/syntax_tools/vsn.mk b/lib/syntax_tools/vsn.mk
index 6cafc4dd55..26153a55f1 100644
--- a/lib/syntax_tools/vsn.mk
+++ b/lib/syntax_tools/vsn.mk
@@ -1 +1 @@
-SYNTAX_TOOLS_VSN = 1.6.12
+SYNTAX_TOOLS_VSN = 1.6.13
diff --git a/lib/wx/api_gen/gen_util.erl b/lib/wx/api_gen/gen_util.erl
index 2ba1c6e16f..9b08815bf7 100644
--- a/lib/wx/api_gen/gen_util.erl
+++ b/lib/wx/api_gen/gen_util.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -222,11 +222,12 @@ halt(Reason) ->
erl_copyright() ->
StartYear = start_year(get(current_class)),
+ {CurrentYear,_,_} = erlang:date(),
w("%%~n",[]),
w("%% %CopyrightBegin%~n",[]),
w("%%~n",[]),
- w("%% Copyright Ericsson AB ~p-2013. All Rights Reserved.~n",
- [StartYear]),
+ w("%% Copyright Ericsson AB ~p-~p. All Rights Reserved.~n",
+ [StartYear, CurrentYear]),
w("%%~n",[]),
w("%% The contents of this file are subject to the Erlang Public License,~n",[]),
w("%% Version 1.1, (the \"License\"); you may not use this file except in~n",[]),
@@ -242,10 +243,11 @@ erl_copyright() ->
w("%% %CopyrightEnd%~n",[]).
c_copyright() ->
+ {CurrentYear,_,_} = erlang:date(),
w("/*~n",[]),
w(" * %CopyrightBegin%~n",[]),
w(" *~n",[]),
- w(" * Copyright Ericsson AB 2008-2013. All Rights Reserved.~n",[]),
+ w(" * Copyright Ericsson AB 2008-~p. All Rights Reserved.~n",[CurrentYear]),
w(" *~n",[]),
w(" * The contents of this file are subject to the Erlang Public License,~n",[]),
w(" * Version 1.1, (the \"License\"); you may not use this file except in~n",[]),
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl
index 6eed0668f6..5ac57e4929 100644
--- a/lib/wx/api_gen/wx_gen_cpp.erl
+++ b/lib/wx/api_gen/wx_gen_cpp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -190,10 +190,14 @@ gen_funcs(Defs) ->
%% w(" case WXE_REMOVE_PORT:~n", []),
%% w(" { destroyMemEnv(Ecmd.port); } break;~n", []),
w(" case DESTROY_OBJECT: {~n"),
- w(" wxObject *This = (wxObject *) getPtr(bp,memenv); "),
- w(" if(This) {"),
- w(" ((WxeApp *) wxTheApp)->clearPtr((void *) This);~n"),
- w(" delete This; }~n } break;~n"),
+ w(" wxObject *This = (wxObject *) getPtr(bp,memenv);~n"),
+ w(" if(This) {~n"),
+ w(" if(recurse_level > 1) {~n"),
+ w(" delayed_delete->Append(Ecmd.Save());~n"),
+ w(" } else {~n"),
+ w(" ((WxeApp *) wxTheApp)->clearPtr((void *) This);~n"),
+ w(" delete This; }~n"),
+ w(" } } break;~n"),
w(" case WXE_REGISTER_OBJECT: {~n"
" registerPid(bp, Ecmd.caller, memenv);~n"
" rt.addAtom(\"ok\");~n"
diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf
index ff680d0655..73c5af43d8 100644
--- a/lib/wx/api_gen/wxapi.conf
+++ b/lib/wx/api_gen/wxapi.conf
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -1883,3 +1883,5 @@
[{event,[wxEVT_TASKBAR_MOVE,wxEVT_TASKBAR_LEFT_DOWN,wxEVT_TASKBAR_LEFT_UP,
wxEVT_TASKBAR_RIGHT_DOWN,wxEVT_TASKBAR_RIGHT_UP,
wxEVT_TASKBAR_LEFT_DCLICK,wxEVT_TASKBAR_RIGHT_DCLICK]}],[]}.
+
+{class, wxInitDialogEvent, wxEvent, [{event,[wxEVT_INIT_DIALOG]}], []}.
diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in
index 5507a74c14..93a191378f 100644
--- a/lib/wx/c_src/Makefile.in
+++ b/lib/wx/c_src/Makefile.in
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2008-2012. All Rights Reserved.
+# Copyright Ericsson AB 2008-2014. 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
@@ -34,8 +34,9 @@ SO_EXT = @SO_EXT@
OBJC_CC=@OBJC_CC@
OBJC_CFLAGS=@OBJC_CFLAGS@
-GENERAL = wxe_driver wxe_ps_init wxe_impl wxePrintout wxe_return wxe_gl
-GENERAL_H = wxe_driver.h wxe_impl.h wxe_return.h
+GENERAL = wxe_driver wxe_ps_init wxe_main wxe_impl wxe_helpers wxe_callback_impl wxe_return wxe_gl
+GENERAL_H = wxe_callback_impl.h wxe_driver.h wxe_events.h wxe_gl.h \
+ wxe_helpers.h wxe_impl.h wxe_memory.h wxe_return.h
GENERATED_F = wxe_funcs wxe_events wxe_init
GENERATED_H = gen/wxe_macros.h
diff --git a/lib/wx/c_src/gen/wxe_events.cpp b/lib/wx/c_src/gen/wxe_events.cpp
index fb3a065448..a1b4d090b3 100644
--- a/lib/wx/c_src/gen/wxe_events.cpp
+++ b/lib/wx/c_src/gen/wxe_events.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -297,6 +297,7 @@ void initEventTable()
{wxEVT_TASKBAR_RIGHT_UP, 227, "taskbar_right_up"},
{wxEVT_TASKBAR_LEFT_DCLICK, 227, "taskbar_left_dclick"},
{wxEVT_TASKBAR_RIGHT_DCLICK, 227, "taskbar_right_dclick"},
+ {wxEVT_INIT_DIALOG, 228, "init_dialog"},
{-1, 0, }
};
for(int i=0; event_types[i].ev_type != -1; i++) {
@@ -814,6 +815,13 @@ case 227: {// wxTaskBarIconEvent
rt.addTupleCount(2);
break;
}
+case 228: {// wxInitDialogEvent
+ evClass = (char*)"wxInitDialogEvent";
+ rt.addAtom((char*)"wxInitDialog");
+ rt.addAtom(Etype->eName);
+ rt.addTupleCount(2);
+ break;
+}
}
rt.addTupleCount(5);
diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp
index 329af36f4d..82dd414911 100644
--- a/lib/wx/c_src/gen/wxe_funcs.cpp
+++ b/lib/wx/c_src/gen/wxe_funcs.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -45,9 +45,14 @@ void WxeApp::wxe_dispatch(wxeCommand& Ecmd)
switch (Ecmd.op)
{
case DESTROY_OBJECT: {
- wxObject *This = (wxObject *) getPtr(bp,memenv); if(This) { ((WxeApp *) wxTheApp)->clearPtr((void *) This);
- delete This; }
- } break;
+ wxObject *This = (wxObject *) getPtr(bp,memenv);
+ if(This) {
+ if(recurse_level > 1) {
+ delayed_delete->Append(Ecmd.Save());
+ } else {
+ ((WxeApp *) wxTheApp)->clearPtr((void *) This);
+ delete This; }
+ } } break;
case WXE_REGISTER_OBJECT: {
registerPid(bp, Ecmd.caller, memenv);
rt.addAtom("ok");
diff --git a/lib/wx/c_src/wxePrintout.cpp b/lib/wx/c_src/wxe_callback_impl.cpp
index fc8782ba95..8ba2557d82 100644
--- a/lib/wx/c_src/wxePrintout.cpp
+++ b/lib/wx/c_src/wxe_callback_impl.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -20,9 +20,49 @@
#include <wx/wx.h>
#include "wxe_impl.h"
#include "wxe_return.h"
+#include "wxe_events.h"
+#include "wxe_gl.h"
#include "gen/wxe_macros.h"
#include "gen/wxe_derived_dest.h"
+
+/* ****************************************************************************
+ * CallbackData *
+ * ****************************************************************************/
+
+wxeCallbackData::wxeCallbackData(ErlDrvTermData caller, int req, char *req_type,
+ int funcb, int skip_ev, wxeErlTerm * userData,
+ wxeEvtListener *handler_cb)
+ : wxObject()
+{
+ listener = caller;
+ obj = req;
+ fun_id = funcb;
+ strcpy(class_name, req_type);
+ skip = skip_ev;
+ user_data = userData;
+ handler = handler_cb;
+}
+
+wxeCallbackData::~wxeCallbackData() {
+ // fprintf(stderr, "CBD Deleteing %p %s\r\n", this, class_name); fflush(stderr);
+ if(user_data) {
+ delete user_data;
+ }
+ ptrMap::iterator it;
+ it = ((WxeApp *)wxTheApp)->ptr2ref.find(handler);
+ if(it != ((WxeApp *)wxTheApp)->ptr2ref.end()) {
+ wxeRefData *refd = it->second;
+ wxeReturn rt = wxeReturn(WXE_DRV_PORT, refd->memenv->owner, false);
+ rt.addAtom("wx_delete_cb");
+ rt.addInt(fun_id);
+ rt.addRef(refd->ref, "wxeEvtListener");
+ rt.addRef(obj, class_name);
+ rt.addTupleCount(4);
+ rt.send();
+ }
+}
+
/* *****************************************************************/
/* Special Class impls */
@@ -228,6 +268,35 @@ EwxListCtrl::~EwxListCtrl() {
clear_cb(port, onGetItemColumnImage);
((WxeApp *)wxTheApp)->clearPtr(this);
}
+
+/* ****************************************************************************
+ * wxListCtrlCompare wrapper
+ * ****************************************************************************/
+
+int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr)
+{
+ callbackInfo * cb = (callbackInfo *)callbackInfoPtr;
+ wxeMemEnv * memenv = ((WxeApp *) wxTheApp)->getMemEnv(cb->port);
+ wxeReturn rt = wxeReturn(WXE_DRV_PORT, memenv->owner, false);
+ rt.addInt(cb->callbackID);
+ rt.addInt(item1);
+ rt.addInt(item2);
+ rt.endList(2);
+ rt.addAtom("_wx_invoke_cb_");
+ rt.addTupleCount(3);
+ rt.send();
+ handle_event_callback(WXE_DRV_PORT_HANDLE, memenv->owner);
+
+ if(((WxeApp *) wxTheApp)->cb_buff) {
+ int res = * (int*) ((WxeApp *) wxTheApp)->cb_buff;
+ driver_free(((WxeApp *) wxTheApp)->cb_buff);
+ ((WxeApp *) wxTheApp)->cb_buff = NULL;
+ return res;
+ }
+ return 0;
+}
+
+
// tools
void clear_cb(ErlDrvTermData port, int callback)
diff --git a/lib/wx/c_src/wxe_callback_impl.h b/lib/wx/c_src/wxe_callback_impl.h
new file mode 100644
index 0000000000..c7243e23a4
--- /dev/null
+++ b/lib/wx/c_src/wxe_callback_impl.h
@@ -0,0 +1,75 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. 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%
+ */
+
+#ifndef _WXE_CALLBACK_IMPL_H
+#define _WXE_CALLBACK_IMPL_H
+
+void pre_callback();
+void handle_event_callback(ErlDrvPort port, ErlDrvTermData process);
+
+class wxEPrintout : public wxPrintout
+{
+ public:
+ wxEPrintout(wxString Title, int onPrintP, int onPrepareP,
+ int onBeginP, int onEndP,
+ int onBeginD, int onEndD,
+ int hasP, int getPageI, ErlDrvTermData Port) :
+ wxPrintout(Title),
+ onPrintPage(onPrintP), onPreparePrinting(onPrepareP),
+ onBeginPrinting(onBeginP), onEndPrinting(onEndP),
+ onBeginDocument(onBeginD), onEndDocument(onEndD), hasPage(hasP), getPageInfo(getPageI),
+ port(Port)
+ { } ;
+
+ ~wxEPrintout();
+
+ bool OnBeginDocument(int startPage, int endPage);
+ void OnEndDocument();
+ void OnBeginPrinting();
+ void OnEndPrinting();
+
+ void OnPreparePrinting();
+
+ bool HasPage(int page);
+ bool OnPrintPage(int page);
+ void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
+
+ int onPrintPage;
+ int onPreparePrinting;
+ int onBeginPrinting;
+ int onEndPrinting;
+ int onBeginDocument;
+ int onEndDocument;
+ int hasPage;
+ int getPageInfo;
+
+ ErlDrvTermData port;
+};
+
+void clear_cb(ErlDrvTermData port, int callback);
+
+// Implementation of wxListCtrlCompare
+struct callbackInfo {
+ ErlDrvTermData port;
+ int callbackID;
+};
+
+int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr);
+
+#endif
diff --git a/lib/wx/c_src/wxe_driver.c b/lib/wx/c_src/wxe_driver.c
index 4d3aa577bf..ea52737fa2 100644
--- a/lib/wx/c_src/wxe_driver.c
+++ b/lib/wx/c_src/wxe_driver.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -195,7 +195,7 @@ void wxe_process_died(ErlDrvData handle, ErlDrvMonitor *monitor)
{
/* Callback is active for the dead process */
wxe_data *sd = ((wxe_data *)handle);
- push_command(WXE_CB_RETURN,NULL,0,sd);
+ push_command(WXE_CB_DIED,NULL,0,sd);
/* ErlDrvTermData pid; */
/* pid = driver_get_monitored_process(sd->port_handle, monitor); */
diff --git a/lib/wx/c_src/wxe_driver.h b/lib/wx/c_src/wxe_driver.h
index 0f0143bd4c..e35bbe2118 100644
--- a/lib/wx/c_src/wxe_driver.h
+++ b/lib/wx/c_src/wxe_driver.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -89,6 +89,7 @@ extern char * erl_wx_privdir;
#define WXE_BIN_INCR 11
#define WXE_BIN_DECR 12
#define WXE_INIT_OPENGL 13
+#define WXE_CB_DIED 14
#define OPENGL_START 5000
diff --git a/lib/wx/c_src/wxe_events.h b/lib/wx/c_src/wxe_events.h
index 718e0ad120..22a737d854 100644
--- a/lib/wx/c_src/wxe_events.h
+++ b/lib/wx/c_src/wxe_events.h
@@ -1,20 +1,20 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2014. 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%
+ *
+ * %CopyrightEnd%
*/
#ifndef __WXE_EVENT_H__
@@ -22,6 +22,8 @@
#include "wxe_driver.h"
+bool sendevent(wxEvent * event, ErlDrvTermData port);
+
class wxeEtype
{
public:
diff --git a/lib/wx/c_src/wxe_gl.cpp b/lib/wx/c_src/wxe_gl.cpp
index 34904397d3..a9feb23831 100644
--- a/lib/wx/c_src/wxe_gl.cpp
+++ b/lib/wx/c_src/wxe_gl.cpp
@@ -1,20 +1,20 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2014. 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%
+ *
+ * %CopyrightEnd%
*/
#include <stdio.h>
@@ -26,8 +26,9 @@
#endif
#include "wxe_impl.h"
#include "wxe_return.h"
+#include "wxe_gl.h"
-/* ****************************************************************************
+/* ****************************************************************************
* Opengl context management *
* ****************************************************************************/
@@ -138,7 +139,7 @@ void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
else {
ErlDrvTermData rt[] = // Error msg
{ERL_DRV_ATOM, driver_mk_atom((char *) "_egl_error_"),
- ERL_DRV_INT, op,
+ ERL_DRV_INT, (ErlDrvTermData) op,
ERL_DRV_ATOM, driver_mk_atom((char *) "no_gl_context"),
ERL_DRV_TUPLE,3};
erl_drv_send_term(WXE_DRV_PORT,caller,rt,8);
diff --git a/lib/wx/c_src/wxe_gl.h b/lib/wx/c_src/wxe_gl.h
index 1b556ff4ec..dc117bf610 100644
--- a/lib/wx/c_src/wxe_gl.h
+++ b/lib/wx/c_src/wxe_gl.h
@@ -1,22 +1,35 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2010. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2014. 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%
+ *
+ * %CopyrightEnd%
*/
+#ifndef _WXE_GL_H
+#define _WXE_GL_H
+
#include "egl_impl.h"
+#include "wxe_return.h"
+void activateGL(ErlDrvTermData caller);
+void setActiveGL(ErlDrvTermData caller, wxGLCanvas *canvas);
+void deleteActiveGL(wxGLCanvas *canvas);
void wxe_initOpenGL(wxeReturn, char*);
+void gl_dispatch(int op, char *bp, ErlDrvTermData caller, WXEBinRef *bins[]);
+
+WX_DECLARE_HASH_MAP(ErlDrvTermData, wxGLCanvas*, wxIntegerHash, wxIntegerEqual, wxeGLC);
+extern wxeGLC glc;
+
+#endif
diff --git a/lib/wx/c_src/wxe_helpers.cpp b/lib/wx/c_src/wxe_helpers.cpp
new file mode 100644
index 0000000000..15d75080d9
--- /dev/null
+++ b/lib/wx/c_src/wxe_helpers.cpp
@@ -0,0 +1,95 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. 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 <wx/wx.h>
+#include "wxe_impl.h"
+
+/* ****************************************************************************
+ * Erlang Commands
+ * ****************************************************************************/
+
+wxeCommand::wxeCommand(int fc,char * cbuf,int buflen, wxe_data *sd)
+ : wxObject()
+{
+ WXEBinRef *temp, *start, *prev;
+ int n = 0;
+ ref_count = 1;
+ caller = driver_caller(sd->port_handle);
+ port = sd->port;
+ op = fc;
+ len = buflen;
+ bin[0] = NULL;
+ bin[1] = NULL;
+ bin[2] = NULL;
+
+ if(cbuf) {
+ buffer = (char *) driver_alloc(len);
+ memcpy((void *) buffer, (void *) cbuf, len);;
+
+ temp = sd->bin;
+
+ prev = NULL;
+ start = temp;
+
+ while(temp) {
+ if(caller == temp->from) {
+ bin[n++] = temp;
+ if(prev) {
+ prev->next = temp->next;
+ } else {
+ start = temp->next;
+ }
+ temp = temp->next;
+ } else {
+ prev = temp;
+ temp = temp->next;
+ }
+ }
+ sd->bin = start;
+ } else { // No-op only PING currently
+ buffer = NULL;
+ }
+}
+
+wxeCommand::~wxeCommand() {
+ int n = 0;
+ if(buffer) {
+ while(bin[n]) {
+ if(bin[n]->bin)
+ driver_free_binary(bin[n]->bin);
+ driver_free(bin[n++]);
+ }
+ driver_free(buffer);
+ }
+}
+
+/* ****************************************************************************
+ * TreeItemData
+ * ****************************************************************************/
+
+wxETreeItemData::wxETreeItemData(int sz, char * data) {
+ size = sz;
+ bin = (char *) driver_alloc(sz);
+ memcpy(bin, data, sz);
+}
+
+wxETreeItemData::~wxETreeItemData()
+{
+ driver_free(bin);
+}
diff --git a/lib/wx/c_src/wxe_helpers.h b/lib/wx/c_src/wxe_helpers.h
new file mode 100644
index 0000000000..659bc666c6
--- /dev/null
+++ b/lib/wx/c_src/wxe_helpers.h
@@ -0,0 +1,122 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. 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%
+ */
+
+#ifndef _WXE_HELPER_H
+#define _WXE_HELPER_H
+
+DECLARE_EVENT_TYPE(wxeEVT_META_COMMAND, -1)
+
+class wxeMetaCommand : public wxEvent
+{
+ public:
+ wxeMetaCommand(wxe_data *sd, int EvId)
+ : wxEvent(EvId, wxeEVT_META_COMMAND)
+ { caller = driver_caller(sd->port_handle); port = sd->port; pdl = sd->pdl; } ;
+ wxeMetaCommand(const wxeMetaCommand& event)
+ : wxEvent(event)
+ { caller = event.caller; port = event.port; pdl = event.pdl; };
+ virtual ~wxeMetaCommand() {};
+ virtual wxEvent *Clone() const { return new wxeMetaCommand(*this); }
+
+ ErlDrvTermData caller;
+ ErlDrvTermData port;
+ ErlDrvPDL pdl;
+};
+
+class wxeCommand : public wxObject
+{
+ public:
+ wxeCommand(int fc,char * cbuf,int buflen, wxe_data *);
+ virtual ~wxeCommand(); // Use Delete()
+
+ wxeCommand * Save() {ref_count++; return this; };
+ void Delete() {if(--ref_count < 1) delete this;};
+
+ ErlDrvTermData caller;
+ ErlDrvTermData port;
+ WXEBinRef * bin[3];
+ char * buffer;
+ int len;
+ int op;
+ int ref_count;
+};
+
+class intListElement {
+ public:
+ intListElement(int Element) {car = Element; cdr = NULL;};
+ intListElement(int Element, intListElement *list)
+ {car = Element; cdr = list;};
+ int car;
+ intListElement *cdr;
+};
+
+class intList {
+ public:
+ intList() {list = NULL;};
+ ~intList() {
+ intListElement *head = list;
+ while(head) {
+ intListElement *tail=head->cdr;
+ delete head;
+ head = tail;
+ } };
+ bool IsEmpty() {return list == NULL;};
+ void Append(int Element) { list = new intListElement(Element, list); };
+ int Pop() {
+ intListElement *temp = list;
+ int res = list->car;
+ list = temp->cdr;
+ delete temp;
+ return res;
+ }
+ intListElement *list;
+};
+
+class wxe_badarg
+{
+ public:
+ wxe_badarg(int Ref) : ref(Ref) { } ;
+ int ref;
+};
+
+class wxeErlTerm : public wxClientData
+{
+ public:
+ wxeErlTerm(WXEBinRef * data)
+ {
+ size = data->size;
+ bin = (char *) driver_alloc(size);
+ memcpy(bin, data->base, size);
+ } ;
+ ~wxeErlTerm() { driver_free(bin); };
+ char * bin;
+ int size;
+};
+
+class wxETreeItemData : public wxTreeItemData
+{
+ public:
+ wxETreeItemData(int sz, char * data);
+ ~wxETreeItemData();
+
+ int size;
+ char * bin;
+};
+
+#endif
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index cc9bcc9957..5964ccfd00 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -23,10 +23,6 @@
#include <wx/wx.h>
-#if defined(_WIN32)
-#include <wx/msw/private.h> // for wxSetInstance
-#endif
-
// Avoid including these in dcbuffer below
#include "wx/dcmemory.h"
#include "wx/dcclient.h"
@@ -34,12 +30,12 @@
// Ok ugly but needed for wxBufferedDC crash workaround
#define private public
#include <wx/dcbuffer.h>
-
#undef private
#include "wxe_impl.h"
#include "wxe_events.h"
#include "wxe_return.h"
+#include "wxe_gl.h"
IMPLEMENT_APP_NO_MAIN(WxeApp)
@@ -47,120 +43,21 @@ DECLARE_APP(WxeApp)
DEFINE_EVENT_TYPE(wxeEVT_META_COMMAND)
-#define WXE_NOT_INITIATED 0
-#define WXE_INITIATED 1
-#define WXE_EXITED 2
-#define WXE_ERROR -1
-
#define WXE_NORMAL 0
#define WXE_CALLBACK 1
#define WXE_STORED 2
-ErlDrvTid wxe_thread;
-
-ErlDrvMutex *wxe_status_m;
-ErlDrvCond *wxe_status_c;
-
-ErlDrvMutex * wxe_batch_locker_m;
-ErlDrvCond * wxe_batch_locker_c;
-
-static int wxe_status = WXE_NOT_INITIATED;
+// Globals initiated in wxe_init.cpp
+extern ErlDrvMutex *wxe_status_m;
+extern ErlDrvCond *wxe_status_c;
+extern ErlDrvMutex * wxe_batch_locker_m;
+extern ErlDrvCond * wxe_batch_locker_c;
+extern ErlDrvTermData init_caller;
+extern int wxe_status;
wxList * wxe_batch = NULL;
wxList * wxe_batch_cb_saved = NULL;
-
-ErlDrvTermData wxe_batch_caller = 0;
-ErlDrvTermData init_caller = 0;
-
-// extern opengl
-void gl_dispatch(int op, char *bp, ErlDrvTermData caller, WXEBinRef *bins[]);
-
-
-// Until fixed in emulator
-#ifndef _WIN32
-extern "C" {
-extern void erts_thread_disable_fpe(void);
-}
-#endif
-
-#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
-#define __DARWIN__ 1
-#endif
-
-#ifdef __DARWIN__
-extern "C" {
- int erl_drv_stolen_main_thread_join(ErlDrvTid tid, void **respp);
- int erl_drv_steal_main_thread(char *name,
- ErlDrvTid *dtid,
- void* (*func)(void*),
- void* arg,
- ErlDrvThreadOpts *opts);
-}
-#endif
-
-void *wxe_main_loop(void * );
-
-/* ************************************************************
- * START AND STOP of driver thread
- * ************************************************************/
-
-int load_native_gui()
-{
- return 1;
-}
-
-int start_native_gui(wxe_data *sd)
-{
- int res;
- wxe_status_m = erl_drv_mutex_create((char *) "wxe_status_m");
- wxe_status_c = erl_drv_cond_create((char *)"wxe_status_c");
-
- wxe_batch_locker_m = erl_drv_mutex_create((char *)"wxe_batch_locker_m");
- wxe_batch_locker_c = erl_drv_cond_create((char *)"wxe_batch_locker_c");
- init_caller = driver_connected(sd->port_handle);
-
-#ifdef __DARWIN__
- res = erl_drv_steal_main_thread((char *)"wxwidgets",
- &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
-#else
- res = erl_drv_thread_create((char *)"wxwidgets",
- &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
-#endif
- if(res == 0) {
- erl_drv_mutex_lock(wxe_status_m);
- for(;wxe_status == WXE_NOT_INITIATED;) {
- erl_drv_cond_wait(wxe_status_c, wxe_status_m);
- }
- erl_drv_mutex_unlock(wxe_status_m);
- return wxe_status;
- } else {
- wxString msg;
- msg.Printf(wxT("Erlang failed to create wxe-thread %d\r\n"), res);
- send_msg("error", &msg);
- return -1;
- }
-}
-
-void stop_native_gui(wxe_data *sd)
-{
- if(wxe_status == WXE_INITIATED) {
- meta_command(WXE_SHUTDOWN, sd);
- }
-#ifdef __DARWIN__
- erl_drv_stolen_main_thread_join(wxe_thread, NULL);
-#else
- erl_drv_thread_join(wxe_thread, NULL);
-#endif
- erl_drv_mutex_destroy(wxe_status_m);
- erl_drv_cond_destroy(wxe_status_c);
- erl_drv_mutex_destroy(wxe_batch_locker_m);
- erl_drv_cond_destroy(wxe_batch_locker_c);
-}
-
-void unload_native_gui()
-{
-
-}
+int wxe_batch_caller = 0; // inside batch if larger than 0
/* ************************************************************
* Commands from erlang
@@ -169,7 +66,8 @@ void unload_native_gui()
void push_command(int op,char * buf,int len, wxe_data *sd)
{
- // fprintf(stderr, "Op %d %d\r\n", op, (int) driver_caller(sd->port_handle)),fflush(stderr);
+ /* fprintf(stderr, "Op %d %d [%ld] %d\r\n", op, (int) driver_caller(sd->port_handle),
+ wxe_batch->size(), wxe_batch_caller),fflush(stderr); */
wxeCommand *Cmd = new wxeCommand(op, buf, len, sd);
erl_drv_mutex_lock(wxe_batch_locker_m);
wxe_batch->Append(Cmd);
@@ -206,60 +104,19 @@ void meta_command(int what, wxe_data *sd) {
}
}
-/* ************************************************************
- * wxWidgets Thread
- * ************************************************************/
-
-void *wxe_main_loop(void *vpdl)
-{
- int result;
- int argc = 1;
- char * temp = (char *) "Erlang";
- char * argv[] = {temp,NULL};
- ErlDrvPDL pdl = (ErlDrvPDL) vpdl;
-
- driver_pdl_inc_refc(pdl);
-
- // Disable floating point execption if they are on.
- // This should be done in emulator but it's not in yet.
-#ifndef _WIN32
- erts_thread_disable_fpe();
-#else
- // Setup that wxWidgets should look for cursors and icons in
- // this dll and not in werl.exe (which is the default)
- HMODULE WXEHandle = GetModuleHandle(_T("wxe_driver"));
- wxSetInstance((HINSTANCE) WXEHandle);
-#endif
-
- wxe_ps_init();
- result = wxEntry(argc, argv);
- // fprintf(stderr, "WXWidgets quits main loop %d \r\n", result);
- if(result >= 0 && wxe_status == WXE_INITIATED) {
- /* We are done try to make a clean exit */
- wxe_status = WXE_EXITED;
- driver_pdl_dec_refc(pdl);
-#ifndef __DARWIN__
- erl_drv_thread_exit(NULL);
-#endif
- return NULL;
- } else {
- erl_drv_mutex_lock(wxe_status_m);
- wxe_status = WXE_ERROR;
- erl_drv_cond_signal(wxe_status_c);
- erl_drv_mutex_unlock(wxe_status_m);
- driver_pdl_dec_refc(pdl);
- return NULL;
- }
-}
-
-void WxeApp::dummy_close(wxEvent& Ev) {
- // fprintf(stderr, "Dummy Close invoked\r\n");
- // wxMac really wants a top level window which command-q quits if there are no
- // windows open, and this will kill the erlang, override default handling
+void send_msg(const char * type, wxString * msg) {
+ wxeReturn rt = wxeReturn(WXE_DRV_PORT, init_caller);
+ rt.addAtom((char *) "wxe_driver");
+ rt.addAtom((char *) type);
+ rt.add(msg);
+ rt.addTupleCount(3);
+ rt.send();
}
+/* ************************************************************
+ * Init WxeApp the application emulator
+ * ************************************************************/
-// Init wx-widgets thread
bool WxeApp::OnInit()
{
@@ -267,6 +124,9 @@ bool WxeApp::OnInit()
wxe_batch = new wxList;
wxe_batch_cb_saved = new wxList;
cb_buff = NULL;
+ recurse_level = 0;
+ delayed_cleanup = new wxList;
+ delayed_delete = new wxList;
wxe_ps_init2();
// wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); // Hmm printpreview doesn't work in 2.9 with this
@@ -304,13 +164,16 @@ void WxeApp::shutdown(wxeMetaCommand& Ecmd) {
ExitMainLoop();
}
-void send_msg(const char * type, wxString * msg) {
- wxeReturn rt = wxeReturn(WXE_DRV_PORT, init_caller);
- rt.addAtom((char *) "wxe_driver");
- rt.addAtom((char *) type);
- rt.add(msg);
- rt.addTupleCount(3);
- rt.send();
+void WxeApp::dummy_close(wxEvent& Ev) {
+ // fprintf(stderr, "Dummy Close invoked\r\n");
+ // wxMac really wants a top level window which command-q quits if there are no
+ // windows open, and this will kill the erlang, override default handling
+}
+
+// Called by wx thread
+void WxeApp::idle(wxIdleEvent& event) {
+ event.Skip(true);
+ dispatch_cmds();
}
/* ************************************************************
@@ -327,29 +190,51 @@ void handle_event_callback(ErlDrvPort port, ErlDrvTermData process)
{
WxeApp * app = (WxeApp *) wxTheApp;
ErlDrvMonitor monitor;
- driver_monitor_process(port, process, &monitor);
- // Should we be able to handle commands when recursing? probably
- erl_drv_mutex_lock(wxe_batch_locker_m);
- //fprintf(stderr, "\r\nCB EV Start %lu \r\n", process);fflush(stderr);
- app->dispatch_cb(wxe_batch, wxe_batch_cb_saved, process);
- //fprintf(stderr, "CB EV done %lu \r\n", process);fflush(stderr);
- wxe_batch_caller = 0;
- erl_drv_mutex_unlock(wxe_batch_locker_m);
- driver_demonitor_process(port, &monitor);
-}
-
-// Called by wx thread
-void WxeApp::idle(wxIdleEvent& event) {
- event.Skip(true);
- dispatch_cmds();
+ // Is thread safe if pdl have been incremented
+ if(driver_monitor_process(port, process, &monitor) == 0) {
+ // Should we be able to handle commands when recursing? probably
+ erl_drv_mutex_lock(wxe_batch_locker_m);
+ //fprintf(stderr, "\r\nCB EV Start %lu \r\n", process);fflush(stderr);
+ app->recurse_level++;
+ app->dispatch_cb(wxe_batch, wxe_batch_cb_saved, process);
+ app->recurse_level--;
+ //fprintf(stderr, "CB EV done %lu \r\n", process);fflush(stderr);
+ wxe_batch_caller = 0;
+ erl_drv_mutex_unlock(wxe_batch_locker_m);
+ driver_demonitor_process(port, &monitor);
+ }
}
-void WxeApp::dispatch_cmds() {
+void WxeApp::dispatch_cmds()
+{
erl_drv_mutex_lock(wxe_batch_locker_m);
+ recurse_level++;
int level = dispatch(wxe_batch_cb_saved, 0, WXE_STORED);
dispatch(wxe_batch, level, WXE_NORMAL);
+ recurse_level--;
wxe_batch_caller = 0;
erl_drv_mutex_unlock(wxe_batch_locker_m);
+ // Cleanup old memenv's and deleted objects
+ if(recurse_level == 0) {
+ if(delayed_delete->size() > 0)
+ for( wxList::compatibility_iterator node = delayed_delete->GetFirst();
+ node;
+ node = delayed_delete->GetFirst()) {
+ wxeCommand *event = (wxeCommand *)node->GetData();
+ delayed_delete->Erase(node);
+ wxe_dispatch(*event);
+ event->Delete();
+ }
+ if(delayed_cleanup->size() > 0)
+ for( wxList::compatibility_iterator node = delayed_cleanup->GetFirst();
+ node;
+ node = delayed_cleanup->GetFirst()) {
+ wxeMetaCommand *event = (wxeMetaCommand *)node->GetData();
+ delayed_cleanup->Erase(node);
+ destroyMemEnv(*event);
+ delete event;
+ }
+ }
}
// Should have erl_drv_mutex_lock(wxe_batch_locker_m);
@@ -401,7 +286,7 @@ int WxeApp::dispatch(wxList * batch, int blevel, int list_type)
erl_drv_mutex_lock(wxe_batch_locker_m);
break;
}
- delete event;
+ event->Delete();
}
} else {
if((list_type == WXE_STORED) || (blevel <= 0 && list_type == WXE_NORMAL)) {
@@ -433,6 +318,7 @@ void WxeApp::dispatch_cb(wxList * batch, wxList * temp, ErlDrvTermData process)
// fprintf(stderr, " Ev %d %lu\r\n", event->op, event->caller);
if(event->caller == process || // Callbacks from CB process only
event->op == WXE_CB_START || // Event callback start change process
+ event->op == WXE_CB_DIED || // Event callback process died
// Allow connect_cb during CB i.e. msg from wxe_server.
(memenv && event->caller == memenv->owner))
{
@@ -445,7 +331,8 @@ void WxeApp::dispatch_cb(wxList * batch, wxList * temp, ErlDrvTermData process)
if(event->len > 0) {
cb_buff = (char *) driver_alloc(event->len);
memcpy(cb_buff, event->buffer, event->len);
- }
+ } // continue
+ case WXE_CB_DIED:
callback_returned = 1;
return;
case WXE_CB_START:
@@ -480,7 +367,7 @@ void WxeApp::dispatch_cb(wxList * batch, wxList * temp, ErlDrvTermData process)
return;
break;
}
- delete event;
+ event->Delete();
} else {
// fprintf(stderr, " save %d \r\n", event->op);
temp->Append(event);
@@ -517,7 +404,8 @@ void WxeApp::newMemEnv(wxeMetaCommand& Ecmd) {
erl_drv_send_term(WXE_DRV_PORT,Ecmd.caller,rt,2);
}
-void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
+void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd)
+{
// Clear incoming cmd queue first
// dispatch_cmds();
wxWindow *parent = NULL;
@@ -536,26 +424,33 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
ptrMap::iterator it = ptr2ref.find(ptr);
if(it != ptr2ref.end()) {
wxeRefData *refd = it->second;
- if(refd->alloc_in_erl) {
- if(refd->type == 2) {
- wxDialog *win = (wxDialog *) ptr;
- if(win->IsModal()) {
- win->EndModal(-1);
- }
- parent = win->GetParent();
- if(parent) {
- ptrMap::iterator parentRef = ptr2ref.find(parent);
- if(parentRef == ptr2ref.end()) {
- // The parent is already dead delete the parent ref
- win->SetParent(NULL);
- }
+ if(refd->alloc_in_erl && refd->type == 2) {
+ wxDialog *win = (wxDialog *) ptr;
+ if(win->IsModal()) {
+ win->EndModal(-1);
+ }
+ parent = win->GetParent();
+ if(parent) {
+ ptrMap::iterator parentRef = ptr2ref.find(parent);
+ if(parentRef == ptr2ref.end()) {
+ // The parent is already dead delete the parent ref
+ win->SetParent(NULL);
}
+ }
+ if(recurse_level > 0) {
+ // Delay delete until we are out of dispatch*
+ delayed_cleanup->Append(Ecmd.Clone());
+ } else {
delete win;
}
}
}
}
}
+
+ if(recurse_level > 0)
+ return;
+
// First pass, delete all top parents/windows of all linked objects
// fprintf(stderr, "close port %x\r\n", Ecmd.port);fflush(stderr);
@@ -780,161 +675,3 @@ void WxeApp::registerPid(char * bp, ErlDrvTermData pid, wxeMemEnv * memenv) {
};
throw wxe_badarg(index);
}
-
-
-/* ************************************************************
- * Misc utility classes
- * ************************************************************/
-
-/* ****************************************************************************
- * Memory handling
- * ****************************************************************************/
-
-wxeMemEnv::wxeMemEnv() {
- ref2ptr = (void **) driver_alloc(128*sizeof(void *));
- ref2ptr[0] = NULL;
- next = 1;
- max = 128;
-}
-
-wxeMemEnv::~wxeMemEnv() {
- driver_free(ref2ptr);
-}
-
-/* ****************************************************************************
- * Erlang Commands (don't need to be derived of wxEvent anymore should
- * be re-written to own class struct)
- * ****************************************************************************/
-
-wxeCommand::wxeCommand(int fc,char * cbuf,int buflen, wxe_data *sd)
- : wxObject()
-{
- WXEBinRef *temp, *start, *prev;
- int n = 0;
- caller = driver_caller(sd->port_handle);
- port = sd->port;
- op = fc;
- len = buflen;
- bin[0] = NULL;
- bin[1] = NULL;
- bin[2] = NULL;
-
- if(cbuf) {
- buffer = (char *) driver_alloc(len);
- memcpy((void *) buffer, (void *) cbuf, len);;
-
- temp = sd->bin;
-
- prev = NULL;
- start = temp;
-
- while(temp) {
- if(caller == temp->from) {
- bin[n++] = temp;
- if(prev) {
- prev->next = temp->next;
- } else {
- start = temp->next;
- }
- temp = temp->next;
- } else {
- prev = temp;
- temp = temp->next;
- }
- }
- sd->bin = start;
- } else { // No-op only PING currently
- buffer = NULL;
- }
-}
-
-wxeCommand::~wxeCommand() {
- int n = 0;
- if(buffer) {
- while(bin[n]) {
- if(bin[n]->bin)
- driver_free_binary(bin[n]->bin);
- driver_free(bin[n++]);
- }
- driver_free(buffer);
- }
-}
-
-/* ****************************************************************************
- * TreeItemData
- * ****************************************************************************/
-
-wxETreeItemData::wxETreeItemData(int sz, char * data) {
- size = sz;
- bin = (char *) driver_alloc(sz);
- memcpy(bin, data, sz);
-}
-
-wxETreeItemData::~wxETreeItemData()
-{
- driver_free(bin);
-}
-
-/* ****************************************************************************
- * CallbackData *
- * ****************************************************************************/
-
-wxeCallbackData::wxeCallbackData(ErlDrvTermData caller, int req, char *req_type,
- int funcb, int skip_ev, wxeErlTerm * userData,
- wxeEvtListener *handler_cb)
- : wxObject()
-{
- listener = caller;
- obj = req;
- fun_id = funcb;
- strcpy(class_name, req_type);
- skip = skip_ev;
- user_data = userData;
- handler = handler_cb;
-}
-
-wxeCallbackData::~wxeCallbackData() {
- // fprintf(stderr, "CBD Deleteing %p %s\r\n", this, class_name); fflush(stderr);
- if(user_data) {
- delete user_data;
- }
- ptrMap::iterator it;
- it = ((WxeApp *)wxTheApp)->ptr2ref.find(handler);
- if(it != ((WxeApp *)wxTheApp)->ptr2ref.end()) {
- wxeRefData *refd = it->second;
- wxeReturn rt = wxeReturn(WXE_DRV_PORT, refd->memenv->owner, false);
- rt.addAtom("wx_delete_cb");
- rt.addInt(fun_id);
- rt.addRef(refd->ref, "wxeEvtListener");
- rt.addRef(obj, class_name);
- rt.addTupleCount(4);
- rt.send();
- }
-}
-
-/* ****************************************************************************
- * wxListCtrlCompare wrapper
- * ****************************************************************************/
-
-int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr)
-{
- callbackInfo * cb = (callbackInfo *)callbackInfoPtr;
- wxeMemEnv * memenv = ((WxeApp *) wxTheApp)->getMemEnv(cb->port);
- wxeReturn rt = wxeReturn(WXE_DRV_PORT, memenv->owner, false);
- rt.addInt(cb->callbackID);
- rt.addInt(item1);
- rt.addInt(item2);
- rt.endList(2);
- rt.addAtom("_wx_invoke_cb_");
- rt.addTupleCount(3);
- rt.send();
- handle_event_callback(WXE_DRV_PORT_HANDLE, memenv->owner);
-
- if(((WxeApp *) wxTheApp)->cb_buff) {
- int res = * (int*) ((WxeApp *) wxTheApp)->cb_buff;
- driver_free(((WxeApp *) wxTheApp)->cb_buff);
- ((WxeApp *) wxTheApp)->cb_buff = NULL;
- return res;
- }
- return 0;
-}
diff --git a/lib/wx/c_src/wxe_impl.h b/lib/wx/c_src/wxe_impl.h
index a3c57e2598..bb54961edd 100644
--- a/lib/wx/c_src/wxe_impl.h
+++ b/lib/wx/c_src/wxe_impl.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -14,12 +14,17 @@
* the License for the specific language governing rights and limitations
* under the License.
*
- * %CopyrightEnd%
+ * %CopyrightEnd%
*/
#ifndef _WXE_IMPL_H
#define _WXE_IMPL_H
+#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
+#define __DARWIN__ 1
+#endif
+
+
#include <wx/glcanvas.h>
#include <wx/treectrl.h>
#include <wx/print.h>
@@ -27,119 +32,16 @@ extern "C" {
#include "wxe_driver.h"
}
-DECLARE_EVENT_TYPE(wxeEVT_META_COMMAND, -1)
-
-class wxeMetaCommand : public wxEvent
-{
- public:
- wxeMetaCommand(wxe_data *sd, int EvId)
- : wxEvent(EvId, wxeEVT_META_COMMAND)
- { caller = driver_caller(sd->port_handle); port = sd->port; pdl = sd->pdl; } ;
- wxeMetaCommand(const wxeMetaCommand& event)
- : wxEvent(event)
- { caller = event.caller; port = event.port; pdl = event.pdl; };
- virtual ~wxeMetaCommand() {};
- virtual wxEvent *Clone() const { return new wxeMetaCommand(*this); }
-
- ErlDrvTermData caller;
- ErlDrvTermData port;
- ErlDrvPDL pdl;
-};
-
-class wxeCommand : public wxObject
-{
- public:
- wxeCommand(int fc,char * cbuf,int buflen, wxe_data *);
- virtual ~wxeCommand();
-
- ErlDrvTermData caller;
- ErlDrvTermData port;
- WXEBinRef * bin[3];
- char * buffer;
- int len;
- int op;
-};
-
-#define WXE_EVENT_PTR 0
-#define WXE_OBJECT_PTR 1
-
-class intListElement {
-public:
- intListElement(int Element) {car = Element; cdr = NULL;};
- intListElement(int Element, intListElement *list)
- {car = Element; cdr = list;};
- int car;
- intListElement *cdr;
-};
-
-class intList {
-public:
- intList() {list = NULL;};
- bool IsEmpty() {return list == NULL;};
- void Append(int Element) { list = new intListElement(Element, list); };
- int Pop() {
- intListElement *temp = list;
- int res = list->car;
- list = temp->cdr;
- delete temp;
- return res;
- }
- intListElement *list;
-};
-
-class wxe_badarg
-{
-public:
- wxe_badarg(int Ref) : ref(Ref) { } ;
- int ref;
-};
-
-class wxeErlTerm : public wxClientData
-{
- public:
- wxeErlTerm(WXEBinRef * data)
- {
- size = data->size;
- bin = (char *) driver_alloc(size);
- memcpy(bin, data->base, size);
- } ;
- ~wxeErlTerm() { driver_free(bin); };
- char * bin;
- int size;
-};
-
-class wxeMemEnv
-{
-public:
- wxeMemEnv();
- int next;
- int max;
- void ** ref2ptr;
- intList free;
- ~wxeMemEnv();
- ErlDrvTermData owner;
-};
-
-class wxeRefData {
- public:
- wxeRefData(unsigned int dref, int ttype, int is_new, wxeMemEnv *menv) :
- ref(dref), type(ttype), alloc_in_erl(is_new), memenv(menv), pid(-1) { } ;
- int ref;
- int type;
- // 0 = wxWindow subclasses, 1 = wxObject subclasses
- // 2 = wxDialog subclasses, 3 = allocated wxObjects but not returned from new
- // > 3 classes which lack virtual destr, or are supposed to be allocated on
- // the stack
- bool alloc_in_erl;
- wxeMemEnv *memenv;
- ErlDrvTermData pid;
-};
-
-WX_DECLARE_HASH_MAP(ErlDrvTermData, wxGLCanvas*, wxIntegerHash, wxIntegerEqual, wxeGLC);
-WX_DECLARE_HASH_MAP(ErlDrvTermData, wxeMemEnv*, wxIntegerHash, wxIntegerEqual, wxeMemMap);
+#include "wxe_helpers.h"
+#include "wxe_callback_impl.h"
+#include "wxe_memory.h"
+#define WXE_NOT_INITIATED 0
+#define WXE_INITIATED 1
+#define WXE_EXITED 2
+#define WXE_ERROR -1
-WX_DECLARE_VOIDPTR_HASH_MAP(wxeRefData *, ptrMap);
+void send_msg(const char *, wxString *); // For debugging and error msgs
class WxeApp : public wxApp
{
@@ -158,101 +60,31 @@ public:
void dummy_close(wxEvent& Ev);
bool sendevent(wxEvent *event);
- // MemEnv handling
+ // MemEnv handling
void newMemEnv(wxeMetaCommand& event);
void destroyMemEnv(wxeMetaCommand& event);
wxeMemEnv * getMemEnv(ErlDrvTermData port);
-
+
int newPtr(void * ptr, int type, wxeMemEnv *memenv);
int getRef(void * ptr, wxeMemEnv *memenv);
- void * getPtr(char * bp, wxeMemEnv *memenv);
+ void * getPtr(char * bp, wxeMemEnv *memenv);
void clearPtr(void *ptr);
void registerPid(char *ptr, ErlDrvTermData pid, wxeMemEnv *memenv);
- void init_nonconsts(wxeMemEnv *memenv, ErlDrvTermData caller);
-
+ void init_nonconsts(wxeMemEnv *memenv, ErlDrvTermData caller);
+
// Code found in gen/wxe_derived_dest.h
void delete_object(void *ptr, wxeRefData *refd);
-
+
wxeMemMap refmap;
ptrMap ptr2ref;
wxeMemEnv * global_me;
-
+
+ int recurse_level;
+ wxList * delayed_cleanup;
+ wxList * delayed_delete;
// Temp container for callbacks
char *cb_buff;
int cb_len;
};
-class wxETreeItemData : public wxTreeItemData
-{
- public:
- wxETreeItemData(int sz, char * data);
-
- ~wxETreeItemData();
-
- int size;
- char * bin;
-};
-
-bool sendevent(wxEvent * event, ErlDrvTermData port);
-void pre_callback();
-void handle_event_callback(ErlDrvPort port, ErlDrvTermData process);
-
-void activateGL(ErlDrvTermData caller);
-void setActiveGL(ErlDrvTermData caller, wxGLCanvas *canvas);
-void deleteActiveGL(wxGLCanvas *canvas);
-
-void send_msg(const char *, wxString *); // For debugging and error msgs
-
-extern wxeGLC glc;
-
-class wxEPrintout : public wxPrintout
-{
- public:
- wxEPrintout(wxString Title, int onPrintP, int onPrepareP,
- int onBeginP, int onEndP,
- int onBeginD, int onEndD,
- int hasP, int getPageI, ErlDrvTermData Port) :
- wxPrintout(Title),
- onPrintPage(onPrintP), onPreparePrinting(onPrepareP),
- onBeginPrinting(onBeginP), onEndPrinting(onEndP),
- onBeginDocument(onBeginD), onEndDocument(onEndD), hasPage(hasP), getPageInfo(getPageI),
- port(Port)
- { } ;
-
- ~wxEPrintout();
-
- bool OnBeginDocument(int startPage, int endPage);
- void OnEndDocument();
- void OnBeginPrinting();
- void OnEndPrinting();
-
- void OnPreparePrinting();
-
- bool HasPage(int page);
- bool OnPrintPage(int page);
- void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
-
- int onPrintPage;
- int onPreparePrinting;
- int onBeginPrinting;
- int onEndPrinting;
- int onBeginDocument;
- int onEndDocument;
- int hasPage;
- int getPageInfo;
-
- ErlDrvTermData port;
-};
-
-void clear_cb(ErlDrvTermData port, int callback);
-
-
-// Implementation of wxListCtrlCompare
-struct callbackInfo {
- ErlDrvTermData port;
- int callbackID;
-};
-
-int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr);
-
#endif //_WXE_IMPL_H
diff --git a/lib/wx/c_src/wxe_main.cpp b/lib/wx/c_src/wxe_main.cpp
new file mode 100644
index 0000000000..2bec2422c9
--- /dev/null
+++ b/lib/wx/c_src/wxe_main.cpp
@@ -0,0 +1,163 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. 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%
+ */
+
+#if defined(_WIN32)
+#include <wx/msw/private.h> // for wxSetInstance
+#endif
+
+#include "wxe_impl.h"
+
+// Until fixed in emulator
+#ifndef _WIN32
+extern "C" {
+ extern void erts_thread_disable_fpe(void);
+}
+#endif
+
+ErlDrvTid wxe_thread;
+
+ErlDrvMutex *wxe_status_m;
+ErlDrvCond *wxe_status_c;
+
+int wxe_status = WXE_NOT_INITIATED;
+
+ErlDrvMutex * wxe_batch_locker_m;
+ErlDrvCond * wxe_batch_locker_c;
+ErlDrvTermData init_caller = 0;
+
+#ifdef __DARWIN__
+extern "C" {
+ int erl_drv_stolen_main_thread_join(ErlDrvTid tid, void **respp);
+ int erl_drv_steal_main_thread(char *name,
+ ErlDrvTid *dtid,
+ void* (*func)(void*),
+ void* arg,
+ ErlDrvThreadOpts *opts);
+}
+#endif
+
+void *wxe_main_loop(void * );
+
+/* ************************************************************
+ * START AND STOP of driver thread
+ * ************************************************************/
+
+int load_native_gui()
+{
+ return 1;
+}
+
+int start_native_gui(wxe_data *sd)
+{
+ int res;
+ wxe_status_m = erl_drv_mutex_create((char *) "wxe_status_m");
+ wxe_status_c = erl_drv_cond_create((char *)"wxe_status_c");
+
+ wxe_batch_locker_m = erl_drv_mutex_create((char *)"wxe_batch_locker_m");
+ wxe_batch_locker_c = erl_drv_cond_create((char *)"wxe_batch_locker_c");
+ init_caller = driver_connected(sd->port_handle);
+
+#ifdef __DARWIN__
+ res = erl_drv_steal_main_thread((char *)"wxwidgets",
+ &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
+#else
+ res = erl_drv_thread_create((char *)"wxwidgets",
+ &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
+#endif
+ if(res == 0) {
+ erl_drv_mutex_lock(wxe_status_m);
+ for(;wxe_status == WXE_NOT_INITIATED;) {
+ erl_drv_cond_wait(wxe_status_c, wxe_status_m);
+ }
+ erl_drv_mutex_unlock(wxe_status_m);
+ return wxe_status;
+ } else {
+ wxString msg;
+ msg.Printf(wxT("Erlang failed to create wxe-thread %d\r\n"), res);
+ send_msg("error", &msg);
+ return -1;
+ }
+}
+
+void stop_native_gui(wxe_data *sd)
+{
+ if(wxe_status == WXE_INITIATED) {
+ meta_command(WXE_SHUTDOWN, sd);
+ }
+#ifdef __DARWIN__
+ erl_drv_stolen_main_thread_join(wxe_thread, NULL);
+#else
+ erl_drv_thread_join(wxe_thread, NULL);
+#endif
+ erl_drv_mutex_destroy(wxe_status_m);
+ erl_drv_cond_destroy(wxe_status_c);
+ erl_drv_mutex_destroy(wxe_batch_locker_m);
+ erl_drv_cond_destroy(wxe_batch_locker_c);
+}
+
+void unload_native_gui()
+{
+
+}
+
+/* ************************************************************
+ * wxWidgets Thread
+ * ************************************************************/
+
+void *wxe_main_loop(void *vpdl)
+{
+ int result;
+ int argc = 1;
+ char * temp = (char *) "Erlang";
+ char * argv[] = {temp,NULL};
+ ErlDrvPDL pdl = (ErlDrvPDL) vpdl;
+
+ driver_pdl_inc_refc(pdl);
+
+ // Disable floating point execption if they are on.
+ // This should be done in emulator but it's not in yet.
+#ifndef _WIN32
+ erts_thread_disable_fpe();
+#else
+ // Setup that wxWidgets should look for cursors and icons in
+ // this dll and not in werl.exe (which is the default)
+ HMODULE WXEHandle = GetModuleHandle(_T("wxe_driver"));
+ wxSetInstance((HINSTANCE) WXEHandle);
+#endif
+
+ wxe_ps_init();
+ result = wxEntry(argc, argv);
+ // fprintf(stderr, "WXWidgets quits main loop %d \r\n", result);
+ if(result >= 0 && wxe_status == WXE_INITIATED) {
+ /* We are done try to make a clean exit */
+ wxe_status = WXE_EXITED;
+ driver_pdl_dec_refc(pdl);
+#ifndef __DARWIN__
+ erl_drv_thread_exit(NULL);
+#endif
+ return NULL;
+ } else {
+ erl_drv_mutex_lock(wxe_status_m);
+ wxe_status = WXE_ERROR;
+ erl_drv_cond_signal(wxe_status_c);
+ erl_drv_mutex_unlock(wxe_status_m);
+ driver_pdl_dec_refc(pdl);
+ return NULL;
+ }
+}
diff --git a/lib/wx/c_src/wxe_memory.h b/lib/wx/c_src/wxe_memory.h
new file mode 100644
index 0000000000..ec22183bfa
--- /dev/null
+++ b/lib/wx/c_src/wxe_memory.h
@@ -0,0 +1,61 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. 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%
+ */
+
+#ifndef _WXE_MEMORY_H
+#define _WXE_MEMORY_H
+
+class wxeMemEnv
+{
+public:
+ wxeMemEnv()
+ {
+ ref2ptr = (void **) driver_alloc(128*sizeof(void *));
+ ref2ptr[0] = NULL;
+ next = 1;
+ max = 128;
+ };
+ ~wxeMemEnv()
+ { driver_free(ref2ptr); };
+ int next;
+ int max;
+ void ** ref2ptr;
+ intList free;
+ ErlDrvTermData owner;
+};
+
+class wxeRefData {
+ public:
+ wxeRefData(unsigned int dref, int ttype, int is_new, wxeMemEnv *menv) :
+ ref(dref), type(ttype), alloc_in_erl(is_new), memenv(menv), pid(-1) { } ;
+ int ref;
+ int type;
+ // 0 = wxWindow subclasses, 1 = wxObject subclasses
+ // 2 = wxDialog subclasses, 3 = allocated wxObjects but not returned from new
+ // > 3 classes which lack virtual destr, or are supposed to be allocated on
+ // the stack
+ bool alloc_in_erl;
+ wxeMemEnv *memenv;
+ ErlDrvTermData pid;
+};
+
+WX_DECLARE_HASH_MAP(ErlDrvTermData, wxeMemEnv*, wxIntegerHash, wxIntegerEqual, wxeMemMap);
+
+WX_DECLARE_VOIDPTR_HASH_MAP(wxeRefData *, ptrMap);
+
+#endif
diff --git a/lib/wx/doc/src/notes.xml b/lib/wx/doc/src/notes.xml
index c330353dd4..6e653cf828 100644
--- a/lib/wx/doc/src/notes.xml
+++ b/lib/wx/doc/src/notes.xml
@@ -31,6 +31,22 @@
<p>This document describes the changes made to the wxErlang
application.</p>
+<section><title>Wx 1.1.2</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fixed a problem which caused the debugger to crash when
+ closing a window. Fixed static linking on mac.</p>
+ <p>
+ Own Id: OTP-11444</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Wx 1.1.1</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/wx/include/wx.hrl b/lib/wx/include/wx.hrl
index aa1c81ac0f..2dc1791cce 100644
--- a/lib/wx/include/wx.hrl
+++ b/lib/wx/include/wx.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -273,6 +273,10 @@
-type wxAuiManagerEventType() :: aui_pane_button | aui_pane_close | aui_pane_maximize | aui_pane_restore | aui_render | aui_find_manager.
-type wxAuiManager() :: #wxAuiManager{}. %% Callback event: {@link wxAuiManagerEvent}
+-record(wxInitDialog, {type :: wxInitDialogEventType()}). %% Callback event: {@link wxInitDialogEvent}
+-type wxInitDialogEventType() :: init_dialog.
+-type wxInitDialog() :: #wxInitDialog{}. %% Callback event: {@link wxInitDialogEvent}
+
-record(wxCommand,{type :: wxCommandEventType(), %% Callback event: {@link wxCommandEvent}
cmdString :: unicode:chardata(),
commandInt :: integer(),
@@ -312,8 +316,8 @@
-type wxTreeEventType() :: command_tree_begin_drag | command_tree_begin_rdrag | command_tree_begin_label_edit | command_tree_end_label_edit | command_tree_delete_item | command_tree_get_info | command_tree_set_info | command_tree_item_expanded | command_tree_item_expanding | command_tree_item_collapsed | command_tree_item_collapsing | command_tree_sel_changed | command_tree_sel_changing | command_tree_key_down | command_tree_item_activated | command_tree_item_right_click | command_tree_item_middle_click | command_tree_end_drag | command_tree_state_image_click | command_tree_item_gettooltip | command_tree_item_menu.
-type wxTree() :: #wxTree{}. %% Callback event: {@link wxTreeEvent}
--type event() :: wxAuiManager() | wxAuiNotebook() | wxCalendar() | wxChildFocus() | wxClipboardText() | wxClose() | wxColourPicker() | wxCommand() | wxContextMenu() | wxDate() | wxDisplayChanged() | wxErase() | wxFileDirPicker() | wxFocus() | wxFontPicker() | wxGrid() | wxHelp() | wxHtmlLink() | wxIconize() | wxIdle() | wxJoystick() | wxKey() | wxList() | wxMaximize() | wxMenu() | wxMouse() | wxMouseCaptureChanged() | wxMove() | wxNavigationKey() | wxNotebook() | wxPaint() | wxPaletteChanged() | wxQueryNewPalette() | wxSash() | wxScroll() | wxScrollWin() | wxSetCursor() | wxShow() | wxSize() | wxSpin() | wxSplitter() | wxStyledText() | wxSysColourChanged() | wxTaskBarIcon() | wxTree() | wxUpdateUI() | wxWindowCreate() | wxWindowDestroy().
--type wxEventType() :: wxAuiManagerEventType() | wxAuiNotebookEventType() | wxCalendarEventType() | wxChildFocusEventType() | wxClipboardTextEventType() | wxCloseEventType() | wxColourPickerEventType() | wxCommandEventType() | wxContextMenuEventType() | wxDateEventType() | wxDisplayChangedEventType() | wxEraseEventType() | wxFileDirPickerEventType() | wxFocusEventType() | wxFontPickerEventType() | wxGridEventType() | wxHelpEventType() | wxHtmlLinkEventType() | wxIconizeEventType() | wxIdleEventType() | wxJoystickEventType() | wxKeyEventType() | wxListEventType() | wxMaximizeEventType() | wxMenuEventType() | wxMouseCaptureChangedEventType() | wxMouseEventType() | wxMoveEventType() | wxNavigationKeyEventType() | wxNotebookEventType() | wxPaintEventType() | wxPaletteChangedEventType() | wxQueryNewPaletteEventType() | wxSashEventType() | wxScrollEventType() | wxScrollWinEventType() | wxSetCursorEventType() | wxShowEventType() | wxSizeEventType() | wxSpinEventType() | wxSplitterEventType() | wxStyledTextEventType() | wxSysColourChangedEventType() | wxTaskBarIconEventType() | wxTreeEventType() | wxUpdateUIEventType() | wxWindowCreateEventType() | wxWindowDestroyEventType().
+-type event() :: wxAuiManager() | wxAuiNotebook() | wxCalendar() | wxChildFocus() | wxClipboardText() | wxClose() | wxColourPicker() | wxCommand() | wxContextMenu() | wxDate() | wxDisplayChanged() | wxErase() | wxFileDirPicker() | wxFocus() | wxFontPicker() | wxGrid() | wxHelp() | wxHtmlLink() | wxIconize() | wxIdle() | wxInitDialog() | wxJoystick() | wxKey() | wxList() | wxMaximize() | wxMenu() | wxMouse() | wxMouseCaptureChanged() | wxMove() | wxNavigationKey() | wxNotebook() | wxPaint() | wxPaletteChanged() | wxQueryNewPalette() | wxSash() | wxScroll() | wxScrollWin() | wxSetCursor() | wxShow() | wxSize() | wxSpin() | wxSplitter() | wxStyledText() | wxSysColourChanged() | wxTaskBarIcon() | wxTree() | wxUpdateUI() | wxWindowCreate() | wxWindowDestroy().
+-type wxEventType() :: wxAuiManagerEventType() | wxAuiNotebookEventType() | wxCalendarEventType() | wxChildFocusEventType() | wxClipboardTextEventType() | wxCloseEventType() | wxColourPickerEventType() | wxCommandEventType() | wxContextMenuEventType() | wxDateEventType() | wxDisplayChangedEventType() | wxEraseEventType() | wxFileDirPickerEventType() | wxFocusEventType() | wxFontPickerEventType() | wxGridEventType() | wxHelpEventType() | wxHtmlLinkEventType() | wxIconizeEventType() | wxIdleEventType() | wxInitDialogEventType() | wxJoystickEventType() | wxKeyEventType() | wxListEventType() | wxMaximizeEventType() | wxMenuEventType() | wxMouseCaptureChangedEventType() | wxMouseEventType() | wxMoveEventType() | wxNavigationKeyEventType() | wxNotebookEventType() | wxPaintEventType() | wxPaletteChangedEventType() | wxQueryNewPaletteEventType() | wxSashEventType() | wxScrollEventType() | wxScrollWinEventType() | wxSetCursorEventType() | wxShowEventType() | wxSizeEventType() | wxSpinEventType() | wxSplitterEventType() | wxStyledTextEventType() | wxSysColourChangedEventType() | wxTaskBarIconEventType() | wxTreeEventType() | wxUpdateUIEventType() | wxWindowCreateEventType() | wxWindowDestroyEventType().
%% Hardcoded Records
-record(wxMouseState, {x :: integer(), y :: integer(),
diff --git a/lib/wx/priv/erlang-logo128.png b/lib/wx/priv/erlang-logo128.png
new file mode 100644
index 0000000000..33d1475cea
--- /dev/null
+++ b/lib/wx/priv/erlang-logo128.png
Binary files differ
diff --git a/lib/wx/priv/erlang-logo32.png b/lib/wx/priv/erlang-logo32.png
index a4afed8140..efddf5c5f9 100644
--- a/lib/wx/priv/erlang-logo32.png
+++ b/lib/wx/priv/erlang-logo32.png
Binary files differ
diff --git a/lib/wx/priv/erlang-logo64.png b/lib/wx/priv/erlang-logo64.png
index 91dfbbab53..b7d2128cdb 100644
--- a/lib/wx/priv/erlang-logo64.png
+++ b/lib/wx/priv/erlang-logo64.png
Binary files differ
diff --git a/lib/wx/src/gen/wxInitDialogEvent.erl b/lib/wx/src/gen/wxInitDialogEvent.erl
new file mode 100644
index 0000000000..c8fe6042ac
--- /dev/null
+++ b/lib/wx/src/gen/wxInitDialogEvent.erl
@@ -0,0 +1,64 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2014. 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%
+%% This file is generated DO NOT EDIT
+
+%% @doc See external documentation: <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxinitdialogevent.html">wxInitDialogEvent</a>.
+%% <dl><dt>Use {@link wxEvtHandler:connect/3.} with EventType:</dt>
+%% <dd><em>init_dialog</em></dd></dl>
+%% See also the message variant {@link wxEvtHandler:wxInitDialog(). #wxInitDialog{}} event record type.
+%%
+%% <p>This class is derived (and can use functions) from:
+%% <br />{@link wxEvent}
+%% </p>
+%% @type wxInitDialogEvent(). An object reference, The representation is internal
+%% and can be changed without notice. It can't be used for comparsion
+%% stored on disc or distributed for use on other nodes.
+
+-module(wxInitDialogEvent).
+-include("wxe.hrl").
+-export([]).
+
+%% inherited exports
+-export([getId/1,getSkipped/1,getTimestamp/1,isCommandEvent/1,parent_class/1,
+ resumePropagation/2,shouldPropagate/1,skip/1,skip/2,stopPropagation/1]).
+
+-export_type([wxInitDialogEvent/0]).
+%% @hidden
+parent_class(wxEvent) -> true;
+parent_class(_Class) -> erlang:error({badtype, ?MODULE}).
+
+-type wxInitDialogEvent() :: wx:wx_object().
+ %% From wxEvent
+%% @hidden
+stopPropagation(This) -> wxEvent:stopPropagation(This).
+%% @hidden
+skip(This, Options) -> wxEvent:skip(This, Options).
+%% @hidden
+skip(This) -> wxEvent:skip(This).
+%% @hidden
+shouldPropagate(This) -> wxEvent:shouldPropagate(This).
+%% @hidden
+resumePropagation(This,PropagationLevel) -> wxEvent:resumePropagation(This,PropagationLevel).
+%% @hidden
+isCommandEvent(This) -> wxEvent:isCommandEvent(This).
+%% @hidden
+getTimestamp(This) -> wxEvent:getTimestamp(This).
+%% @hidden
+getSkipped(This) -> wxEvent:getSkipped(This).
+%% @hidden
+getId(This) -> wxEvent:getId(This).
diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl
index 9174b80d52..79dbea0575 100644
--- a/lib/wx/test/wx_basic_SUITE.erl
+++ b/lib/wx/test/wx_basic_SUITE.erl
@@ -241,21 +241,6 @@ wx_misc(Config) ->
%% wx:shutdown() %% How do you test this?
- case os:type() of
- {win32, _} -> %% These hangs when running automatic tests
- skip; %% through ssh on windows. Works otherwise
- _ ->
- wx_misc:shell([{command,"echo TESTING close the popup shell"}])
- end,
-
- case wx_test_lib:user_available(Config) of
- true ->
- wx_misc:shell();
- false ->
- %% Don't want to spawn a shell if no user
- skip %% is available
- end,
-
?m(false, wx_misc:isBusy()),
?m(ok, wx_misc:beginBusyCursor([])),
?m(true, wx_misc:isBusy()),
@@ -356,6 +341,7 @@ wx_object(Config) ->
%% Which it did in my buggy handling of the sync_callback
wxWindow:refresh(Frame),
?m([{sync_event, #wx{event=#wxPaint{}}, _}], flush()),
+ timer:sleep(500),
?m([{cast, slept}], flush()),
Monitor = erlang:monitor(process, FramePid),
diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl
index bbb5294d08..b9c2fafe0e 100644
--- a/lib/wx/test/wx_event_SUITE.erl
+++ b/lib/wx/test/wx_event_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -48,7 +48,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[connect, disconnect, connect_msg_20, connect_cb_20,
mouse_on_grid, spin_event, connect_in_callback, recursive,
- char_events, callback_clean
+ dialog, char_events, callback_clean
].
groups() ->
@@ -402,6 +402,42 @@ recursive(Config) ->
wx_test_lib:wx_destroy(Frame, Config).
+dialog(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo);
+dialog(Config) ->
+ Wx = wx:new(),
+ Frame = wxFrame:new(Wx, ?wxID_ANY, "Testing"),
+ wxFrame:show(Frame),
+ Env = wx:get_env(),
+ Tester = self(),
+ PD = wxProgressDialog:new("Dialog","Testing",
+ [%%{parent, Frame},
+ {maximum,101},
+ {style, ?wxPD_SMOOTH bor ?wxPD_AUTO_HIDE}]),
+ Forward = fun(#wx{event=#wxInitDialog{}}, Ev) ->
+ ?mt(wxInitDialogEvent, Ev),
+ io:format("Heyhoo~n", []),
+ wxEvent:skip(Ev),
+ Tester ! {progress_dialog,PD}
+ end,
+ wxDialog:connect(PD, init_dialog, [{callback, Forward}]),
+ Recurse = fun(Recurse, N) ->
+ true = wxProgressDialog:update(PD, min(N,100)),
+ timer:sleep(5),
+ Recurse(Recurse,N+1)
+ end,
+ Run = fun() ->
+ wx:set_env(Env),
+ Recurse(Recurse, 0)
+ end,
+ Worker = spawn_link(Run),
+ timer:sleep(500),
+ io:format("Got ~p~n", [wx_test_lib:flush()]),
+ unlink(Worker),
+ wxProgressDialog:destroy(PD),
+ wx_test_lib:wx_destroy(Frame, Config).
+
+
+
char_events(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo);
char_events(Config) ->
Wx = wx:new(),
diff --git a/lib/wx/vsn.mk b/lib/wx/vsn.mk
index 24c62390f4..c018b4fb86 100644
--- a/lib/wx/vsn.mk
+++ b/lib/wx/vsn.mk
@@ -1 +1 @@
-WX_VSN = 1.1.1
+WX_VSN = 1.1.2
diff --git a/lib/xmerl/doc/src/notes.xml b/lib/xmerl/doc/src/notes.xml
index 8f51262c81..b020b9bfa3 100644
--- a/lib/xmerl/doc/src/notes.xml
+++ b/lib/xmerl/doc/src/notes.xml
@@ -31,6 +31,35 @@
<p>This document describes the changes made to the Xmerl application.</p>
+<section><title>Xmerl 1.3.6</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p> Fixed a problem in the SAX parser when the header of
+ the next document was appearing in the buffer when using
+ xmerl_sax_parser:stream/2 function. </p>
+ <p>
+ Own Id: OTP-11551 Aux Id: seq12505 </p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p> The default encoding of Erlang files has been changed
+ from ISO-8859-1 to UTF-8. </p> <p> The encoding of XML
+ files has also been changed to UTF-8. </p>
+ <p>
+ Own Id: OTP-10907</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Xmerl 1.3.5</title>
<section><title>Improvements and New Features</title>
diff --git a/system/doc/design_principles/spec_proc.xml b/system/doc/design_principles/spec_proc.xml
index 96e82c83b3..8de7a5fe03 100644
--- a/system/doc/design_principles/spec_proc.xml
+++ b/system/doc/design_principles/spec_proc.xml
@@ -43,7 +43,7 @@
<p>The module <c>sys</c> contains some functions for simple debugging
of processes implemented using behaviours. We use the
<c>code_lock</c> example from
- the <seealso marker="fsm#ex">gen_event</seealso> chapter to
+ the <seealso marker="fsm#ex">gen_fsm</seealso> chapter to
illustrate this:</p>
<pre>
% <input>erl</input>
diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml
index 567d032bb5..3830a34e5a 100644
--- a/system/doc/getting_started/seq_prog.xml
+++ b/system/doc/getting_started/seq_prog.xml
@@ -408,7 +408,7 @@ list_length([First | Rest]) ->
or "structs" in other languages and we use lists when we want to
represent things which have varying sizes, (i.e. where we would
use linked lists in other languages).</p>
- <p>Erlang does not have a string date type, instead strings can be
+ <p>Erlang does not have a string data type, instead strings can be
represented by lists of ASCII characters. So the list
<c>[97,98,99]</c> is equivalent to "abc". The Erlang shell is
"clever" and guesses the what sort of list we mean and outputs it
@@ -1031,7 +1031,7 @@ month_length(Year, Month) ->
<title>Built In Functions (BIFs)</title>
<p>Built in functions BIFs are functions which for some reason is
built in to the Erlang virtual machine. BIFs often implement
- functionality that is impossible to implement in Erlang or is to
+ functionality that is impossible to implement in Erlang or is too
inefficient to implement in Erlang. Some BIFs can be called
by use of the function name only but they are by default belonging
to the erlang module so for example the call to the BIF <c>trunc</c>