logo       

Adding PerlKDE DCOP support: msg#00029

Subject: Adding PerlKDE DCOP support
I've got PerlKDE built and it runs the kludgeror browser - woo hoo! You can 
now write a full featured browser in less than 150 lines of perl, which is 
one of the reasons I'm looking forward to this next release of PerlQt. So you 
can make use of KParts components from perl.

Another important feature of KDE that would make the PerlKDE bindings even 
more powerful is DCOP support. There in already some work on this in 
kdebindings/perldcop, but it is limited to just calling existing apps with 
DCOP interfaces and doesn't allow you to define DCOP slots and so on.

I've had a look at what was involved adding DCOP support to the Korundum ruby 
bindings and extracted the DCOP bits from that project.

There are two functions smokeStackToStream() and smokeStackFromStream() that 
interface the Smoke::Stack with QDataStream/QByteArrays that are used to 
communicate to and from DCOP:

/*
        Copy items from the stack to the stream, each item has a corresponding 
description in the 
        args array of MocArguments. Used for marshalling the args to DCOP calls 
and 
sends, emitting 
        DCOP signals, and converting the return value of a DCOP slot to a 
stream.
*/
static void
smokeStackToStream(Marshall *m, Smoke::Stack stack, QDataStream* stream, int 
items, MocArgument* args)
{
...
}


/*
        Copy items from the stream to the stack, each item has a corresponding 
description in the 
        args array of MocArguments. Used for marshalling the arguments to a 
DCOP slot 
invocation,
        and for converting a dcop reply to a ruby value.
*/
static void
smokeStackFromStream(Marshall *m, Smoke::Stack stack, QDataStream* stream, int 
items, MocArgument* args)
{
...
}

I only had to add some headers to KDE.xs to get these to compile 'as is' - 
there are no ruby dependencies.

Then there are various C++ classes which marshall DCOP args to and from the 
Smoke stack, they are very much the same as the C++ classes in Qt.xs (or 
Qt.cpp in ruby) for the Qt slots and signals. So porting these to perl just 
consists of seeing how the Qt signal/slot classes needed to be changed to 
port them to ruby, and then doing the same thing in reverse for the perl DCOP 
ones from ruby.

tipitina duke 472% grep ^class KDE.xs
class DCOPReturn : public Marshall {
class DCOPCall : public Marshall {
class DCOPSend : public Marshall {
class EmitDCOPSignal : public Marshall {
class DCOPReplyValue : public Marshall {
class InvokeDCOPSlot : public Marshall {

I've removed some marshalling code for types which weren't in the Smoke 
runtime (they didn't have QDataStream methods in there), as they don't really 
need to be done for a first release.

There are some native methods implemented for ruby, and these need to be 
converted to perl xs ones:

# Add a method for each signal defined via 'k_dcop_signal':
rb_define_method(klass, StringValuePtr(signal), (VALUE (*) (...)) 
k_dcop_signal, -1);

rb_define_method(klass, "interfaces", (VALUE (*) (...)) dcop_interfaces, 0);
rb_define_method(klass, "functions", (VALUE (*) (...)) dcop_functions, 0);
rb_define_method(klass, "connectDCOPSignal", (VALUE (*) (...)) 
dcop_connect_signal, 5);

rb_define_method(klass, "disconnectDCOPSignal", (VALUE (*) (...)) 
dcop_disconnect_signal, 4);

rb_define_singleton_method(kde_module, "dcop_process", (VALUE (*) (...)) 
dcop_process, 7);

rb_define_singleton_method(kde_module, "dcop_call", (VALUE (*) (...)) 
dcop_call, -1);

rb_define_singleton_method(kde_module, "dcop_send", (VALUE (*) (...)) 
dcop_send, -1);

Finally there is some ruby code in KDE.rb, which needs be translated to perl. 
There is a DCOPMetaObject which is very similar to the MetaObject class in 
QtRuby and PerlQt, and that should be straightforward to translate to perl. 
The main difference is that DCOP slots have a return type, whereas Qt slots 
are always void.

Apart from adding DCOP support, PerlKDE just needs more marshallers - it 
really has a very complete coverage of the KDE api via the SmokeKDE library. 
I don't think it is too difficult to look at the Korundum marshallers and 
translate them to perl. 

On the kde-bindings list Gábor Lehel has recently been adding KCanvas support 
to the ruby Korundum bindings, and he has managed to work out what all the 
marshalling stuff was about quite successfully from playing with the source. 
Encouraged by that, I'm hoping I someone keen on PerlKDE might help out, not 
just Ashley, Germain or myself, as it isn't as hard as it sounds. 

But even without that help, and asking a few questions about xs stuff, I don't 
think it would take me too long and would be a lot of bang for very little 
bucks.. I attached to KDE.xs and KDE.rb sources as starting points for 
PerlKDE DCOP support.

-- Richard

Attachment: perlkde_dcop.tgz
Description: application/tgz

_______________________________________________
Kde-bindings mailing list
Kde-bindings@xxxxxxx
https://mail.kde.org/mailman/listinfo/kde-bindings
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe