- stripped not needed code from /ecore-integration
- bugfix for xml2cpp generator with out parameters
This commit is contained in:
parent
eefe20a40d
commit
3b3ffe166b
3 changed files with 59 additions and 96 deletions
|
@ -41,7 +41,7 @@ class DXXAPI BusTimeout : public Timeout
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BusTimeout( Timeout::Internal*/*, GMainContext* */);
|
BusTimeout( Timeout::Internal*);
|
||||||
|
|
||||||
~BusTimeout();
|
~BusTimeout();
|
||||||
|
|
||||||
|
@ -55,8 +55,6 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ecore_Timer *_etimer;
|
Ecore_Timer *_etimer;
|
||||||
//GSource* _source;
|
|
||||||
//GMainContext* _ctx;
|
|
||||||
|
|
||||||
friend class BusDispatcher;
|
friend class BusDispatcher;
|
||||||
};
|
};
|
||||||
|
@ -65,7 +63,7 @@ class DXXAPI BusWatch : public Watch
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BusWatch( Watch::Internal*/*, GMainContext* */);
|
BusWatch( Watch::Internal*);
|
||||||
|
|
||||||
~BusWatch();
|
~BusWatch();
|
||||||
|
|
||||||
|
@ -80,8 +78,6 @@ private:
|
||||||
void _disable();
|
void _disable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//GSource* _source;
|
|
||||||
//GMainContext* _ctx;
|
|
||||||
Ecore_Fd_Handler *fd_handler_read;
|
Ecore_Fd_Handler *fd_handler_read;
|
||||||
Ecore_Fd_Handler *fd_handler_error;
|
Ecore_Fd_Handler *fd_handler_error;
|
||||||
|
|
||||||
|
@ -91,9 +87,9 @@ friend class BusDispatcher;
|
||||||
class DXXAPI BusDispatcher : public Dispatcher
|
class DXXAPI BusDispatcher : public Dispatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BusDispatcher() /*: _ctx(NULL) */{}
|
BusDispatcher() {}
|
||||||
|
|
||||||
void attach(/* GMainContext* */);
|
void attach();
|
||||||
|
|
||||||
void enter() {}
|
void enter() {}
|
||||||
|
|
||||||
|
@ -109,7 +105,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//GMainContext* _ctx;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace Ecore */
|
} /* namespace Ecore */
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
using namespace DBus;
|
using namespace DBus;
|
||||||
|
|
||||||
Ecore::BusTimeout::BusTimeout( Timeout::Internal* ti/*, GMainContext* ctx */)
|
Ecore::BusTimeout::BusTimeout( Timeout::Internal* ti)
|
||||||
: Timeout(ti)/*, _ctx(ctx)*/
|
: Timeout(ti)
|
||||||
{
|
{
|
||||||
_enable();
|
_enable();
|
||||||
}
|
}
|
||||||
|
@ -63,16 +63,9 @@ int Ecore::BusTimeout::timeout_handler( void *data )
|
||||||
|
|
||||||
void Ecore::BusTimeout::_enable()
|
void Ecore::BusTimeout::_enable()
|
||||||
{
|
{
|
||||||
// TODO: port
|
|
||||||
// _source => Ecore_Timer
|
|
||||||
// g_source_set_callback => EcoreDispatcher init()
|
|
||||||
debug_log("Ecore::BusTimeout::_enable()");
|
debug_log("Ecore::BusTimeout::_enable()");
|
||||||
|
|
||||||
_etimer = ecore_timer_add (((double)Timeout::interval())/1000, timeout_handler, this);
|
_etimer = ecore_timer_add (((double)Timeout::interval())/1000, timeout_handler, this);
|
||||||
|
|
||||||
/*_source = g_timeout_source_new();
|
|
||||||
g_source_set_callback(_source, timeout_handler, this, NULL);
|
|
||||||
g_source_attach(_source, _ctx);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ecore::BusTimeout::_disable()
|
void Ecore::BusTimeout::_disable()
|
||||||
|
@ -80,17 +73,9 @@ void Ecore::BusTimeout::_disable()
|
||||||
debug_log("Ecore::BusTimeout::_disable()");
|
debug_log("Ecore::BusTimeout::_disable()");
|
||||||
|
|
||||||
ecore_timer_del (_etimer);
|
ecore_timer_del (_etimer);
|
||||||
//g_source_destroy(_source);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BusSource
|
static bool watch_prepare( int *timeout )
|
||||||
{
|
|
||||||
// TODO: needed?
|
|
||||||
//GSource source;
|
|
||||||
//GPollFD poll;
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool watch_prepare( /*GSource *source,*/ int *timeout )
|
|
||||||
{
|
{
|
||||||
debug_log("ecore: watch_prepare");
|
debug_log("ecore: watch_prepare");
|
||||||
|
|
||||||
|
@ -98,35 +83,24 @@ static bool watch_prepare( /*GSource *source,*/ int *timeout )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool watch_check( /*GSource *source*/ )
|
static bool watch_check( )
|
||||||
{
|
{
|
||||||
debug_log("ecore: watch_check");
|
debug_log("ecore: watch_check");
|
||||||
|
|
||||||
//BusSource* io = (BusSource*)source;
|
return true;
|
||||||
return true;//io->poll.revents ? true : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: port parameters
|
static bool watch_dispatch( void *data )
|
||||||
static bool watch_dispatch(/* GSource *source, GSourceFunc callback, */void *data )
|
|
||||||
{
|
{
|
||||||
debug_log("ecore: watch_dispatch");
|
debug_log("ecore: watch_dispatch");
|
||||||
|
|
||||||
bool cb = true;//callback(data);
|
bool cb = true;
|
||||||
DBus::default_dispatcher->dispatch_pending(); //TODO: won't work in case of multiple dispatchers
|
DBus::default_dispatcher->dispatch_pending(); //TODO: won't work in case of multiple dispatchers
|
||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: needed?
|
Ecore::BusWatch::BusWatch( Watch::Internal* wi)
|
||||||
/*static GSourceFuncs watch_funcs = {
|
: Watch(wi)
|
||||||
watch_prepare,
|
|
||||||
watch_check,
|
|
||||||
watch_dispatch,
|
|
||||||
NULL
|
|
||||||
};*/
|
|
||||||
|
|
||||||
// TODO: port parameter
|
|
||||||
Ecore::BusWatch::BusWatch( Watch::Internal* wi/*, GMainContext* ctx */)
|
|
||||||
: Watch(wi)/*, _ctx(ctx)*/
|
|
||||||
{
|
{
|
||||||
_enable();
|
_enable();
|
||||||
}
|
}
|
||||||
|
@ -169,8 +143,6 @@ int Ecore::BusWatch::watch_handler_error( void *data, Ecore_Fd_Handler *fdh )
|
||||||
|
|
||||||
watch_dispatch(NULL);
|
watch_dispatch(NULL);
|
||||||
|
|
||||||
//w->handle(flags);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,18 +151,6 @@ void Ecore::BusWatch::_enable()
|
||||||
debug_log("Ecore::BusWatch::_enable()");
|
debug_log("Ecore::BusWatch::_enable()");
|
||||||
|
|
||||||
int flags = Watch::flags();
|
int flags = Watch::flags();
|
||||||
//Ecore_Fd_Handler_Flags condition = ECORE_FD_READ;
|
|
||||||
|
|
||||||
// TODO: create second handler for ECORE_FD_ERROR case
|
|
||||||
|
|
||||||
/*if(flags & DBUS_WATCH_READABLE)
|
|
||||||
condition |= ECORE_FD_READ;
|
|
||||||
// if(flags & DBUS_WATCH_WRITABLE)
|
|
||||||
// condition |= G_IO_OUT;
|
|
||||||
if(flags & DBUS_WATCH_ERROR)
|
|
||||||
condition |= ECORE_FD_ERROR;
|
|
||||||
//if(flags & DBUS_WATCH_HANGUP)
|
|
||||||
//condition |= G_IO_HUP;*/
|
|
||||||
|
|
||||||
fd_handler_read = ecore_main_fd_handler_add (Watch::descriptor(),
|
fd_handler_read = ecore_main_fd_handler_add (Watch::descriptor(),
|
||||||
ECORE_FD_READ,
|
ECORE_FD_READ,
|
||||||
|
@ -207,41 +167,21 @@ void Ecore::BusWatch::_enable()
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
ecore_main_fd_handler_active_set(fd_handler_error, ECORE_FD_ERROR);
|
ecore_main_fd_handler_active_set(fd_handler_error, ECORE_FD_ERROR);
|
||||||
|
|
||||||
// TODO: port this
|
|
||||||
/*_source = g_source_new(&watch_funcs, sizeof(BusSource));
|
|
||||||
g_source_set_callback(_source, watch_handler, this, NULL);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GPollFD* poll = &(((BusSource*)_source)->poll);
|
|
||||||
poll->fd = Watch::descriptor();
|
|
||||||
poll->events = condition;
|
|
||||||
poll->revents = 0;
|
|
||||||
|
|
||||||
g_source_add_poll(_source, poll);
|
|
||||||
g_source_attach(_source, _ctx);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ecore::BusWatch::_disable()
|
void Ecore::BusWatch::_disable()
|
||||||
{
|
{
|
||||||
ecore_main_fd_handler_del (fd_handler_read);
|
ecore_main_fd_handler_del (fd_handler_read);
|
||||||
ecore_main_fd_handler_del (fd_handler_error);
|
ecore_main_fd_handler_del (fd_handler_error);
|
||||||
|
|
||||||
// TODO: port this
|
|
||||||
/*GPollFD* poll = &(((BusSource*)_source)->poll);
|
|
||||||
g_source_remove_poll(_source, poll);
|
|
||||||
g_source_destroy(_source);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ecore::BusDispatcher::attach( /*GMainContext* ctx */)
|
void Ecore::BusDispatcher::attach( )
|
||||||
{
|
{
|
||||||
//_ctx = ctx ? ctx : g_main_context_default();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timeout* Ecore::BusDispatcher::add_timeout( Timeout::Internal* wi )
|
Timeout* Ecore::BusDispatcher::add_timeout( Timeout::Internal* wi )
|
||||||
{
|
{
|
||||||
Timeout* t = new Ecore::BusTimeout(wi/*, _ctx*/);
|
Timeout* t = new Ecore::BusTimeout( wi );
|
||||||
|
|
||||||
debug_log("ecore: added timeout %p (%s)", t, t->enabled() ? "on":"off");
|
debug_log("ecore: added timeout %p (%s)", t, t->enabled() ? "on":"off");
|
||||||
|
|
||||||
|
@ -257,7 +197,7 @@ void Ecore::BusDispatcher::rem_timeout( Timeout* t )
|
||||||
|
|
||||||
Watch* Ecore::BusDispatcher::add_watch( Watch::Internal* wi )
|
Watch* Ecore::BusDispatcher::add_watch( Watch::Internal* wi )
|
||||||
{
|
{
|
||||||
Watch* w = new Ecore::BusWatch(wi/*, _ctx*/);
|
Watch* w = new Ecore::BusWatch(wi);
|
||||||
|
|
||||||
debug_log("ecore: added watch %p (%s) fd=%d flags=%d",
|
debug_log("ecore: added watch %p (%s) fd=%d flags=%d",
|
||||||
w, w->enabled() ? "on":"off", w->descriptor(), w->flags()
|
w, w->enabled() ? "on":"off", w->descriptor(), w->flags()
|
||||||
|
|
|
@ -1287,6 +1287,16 @@ void generate_adaptor(Xml::Document &doc, const char *filename)
|
||||||
for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++i)
|
for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++i)
|
||||||
{
|
{
|
||||||
Xml::Node &arg = **ai;
|
Xml::Node &arg = **ai;
|
||||||
|
|
||||||
|
body << tab << tab << signature_to_type(arg.get("type")) << " argin" << i << ";" << " ";
|
||||||
|
body << "ri >> argin" << i << ";" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate the 'in' object variables
|
||||||
|
i = 1;
|
||||||
|
for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++i)
|
||||||
|
{
|
||||||
|
Xml::Node &arg = **ai;
|
||||||
Xml::Nodes annotations = arg["annotation"];
|
Xml::Nodes annotations = arg["annotation"];
|
||||||
Xml::Nodes annotations_object = annotations.select("name","org.freedesktop.DBus.Object");
|
Xml::Nodes annotations_object = annotations.select("name","org.freedesktop.DBus.Object");
|
||||||
string arg_object;
|
string arg_object;
|
||||||
|
@ -1296,17 +1306,36 @@ void generate_adaptor(Xml::Document &doc, const char *filename)
|
||||||
arg_object = annotations_object.front()->get("value");
|
arg_object = annotations_object.front()->get("value");
|
||||||
}
|
}
|
||||||
|
|
||||||
body << tab << tab << signature_to_type(arg.get("type")) << " argin" << i << ";" << endl;
|
|
||||||
body << tab << tab << "ri >> argin" << i << ";" << endl;
|
|
||||||
|
|
||||||
if (arg_object.length())
|
if (arg_object.length())
|
||||||
{
|
{
|
||||||
body << tab << tab << arg_object << " _argin" << i << ";" << endl;
|
body << tab << tab << arg_object << " _argin" << i << ";";
|
||||||
|
body << " " << "_argin" << i << " << " << "argin" << i << ";" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate out variables
|
// generate 'out' variables
|
||||||
if (args_out.size() != 0)
|
if (args_out.size() > 0)
|
||||||
|
{
|
||||||
|
unsigned int i = 1;
|
||||||
|
for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i)
|
||||||
|
{
|
||||||
|
Xml::Node &arg = **ao;
|
||||||
|
|
||||||
|
body << tab << tab << signature_to_type(arg.get("type")) << " argout" << i;
|
||||||
|
|
||||||
|
if (args_out.size() == 1) // a single 'out' parameter will be assigned
|
||||||
|
{
|
||||||
|
body << " = ";
|
||||||
|
}
|
||||||
|
else // multible 'out' parameters will be handled as parameters below
|
||||||
|
{
|
||||||
|
body << ";" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate 'out' object variables
|
||||||
|
if (args_out.size() > 0)
|
||||||
{
|
{
|
||||||
unsigned int i = 1;
|
unsigned int i = 1;
|
||||||
for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i)
|
for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i)
|
||||||
|
@ -1321,8 +1350,6 @@ void generate_adaptor(Xml::Document &doc, const char *filename)
|
||||||
arg_object = annotations_object.front()->get("value");
|
arg_object = annotations_object.front()->get("value");
|
||||||
}
|
}
|
||||||
|
|
||||||
body << tab << tab << signature_to_type(arg.get("type")) << " argout" << i << ";" << endl;
|
|
||||||
|
|
||||||
// generate object types
|
// generate object types
|
||||||
if (arg_object.length())
|
if (arg_object.length())
|
||||||
{
|
{
|
||||||
|
@ -1344,14 +1371,15 @@ void generate_adaptor(Xml::Document &doc, const char *filename)
|
||||||
{
|
{
|
||||||
arg_object = annotations_object.front()->get("value");
|
arg_object = annotations_object.front()->get("value");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (arg_object.length())
|
// do correct indent
|
||||||
|
if (args_out.size() != 1 )
|
||||||
{
|
{
|
||||||
body << tab << tab << "_argin" << i+1 << " << " << "argin" << i+1 << ";" << endl;
|
body << tab << tab;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body << tab << tab << method.get("name") << "(";
|
body << method.get("name") << "(";
|
||||||
|
|
||||||
// generate call stub parameters
|
// generate call stub parameters
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue