aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wx/c_src')
-rw-r--r--lib/wx/c_src/gen/wxe_derived_dest.h4
-rw-r--r--lib/wx/c_src/gen/wxe_events.cpp6
-rw-r--r--lib/wx/c_src/wxePrintout.cpp6
-rw-r--r--lib/wx/c_src/wxe_driver.c22
-rw-r--r--lib/wx/c_src/wxe_driver.h10
-rw-r--r--lib/wx/c_src/wxe_events.h6
-rw-r--r--lib/wx/c_src/wxe_gl.cpp6
-rw-r--r--lib/wx/c_src/wxe_impl.cpp20
-rw-r--r--lib/wx/c_src/wxe_impl.h24
-rw-r--r--lib/wx/c_src/wxe_return.cpp10
-rw-r--r--lib/wx/c_src/wxe_return.h10
11 files changed, 65 insertions, 59 deletions
diff --git a/lib/wx/c_src/gen/wxe_derived_dest.h b/lib/wx/c_src/gen/wxe_derived_dest.h
index 5fdce27d4b..8dcaf1c1ac 100644
--- a/lib/wx/c_src/gen/wxe_derived_dest.h
+++ b/lib/wx/c_src/gen/wxe_derived_dest.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2012. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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
@@ -391,7 +391,7 @@ class EwxListCtrl : public wxListCtrl {
int onGetItemText;
int onGetItemAttr;
int onGetItemColumnImage;
- ErlDrvPort port;
+ ErlDrvTermData port;
private:
virtual wxString OnGetItemText(long item, long col) const;
diff --git a/lib/wx/c_src/gen/wxe_events.cpp b/lib/wx/c_src/gen/wxe_events.cpp
index 7a3233a410..c9cdee3160 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-2012. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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
@@ -328,7 +328,7 @@ int getRef(void* ptr, wxeMemEnv* memenv)
return app->getRef(ptr,memenv);
}
-bool sendevent(wxEvent *event, ErlDrvPort port)
+bool sendevent(wxEvent *event, ErlDrvTermData port)
{
int send_res ;
char * evClass = NULL;
@@ -815,7 +815,7 @@ case 226: {// wxTaskBarIconEvent
rt.addTupleCount(3);
pre_callback();
send_res = rt.send();
- if(send_res) handle_event_callback(port, cb->listener);
+ if(send_res) handle_event_callback(WXE_DRV_PORT_HANDLE, cb->listener);
app->clearPtr((void *) event);
} else {
send_res = rt.send();
diff --git a/lib/wx/c_src/wxePrintout.cpp b/lib/wx/c_src/wxePrintout.cpp
index 90959df379..fc8782ba95 100644
--- a/lib/wx/c_src/wxePrintout.cpp
+++ b/lib/wx/c_src/wxePrintout.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2011. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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
@@ -38,7 +38,7 @@
rt.addAtom("_wx_invoke_cb_"); \
rt.addTupleCount(3); \
rt.send(); \
- handle_event_callback(port, memenv->owner); \
+ handle_event_callback(WXE_DRV_PORT_HANDLE, memenv->owner); \
}
#define INVOKE_CALLBACK(port, callback, class_str) \
@@ -230,7 +230,7 @@ EwxListCtrl::~EwxListCtrl() {
}
// tools
-void clear_cb(ErlDrvPort port, int callback)
+void clear_cb(ErlDrvTermData port, int callback)
{
if(callback > 0) {
wxeMemEnv * memenv = ((WxeApp *) wxTheApp)->getMemEnv(port);
diff --git a/lib/wx/c_src/wxe_driver.c b/lib/wx/c_src/wxe_driver.c
index d1ed252ec0..4d3aa577bf 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-2011. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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
@@ -100,7 +100,8 @@ int wxe_driver_load()
return -1;
}
-ErlDrvPort WXE_DRV_PORT = 0;
+ErlDrvPort WXE_DRV_PORT_HANDLE = 0;
+ErlDrvTermData WXE_DRV_PORT = 0;
static ErlDrvData
wxe_driver_start(ErlDrvPort port, char *buff)
@@ -114,17 +115,20 @@ wxe_driver_start(ErlDrvPort port, char *buff)
fprintf(stderr, " Couldn't alloc mem\r\n");
return(ERL_DRV_ERROR_GENERAL); /* ENOMEM */
} else {
+ ErlDrvTermData term_port = driver_mk_port(port);
set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY);
data->driver_data = NULL;
data->bin = NULL;
- data->port = port;
+ data->port_handle = port;
+ data->port = term_port;
data->pdl = driver_pdl_create(port);
- if(WXE_DRV_PORT == 0) {
+ if(WXE_DRV_PORT_HANDLE == 0) {
for(; *buff != 32; buff++);
buff++;
erl_wx_privdir = strdup(buff);
- WXE_DRV_PORT = port;
+ WXE_DRV_PORT_HANDLE = port;
+ WXE_DRV_PORT = term_port;
wxe_master = data;
if(!(start_native_gui(data) == 1))
return(ERL_DRV_ERROR_GENERAL); /* ENOMEM */
@@ -139,7 +143,7 @@ static void
wxe_driver_stop(ErlDrvData handle)
{
wxe_data *sd = ((wxe_data *)handle);
- if(sd->port != WXE_DRV_PORT) {
+ if(sd->port_handle != WXE_DRV_PORT_HANDLE) {
// fprintf(stderr, "%s:%d: STOP \r\n", __FILE__,__LINE__);
meta_command(DELETE_PORT,sd);
free(handle);
@@ -194,7 +198,7 @@ void wxe_process_died(ErlDrvData handle, ErlDrvMonitor *monitor)
push_command(WXE_CB_RETURN,NULL,0,sd);
/* ErlDrvTermData pid; */
-/* pid = driver_get_monitored_process(sd->port, monitor); */
+/* pid = driver_get_monitored_process(sd->port_handle, monitor); */
/* fprintf(stderr, "Process died %d \r\n", (int) pid); */
}
@@ -210,7 +214,7 @@ standard_outputv(ErlDrvData drv_data, ErlIOVec* ev)
binref = driver_alloc(sizeof(WXEBinRef));
binref->base = ev->iov[1].iov_base;
binref->size = ev->iov[1].iov_len;
- binref->from = driver_caller(sd->port);
+ binref->from = driver_caller(sd->port_handle);
bin = ev->binv[1];
driver_binary_inc_refc(bin); /* Otherwise it could get deallocated */
binref->bin = bin;
@@ -220,7 +224,7 @@ standard_outputv(ErlDrvData drv_data, ErlIOVec* ev)
binref = driver_alloc(sizeof(WXEBinRef));
binref->base = NULL;
binref->size = 0;
- binref->from = driver_caller(sd->port);
+ binref->from = driver_caller(sd->port_handle);
binref->bin = NULL;
binref->next = sd->bin;
sd->bin = binref;
diff --git a/lib/wx/c_src/wxe_driver.h b/lib/wx/c_src/wxe_driver.h
index 5c5b8614ed..c765c866c2 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-2010. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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
@@ -43,7 +43,8 @@ typedef struct wxe_bin_ref {
typedef struct wxe_data_def {
void * driver_data;
WXEBinRef * bin; /* Argument binaries */
- ErlDrvPort port;
+ ErlDrvPort port_handle;
+ ErlDrvTermData port;
int is_cbport;
ErlDrvPDL pdl;
} wxe_data;
@@ -67,8 +68,9 @@ void meta_command(int what, wxe_data *sd);
void * wxe_ps_init();
-extern ErlDrvPort WXE_DRV_PORT;
-extern int wxe_debug;
+extern ErlDrvPort WXE_DRV_PORT_HANDLE;
+extern ErlDrvTermData WXE_DRV_PORT;
+extern int wxe_debug;
extern char * erl_wx_privdir;
diff --git a/lib/wx/c_src/wxe_events.h b/lib/wx/c_src/wxe_events.h
index 43ea656a8d..6bbb0dfa13 100644
--- a/lib/wx/c_src/wxe_events.h
+++ b/lib/wx/c_src/wxe_events.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2009. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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
@@ -54,7 +54,7 @@ public:
class wxeEvtListener : public wxEvtHandler
{
public:
- wxeEvtListener(ErlDrvPort Thisport) : port(Thisport)
+ wxeEvtListener(ErlDrvTermData Thisport) : port(Thisport)
{}
// {fprintf(stderr, "Creating %x\r\n", (unsigned int) this); fflush(stderr);}
void forward(wxEvent& event);
@@ -62,7 +62,7 @@ public:
((WxeApp *)wxTheApp)->clearPtr(this);
// fprintf(stderr, "Deleteing %x\r\n", (unsigned int) this); fflush(stderr);
};
- ErlDrvPort port;
+ ErlDrvTermData port;
};
#endif
diff --git a/lib/wx/c_src/wxe_gl.cpp b/lib/wx/c_src/wxe_gl.cpp
index e947a1bc6e..34904397d3 100644
--- a/lib/wx/c_src/wxe_gl.cpp
+++ b/lib/wx/c_src/wxe_gl.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2010. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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 @@ void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
ERL_DRV_INT, op,
ERL_DRV_ATOM, driver_mk_atom((char *) "no_gl_context"),
ERL_DRV_TUPLE,3};
- driver_send_term(WXE_DRV_PORT,caller,rt,8);
+ erl_drv_send_term(WXE_DRV_PORT,caller,rt,8);
return ;
}
};
@@ -155,6 +155,6 @@ void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
else
bs[i] = NULL;
}
- wxe_gl_dispatch(op, bp, WXE_DRV_PORT, caller, bs, bs_sz);
+ wxe_gl_dispatch(op, bp, WXE_DRV_PORT_HANDLE, caller, bs, bs_sz);
}
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index 527fabc315..adfee8da73 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2012. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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,7 +117,7 @@ int start_native_gui(wxe_data *sd)
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);
+ init_caller = driver_connected(sd->port_handle);
#ifdef __DARWIN__
res = erl_drv_steal_main_thread((char *)"wxwidgets",
@@ -169,7 +169,7 @@ 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)),fflush(stderr);
+ // fprintf(stderr, "Op %d %d\r\n", op, (int) driver_caller(sd->port_handle)),fflush(stderr);
wxeCommand *Cmd = new wxeCommand(op, buf, len, sd);
erl_drv_mutex_lock(wxe_batch_locker_m);
wxe_batch->Append(Cmd);
@@ -536,18 +536,18 @@ void WxeApp::newMemEnv(wxeMetaCommand& Ecmd) {
memenv->ref2ptr[i] = global_me->ref2ptr[i];
}
memenv->next = global_me->next;
- refmap[(ErlDrvTermData) Ecmd.port] = memenv;
+ refmap[Ecmd.port] = memenv;
memenv->owner = Ecmd.caller;
ErlDrvTermData rt[] = {ERL_DRV_ATOM, driver_mk_atom((char *)"wx_port_initiated")};
- driver_send_term(WXE_DRV_PORT,Ecmd.caller,rt,2);
+ erl_drv_send_term(WXE_DRV_PORT,Ecmd.caller,rt,2);
}
void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
// Clear incoming cmd queue first
// dispatch_cmds();
wxWindow *parent = NULL;
- wxeMemEnv * memenv = refmap[(ErlDrvTermData) Ecmd.port];
+ wxeMemEnv * memenv = refmap[Ecmd.port];
if(wxe_debug) {
wxString msg;
@@ -656,8 +656,8 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
refmap.erase((ErlDrvTermData) Ecmd.port);
}
-wxeMemEnv * WxeApp::getMemEnv(ErlDrvPort port) {
- return refmap[(ErlDrvTermData) port];
+wxeMemEnv * WxeApp::getMemEnv(ErlDrvTermData port) {
+ return refmap[port];
}
int WxeApp::newPtr(void * ptr, int type, wxeMemEnv *memenv) {
@@ -837,7 +837,7 @@ wxeCommand::wxeCommand(int fc,char * cbuf,int buflen, wxe_data *sd)
{
WXEBinRef *temp, *start, *prev;
int n = 0;
- caller = driver_caller(sd->port);
+ caller = driver_caller(sd->port_handle);
port = sd->port;
op = fc;
len = buflen;
@@ -940,7 +940,7 @@ int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr)
rt.addAtom("_wx_invoke_cb_");
rt.addTupleCount(3);
rt.send();
- handle_event_callback(cb->port, memenv->owner);
+ handle_event_callback(WXE_DRV_PORT_HANDLE, memenv->owner);
if(((WxeApp *) wxTheApp)->cb_buff) {
int res = * (int*) ((WxeApp *) wxTheApp)->cb_buff;
diff --git a/lib/wx/c_src/wxe_impl.h b/lib/wx/c_src/wxe_impl.h
index ee31068d5d..a3c57e2598 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-2011. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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,7 +34,7 @@ class wxeMetaCommand : public wxEvent
public:
wxeMetaCommand(wxe_data *sd, int EvId)
: wxEvent(EvId, wxeEVT_META_COMMAND)
- { caller = driver_caller(sd->port); port = sd->port; pdl = sd->pdl; } ;
+ { 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; };
@@ -42,7 +42,7 @@ class wxeMetaCommand : public wxEvent
virtual wxEvent *Clone() const { return new wxeMetaCommand(*this); }
ErlDrvTermData caller;
- ErlDrvPort port;
+ ErlDrvTermData port;
ErlDrvPDL pdl;
};
@@ -51,9 +51,9 @@ class wxeCommand : public wxObject
public:
wxeCommand(int fc,char * cbuf,int buflen, wxe_data *);
virtual ~wxeCommand();
-
+
ErlDrvTermData caller;
- ErlDrvPort port;
+ ErlDrvTermData port;
WXEBinRef * bin[3];
char * buffer;
int len;
@@ -161,7 +161,7 @@ public:
// MemEnv handling
void newMemEnv(wxeMetaCommand& event);
void destroyMemEnv(wxeMetaCommand& event);
- wxeMemEnv * getMemEnv(ErlDrvPort port);
+ wxeMemEnv * getMemEnv(ErlDrvTermData port);
int newPtr(void * ptr, int type, wxeMemEnv *memenv);
int getRef(void * ptr, wxeMemEnv *memenv);
@@ -193,7 +193,7 @@ class wxETreeItemData : public wxTreeItemData
char * bin;
};
-bool sendevent(wxEvent * event, ErlDrvPort port);
+bool sendevent(wxEvent * event, ErlDrvTermData port);
void pre_callback();
void handle_event_callback(ErlDrvPort port, ErlDrvTermData process);
@@ -208,10 +208,10 @@ extern wxeGLC glc;
class wxEPrintout : public wxPrintout
{
public:
- wxEPrintout(wxString Title, int onPrintP, int onPrepareP,
+ wxEPrintout(wxString Title, int onPrintP, int onPrepareP,
int onBeginP, int onEndP,
int onBeginD, int onEndD,
- int hasP, int getPageI, ErlDrvPort Port) :
+ int hasP, int getPageI, ErlDrvTermData Port) :
wxPrintout(Title),
onPrintPage(onPrintP), onPreparePrinting(onPrepareP),
onBeginPrinting(onBeginP), onEndPrinting(onEndP),
@@ -241,15 +241,15 @@ class wxEPrintout : public wxPrintout
int hasPage;
int getPageInfo;
- ErlDrvPort port;
+ ErlDrvTermData port;
};
-void clear_cb(ErlDrvPort port, int callback);
+void clear_cb(ErlDrvTermData port, int callback);
// Implementation of wxListCtrlCompare
struct callbackInfo {
- ErlDrvPort port;
+ ErlDrvTermData port;
int callbackID;
};
diff --git a/lib/wx/c_src/wxe_return.cpp b/lib/wx/c_src/wxe_return.cpp
index 0f3eb40efc..d50a74ac9d 100644
--- a/lib/wx/c_src/wxe_return.cpp
+++ b/lib/wx/c_src/wxe_return.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2012. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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
@@ -26,9 +26,9 @@ WX_DEFINE_OBJARRAY(wxErlDrvTermDataArray);
#define INLINE
-wxeReturn::wxeReturn (ErlDrvPort _port,
- ErlDrvTermData _caller,
- bool _isResult) {
+wxeReturn::wxeReturn (ErlDrvTermData _port,
+ ErlDrvTermData _caller,
+ bool _isResult) {
port = _port;
caller = _caller;
@@ -61,7 +61,7 @@ int wxeReturn::send() {
rtData[i] = rt[i];
}
- int res = driver_send_term(port, caller, rtData, rtLength);
+ int res = erl_drv_send_term(port, caller, rtData, rtLength);
driver_free(rtData);
#ifdef DEBUG
diff --git a/lib/wx/c_src/wxe_return.h b/lib/wx/c_src/wxe_return.h
index b6bfa85e63..80946e2dc6 100644
--- a/lib/wx/c_src/wxe_return.h
+++ b/lib/wx/c_src/wxe_return.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2012. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2013. 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,9 +48,9 @@ WX_DECLARE_OBJARRAY(ErlDrvTermData, wxErlDrvTermDataArray);
class wxeReturn {
public:
- wxeReturn (ErlDrvPort _port,
- ErlDrvTermData _caller,
- bool _isResult=false);
+ wxeReturn (ErlDrvTermData _port,
+ ErlDrvTermData _caller,
+ bool _isResult=false);
~wxeReturn();
@@ -130,7 +130,7 @@ private:
// WxeApp* wxe_app;
ErlDrvTermData caller;
- ErlDrvPort port;
+ ErlDrvTermData port;
// wxeMemEnv *memEnv;
wxErlDrvTermDataArray rt;
wxArrayDouble temp_float;