diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /dcopperl | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'dcopperl')
-rw-r--r-- | dcopperl/DCOP.pm | 18 | ||||
-rw-r--r-- | dcopperl/DCOP.xs | 202 | ||||
-rw-r--r-- | dcopperl/Makefile.PL | 2 | ||||
-rw-r--r-- | dcopperl/Makefile.PL.in | 2 | ||||
-rw-r--r-- | dcopperl/TODO | 2 | ||||
-rw-r--r-- | dcopperl/test.pl | 2 | ||||
-rw-r--r-- | dcopperl/typemap | 10 |
7 files changed, 119 insertions, 119 deletions
diff --git a/dcopperl/DCOP.pm b/dcopperl/DCOP.pm index ff463362..c71e1f91 100644 --- a/dcopperl/DCOP.pm +++ b/dcopperl/DCOP.pm @@ -233,7 +233,7 @@ sub remoteFunctions($app, $object) returns a reference to an array with the names of the functions the specified interface supports. The functions are returned as their signatures with parameter names and return type like - QCStringList functions() + TQCStringList functions() sub normalizeSignature($signature) @@ -254,31 +254,31 @@ return values: =item * int mapped to scalar -=item * QCString +=item * TQCString mapped to scalar -=item * QString (no Unicode support yet, just latin 1) +=item * TQString (no Unicode support yet, just latin 1) mapped to scalar -=item * QCStringList +=item * TQCStringList mapped to a reference to an array of scalars. -=item * QStringList +=item * TQStringList mapped to a reference to an array of scalars. -=item * QPoint (untested) +=item * TQPoint (untested) mapped to a reference to a two elemtent array [$x, $y] named value support via hash planned. -=item * QSize (untested) +=item * TQSize (untested) mapped to a reference to a two elemtent array [$width, $height] named value support via hash planned. -=item * QRect (untested) +=item * TQRect (untested) mapped to a reference to a four elemtent array [$left, $top, $width, $height] named value support via hash planned (including alternative right and bottom / width height) -=item * KURL (only QString url() now) +=item * KURL (only TQString url() now) mapped to scalar =item * DCOPRef (partially) diff --git a/dcopperl/DCOP.xs b/dcopperl/DCOP.xs index 509366af..02a8b19b 100644 --- a/dcopperl/DCOP.xs +++ b/dcopperl/DCOP.xs @@ -73,7 +73,7 @@ bool boolFromSV(SV *data) if (SvIOK(data)) return SvIV(data); if (SvPOK(data)) - return QCString(SvPV(data, PL_na)).lower() == "true"; + return TQCString(SvPV(data, PL_na)).lower() == "true"; croak("DCOP: Cannot convert to bool"); } @@ -82,87 +82,87 @@ SV *boolToSV(bool data, SV *self = 0) return newSViv(data ? 1 : 0); } -QCString QCStringFromSV(SV *data) +TTQCString TQCStringFromSV(SV *data) { if (!SvOK(data)) - return QCString(); + return TQCString(); if (!SvPOK(data)) - croak("DCOP: Cannot convert to QCString"); + croak("DCOP: Cannot convert to TQCString"); return SvPV(data, PL_na); } -SV *QCStringToSV(const QCString &data, SV * self = 0) +SV *TQCStringToSV(const TQCString &data, SV * self = 0) { return data.isNull() ? &PL_sv_undef : newSVpv(data.data(), 0); } -QString QStringFromSV(SV *data) +TTQString TQStringFromSV(SV *data) { if (!SvOK(data)) - return QString::null; + return TQString::null; if (!SvPOK(data)) - croak("DCOP: Cannot convert to QString"); + croak("DCOP: Cannot convert to TQString"); return SvPV(data, PL_na); } -SV *QStringToSV(const QString &data, SV * self = 0) +SV *TQStringToSV(const TQString &data, SV * self = 0) { return data.isNull() ? &PL_sv_undef : newSVpv((char *)data.latin1(), 0); } -QCStringList QCStringListFromSV(SV *data) +TTQCStringList TQCStringListFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); - QCStringList result; + TQCStringList result; for (int i = 0; i <= av_len((AV*)SvRV(data)); i++) - result.append(QCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); + result.append(TQCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); return result; } -SV *QCStringListToSV(const QCStringList &data, SV * self = 0) +SV *TQCStringListToSV(const TQCStringList &data, SV * self = 0) { AV *result = newAV(); - for (QCStringList::ConstIterator i = data.begin(); i != data.end(); i++) - av_push(result, QCStringToSV(*i)); + for (TQCStringList::ConstIterator i = data.begin(); i != data.end(); i++) + av_push(result, TQCStringToSV(*i)); return newRV((SV*)result); } -QStringList QStringListFromSV(SV *data) +TTQStringList TQStringListFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); - QStringList result; + TQStringList result; for (int i = 0; i <= av_len((AV*)SvRV(data)); i++) - result.append(QCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); + result.append(TQCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); return result; } -SV *QStringListToSV(const QStringList &data, SV * self = 0) +SV *TQStringListToSV(const TQStringList &data, SV * self = 0) { AV *result = newAV(); - for (QStringList::ConstIterator i = data.begin(); i != data.end(); i++) - av_push(result, QStringToSV(*i)); + for (TQStringList::ConstIterator i = data.begin(); i != data.end(); i++) + av_push(result, TQStringToSV(*i)); return newRV((SV*)result); } -QPoint QPointFromSV(SV *data) +TTQPoint TQPointFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); if (av_len((AV*)SvRV(data)) != 1) - croak("DCOP: A QPoint must have exactly 2 components"); + croak("DCOP: A TQPoint must have exactly 2 components"); SV **pts = av_fetch((AV*)SvRV(data), 0, 0); - return QPoint(intFromSV(pts[0]), intFromSV(pts[1])); + return TQPoint(intFromSV(pts[0]), intFromSV(pts[1])); } -SV *QPointToSV(const QPoint &data, SV * self = 0) +SV *TQPointToSV(const TQPoint &data, SV * self = 0) { SV *pts[2] = { intToSV(data.x()), @@ -171,19 +171,19 @@ SV *QPointToSV(const QPoint &data, SV * self = 0) return newRV((SV*)av_make(2, pts)); } -QSize QSizeFromSV(SV *data) +TTQSize TQSizeFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); if (av_len((AV*)SvRV(data)) != 1) - croak("DCOP: A QSize must have exactly 2 components"); + croak("DCOP: A TQSize must have exactly 2 components"); SV **ext = av_fetch((AV*)SvRV(data), 0, 0); - return QSize(intFromSV(ext[0]), intFromSV(ext[1])); + return TQSize(intFromSV(ext[0]), intFromSV(ext[1])); } -SV *QSizeToSV(const QSize &data, SV * self = 0) +SV *TQSizeToSV(const TQSize &data, SV * self = 0) { SV *ext[2] = { intToSV(data.width()), @@ -192,19 +192,19 @@ SV *QSizeToSV(const QSize &data, SV * self = 0) return newRV((SV*)av_make(2, ext)); } -QRect QRectFromSV(SV *data) +TTQRect TQRectFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not a reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); if (av_len((AV*)SvRV(data)) != 1) - croak("DCOP: A QRect must have exactly 4 components"); + croak("DCOP: A TQRect must have exactly 4 components"); SV **rc = av_fetch((AV*)SvRV(data), 0, 0); - return QRect(intFromSV(rc[0]), intFromSV(rc[1]), intFromSV(rc[2]), intFromSV(rc[3])); + return TQRect(intFromSV(rc[0]), intFromSV(rc[1]), intFromSV(rc[2]), intFromSV(rc[3])); } -SV *QRectToSV(const QRect &data, SV * self = 0) +SV *TQRectToSV(const TQRect &data, SV * self = 0) { SV *rc[4] = { intToSV(data.left()), @@ -217,12 +217,12 @@ SV *QRectToSV(const QRect &data, SV * self = 0) KURL KURLFromSV(SV *data) { - return KURL(QStringFromSV(data)); + return KURL(TQStringFromSV(data)); } SV *KURLToSV(const KURL &data, SV * self = 0) { - return QStringToSV(data.url()); + return TQStringToSV(data.url()); } DCOPRef DCOPRefFromSV(SV *data) @@ -231,15 +231,15 @@ DCOPRef DCOPRefFromSV(SV *data) croak("DCOP: Not a DCOP::Object"); SV **app = hv_fetch((HV*)SvRV(data), "APP", 3, 0); SV **obj = hv_fetch((HV*)SvRV(data), "OBJ", 3, 0); - return DCOPRef(QCStringFromSV(app[0]), QCStringFromSV(obj[0])); + return DCOPRef(TQCStringFromSV(app[0]), TQCStringFromSV(obj[0])); } SV *DCOPRefToSV(const DCOPRef &data, SV * self) { SV *ref = newRV((SV*)newHV()); hv_store((HV*)SvRV(ref), "CLIENT", 6, SvREFCNT_inc(self), 0); - hv_store((HV*)SvRV(ref), "APP", 3, QCStringToSV(data.app()), 0); - hv_store((HV*)SvRV(ref), "OBJ", 3, QCStringToSV(data.object()), 0); + hv_store((HV*)SvRV(ref), "APP", 3, TQCStringToSV(data.app()), 0); + hv_store((HV*)SvRV(ref), "OBJ", 3, TQCStringToSV(data.object()), 0); return sv_bless(ref, gv_stashpv("DCOP::Object", 0)); } @@ -258,16 +258,16 @@ SV *DCOPRefToSV(const DCOPRef &data, SV * self) #define DATA(func, argn) mapArgs(func, &ST(argn), items - argn) -QByteArray mapArgs(const QCString &func, SV **data, int n) +TTQByteArray mapArgs(const TQCString &func, SV **data, int n) { int p = func.find('('), q = func.find(')'); if (p == -1 || q == -1 || q < p) croak("DCOP: Invalid function signature \"%s\"", func.data()); - QStringList types = QStringList::split(',', func.mid(p + 1, q - p - 1)); - QByteArray result; - QDataStream s(result, IO_WriteOnly); - QStringList::ConstIterator it = types.begin(); + TQStringList types = TQStringList::split(',', func.mid(p + 1, q - p - 1)); + TQByteArray result; + TQDataStream s(result, IO_WriteOnly); + TQStringList::ConstIterator it = types.begin(); for (int i = 0; i < n; ++i, ++it) { if (it == types.end()) @@ -275,13 +275,13 @@ QByteArray mapArgs(const QCString &func, SV **data, int n) CHECK_ARG(int) else CHECK_ARG(uint) else CHECK_ARG(bool) - else CHECK_ARG(QCString) - else CHECK_ARG(QString) - else CHECK_ARG(QCStringList) - else CHECK_ARG(QStringList) - else CHECK_ARG(QPoint) - else CHECK_ARG(QSize) - else CHECK_ARG(QRect) + else CHECK_ARG(TQCString) + else CHECK_ARG(TQString) + else CHECK_ARG(TQCStringList) + else CHECK_ARG(TQStringList) + else CHECK_ARG(TQPoint) + else CHECK_ARG(TQSize) + else CHECK_ARG(TQRect) else CHECK_ARG(KURL) else CHECK_ARG(DCOPRef) else @@ -292,43 +292,43 @@ QByteArray mapArgs(const QCString &func, SV **data, int n) return result; } -SV* mapReply(const QCString &replyType, const QByteArray &replyData, SV *self) +SV* mapReply(const TQCString &replyType, const TQByteArray &replyData, SV *self) { if (replyType == "void") return sv_newmortal(); - QDataStream s(replyData, IO_ReadOnly); + TQDataStream s(replyData, IO_ReadOnly); CHECK_REPLY(int) else CHECK_REPLY(uint) else CHECK_REPLY(bool) - else CHECK_REPLY(QCString) - else CHECK_REPLY(QString) - else CHECK_REPLY(QCStringList) - else CHECK_REPLY(QStringList) - else CHECK_REPLY(QPoint) - else CHECK_REPLY(QSize) - else CHECK_REPLY(QRect) + else CHECK_REPLY(TQCString) + else CHECK_REPLY(TQString) + else CHECK_REPLY(TQCStringList) + else CHECK_REPLY(TQStringList) + else CHECK_REPLY(TQPoint) + else CHECK_REPLY(TQSize) + else CHECK_REPLY(TQRect) else CHECK_REPLY(KURL) else CHECK_REPLY(DCOPRef) else croak("Sorry, receiving a %s is not implemented", replyType.data()); } -bool isMultiWordType(const QString &type) +bool isMultiWordType(const TQString &type) { return type == "unsigned" || type == "signed" || type == "long"; } -QCString canonicalizeSignature(const QCString &sig) +TTQCString canonicalizeSignature(const TQCString &sig) { - QCString normal = DCOPClient::normalizeFunctionSignature(sig); + TQCString normal = DCOPClient::normalizeFunctionSignature(sig); int p = normal.find('('), q = normal.find(')'); - QCString result = normal.left(p + 1); + TQCString result = normal.left(p + 1); result.remove(0, result.findRev(' ') + 1); - QStringList params = QStringList::split(',', normal.mid(p + 1, q - p - 1)); - for (QStringList::ConstIterator it = params.begin(); it != params.end(); ++it) + TQStringList params = TQStringList::split(',', normal.mid(p + 1, q - p - 1)); + for (TQStringList::ConstIterator it = params.begin(); it != params.end(); ++it) { - QStringList words = QStringList::split(' ', (*it).simplifyWhiteSpace()); - for (QStringList::ConstIterator wi = words.begin(); wi != words.end(); ++wi) + TQStringList words = TQStringList::split(' ', (*it).simplifyWhiteSpace()); + for (TQStringList::ConstIterator wi = words.begin(); wi != words.end(); ++wi) if (!isMultiWordType(*wi)) { result += *wi; @@ -370,9 +370,9 @@ DCOPClient::isAttached() RETVAL #if 0 -QCString +TTQCString DCOPClient::registerAs(appId, ...) - QCString appId + TQCString appId PREINIT: bool addPID = true; CODE: @@ -391,16 +391,16 @@ DCOPClient::isRegistered() #endif -QCString +TTQCString DCOPClient::appId() OUTPUT: RETVAL bool DCOPClient::send(app, obj, func, ...) - QCString app - QCString obj - QCString func + TQCString app + TQCString obj + TQCString func CODE: func = canonicalizeSignature(func); RETVAL = THIS->send(app, obj, func, DATA(func, 4)); @@ -409,13 +409,13 @@ DCOPClient::send(app, obj, func, ...) SV* DCOPClient::call(app, obj, func, ...) - QCString app - QCString obj - QCString func + TQCString app + TQCString obj + TQCString func PPCODE: func = canonicalizeSignature(func); - QCString replyType; - QByteArray replyData; + TQCString replyType; + TQByteArray replyData; bool success; if ((success = THIS->call(app, obj, func, DATA(func, 4), replyType, replyData))) PUSHs(mapReply(replyType, replyData, ST(0))); @@ -426,66 +426,66 @@ DCOPClient::call(app, obj, func, ...) SV* DCOPClient::findObject(app, obj, func, ...) - QCString app - QCString obj - QCString func + TQCString app + TQCString obj + TQCString func PPCODE: func = canonicalizeSignature(func); - QCString foundApp; - QCString foundObj; + TQCString foundApp; + TQCString foundObj; if (!THIS->findObject(app, obj, func, DATA(func, 4), foundApp, foundObj)) XSRETURN_UNDEF; - PUSHs(QCStringToSV(foundApp)); - PUSHs(QCStringToSV(foundObj)); + PUSHs(TQCStringToSV(foundApp)); + PUSHs(TQCStringToSV(foundObj)); void DCOPClient::emitDCOPSignal(obj, signal, ...) - QCString obj - QCString signal + TQCString obj + TQCString signal CODE: signal = canonicalizeSignature(signal); THIS->emitDCOPSignal(obj, signal, DATA(signal, 3)); bool DCOPClient::isApplicationRegistered(app) - QCString app + TQCString app OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::registeredApplications() OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::remoteObjects(app) - QCString app + TQCString app OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::remoteInterfaces(app, obj) - QCString app - QCString obj + TQCString app + TQCString obj OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::remoteFunctions(app, obj) - QCString app - QCString obj + TQCString app + TQCString obj OUTPUT: RETVAL -static QCString +static TQCString DCOPClient::normalizeFunctionSignature(sig) - QCString sig + TQCString sig OUTPUT: RETVAL -QCString +TTQCString canonicalizeSignature(sig) - QCString sig + TQCString sig CODE: RETVAL = canonicalizeSignature(sig); OUTPUT: diff --git a/dcopperl/Makefile.PL b/dcopperl/Makefile.PL index 8517a323..fbab8952 100644 --- a/dcopperl/Makefile.PL +++ b/dcopperl/Makefile.PL @@ -27,7 +27,7 @@ WriteMakefile( NAME => 'DCOP', VERSION_FROM => 'DCOP.pm', INC => "-I$qt_inc -I$kde_inc", - LIBS => "-L$qt_lib -lqt-mt -L$kde_lib -ltdecore -lDCOP", + LIBS => "-L$qt_lib -ltqt-mt -L$kde_lib -ltdecore -lDCOP", XS => {'DCOP.xs' => 'DCOP.cpp'}, XSOPT => '-C++', CCFLAGS => '-x c++', diff --git a/dcopperl/Makefile.PL.in b/dcopperl/Makefile.PL.in index e30f32a4..3c5e0c18 100644 --- a/dcopperl/Makefile.PL.in +++ b/dcopperl/Makefile.PL.in @@ -13,7 +13,7 @@ WriteMakefile( NAME => 'DCOP', VERSION_FROM => '@srcdir@/DCOP.pm', INC => "-I$qt_inc -I$kde_inc", - LIBS => "-L$qt_lib -lqt-mt -L$kde_lib -ltdecore -lDCOP", + LIBS => "-L$qt_lib -ltqt-mt -L$kde_lib -ltdecore -lDCOP", XS => {'DCOP.xs' => 'DCOP.cpp'}, XSOPT => '-C++', CCFLAGS => '-x c++', diff --git a/dcopperl/TODO b/dcopperl/TODO index 9846ee5f..6d9e96c6 100644 --- a/dcopperl/TODO +++ b/dcopperl/TODO @@ -1,4 +1,4 @@ * Lots of cleanup * More data types * signals/slots -* UTF8-safe QString <=> scalar conversions +* UTF8-safe TQString <=> scalar conversions diff --git a/dcopperl/test.pl b/dcopperl/test.pl index 0402395e..29187a2e 100644 --- a/dcopperl/test.pl +++ b/dcopperl/test.pl @@ -62,7 +62,7 @@ sub query { print "[$#$list]"; check ($list = $client->remoteFunctions("kdesktop", "qt")); print "[$#$list]"; - check grep /^QCStringList functions\(\)$/, @$list; + check grep /^TQCStringList functions\(\)$/, @$list; } sub calls { diff --git a/dcopperl/typemap b/dcopperl/typemap index cb7f2420..62af8ae1 100644 --- a/dcopperl/typemap +++ b/dcopperl/typemap @@ -1,7 +1,7 @@ TYPEMAP DCOPClient * O_OBJECT -QCString T_QCSTRING -QCStringList T_QCSTRINGLIST +TTQCString T_QCSTRING +TTQCStringList T_QCSTRINGLIST INPUT O_OBJECT @@ -12,12 +12,12 @@ O_OBJECT XSRETURN_UNDEF; } T_QCSTRING - $var = QCStringFromSV($arg); + $var = TQCStringFromSV($arg); OUTPUT O_OBJECT sv_setref_pv( $arg, CLASS, (void*)$var ); T_QCSTRING - sv_setsv($arg, QCStringToSV($var)); + sv_setsv($arg, TQCStringToSV($var)); T_QCSTRINGLIST - sv_setsv($arg, QCStringListToSV($var)); + sv_setsv($arg, TQCStringListToSV($var)); |