Mercurial > projects > qtd
changeset 357:9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Q_CLASSINFO implementation
Now Qtd can be built on Windows
line wrap: on
line diff
--- a/CMakeLists.txt Tue May 25 20:14:04 2010 +0300 +++ b/CMakeLists.txt Wed Jun 02 19:38:05 2010 +0300 @@ -12,7 +12,7 @@ #set( SUFFIXBIN "${SUFFIXBIN}-debug" ) add_definitions(-DDEBUG) elseif (NOT ${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) - message(STATUS "Only debug and release configurations are supproted. The configuration is changed to 'Release'") + message(STATUS "Only debug and release configurations are supported. The configuration is changed to 'Release'") set(CMAKE_BUILD_TYPE Release) endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) @@ -28,7 +28,7 @@ option(ALLOW_IN_SOURCE_BUILDS "Allow in-source builds" "OFF") if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT ALLOW_IN_SOURCE_BUILDS) message(FATAL_ERROR "In-source builds are not allowed. " - "Please create a directory and run cmake from there, passing the path" + "Please create a directory and run cmake from there, passing the path " "to this source directory as the last argument. " "This process created the file `CMakeCache.txt` and the directory `CMakeFiles'. Please delete them. " "Or you can restart cmake with `-DALLOW_IN_SOURCE_BUILDS=1`, but it is not recommended." @@ -180,14 +180,11 @@ endif(CMAKE_HOST_WIN32) if(CMAKE_HOST_WIN32 AND D_IS_MARS) + set(D_FLAGS -version=cpp_shared) + add_definitions(-DCPP_SHARED) set(CPP_SHARED 1 CACHE INTERNAL "") endif(CMAKE_HOST_WIN32 AND D_IS_MARS) -if(D_IS_MARS) - set(D_FLAGS -version=cpp_shared) - add_definitions(-DCPP_SHARED) -endif(D_IS_MARS) - if(UNITTEST) add_d_versions(QtdUnittest) set(D_FLAGS ${D_FLAGS} -unittest) @@ -438,7 +435,7 @@ endforeach(d_source ${d_sources}) endif(NOT GENERATE_DI_FILES) - ## Build the CPP part. + ### Build the CPP part. if(CPP_SHARED) set(cpp_method SHARED) else(CPP_SHARED) @@ -447,6 +444,8 @@ add_library(cpp_${package} ${cpp_method} ${cpp_sources}) set_property(TARGET cpp_${package} PROPERTY RUNTIME_OUTPUT_DIRECTORY lib) set_property(TARGET cpp_${package} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles) + set_property(TARGET cpp_${package} PROPERTY COMPILE_DEFINITIONS QTD_${package_upper}) + set(link_cpp ${link_cpp} ${QT_QT${package_upper}_LIBRARY}) if(CPP_SHARED) else(CPP_SHARED) @@ -498,7 +497,7 @@ add_custom_command( OUTPUT "${d_implib}" COMMAND "${IMPLIB}" - ARGS /system /PAGESIZE:32 ${d_implib_native} ${cpp_lib_native} + ARGS /system /PAGESIZE:64 ${d_implib_native} ${cpp_lib_native} DEPENDS "cpp_${package}" COMMENT "Creating implib ${lib_name}" ) @@ -516,6 +515,7 @@ ## Generate dependences for make (or nmake). add_custom_target(${package}) add_dependencies(${package} ${lib_name}) + add_dependencies(${lib_name} cpp_${package}) foreach(depend ${required}) string(TOLOWER ${depend} depend)
--- a/boost-license-1.0.txt Tue May 25 20:14:04 2010 +0300 +++ b/boost-license-1.0.txt Wed Jun 02 19:38:05 2010 +0300 @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE.
--- a/build/core.makefile Tue May 25 20:14:04 2010 +0300 +++ b/build/core.makefile Wed Jun 02 19:38:05 2010 +0300 @@ -1,83 +0,0 @@ -ifeq ($(D_VERSION), 1) -D_PATH = d1/qt -else -D_PATH = d2/qt -endif - -##-------------------------- -QTD_CORE += QGlobal $(D_PATH)/qtd/Str core/Qt qtd/ArrayOpsPrimitive $(D_PATH)/QtdObject $(D_PATH)/Signal \ -$(D_PATH)/core/QPoint \ -$(D_PATH)/core/QPointF \ -$(D_PATH)/core/QRect \ -$(D_PATH)/core/QRectF \ -$(D_PATH)/core/QSize \ -$(D_PATH)/core/QSizeF \ -$(D_PATH)/core/QLine \ -$(D_PATH)/core/QLineF \ -$(D_PATH)/core/QModelIndex \ -$(D_PATH)/core/QVariant - -##-------------------------- - -## Qt Lib name. -qt_core_name = QtCore - -## Libraries linked to the cpp part (is active only when CPP_SHARED == true). -core_link_cpp += - -## Libraries linked to the d part (is active only when CPP_SHARED == true).. -core_link_d += - -## Module specific cpp files. -core_cpp_files += cpp/qt_qtd/qtd_core.cpp cpp/qt_qtd/ArrayOpsPrimitive_shell.cpp \ -cpp/qt_core/QPoint_shell.cpp cpp/qt_core/QPointF_shell.cpp cpp/qt_core/QRect_shell.cpp cpp/qt_core/QRectF_shell.cpp \ -cpp/qt_core/QSize_shell.cpp cpp/qt_core/QSizeF_shell.cpp cpp/qt_core/QLine_shell.cpp cpp/qt_core/QLineF_shell.cpp \ -cpp/qt_core/QModelIndex_shell.cpp cpp/qt_core/QVariant_shell.cpp - -## Module specific d files. -core_d_files += $(QTD_CORE:%=qt/%.d) qt/core/ArrayOps2 - -## Classes. -## TODO: use list that genareted by dgen. -core_classes = \ - ArrayOps \ - QChildEvent \ - QCoreApplication \ - QEvent \ - QEventLoop \ - QObject \ - QTimerEvent \ - QTranslator \ - QByteArray \ - QLocale \ - QDataStream \ - QMimeData \ - QIODevice \ - QDateTime \ - QDate \ - QTime \ - QBitArray \ - QRegExp \ - QUrl \ - QAbstractItemModel \ - QAbstractFileEngine \ - QFile \ - QDir \ - QFileInfo \ - QTextStream \ - QString \ - QTimer \ - QTextCodec \ - QTextCodec_ConverterState \ - QTextEncoder \ - QTextDecoder \ - QTimeLine \ - QAbstractFactory \ - QAbstractListModel \ - QCryptographicHash \ - QProcess \ - QBuffer \ - QMetaType \ - QLibraryInfo \ - QFileSystemWatcher \ - QXmlStreamEntityResolver \ No newline at end of file
--- a/build/core.txt Tue May 25 20:14:04 2010 +0300 +++ b/build/core.txt Wed Jun 02 19:38:05 2010 +0300 @@ -25,6 +25,7 @@ core/QVariant ) set (d_qtd_files + Core QtdObject Signal String
--- a/cpp/qt_core/QLineF_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QLineF_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -5,7 +5,7 @@ // QLineF::angle() const -extern "C" DLL_PUBLIC double qtd_QLineF_angle +QTD_EXTERN QTD_DLL_PUBLIC double qtd_QLineF_angle (void* __this_nativeId) { QLineF *__qt_this = (QLineF *) __this_nativeId; @@ -17,7 +17,7 @@ } // QLineF::angle(const QLineF & l) const -extern "C" DLL_PUBLIC double qtd_QLineF_angle_QLineF +QTD_EXTERN QTD_DLL_PUBLIC double qtd_QLineF_angle_QLineF (void* __this_nativeId, void* l0) { @@ -31,7 +31,7 @@ } // QLineF::angleTo(const QLineF & l) const -extern "C" DLL_PUBLIC double qtd_QLineF_angleTo_QLineF +QTD_EXTERN QTD_DLL_PUBLIC double qtd_QLineF_angleTo_QLineF (void* __this_nativeId, void* l0) { @@ -45,7 +45,7 @@ } // QLineF::intersect(const QLineF & l, QPointF * intersectionPoint) const -extern "C" DLL_PUBLIC int qtd_QLineF_intersect_QLineF_nativepointerQPointF +QTD_EXTERN QTD_DLL_PUBLIC int qtd_QLineF_intersect_QLineF_nativepointerQPointF (void* __this_nativeId, void* l0, void* intersectionPoint1) @@ -60,7 +60,7 @@ } // QLineF::isNull() const -extern "C" DLL_PUBLIC bool qtd_QLineF_isNull +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QLineF_isNull (void* __this_nativeId) { QLineF *__qt_this = (QLineF *) __this_nativeId; @@ -72,7 +72,7 @@ } // QLineF::length() const -extern "C" DLL_PUBLIC double qtd_QLineF_length +QTD_EXTERN QTD_DLL_PUBLIC double qtd_QLineF_length (void* __this_nativeId) { QLineF *__qt_this = (QLineF *) __this_nativeId; @@ -84,7 +84,7 @@ } // QLineF::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QLineF_writeTo_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QLineF_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -95,7 +95,7 @@ } // QLineF::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QLineF_readFrom_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QLineF_readFrom_QDataStream (void* __this_nativeId, void* arg__1) { @@ -106,7 +106,7 @@ } // QLineF::p1() const -extern "C" DLL_PUBLIC QPointF qtd_QLineF_p1 +QTD_EXTERN QTD_DLL_PUBLIC QPointF qtd_QLineF_p1 (void* __this_nativeId) { QLineF *__qt_this = (QLineF *) __this_nativeId; @@ -118,7 +118,7 @@ } // QLineF::setAngle(double angle) -extern "C" DLL_PUBLIC void qtd_QLineF_setAngle_double +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QLineF_setAngle_double (void* __this_nativeId, double angle0) { @@ -128,7 +128,7 @@ } // QLineF::unitVector() const -extern "C" DLL_PUBLIC QLineF qtd_QLineF_unitVector +QTD_EXTERN QTD_DLL_PUBLIC QLineF qtd_QLineF_unitVector (void* __this_nativeId) { QLineF *__qt_this = (QLineF *) __this_nativeId; @@ -136,7 +136,7 @@ } // QLineF::fromPolar(double length, double angle) -extern "C" DLL_PUBLIC QLineF qtd_QLineF_fromPolar_double_double +QTD_EXTERN QTD_DLL_PUBLIC QLineF qtd_QLineF_fromPolar_double_double (double length0, double angle1) {
--- a/cpp/qt_core/QLine_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QLine_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -4,7 +4,7 @@ #include "qtd_core.h" // QLine::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QLine_writeTo_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QLine_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -15,7 +15,7 @@ } // QLine::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QLine_readFrom_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QLine_readFrom_QDataStream (void* __this_nativeId, void* arg__1) {
--- a/cpp/qt_core/QMetaObject_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QMetaObject_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -4,61 +4,61 @@ #include <QList> -extern "C" DLL_PUBLIC void* qtd_QMetaObject_superClass(void *nativeId) +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QMetaObject_superClass(void *nativeId) { return (void*)((QMetaObject*)nativeId)->superClass(); } -extern "C" DLL_PUBLIC void qtd_QMetaObject_activate(QObject *sender, int signal_index, void **argv) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QMetaObject_activate(QObject *sender, int signal_index, void **argv) { QMetaObject::activate(sender, signal_index, argv); } -extern "C" DLL_PUBLIC void qtd_QMetaObject_activate_3(QObject *sender, const QMetaObject *m, int local_signal_index, void **argv) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QMetaObject_activate_3(QObject *sender, const QMetaObject *m, int local_signal_index, void **argv) { QMetaObject::activate(sender, m, local_signal_index, argv); } -extern "C" DLL_PUBLIC void qtd_QMetaObject_activate_4(QObject *sender, const QMetaObject *m, int from_local_signal_index, int to_local_signal_index, void **argv) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QMetaObject_activate_4(QObject *sender, const QMetaObject *m, int from_local_signal_index, int to_local_signal_index, void **argv) { QMetaObject::activate(sender, m, from_local_signal_index, to_local_signal_index, argv); } -extern "C" DLL_PUBLIC bool qtd_QMetaObject_connect(const QObject *sender, int signal_index, +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QMetaObject_connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type, int *types) { return QMetaObject::connect(sender, signal_index, receiver, method_index, type, types); } -extern "C" DLL_PUBLIC int qtd_QMetaObject_indexOfMethod(void *nativeId, const char *method) +QTD_EXTERN QTD_DLL_PUBLIC int qtd_QMetaObject_indexOfMethod(void *nativeId, const char *method) { return ((QMetaObject*)nativeId)->indexOfMethod(method); } -extern "C" DLL_PUBLIC int qtd_QMetaObject_methodCount(void *nativeId) +QTD_EXTERN QTD_DLL_PUBLIC int qtd_QMetaObject_methodCount(void *nativeId) { return ((QMetaObject*)nativeId)->methodCount(); } -extern "C" DLL_PUBLIC void qtd_create_QList(void *nativeId) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_create_QList(void *nativeId) { QList<int> & list = (*(QList<int> *)nativeId); list.append(54); list.append(45); } -extern "C" DLL_PUBLIC void qtd_create_QList_double(void *nativeId) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_create_QList_double(void *nativeId) { QList<double> & list = (*(QList<double> *)nativeId); list.append(54.44); list.append(45.55); } -extern "C" DLL_PUBLIC void qtd_create_QList_QObject(void *nativeId) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_create_QList_QObject(void *nativeId) { QList<QObject*> & list2 = (*(QList<QObject*> *)nativeId); - + QList<QObject*> list; QObject* a1 = new QObject(); a1->setObjectName("a1");
--- a/cpp/qt_core/QMetaType_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QMetaType_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -5,8 +5,8 @@ typedef void * Ctor (const void *copy); typedef void Dtor(void *obj); -extern "C" DLL_PUBLIC int qtd_registerType(char* namePtr, Ctor ctor, Dtor dtor) -{ +QTD_EXTERN QTD_DLL_PUBLIC int qtd_registerType(char* namePtr, Ctor ctor, Dtor dtor) +{ return QMetaType::registerType(namePtr, dtor, ctor); } @@ -14,15 +14,15 @@ typedef void (*LoadOperator)(void *, void *); -extern "C" DLL_PUBLIC void qtd_registerStreamOperators(const char *typeName, SaveOperator saveOp, +QTD_EXTERN QTD_DLL_PUBLIC void qtd_registerStreamOperators(const char *typeName, SaveOperator saveOp, LoadOperator loadOp) -{ +{ QMetaType::registerStreamOperators(typeName, reinterpret_cast<QMetaType::SaveOperator>(saveOp), reinterpret_cast<QMetaType::LoadOperator>(loadOp)); } - + -extern "C" DLL_PUBLIC int qtd_MetatypeId(char *id) +QTD_EXTERN QTD_DLL_PUBLIC int qtd_MetatypeId(char *id) { return QMetaType::type(id); }
--- a/cpp/qt_core/QModelIndex_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QModelIndex_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -6,14 +6,14 @@ #include "qtd_core.h" -extern "C" DLL_PUBLIC void __qtd_QModelIndex_destructor(void *ptr) +QTD_EXTERN QTD_DLL_PUBLIC void __qtd_QModelIndex_destructor(void *ptr) { delete (QModelIndex *)ptr; } // ---externC--- // QModelIndex::QModelIndex() -extern "C" DLL_PUBLIC void* __qtd_QModelIndex_QModelIndex +QTD_EXTERN QTD_DLL_PUBLIC void* __qtd_QModelIndex_QModelIndex () { QModelIndex *__qt_this = new QModelIndex(); @@ -22,7 +22,7 @@ } // QModelIndex::QModelIndex(const QModelIndex & other) -extern "C" DLL_PUBLIC void* __qtd_QModelIndex_QModelIndex_QModelIndex +QTD_EXTERN QTD_DLL_PUBLIC void* __qtd_QModelIndex_QModelIndex_QModelIndex (QModelIndex other0) { QModelIndex *__qt_this = new QModelIndex((const QModelIndex& )other0); @@ -31,7 +31,7 @@ } // QModelIndex::child(int row, int column) const -extern "C" DLL_PUBLIC QModelIndex __qtd_QModelIndex_child_int_int +QTD_EXTERN QTD_DLL_PUBLIC QModelIndex __qtd_QModelIndex_child_int_int (void* __this_nativeId, int row0, int column1) @@ -44,7 +44,7 @@ } // QModelIndex::column() const -extern "C" DLL_PUBLIC int __qtd_QModelIndex_column +QTD_EXTERN QTD_DLL_PUBLIC int __qtd_QModelIndex_column (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -56,7 +56,7 @@ } // QModelIndex::data(int role) const -extern "C" DLL_PUBLIC void* __qtd_QModelIndex_data_int +QTD_EXTERN QTD_DLL_PUBLIC void* __qtd_QModelIndex_data_int (void* __this_nativeId, int role0) { @@ -69,7 +69,7 @@ } // QModelIndex::flags() const -extern "C" DLL_PUBLIC int __qtd_QModelIndex_flags +QTD_EXTERN QTD_DLL_PUBLIC int __qtd_QModelIndex_flags (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -81,7 +81,7 @@ } // QModelIndex::internalId() const -extern "C" DLL_PUBLIC qint64 __qtd_QModelIndex_internalId +QTD_EXTERN QTD_DLL_PUBLIC qint64 __qtd_QModelIndex_internalId (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -93,7 +93,7 @@ } // QModelIndex::internalPointer() const -extern "C" DLL_PUBLIC void* __qtd_QModelIndex_internalPointer +QTD_EXTERN QTD_DLL_PUBLIC void* __qtd_QModelIndex_internalPointer (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -105,7 +105,7 @@ } // QModelIndex::isValid() const -extern "C" DLL_PUBLIC bool __qtd_QModelIndex_isValid +QTD_EXTERN QTD_DLL_PUBLIC bool __qtd_QModelIndex_isValid (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -117,7 +117,7 @@ } // QModelIndex::model() const -extern "C" DLL_PUBLIC void* __qtd_QModelIndex_model +QTD_EXTERN QTD_DLL_PUBLIC void* __qtd_QModelIndex_model (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -129,7 +129,7 @@ } // QModelIndex::operator<(const QModelIndex & other) const -extern "C" DLL_PUBLIC bool __qtd_QModelIndex_operator_less_QModelIndex +QTD_EXTERN QTD_DLL_PUBLIC bool __qtd_QModelIndex_operator_less_QModelIndex (void* __this_nativeId, QModelIndex other0) { @@ -142,7 +142,7 @@ } // QModelIndex::operator==(const QModelIndex & other) const -extern "C" DLL_PUBLIC bool __qtd_QModelIndex_operator_equal_QModelIndex +QTD_EXTERN QTD_DLL_PUBLIC bool __qtd_QModelIndex_operator_equal_QModelIndex (void* __this_nativeId, QModelIndex other0) { @@ -155,7 +155,7 @@ } // QModelIndex::parent() const -extern "C" DLL_PUBLIC QModelIndex __qtd_QModelIndex_parent +QTD_EXTERN QTD_DLL_PUBLIC QModelIndex __qtd_QModelIndex_parent (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -166,7 +166,7 @@ } // QModelIndex::row() const -extern "C" DLL_PUBLIC int __qtd_QModelIndex_row +QTD_EXTERN QTD_DLL_PUBLIC int __qtd_QModelIndex_row (void* __this_nativeId) { QModelIndex *__qt_this = (QModelIndex *) __this_nativeId; @@ -178,7 +178,7 @@ } // QModelIndex::sibling(int row, int column) const -extern "C" DLL_PUBLIC QModelIndex __qtd_QModelIndex_sibling_int_int +QTD_EXTERN QTD_DLL_PUBLIC QModelIndex __qtd_QModelIndex_sibling_int_int (void* __this_nativeId, int row0, int column1)
--- a/cpp/qt_core/QPointF_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QPointF_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -5,7 +5,7 @@ // ---externC--- // QPointF::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QPointF_writeTo_QDataStream +QTD_EXTERN QTD_DLL_EXPORT void qtd_QPointF_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -16,7 +16,7 @@ } // QPointF::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QPointF_readFrom_QDataStream +QTD_EXTERN QTD_DLL_EXPORT void qtd_QPointF_readFrom_QDataStream (void* __this_nativeId, void* arg__1) {
--- a/cpp/qt_core/QPoint_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QPoint_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -5,7 +5,7 @@ // QPoint::manhattanLength() const -extern "C" DLL_PUBLIC int qtd_QPoint_manhattanLength +QTD_EXTERN QTD_DLL_EXPORT int qtd_QPoint_manhattanLength (void* __this_nativeId) { QPoint *__qt_this = (QPoint *) __this_nativeId; @@ -17,7 +17,7 @@ } // QPoint::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QPoint_writeTo_QDataStream +QTD_EXTERN QTD_DLL_EXPORT void qtd_QPoint_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -28,7 +28,7 @@ } // QPoint::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QPoint_readFrom_QDataStream +QTD_EXTERN QTD_DLL_EXPORT void qtd_QPoint_readFrom_QDataStream (void* __this_nativeId, void* arg__1) {
--- a/cpp/qt_core/QRectF_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QRectF_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -5,7 +5,7 @@ // QRectF::contains(const QPointF & p) const -extern "C" DLL_PUBLIC bool qtd_QRectF_contains_QPointF +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QRectF_contains_QPointF (void* __this_nativeId, void* p0) { @@ -20,7 +20,7 @@ } // QRectF::contains(const QRectF & r) const -extern "C" DLL_PUBLIC bool qtd_QRectF_contains_QRectF +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QRectF_contains_QRectF (void* __this_nativeId, void* r0) { @@ -34,7 +34,7 @@ } // QRectF::intersects(const QRectF & r) const -extern "C" DLL_PUBLIC bool qtd_QRectF_intersects_QRectF +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QRectF_intersects_QRectF (void* __this_nativeId, void* r0) { @@ -48,7 +48,7 @@ } // QRectF::normalized() const -extern "C" DLL_PUBLIC QRectF qtd_QRectF_normalized +QTD_EXTERN QTD_DLL_PUBLIC QRectF qtd_QRectF_normalized (void* __this_nativeId) { QRectF *__qt_this = (QRectF *) __this_nativeId; @@ -56,7 +56,7 @@ } // QRectF::operator&(const QRectF & r) const -extern "C" DLL_PUBLIC QRectF qtd_QRectF_operator_and_QRectF +QTD_EXTERN QTD_DLL_PUBLIC QRectF qtd_QRectF_operator_and_QRectF (void* __this_nativeId, void* r0) { @@ -66,7 +66,7 @@ } // QRectF::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QRectF_writeTo_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QRectF_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -77,7 +77,7 @@ } // QRectF::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QRectF_readFrom_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QRectF_readFrom_QDataStream (void* __this_nativeId, void* arg__1) { @@ -88,7 +88,7 @@ } // QRectF::operator|(const QRectF & r) const -extern "C" DLL_PUBLIC QRectF qtd_QRectF_operator_or_QRectF +QTD_EXTERN QTD_DLL_PUBLIC QRectF qtd_QRectF_operator_or_QRectF (void* __this_nativeId, void* r0) { @@ -98,7 +98,7 @@ } // QRectF::toAlignedRect() const -extern "C" DLL_PUBLIC QRect qtd_QRectF_toAlignedRect +QTD_EXTERN QTD_DLL_PUBLIC QRect qtd_QRectF_toAlignedRect (void* __this_nativeId) { QRectF *__qt_this = (QRectF *) __this_nativeId;
--- a/cpp/qt_core/QRect_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QRect_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -4,7 +4,7 @@ #include "qtd_core.h" // QRect::contains(const QPoint & p, bool proper) const -extern "C" DLL_PUBLIC bool qtd_QRect_contains_QPoint_bool +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QRect_contains_QPoint_bool (void* __this_nativeId, void* p0, bool proper1) @@ -19,7 +19,7 @@ } // QRect::contains(const QRect & r, bool proper) const -extern "C" DLL_PUBLIC bool qtd_QRect_contains_QRect_bool +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QRect_contains_QRect_bool (void* __this_nativeId, void* r0, bool proper1) @@ -34,7 +34,7 @@ } // QRect::intersects(const QRect & r) const -extern "C" DLL_PUBLIC bool qtd_QRect_intersects_QRect +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QRect_intersects_QRect (void* __this_nativeId, void* r0) { @@ -48,7 +48,7 @@ } // QRect::normalized() const -extern "C" DLL_PUBLIC QRect qtd_QRect_normalized +QTD_EXTERN QTD_DLL_PUBLIC QRect qtd_QRect_normalized (void* __this_nativeId) { QRect *__qt_this = (QRect *) __this_nativeId; @@ -56,7 +56,7 @@ } // QRect::operator&(const QRect & r) const -extern "C" DLL_PUBLIC QRect qtd_QRect_operator_and_QRect +QTD_EXTERN QTD_DLL_PUBLIC QRect qtd_QRect_operator_and_QRect (void* __this_nativeId, void* r0) { @@ -66,7 +66,7 @@ } // QRect::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QRect_writeTo_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QRect_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -77,7 +77,7 @@ } // QRect::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void qtd_QRect_readFrom_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QRect_readFrom_QDataStream (void* __this_nativeId, void* arg__1) { @@ -88,7 +88,7 @@ } // QRect::operator|(const QRect & r) const -extern "C" DLL_PUBLIC QRect qtd_QRect_operator_or_QRect +QTD_EXTERN QTD_DLL_PUBLIC QRect qtd_QRect_operator_or_QRect (void* __this_nativeId, void* r0) {
--- a/cpp/qt_core/QSizeF_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QSizeF_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -3,7 +3,7 @@ #include "qtd_core.h" // QSizeF::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void __qtd_QSizeF_writeTo_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void __qtd_QSizeF_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -14,7 +14,7 @@ } // QSizeF::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void __qtd_QSizeF_readFrom_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void __qtd_QSizeF_readFrom_QDataStream (void* __this_nativeId, void* arg__1) { @@ -25,7 +25,7 @@ } // QSizeF::scale(const QSizeF & s, Qt::AspectRatioMode mode) -extern "C" DLL_PUBLIC void __qtd_QSizeF_scale_QSizeF_AspectRatioMode +QTD_EXTERN QTD_DLL_PUBLIC void __qtd_QSizeF_scale_QSizeF_AspectRatioMode (void* __this_nativeId, void* s0, int mode1)
--- a/cpp/qt_core/QSize_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QSize_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -4,7 +4,7 @@ // QSize::operator<<(QDataStream & arg__1) -extern "C" DLL_PUBLIC void __qtd_QSize_writeTo_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void __qtd_QSize_writeTo_QDataStream (void* __this_nativeId, void* arg__1) { @@ -15,7 +15,7 @@ } // QSize::operator>>(QDataStream & arg__1) -extern "C" DLL_PUBLIC void __qtd_QSize_readFrom_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void __qtd_QSize_readFrom_QDataStream (void* __this_nativeId, void* arg__1) { @@ -26,7 +26,7 @@ } // QSize::scale(const QSize & s, Qt::AspectRatioMode mode) -extern "C" DLL_PUBLIC void __qtd_QSize_scale_QSize_AspectRatioMode +QTD_EXTERN QTD_DLL_PUBLIC void __qtd_QSize_scale_QSize_AspectRatioMode (void* __this_nativeId, void* s0, int mode1)
--- a/cpp/qt_core/QString_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QString_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -1,21 +1,21 @@ #include <QString> #include "qtd_core.h" -extern "C" DLL_PUBLIC const ushort* qtd_QString_utf16 +QTD_EXTERN QTD_DLL_PUBLIC const ushort* qtd_QString_utf16 (void* __this_nativeId) { QString *__qt_this = (QString *) __this_nativeId; return __qt_this->utf16(); } -extern "C" DLL_PUBLIC int qtd_QString_size +QTD_EXTERN QTD_DLL_PUBLIC int qtd_QString_size (void* __this_nativeId) { QString *__qt_this = (QString *) __this_nativeId; return __qt_this->size(); } -extern "C" DLL_PUBLIC void qtd_QString_operatorAssign +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QString_operatorAssign (void* __this_nativeId, DArray text) { @@ -23,18 +23,18 @@ *__qt_this = QString::fromUtf8((const char *)text.ptr, text.length); } -extern "C" DLL_PUBLIC void qtd_QString_destructor(void *ptr) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QString_destructor(void *ptr) { delete (QString *)ptr; } -extern "C" DLL_PUBLIC void qtd_QString_call_destructor(QString *ptr) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QString_call_destructor(QString *ptr) { ptr->~QString(); } -extern "C" DLL_PUBLIC void* qtd_QString_QString_QString +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QString_QString_QString (void* string0) { const QString& __qt_string0 = (const QString& ) *(QString *)string0; @@ -42,7 +42,7 @@ return (void *) __qt_this; } -extern "C" DLL_PUBLIC void* qtd_QString_new_fromUtf8_at +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QString_new_fromUtf8_at (void* place, DArray text) { QString *__qt_this = new(place) QString; @@ -50,17 +50,17 @@ return __qt_this; } -extern "C" DLL_PUBLIC void* qtd_QString_placed_copy(void* string0, void* place) { +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QString_placed_copy(void* string0, void* place) { const QString& __qt_string0 = (const QString& ) *(QString *)string0; QString *result = new (place)QString((const QString& )__qt_string0); return (void *) result; } -extern "C" DLL_PUBLIC void qtd_QString_placed_ctor(void* place) { +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QString_placed_ctor(void* place) { new (place) QString(); } -extern "C" DLL_PUBLIC void qtd_QString_assign_fromUtf8 +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QString_assign_fromUtf8 (QString *__qt_this, DArray text) { *__qt_this = QString::fromUtf8((const char *)text.ptr, text.length);
--- a/cpp/qt_core/QVariant_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_core/QVariant_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -17,12 +17,12 @@ #include <qvariant.h> #include "qtd_core.h" -extern "C" DLL_PUBLIC void qtd_QVariant_destructor(void *ptr) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_destructor(void *ptr) { delete (QVariant *)ptr; } -extern "C" DLL_PUBLIC void qtd_QVariant_call_destructor(QVariant *ptr) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_call_destructor(QVariant *ptr) { ptr->~QVariant(); } @@ -217,7 +217,7 @@ // Write virtual function overries used to decide on static/virtual calls // ---externC--- // QVariant::QVariant() -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant () { QVariant_QtDShell *__qt_this = new QVariant_QtDShell(); @@ -226,7 +226,7 @@ } // QVariant::QVariant(QDataStream & s) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QDataStream (void* s0) { QDataStream& __qt_s0 = (QDataStream& ) * (QDataStream *) s0; @@ -236,7 +236,7 @@ } // QVariant::QVariant(Qt::GlobalColor color) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_GlobalColor +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_GlobalColor (int color0) { Qt::GlobalColor __qt_color0 = (Qt::GlobalColor) color0; @@ -246,7 +246,7 @@ } // QVariant::QVariant(bool b) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_bool +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_bool (bool b0) { QVariant_QtDShell *__qt_this = new QVariant_QtDShell((bool )b0); @@ -255,7 +255,7 @@ } // QVariant::QVariant(const QBitArray & bitarray) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QBitArray +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QBitArray (void* bitarray0) { const QBitArray& __qt_bitarray0 = (const QBitArray& ) *(QBitArray *)bitarray0; @@ -265,7 +265,7 @@ } // QVariant::QVariant(const QByteArray & bytearray) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QByteArray +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QByteArray (void* bytearray0) { const QByteArray& __qt_bytearray0 = (const QByteArray& ) *(QByteArray *)bytearray0; @@ -276,7 +276,7 @@ // QVariant::QVariant(const QChar & qchar) // QVariant::QVariant(const QDate & date) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QDate +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QDate (void* date0) { const QDate& __qt_date0 = (const QDate& ) *(QDate *)date0; @@ -286,7 +286,7 @@ } // QVariant::QVariant(const QDateTime & datetime) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QDateTime +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QDateTime (void* datetime0) { const QDateTime& __qt_datetime0 = (const QDateTime& ) *(QDateTime *)datetime0; @@ -296,7 +296,7 @@ } // QVariant::QVariant(const QLine & line) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QLine +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QLine (void* line0) { const QLine& __qt_line0 = (const QLine& ) *(QLine *)line0; @@ -306,7 +306,7 @@ } // QVariant::QVariant(const QLineF & line) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QLineF +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QLineF (void* line0) { const QLineF& __qt_line0 = (const QLineF& ) *(QLineF *)line0; @@ -317,7 +317,7 @@ // QVariant::QVariant(const QList<QVariant > & list) // QVariant::QVariant(const QLocale & locale) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QLocale +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QLocale (void* locale0) { const QLocale& __qt_locale0 = (const QLocale& ) *(QLocale *)locale0; @@ -328,7 +328,7 @@ // QVariant::QVariant(const QMap<QString, QVariant > & map) // QVariant::QVariant(const QPoint & pt) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QPoint +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QPoint (void* pt0) { const QPoint& __qt_pt0 = (const QPoint& ) *(QPoint *)pt0; @@ -338,7 +338,7 @@ } // QVariant::QVariant(const QPointF & pt) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QPointF +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QPointF (void* pt0) { const QPointF& __qt_pt0 = (const QPointF& ) *(QPointF *)pt0; @@ -348,7 +348,7 @@ } // QVariant::QVariant(const QRect & rect) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QRect +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QRect (void* rect0) { const QRect& __qt_rect0 = (const QRect& ) *(QRect *)rect0; @@ -358,7 +358,7 @@ } // QVariant::QVariant(const QRectF & rect) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QRectF +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QRectF (void* rect0) { const QRectF& __qt_rect0 = (const QRectF& ) *(QRectF *)rect0; @@ -368,7 +368,7 @@ } // QVariant::QVariant(const QRegExp & regExp) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QRegExp +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QRegExp (void* regExp0) { const QRegExp& __qt_regExp0 = (const QRegExp& ) *(QRegExp *)regExp0; @@ -378,7 +378,7 @@ } // QVariant::QVariant(const QSize & size) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QSize +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QSize (void* size0) { const QSize& __qt_size0 = (const QSize& ) *(QSize *)size0; @@ -388,7 +388,7 @@ } // QVariant::QVariant(const QSizeF & size) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QSizeF +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QSizeF (void* size0) { const QSizeF& __qt_size0 = (const QSizeF& ) *(QSizeF *)size0; @@ -398,7 +398,7 @@ } // QVariant::QVariant(const QString & string) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_String +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_String (DArray string0) { QString __qt_string0 = QString::fromUtf8((const char *)string0.ptr, string0.length); @@ -409,7 +409,7 @@ // QVariant::QVariant(const QStringList & stringlist) // QVariant::QVariant(const QTime & time) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QTime +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QTime (void* time0) { const QTime& __qt_time0 = (const QTime& ) *(QTime *)time0; @@ -419,7 +419,7 @@ } // QVariant::QVariant(const QUrl & url) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QUrl +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QUrl (void* url0) { const QUrl& __qt_url0 = (const QUrl& ) *(QUrl *)url0; @@ -429,7 +429,7 @@ } // QVariant::QVariant(const QVariant & other) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_QVariant +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_QVariant (void* other0) { const QVariant& __qt_other0 = (const QVariant& ) *(QVariant *)other0; @@ -439,7 +439,7 @@ } // QVariant::QVariant(const char * str) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_nativepointerchar +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_nativepointerchar (char* str0) { const char* __qt_str0 = (const char* ) str0; @@ -449,7 +449,7 @@ } // QVariant::QVariant(double d) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_double +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_double (double d0) { QVariant_QtDShell *__qt_this = new QVariant_QtDShell((double )d0); @@ -458,7 +458,7 @@ } // QVariant::QVariant(int i) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_int +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_int (int i0) { QVariant_QtDShell *__qt_this = new QVariant_QtDShell((int )i0); @@ -467,7 +467,7 @@ } // QVariant::QVariant(int typeOrUserType, const void * copy) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_int_nativepointervoid +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_int_nativepointervoid (int typeOrUserType0, void* copy1) { @@ -478,7 +478,7 @@ } // QVariant::QVariant(long long ll) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_long +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_long (qint64 ll0) { QVariant_QtDShell *__qt_this = new QVariant_QtDShell((qint64 )ll0); @@ -487,7 +487,7 @@ } // QVariant::QVariant(uint ui) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_uint +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_uint (uint ui0) { QVariant_QtDShell *__qt_this = new QVariant_QtDShell((uint )ui0); @@ -496,7 +496,7 @@ } // QVariant::QVariant(unsigned long long ull) -extern "C" DLL_PUBLIC void* qtd_QVariant_QVariant_ulong +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_QVariant_ulong (quint64 ull0) { QVariant_QtDShell *__qt_this = new QVariant_QtDShell((quint64 )ull0); @@ -505,7 +505,7 @@ } // QVariant::canConvert() const -extern "C" DLL_PUBLIC bool qtd_QVariant_canConvert +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QVariant_canConvert (void* __this_nativeId, QVariant::Type type) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -517,7 +517,7 @@ } // QVariant::clear() -extern "C" DLL_PUBLIC void qtd_QVariant_clear +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_clear (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -526,7 +526,7 @@ } // QVariant::cmp(const QVariant & other) const -extern "C" DLL_PUBLIC bool qtd_QVariant_cmp_QVariant +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QVariant_cmp_QVariant (void* __this_nativeId, void* other0) { @@ -540,7 +540,7 @@ } // QVariant::create(int type, const void * copy) -extern "C" DLL_PUBLIC void qtd_QVariant_create_int_nativepointervoid +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_create_int_nativepointervoid (void* __this_nativeId, int type0, void* copy1) @@ -552,7 +552,7 @@ } // QVariant::isNull() const -extern "C" DLL_PUBLIC bool qtd_QVariant_isNull +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QVariant_isNull (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -564,7 +564,7 @@ } // QVariant::isValid() const -extern "C" DLL_PUBLIC bool qtd_QVariant_isValid +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QVariant_isValid (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -576,7 +576,7 @@ } // QVariant::load(QDataStream & ds) -extern "C" DLL_PUBLIC void qtd_QVariant_load_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_load_QDataStream (void* __this_nativeId, void* ds0) { @@ -587,7 +587,7 @@ } // QVariant::operator<<(QDataStream & s) -extern "C" DLL_PUBLIC void qtd_QVariant_writeTo_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_writeTo_QDataStream (void* __this_nativeId, void* s0) { @@ -598,7 +598,7 @@ } // QVariant::operator=(const QVariant & other) -extern "C" DLL_PUBLIC void* qtd_QVariant_operator_assign_QVariant +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_operator_assign_QVariant (void* __this_nativeId, void* other0) { @@ -612,7 +612,7 @@ } // QVariant::operator==(const QVariant & v) const -extern "C" DLL_PUBLIC bool qtd_QVariant_operator_equal_QVariant +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QVariant_operator_equal_QVariant (void* __this_nativeId, void* v0) { @@ -626,7 +626,7 @@ } // QVariant::operator>>(QDataStream & s) -extern "C" DLL_PUBLIC void qtd_QVariant_readFrom_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_readFrom_QDataStream (void* __this_nativeId, void* s0) { @@ -637,7 +637,7 @@ } // QVariant::save(QDataStream & ds) const -extern "C" DLL_PUBLIC void qtd_QVariant_save_QDataStream +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_save_QDataStream (void* __this_nativeId, void* ds0) { @@ -648,7 +648,7 @@ } // QVariant::toBitArray() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toBitArray +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toBitArray (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -660,7 +660,7 @@ } // QVariant::toBool() const -extern "C" DLL_PUBLIC bool qtd_QVariant_toBool +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_QVariant_toBool (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -672,7 +672,7 @@ } // QVariant::toByteArray() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toByteArray +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toByteArray (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -685,7 +685,7 @@ // QVariant::toChar() const // QVariant::toDate() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toDate +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toDate (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -697,7 +697,7 @@ } // QVariant::toDateTime() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toDateTime +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toDateTime (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -709,7 +709,7 @@ } // QVariant::toDouble(bool * ok) const -extern "C" DLL_PUBLIC double qtd_QVariant_toDouble_nativepointerbool +QTD_EXTERN QTD_DLL_PUBLIC double qtd_QVariant_toDouble_nativepointerbool (void* __this_nativeId, bool* ok0) { @@ -723,7 +723,7 @@ } // QVariant::toInt(bool * ok) const -extern "C" DLL_PUBLIC int qtd_QVariant_toInt_nativepointerbool +QTD_EXTERN QTD_DLL_PUBLIC int qtd_QVariant_toInt_nativepointerbool (void* __this_nativeId, bool* ok0) { @@ -737,7 +737,7 @@ } // QVariant::toLine() const -extern "C" DLL_PUBLIC QLine qtd_QVariant_toLine +QTD_EXTERN QTD_DLL_PUBLIC QLine qtd_QVariant_toLine (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -745,7 +745,7 @@ } // QVariant::toLineF() const -extern "C" DLL_PUBLIC QLineF qtd_QVariant_toLineF +QTD_EXTERN QTD_DLL_PUBLIC QLineF qtd_QVariant_toLineF (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -754,7 +754,7 @@ // QVariant::toList() const // QVariant::toLocale() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toLocale +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toLocale (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -766,7 +766,7 @@ } // QVariant::toLongLong(bool * ok) const -extern "C" DLL_PUBLIC qint64 qtd_QVariant_toLongLong_nativepointerbool +QTD_EXTERN QTD_DLL_PUBLIC qint64 qtd_QVariant_toLongLong_nativepointerbool (void* __this_nativeId, bool* ok0) { @@ -781,7 +781,7 @@ // QVariant::toMap() const // QVariant::toPoint() const -extern "C" DLL_PUBLIC QPoint qtd_QVariant_toPoint +QTD_EXTERN QTD_DLL_PUBLIC QPoint qtd_QVariant_toPoint (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -791,7 +791,7 @@ } // QVariant::toPointF() const -extern "C" DLL_PUBLIC QPointF qtd_QVariant_toPointF +QTD_EXTERN QTD_DLL_PUBLIC QPointF qtd_QVariant_toPointF (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -801,7 +801,7 @@ } // QVariant::toRect() const -extern "C" DLL_PUBLIC QRect qtd_QVariant_toRect +QTD_EXTERN QTD_DLL_PUBLIC QRect qtd_QVariant_toRect (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -811,7 +811,7 @@ } // QVariant::toRectF() const -extern "C" DLL_PUBLIC QRectF qtd_QVariant_toRectF +QTD_EXTERN QTD_DLL_PUBLIC QRectF qtd_QVariant_toRectF (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -821,7 +821,7 @@ } // QVariant::toRegExp() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toRegExp +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toRegExp (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -833,7 +833,7 @@ } // QVariant::toSize() const -extern "C" DLL_PUBLIC QSize qtd_QVariant_toSize +QTD_EXTERN QTD_DLL_PUBLIC QSize qtd_QVariant_toSize (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -844,7 +844,7 @@ } // QVariant::toSizeF() const -extern "C" DLL_PUBLIC QSizeF qtd_QVariant_toSizeF +QTD_EXTERN QTD_DLL_PUBLIC QSizeF qtd_QVariant_toSizeF (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -855,7 +855,7 @@ } // QVariant::toString() const -extern "C" DLL_PUBLIC void qtd_QVariant_toString +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QVariant_toString (void* __this_nativeId, void* __java_return_value) { @@ -868,7 +868,7 @@ // QVariant::toStringList() const // QVariant::toTime() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toTime +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toTime (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -880,7 +880,7 @@ } // QVariant::toUInt(bool * ok) const -extern "C" DLL_PUBLIC uint qtd_QVariant_toUInt_nativepointerbool +QTD_EXTERN QTD_DLL_PUBLIC uint qtd_QVariant_toUInt_nativepointerbool (void* __this_nativeId, bool* ok0) { @@ -894,7 +894,7 @@ } // QVariant::toULongLong(bool * ok) const -extern "C" DLL_PUBLIC quint64 qtd_QVariant_toULongLong_nativepointerbool +QTD_EXTERN QTD_DLL_PUBLIC quint64 qtd_QVariant_toULongLong_nativepointerbool (void* __this_nativeId, bool* ok0) { @@ -908,7 +908,7 @@ } // QVariant::toUrl() const -extern "C" DLL_PUBLIC void* qtd_QVariant_toUrl +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_toUrl (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -920,7 +920,7 @@ } // QVariant::typeName() const -extern "C" DLL_PUBLIC char* qtd_QVariant_typeName +QTD_EXTERN QTD_DLL_PUBLIC char* qtd_QVariant_typeName (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -932,7 +932,7 @@ } // QVariant::type() const -extern "C" DLL_PUBLIC int qtd_QVariant_type +QTD_EXTERN QTD_DLL_PUBLIC int qtd_QVariant_type (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -944,7 +944,7 @@ } // QVariant::userType() const -extern "C" DLL_PUBLIC int qtd_QVariant_userType +QTD_EXTERN QTD_DLL_PUBLIC int qtd_QVariant_userType (void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; @@ -955,7 +955,7 @@ return __java_return_value; } -extern "C" DLL_PUBLIC void *qtd_QVariant_data(void* __this_nativeId) +QTD_EXTERN QTD_DLL_PUBLIC void *qtd_QVariant_data(void* __this_nativeId) { QVariant_QtDShell *__qt_this = (QVariant_QtDShell *) __this_nativeId; return __qt_this->data(); @@ -966,7 +966,7 @@ -extern "C" DLL_PUBLIC void* qtd_QVariant_placed_copy(void* variant0, void* place) { +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QVariant_placed_copy(void* variant0, void* place) { const QVariant& __qt_variant0 = (const QVariant& ) *(QVariant *)variant0; QVariant *result = new (place)QVariant((const QVariant& )__qt_variant0); return (void *) result;
--- a/cpp/qt_qtd/ArrayOpsPrimitive_shell.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_qtd/ArrayOpsPrimitive_shell.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -1,55 +1,24 @@ /** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> -* -* Copyright QtD Team, 2008-2009 -* Distributed under the Boost Software License, Version 1.0. -* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -* -*/ - -// stuff for passing D function pointers! - -#ifdef CPP_SHARED + Copyright: Copyright QtD Team, 2008-2010 + License: Boost License 1.0 + */ #include "ArrayOpsPrimitive.h" -QTD_EXPORT_VAR(qtd_allocate_int_array) -QTD_EXPORT_VAR(qtd_assign_int_array_element) -QTD_EXPORT_VAR(qtd_get_int_from_array) - -QTD_EXPORT_VAR(qtd_allocate_uint_array) -QTD_EXPORT_VAR(qtd_assign_uint_array_element) -QTD_EXPORT_VAR(qtd_get_uint_from_array) +QTD_EXPORT(CORE, allocate_int_array) +QTD_EXPORT(CORE, assign_int_array_element) +QTD_EXPORT(CORE, get_int_from_array) -QTD_EXPORT_VAR(qtd_allocate_double_array) -QTD_EXPORT_VAR(qtd_assign_double_array_element) -QTD_EXPORT_VAR(qtd_get_double_from_array) - -QTD_EXPORT_VAR(qtd_allocate_string_array) -QTD_EXPORT_VAR(qtd_assign_string_array_element) -QTD_EXPORT_VAR(qtd_string_from_array) -QTD_EXPORT_VAR(qtd_get_string_from_array) +QTD_EXPORT(CORE, allocate_uint_array) +QTD_EXPORT(CORE, assign_uint_array_element) +QTD_EXPORT(CORE, get_uint_from_array) -extern "C" DLL_PUBLIC void qtd_core_ArrayOps_initCallBacks(pfunc_abstr *callbacks) -{ - QTD_EXPORT_VAR_SET(qtd_allocate_int_array, callbacks[0]); - QTD_EXPORT_VAR_SET(qtd_assign_int_array_element, callbacks[1]); - QTD_EXPORT_VAR_SET(qtd_get_int_from_array, callbacks[2]); - - QTD_EXPORT_VAR_SET(qtd_allocate_uint_array, callbacks[3]); - QTD_EXPORT_VAR_SET(qtd_assign_uint_array_element, callbacks[4]); - QTD_EXPORT_VAR_SET(qtd_get_uint_from_array, callbacks[5]); +QTD_EXPORT(CORE, allocate_double_array) +QTD_EXPORT(CORE, assign_double_array_element) +QTD_EXPORT(CORE, get_double_from_array) - QTD_EXPORT_VAR_SET(qtd_allocate_double_array, callbacks[6]); - QTD_EXPORT_VAR_SET(qtd_assign_double_array_element, callbacks[7]); - QTD_EXPORT_VAR_SET(qtd_get_double_from_array, callbacks[8]); +QTD_EXPORT(CORE, allocate_string_array) +QTD_EXPORT(CORE, assign_string_array_element) +QTD_EXPORT(CORE, string_from_array) +QTD_EXPORT(CORE, get_string_from_array) - QTD_EXPORT_VAR_SET(qtd_allocate_string_array, callbacks[9]); - QTD_EXPORT_VAR_SET(qtd_assign_string_array_element, callbacks[10]); - QTD_EXPORT_VAR_SET(qtd_string_from_array, callbacks[11]); - QTD_EXPORT_VAR_SET(qtd_get_string_from_array, callbacks[12]); -} - -#endif
--- a/cpp/qt_qtd/qtd_core.cpp Tue May 25 20:14:04 2010 +0300 +++ b/cpp/qt_qtd/qtd_core.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -1,25 +1,25 @@ /** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> -* -* Copyright QtD Team, 2008-2009 -* Distributed under the Boost Software License, Version 1.0. -* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -* -*/ + Copyright: Copyright QtD Team, 2008-2010 + License: Boost License 1.0 + */ #include "qtd_core.h" #include <iostream> -uint userDataId; +QTD_EXPORT(CORE, toUtf8); +QTD_EXPORT(CORE, QtdObject_delete); -extern "C" DLL_PUBLIC QModelIndex qtd_to_QModelIndex(QModelIndexAccessor mia) +QTD_EXTERN QTD_DLL_EXPORT void qtd_initCore() +{ + QObjectLink::userDataId = QObject::registerUserData(); +} + +QTD_EXTERN QTD_DLL_PUBLIC QModelIndex qtd_to_QModelIndex(QModelIndexAccessor mia) { return * (QModelIndex *) (&mia) ; } -extern "C" DLL_PUBLIC QModelIndexAccessor qtd_from_QModelIndex(const QModelIndex &index) +QTD_EXTERN QTD_DLL_PUBLIC QModelIndexAccessor qtd_from_QModelIndex(const QModelIndex &index) { QModelIndexAccessor mia = { index.row(), @@ -31,42 +31,29 @@ return mia; } -extern "C" DLL_PUBLIC const char* qtd_qVersion() +QTD_EXTERN QTD_DLL_PUBLIC const char* qtd_qVersion() { return qVersion(); } -extern "C" DLL_PUBLIC bool qtd_qSharedBuild() +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_qSharedBuild() { return qSharedBuild(); } -//TODO: this has to be replaced with something that makes some sense -#ifdef CPP_SHARED -QTD_EXPORT_VAR(qtd_toUtf8); -QTD_EXPORT_VAR(qtd_QtdObject_delete); - -extern "C" DLL_PUBLIC void qtd_core_initCallBacks(pfunc_abstr d_func, pfunc_abstr del_d_qobj) { - QTD_EXPORT_VAR_SET(qtd_toUtf8, d_func); - QTD_EXPORT_VAR_SET(qtd_QtdObject_delete, del_d_qobj); - - userDataId = QObject::registerUserData(); -} -#endif - extern bool qRegisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); extern bool qUnregisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); -extern "C" DLL_PUBLIC bool qtd_register_resource_data(int version, const unsigned char *tree, +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_register_resource_data(int version, const unsigned char *tree, const unsigned char *name, const unsigned char *data) { return qRegisterResourceData(version, tree, name, data); } -extern "C" DLL_PUBLIC bool qtd_unregister_resource_data(int version, const unsigned char *tree, +QTD_EXTERN QTD_DLL_PUBLIC bool qtd_unregister_resource_data(int version, const unsigned char *tree, const unsigned char *name, const unsigned char *data) { return qUnregisterResourceData(version, tree, name, data); @@ -83,6 +70,8 @@ qObject->setUserData(userDataId, this); } +uint QObjectLink::userDataId; + QObjectLink* QObjectLink::getLink(const QObject *qObject) { return static_cast<QObjectLink*>(qObject->userData(userDataId));
--- a/d2/qt/QGlobal.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qt/QGlobal.d Wed Jun 02 19:38:05 2010 +0300 @@ -1,55 +1,16 @@ module qt.QGlobal; -public import qtd.String; public import qt.QDefines; -version (Tango) -{ - import tango.io.Stdout; - void writeln(string s) - { - Stdout(s).newline; - } - package import tango.stdc.stdlib, - tango.core.Memory; -} -else -{ - import std.stdio; - package import std.c.stdlib, - core.memory; -} - -T static_cast(T, U)(U obj) -{ - return cast(T)cast(void*)obj; -} +import + std.stdio, + std.c.stdlib, + core.memory; -template QT_BEGIN_NAMESPACE() { -} - -template QT_END_NAMESPACE() { -} - -template QT_BEGIN_HEADER() { -} - -template QT_END_HEADER() { -} +public import // TODO: import privately + qtd.String, + qtd.Core; -mixin QT_BEGIN_HEADER; -mixin QT_BEGIN_NAMESPACE; - -// Defined in qtd.QtdObject -extern(C) void qtd_QtdObject_delete(void* dPtr); - -version(cpp_shared) -{ - extern (C) void qtd_core_initCallBacks(void* toUtf8, void* del_d_obj); - static this() { - qtd_core_initCallBacks(&qtd_toUtf8, &qtd_QtdObject_delete); - } -} string tr(string arg) { return arg; @@ -62,9 +23,8 @@ { return cast(bool)((major<<16)|(minor<<8)|(patch)); } -//TODO(katrina) get this from the C++ side + const char[] QT_PACKAGEDATE_STR = "2008-09-27"; -//TODO(katrina) get this from the C++ side const char[] QT_PACKAGE_TAG = "gc9953de622c6a0f655322e0d9f5bd6dc2803b470"; /* @@ -93,7 +53,7 @@ alias qint64 qptrdiff; } -const byte QT_POINTER_SIZE = 8; +enum byte QT_POINTER_SIZE = 8; alias int QNoImplicitBoolCast; @@ -466,61 +426,6 @@ void * qMemCopy(void * dest, void * src, size_t n); void * qMemSet(void * dest, int c, size_t n); -struct QFlags(Enum) -{ -private: - alias void **Zero; - int i; - -public: - alias Enum enum_type; - - public static QFlags!(Enum) opCall(Enum)(QFlags f) { - QFlags!(Enum) res; - res.i = f.i; - return res; - } - - public static QFlags opCall(Enum)(Enum f) { - QFlags!(Enum) res; - res.i = f; - return res; - } - - public static QFlags opCall(Enum)(int f) { - QFlags!(Enum) res; - res.i = cast(Enum) f; - return res; - } - -// this(Zero = 0) : i(0) {} -// this(QFlag f) : i(f) {} - -// QFlags!(Enum) opAssign(QFlags f) { i = f.i; return *this; } - QFlags!(Enum) opAssign(int f) { i = f; return *this; } - QFlags!(Enum) opAndAssign(int mask) { i &= mask; return *this; } - QFlags!(Enum) opAndAssign(uint mask) { i &= mask; return *this; } - QFlags!(Enum) opOrAssign(QFlags f) { i |= f.i; return *this; } - QFlags!(Enum) opOrAssign(Enum f) { i |= f; return *this; } - QFlags!(Enum) opXorAssign(QFlags f) { i ^= f.i; return *this; } - QFlags!(Enum) opXorAssign(Enum f) { i ^= f; return *this; } - - int toInt() { return i; } - - QFlags!(Enum) opOr(QFlags f) { QFlags g; g.i = i | f.i; return g; } - QFlags!(Enum) opOr(Enum f) { QFlags g; g.i = i | f; return g; } - QFlags!(Enum) opXor(QFlags f) { QFlags g; g.i = i ^ f.i; return g; } - QFlags!(Enum) opXor(Enum f) { QFlags g; g.i = i ^ f; return g; } - QFlags!(Enum) opAnd(int mask) { QFlags g; g.i = i & mask; return g; } - QFlags!(Enum) opAnd(uint mask) { QFlags g; g.i = i & mask; return g; } - QFlags!(Enum) opAnd(Enum f) { QFlags g; g.i = i & f; return g; } - QFlags!(Enum) opCom() { QFlags g; g.i = ~i; return g; } - -// bool operator!() { return !i; } - -// bool testFlag(Enum f) { return i & f; } -} - /* TODO typesafety #define Q_DECLARE_FLAGS(Flags, Enum)\ typedef QFlags<Enum> Flags; @@ -553,42 +458,43 @@ This gives us the possibility to check which modules the user can use. These are purely compile time checks and will generate no code. */ - -/* Qt modules */ +enum : ushort +{ + /* Qt modules */ -const ushort QT_MODULE_CORE = 0x0001; -const ushort QT_MODULE_GUI = 0x0002; -const ushort QT_MODULE_NETWORK = 0x0004; -const ushort QT_MODULE_OPENGL = 0x0008; -const ushort QT_MODULE_SQL = 0x0010; -const ushort QT_MODULE_XML = 0x0020; -const ushort QT_MODULE_QT3SUPPORTLIGHT = 0x0040; -const ushort QT_MODULE_QT3SUPPORT = 0x0080; -const ushort QT_MODULE_SVG = 0x0100; -const ushort QT_MODULE_ACTIVEQT = 0x0200; -const ushort QT_MODULE_GRAPHICSVIEW = 0x0400; -const ushort QT_MODULE_SCRIPT = 0x0800; -const ushort QT_MODULE_XMLPATTERNS = 0x1000; -const ushort QT_MODULE_HELP = 0x2000; -const ushort QT_MODULE_TEST = 0x4000; -const ushort QT_MODULE_DBUS = 0x8000; + QT_MODULE_CORE = 0x0001, + QT_MODULE_GUI = 0x0002, + QT_MODULE_NETWORK = 0x0004, + QT_MODULE_OPENGL = 0x0008, + QT_MODULE_SQL = 0x0010, + QT_MODULE_XML = 0x0020, + QT_MODULE_QT3SUPPORTLIGHT = 0x0040, + QT_MODULE_QT3SUPPORT = 0x0080, + QT_MODULE_SVG = 0x0100, + QT_MODULE_ACTIVEQT = 0x0200, + QT_MODULE_GRAPHICSVIEW = 0x0400, + QT_MODULE_SCRIPT = 0x0800, + QT_MODULE_XMLPATTERNS = 0x1000, + QT_MODULE_HELP = 0x2000, + QT_MODULE_TEST = 0x4000, + QT_MODULE_DBUS = 0x8000, /* Qt editions */ -const ushort QT_EDITION_CONSOLE = (QT_MODULE_CORE + QT_EDITION_CONSOLE = (QT_MODULE_CORE | QT_MODULE_NETWORK | QT_MODULE_SQL | QT_MODULE_SCRIPT | QT_MODULE_XML | QT_MODULE_XMLPATTERNS | QT_MODULE_TEST - | QT_MODULE_DBUS); -const ushort QT_EDITION_DESKTOPLIGHT = (QT_MODULE_CORE + | QT_MODULE_DBUS), + QT_EDITION_DESKTOPLIGHT = (QT_MODULE_CORE | QT_MODULE_GUI | QT_MODULE_QT3SUPPORTLIGHT | QT_MODULE_TEST - | QT_MODULE_DBUS); -const ushort QT_EDITION_OPENSOURCE = (QT_MODULE_CORE + | QT_MODULE_DBUS), + QT_EDITION_OPENSOURCE = (QT_MODULE_CORE | QT_MODULE_GUI | QT_MODULE_NETWORK | QT_MODULE_OPENGL @@ -602,15 +508,16 @@ | QT_MODULE_GRAPHICSVIEW | QT_MODULE_HELP | QT_MODULE_TEST - | QT_MODULE_DBUS); -const ushort QT_EDITION_DESKTOP = (QT_EDITION_OPENSOURCE - | QT_MODULE_ACTIVEQT); -const ushort QT_EDITION_UNIVERSAL = QT_EDITION_DESKTOP; -const ushort QT_EDITION_ACADEMIC = QT_EDITION_DESKTOP; -const ushort QT_EDITION_EDUCATIONAL = QT_EDITION_DESKTOP; -const ushort QT_EDITION_EVALUATION = QT_EDITION_DESKTOP; + | QT_MODULE_DBUS), + QT_EDITION_DESKTOP = (QT_EDITION_OPENSOURCE + | QT_MODULE_ACTIVEQT), + QT_EDITION_UNIVERSAL = QT_EDITION_DESKTOP, + QT_EDITION_ACADEMIC = QT_EDITION_DESKTOP, + QT_EDITION_EDUCATIONAL = QT_EDITION_DESKTOP, + QT_EDITION_EVALUATION = QT_EDITION_DESKTOP +} -mixin QT_END_NAMESPACE; +/+ private struct Align @@ -632,55 +539,6 @@ + aligned; } -template InstanceSize(T) -{ - static if( is( T == Object ) ) - const InstanceSize = 2*(void*).sizeof; - else - const InstanceSize = Max!( - AlignPad!( - InstanceSize!(Super!(T)), - InterfaceCount!(T)*(void*).sizeof), - - AlignPad!( - InstanceSizeImpl!(T, 0), - + InterfaceCount!(T)*(void*).sizeof)); -} - -private -template Super(T) -{ - static if( is( T S == super ) ) - alias First!(S) Super; - else - static assert(false, "Can't get super of "~T.mangleof); -} - -private -template First(T) -{ - alias T First; -} - -private -template First(T, Ts...) -{ - alias T First; -} - -private -template InstanceSizeImpl(T, size_t i) -{ - static if( i < T.tupleof.length ) - const InstanceSizeImpl = Max!( - T.tupleof[i].offsetof + T.tupleof[i].sizeof, - InstanceSizeImpl!(T, i+1)); - else - // This is necessary to account for classes without member - // variables. - const InstanceSizeImpl = 2*(void*).sizeof; -} - private template Max(size_t a, size_t b) { @@ -689,51 +547,6 @@ else const Max = b; } - -private -template InterfaceCount(T) -{ - static if( is( T == Object ) ) - const InterfaceCount = 0u; - else static if( is( T S == super ) ) - const InterfaceCount = InterfaceCountImpl!(S); -} - -private -template InterfaceCountImpl(TBase, TInterfaces...) -{ - const InterfaceCountImpl = TInterfaces.length; -} - -/+ -scope class StackObject(C) -{ - byte[InstanceSize!(C)] data; - bool constructed; - - C opCall(A...)(A args) - { - assert(!constructed); - - auto r = new(&data)C(args); - r.__stackAllocated = true; - constructed = true; - - return r; - } - - ~this() - { - if (constructed) - { - auto obj = cast(C)&data; - delete obj; - } - } -} +/ -alias void DArray; - -mixin QT_END_HEADER; - +alias void DArray; \ No newline at end of file
--- a/d2/qt/core/QList.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qt/core/QList.d Wed Jun 02 19:38:05 2010 +0300 @@ -98,17 +98,17 @@ uint sharable; void*[1] array; } - + enum { DataHeaderSize = Data.sizeof - (void*).sizeof } - + static Data shared_null; Data *d; - + static this() { shared_null = Data(Atomic!int(1), 0, 0, 0, true, [null]); } - + // Data *detach(); // remove in 5.0 @@ -128,7 +128,7 @@ return x; } - + void realloc(int alloc) { // assert(d.ref_ == 1); @@ -141,7 +141,7 @@ if (!alloc) d.begin = d.end = 0; } - + void** append() { // #TODO Q_ASSERT(d.ref_ == 1); @@ -318,10 +318,12 @@ import std.stdio; import std.conv; -alias void Dummy; // DMD bug #3538 +alias void Dummy; // DMD bug #3538 struct QList(T, alias Default = Dummy) { + alias T ElementType; + static if (is(Default == Dummy)) alias QTypeInfo!T TI; else @@ -330,7 +332,7 @@ struct Node { void *v; - + static if (isQObjectType!T || isObjectType!T || isValueType!T || is(T == string)) // binded Qt types { T t() @@ -352,7 +354,7 @@ } } else // native types - { + { ref T t() { static if(TI.isLarge || TI.isStatic) @@ -362,7 +364,7 @@ } } } - + union { QListData p; QListData.Data* d; @@ -375,15 +377,15 @@ writeln("QList atomic ", d.ref_.load()); } */ - + static QList!T opCall() { QList!T res; // writeln("QList opCall"); - + res.d = &QListData.shared_null; res.d.ref_.increment(); - + return res; } @@ -416,12 +418,12 @@ } return this; } - + int length() const { return p.size(); } int size() const { return length; } void detach() { if (d.ref_.load() != 1) detach_helper(); } - + private void detach_helper() { Node *n = cast(Node*)(p.begin()); @@ -430,7 +432,7 @@ if (!x.ref_.decrement()) free(x); } - + void append(const T t) // fix to const ref for complex types TODO { detach(); @@ -444,9 +446,9 @@ node_construct(cast(Node*)(p.append()), cpy); } } - + alias append opCatAssign; - + static if (isQObjectType!T || isObjectType!T || isValueType!T || is(T == string)) { T at(int i) const @@ -472,8 +474,8 @@ assert(i >= 0 && i < p.size(), "QList!T.at(): index out of range"); return (cast(Node*)(p.at(i))).t(); } - } - + } + static if (isQObjectType!T || isObjectType!T || isValueType!T) //binded types void node_construct(Node *n, const T t) { @@ -506,7 +508,7 @@ else *cast(T*)(n) = cast(T)(t); } - + void node_copy(Node *from, Node *to, Node *src) { // writeln("QList node_copy"); @@ -527,13 +529,13 @@ T.__constructPlacedNativeCopy(src++, from++); // new (from++) T(*reinterpret_cast<T*>(src++)); } else static if (TI.isLarge || TI.isStatic) - while(from != to) + while(from != to) (from++).v = q_new!T(*cast(T*)((src++).v)); else static if (TI.isComplex) while(from != to) q_new_at(from++, *cast(T*)(src++)); } - + T[] toArray() { T[] res; @@ -547,7 +549,7 @@ } return res; } - + void free(QListData.Data* data) { // writeln("QList data destroyed"); @@ -556,7 +558,7 @@ if (data.ref_.load() == 0) qFree(data); } - + void node_destruct(Node *from, Node *to) { static if (isQObjectType!T || isObjectType!T) //binded types @@ -583,7 +585,7 @@ while (from != to) --to, cast(T*)(to).__dtor(); } } - + //iteration support int opApply(int delegate(ref T) dg) {
--- a/d2/qt/core/QMetaObject.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qt/core/QMetaObject.d Wed Jun 02 19:38:05 2010 +0300 @@ -1,15 +1,17 @@ module qt.core.QMetaObject; -import qt.QGlobal; -import qt.core.QObject; -import qtd.QtdObject; - -import std.algorithm; -import std.string; -import std.stdio; - -import qtd.meta.Runtime; -import qtd.Marshal; +import + qt.QGlobal, + qt.core.QObject, + qtd.QtdObject, + std.algorithm, + qtd.meta.Runtime, + qtd.meta.Compiletime, + qtd.Marshal, + qtd.MOC, + std.string, + std.typetuple, + std.c.stdlib; class QMetaArgument : Meta { @@ -22,13 +24,13 @@ // QMetaArgument[] arguments; string signature; int indexOfMethod; - + this(string signature_, int indexOfMethod_) { signature = signature_; indexOfMethod = indexOfMethod_; } - + string args() const { int openBracket = indexOf(signature, '('); @@ -37,7 +39,7 @@ else return ""; } - + string name() const { int openBracket = indexOf(signature, '('); @@ -55,7 +57,7 @@ class QMetaSignal : QMetaMethod { alias typeof(this) This; - + this(string signature_, int indexOfMethod_) { super(signature_, indexOfMethod_); @@ -70,7 +72,7 @@ class QMetaSlot : QMetaMethod { alias typeof(this) This; - + this(string signature_, int indexOfMethod_) { super(signature_, indexOfMethod_); @@ -102,7 +104,7 @@ alias typeof(this) This; private this() {} - + enum Call { InvokeMetaMethod, @@ -116,7 +118,7 @@ QueryPropertyUser, CreateInstance } - + private { QMetaObjectNative* _nativeId; @@ -208,7 +210,7 @@ { return _base; } - + /++ +/ QMetaObjectNative* nativeId() @@ -222,17 +224,17 @@ { return _classInfo; } - + const (QMetaMethod[]) methods() { return _methods; } - + void addMethod(QMetaMethod method_) { _methods ~= method_; } - + QMetaMethod lookUpMethod(string slot) { foreach (method; _methods) @@ -243,7 +245,7 @@ else return null; } - + QMetaSignal lookUpSignal(string signal) { foreach (method; _methods) @@ -276,11 +278,11 @@ result ~= _base.lookUpSignalOverloads(signalName); return result; } - + private QMetaObject lookupDerived(void*[] moIds) { assert (moIds.length >= 1); - + for (auto mo = _firstDerived; mo !is null; mo = mo._next) { if (mo._nativeId == moIds[0]) @@ -291,19 +293,19 @@ return mo.lookupDerived(moIds[1..$]); } } - + // no initialized wrapper that matches the native object. // use the base class wrapper return this; } - + QObject getObject(void* nativeObjId) { QObject result; if (nativeObjId) { - result = cast(QObject)qtd_get_d_qobject(nativeObjId); + result = cast(QObject)qtd_get_d_qobject(nativeObjId); if (!result) { auto moId = qtd_QObject_metaObject(nativeObjId); @@ -317,9 +319,9 @@ for (void* tmp = moId;;) { - tmp = qtd_QMetaObject_superClass(tmp); + tmp = qtd_QMetaObject_superClass(tmp); assert(tmp); - if (tmp == _nativeId) + if (tmp == _nativeId) break; moCount++; } @@ -337,12 +339,12 @@ return result; } - + static void activate(QObject sender, QMetaObject m, int local_signal_index, void **argv) { qtd_QMetaObject_activate_3(sender.__nativeId, m.nativeId, local_signal_index, argv); } - + static void activate(QObject sender, QMetaObject m, int from_local_signal_index, int to_local_signal_index, void **argv) { qtd_QMetaObject_activate_4(sender.__nativeId, m.nativeId, from_local_signal_index, to_local_signal_index, argv); @@ -354,7 +356,7 @@ { return qtd_QMetaObject_connect(sender.__nativeId, signal_index, receiver.__nativeId, method_index, type, types); } - + int indexOfMethod_Cpp(string method) { return qtd_QMetaObject_indexOfMethod(_nativeId, toStringz(method)); @@ -423,11 +425,33 @@ { int signalIndex = signal.indexOfMethod; int methodIndex = method.indexOfMethod; + success = QMetaObject.connect(sender, signalIndex, receiver, methodIndex, type); } if(!success) - throw new QMetaException("QMetaObject: Signal " ~ signalString ~ " and slot " ~ methodString ~ " cannot be found"); + throw new QMetaException("QMetaObject: Signal " ~ signalString ~ " cannot be connected to slot " ~ methodString); + } +} + +/** + */ +mixin template Q_CLASSINFO(string name, string value) +{ + mixin InnerAttribute!("Q_CLASSINFO", AttributeOptions.allowMultiple, name, value); +} + +version (QtdUnittest) +{ + unittest + { + static class Test : QObject + { + mixin Q_CLASSINFO!("author", "Sabrina Schweinsteiger"); + mixin Q_CLASSINFO!("url", "http://doc.moosesoft.co.uk/1.0/"); + + mixin Q_OBJECT; + } } }
--- a/d2/qt/core/QMetaType.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qt/core/QMetaType.d Wed Jun 02 19:38:05 2010 +0300 @@ -2,13 +2,6 @@ public import qt.core.Qt; private import qt.core.QDataStream; -version (Tango) -{ - import tango.core.Array; - import tango.stdc.stringz; - import tango.core.Traits; -} - alias extern(C) void *function(void *copy) Ctor; alias extern(C) void function(void *obj) Dtor; alias extern(C) void function(void *stream, void * object) StreamOp; @@ -45,7 +38,7 @@ return cast(void*)data; } } - + extern(C) void dtor(void* obj) { @@ -65,7 +58,7 @@ public int qRegisterMetaType(T)(string name = null) { if (!name.length) - name = typeid(T).toString; + name = typeid(T).toString; return qtd_registerType(toStringz(name), &MetaTypeOps!(T).ctor, &MetaTypeOps!(T).dtor); } @@ -86,20 +79,20 @@ static void function (ref QDataStream, ref T) LoadOp; SaveOp = saveOp; LoadOp = loadOp; - + if (!name.length) - name = typeid(T).toString; - + name = typeid(T).toString; + extern(C) void saveOpC(void *stream, void *object) { QDataStream dstream = new DataStreamPriv(stream); Stdout(object).newline; static if (is(T == class) || is(T == interface)) - SaveOp(dstream, cast(T)object); - else + SaveOp(dstream, cast(T)object); + else SaveOp(dstream, *cast(T*)object); } - + extern(C) void loadOpC(void *stream, void *object) { //return stream;
--- a/d2/qtd/Array.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/Array.d Wed Jun 02 19:38:05 2010 +0300 @@ -11,10 +11,7 @@ */ module qtd.Array; -version (Tango) - import tango.stdc.string; -else - import core.stdc.string; +import core.stdc.string; void remove(T)(ref T[] haystack, T needle) {
--- a/d2/qtd/ArrayOpsPrimitive.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/ArrayOpsPrimitive.d Wed Jun 02 19:38:05 2010 +0300 @@ -1,117 +1,76 @@ /** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> -* -* Copyright QtD Team, 2008-2009 -* Distributed under the Boost Software License, Version 1.0. -* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -* -*/ + Copyright: Copyright QtD Team, 2008-2010 + License: Boost License 1.0 + */ module qtd.ArrayOpsPrimitive; - -import qt.QGlobal; +import qtd.Core; // int -private extern(C) void qtd_allocate_int_array(int[]* arr, size_t len) -{ - *arr = new int[len]; -} +mixin (qtdExport("void", "allocate_int_array", "int[]* arr, size_t len", + q{ + *arr = new int[len]; + })); -private extern(C) void qtd_assign_int_array_element(int[]* arr, size_t pos, int elem) -{ - (*arr)[pos] = elem; -} +mixin (qtdExport("void", "assign_int_array_element", "int[]* arr, size_t pos, int elem", + q{ + (*arr)[pos] = elem; + })); -private extern(C) void qtd_get_int_from_array(int* arr, size_t pos, int* elem) -{ - *elem = arr[pos]; -} +mixin (qtdExport("void", "get_int_from_array", "int* arr, size_t pos, int* elem", + q{ + *elem = arr[pos]; + })); // uint -private extern(C) void qtd_allocate_uint_array(int[]* arr, size_t len) -{ - *arr = new int[len]; -} +mixin (qtdExport("void", "allocate_uint_array", "int[]* arr, size_t len", + q{ + *arr = new int[len]; + })); -private extern(C) void qtd_assign_uint_array_element(int[]* arr, size_t pos, uint elem) -{ - (*arr)[pos] = elem; -} +mixin (qtdExport("void", "assign_uint_array_element", "int[]* arr, size_t pos, uint elem", + q{ + (*arr)[pos] = elem; + })); -private extern(C) void qtd_get_uint_from_array(uint* arr, size_t pos, uint* elem) -{ - *elem = arr[pos]; -} +mixin (qtdExport("void", "get_uint_from_array", "uint* arr, size_t pos, uint* elem", + q{ + *elem = arr[pos]; + })); // double -private extern(C) void qtd_allocate_double_array(double[]* arr, size_t len) -{ - *arr = new double[len]; -} +mixin (qtdExport("void", "allocate_double_array", "double[]* arr, size_t len", + q{ + *arr = new double[len]; + })); -private extern(C) void qtd_assign_double_array_element(double[]* arr, size_t pos, double elem) -{ - (*arr)[pos] = elem; -} +mixin (qtdExport("void", "assign_double_array_element", "double[]* arr, size_t pos, double elem", + q{ + (*arr)[pos] = elem; + })); -private extern(C) void qtd_get_double_from_array(double* arr, size_t pos, double* elem) -{ - *elem = arr[pos]; -} +mixin (qtdExport("void", "get_double_from_array", "double* arr, size_t pos, double* elem", + q{ + *elem = arr[pos]; + })); // string -private extern(C) void qtd_allocate_string_array(string[]* arr, size_t len) -{ - *arr = new string[len]; -} - -private extern(C) void qtd_assign_string_array_element(string[]* arr, size_t pos, string* elem) -{ -} +mixin (qtdExport("void", "allocate_string_array", "string[]* arr, size_t len", + q{ + *arr = new string[len]; + })); -private extern(C) void* qtd_string_from_array(string[]* arr, size_t pos) -{ - return &((*arr)[pos]); -} -/* -private extern(C) void qtd_get_string_from_array(string* arr, size_t pos, char** elem, size_t* elem_size) -{ - *elem = arr[pos].ptr; - *elem_size = arr[pos].length; -} -*/ - -private extern(C) void qtd_get_string_from_array(string* arr, size_t pos, string* elem) -{ - *elem = arr[pos]; -} +mixin (qtdExport("void", "assign_string_array_element", "string[]* arr, size_t pos, string* elem", + q{ + })); -version(cpp_shared) -{ - extern (C) void qtd_core_ArrayOps_initCallBacks(void* callbacks); - - static this() { - void*[13] callbacks; +mixin (qtdExport("void*", "string_from_array", "string[]* arr, size_t pos", + q{ + return &((*arr)[pos]); + })); - callbacks[0] = &qtd_allocate_int_array; - callbacks[1] = &qtd_assign_int_array_element; - callbacks[2] = &qtd_get_int_from_array; - - callbacks[3] = &qtd_allocate_uint_array; - callbacks[4] = &qtd_assign_uint_array_element; - callbacks[5] = &qtd_get_uint_from_array; - - callbacks[6] = &qtd_allocate_double_array; - callbacks[7] = &qtd_assign_double_array_element; - callbacks[8] = &qtd_get_double_from_array; - - callbacks[9] = &qtd_allocate_string_array; - callbacks[10] = &qtd_assign_string_array_element; - callbacks[11] = &qtd_string_from_array; - callbacks[12] = &qtd_get_string_from_array; - - qtd_core_ArrayOps_initCallBacks(callbacks.ptr); - } -} +mixin (qtdExport("void", "get_string_from_array", "string* arr, size_t pos, string* elem", + q{ + *elem = arr[pos]; + })); +
--- a/d2/qtd/Atomic.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/Atomic.d Wed Jun 02 19:38:05 2010 +0300 @@ -371,8 +371,8 @@ return oldval == equalTo; } } - - + + //////////////////////////////////////////////////////////////////////////// // Atomic Increment //////////////////////////////////////////////////////////////////////////// @@ -399,8 +399,8 @@ return val; } } - - + + //////////////////////////////////////////////////////////////////////////// // Atomic Decrement //////////////////////////////////////////////////////////////////////////// @@ -440,7 +440,7 @@ { version( BuildInfo ) { - pragma( msg, "tango.core.Atomic: using IA-32 inline asm" ); + pragma( msg, "qtd.Atomic: using IA-32 inline asm" ); } version(darwin){ @@ -454,7 +454,7 @@ { version( BuildInfo ) { - pragma( msg, "tango.core.Atomic: using AMD64 inline asm" ); + pragma( msg, "qtd.core.Atomic: using AMD64 inline asm" ); } version = Has64BitOps; @@ -1184,7 +1184,7 @@ { version( BuildInfo ) { - pragma( msg, "tango.core.Atomic: using synchronized ops" ); + pragma( msg, "qtd.Atomic: using synchronized ops" ); } private
--- a/d2/qtd/MOC.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/MOC.d Wed Jun 02 19:38:05 2010 +0300 @@ -106,6 +106,12 @@ */ } +struct ClassInfoDef +{ + string name; + string value; +} + FunctionDef newSlot(string sig, string args) { return FunctionDef(sig, args, Access.Public); @@ -116,14 +122,26 @@ return FunctionDef(sig, args, Access.Protected); } +struct ClassDef +{ + string classname; + FunctionDef[] signalList; + FunctionDef[] slotList; + ClassInfoDef[] classInfoList; +} + struct Generator { string output; string[] strings; // QByteArray purestSuperClass; // QList<QByteArray> metaTypes; + + ClassDef cdef; } + + int lengthOfEscapeSequence(string s, uint i) { if (s[i] != '\\' || i >= s.length - 1) @@ -187,10 +205,31 @@ } } -string generateCode(string className, FunctionDef[] signalList, FunctionDef[] slotList) +ClassInfoDef[] generateClassInfoDefs(T)() { - auto gen = Generator("", []); + ClassInfoDef[] defs; + alias GetAttributes!(T, "Q_CLASSINFO") classInfos; + // COMPILER BUG: + enum len = classInfos.length; + foreach (i, _; Repeat!(void, len)) + defs ~= ClassInfoDef(classInfos[i].tuple[2], classInfos[i].tuple[3]); + + return defs; +} +void generateClassInfos(ref Generator gen) +{ + if (!gen.cdef.classInfoList.length) + return; + + gen.output ~= "\n // classinfo: key, value\n"; + + foreach (c; gen.cdef.classInfoList) + gen.output ~= format_ctfe(" ${}, ${},\n", strreg(gen, c.name), strreg(gen, c.value)); +} + +string generateCode(ref Generator gen) +{ /* bool isQt = (cdef->classname == "Qt"); bool isQObject = (cdef->classname == "QObject"); bool isConstructible = !cdef->constructorList.isEmpty(); @@ -229,11 +268,11 @@ gen.output ~= "private static const uint[] qt_meta_data = [\n"; gen.output ~= format_ctfe("\n // content:\n"); gen.output ~= format_ctfe(" ${}, // revision\n", 2); - gen.output ~= format_ctfe(" ${}, // classname\n", strreg(gen, className)); - gen.output ~= format_ctfe(" ${}, ${}, // classinfo\n", 0, 0); -// index += cdef->classInfoList.count() * 2; + gen.output ~= format_ctfe(" ${}, // classname\n", strreg(gen, gen.cdef.classname)); + gen.output ~= format_ctfe(" ${}, ${}, // classinfo\n", gen.cdef.classInfoList.length, gen.cdef.classInfoList.length ? index : 0); + index += gen.cdef.classInfoList.length * 2; - int methodCount = signalList.length + slotList.length;// + cdef->methodList.count(); + int methodCount = gen.cdef.signalList.length + gen.cdef.slotList.length;// + cdef->methodList.count(); gen.output ~= format_ctfe(" ${}, ${}, // methods\n", methodCount, methodCount ? index : 0); index += methodCount * 5; gen.output ~= format_ctfe(" ${}, ${}, // properties\n", propertyList.length, propertyList.length ? index : 0); @@ -251,17 +290,17 @@ // // Build classinfo array // -// generateClassInfos(); + generateClassInfos(gen); // // Build signals array first, otherwise the signal indices would be wrong // - generateFunctions(gen, signalList, "signal", MethodFlags.MethodSignal); + generateFunctions(gen, gen.cdef.signalList, "signal", MethodFlags.MethodSignal); // // Build slots array // - generateFunctions(gen, slotList, "slot", MethodFlags.MethodSlot); + generateFunctions(gen, gen.cdef.slotList, "slot", MethodFlags.MethodSlot); // // Build method array @@ -344,18 +383,6 @@ return ret; } -string dDeclArgs(Args...)() -{ - string ret; - foreach(i, _; Args) - { - if (i > 0) - ret ~= ", "; - ret ~= fullName!(Args[i]); - } - return ret; -} - size_t commaCount(int argCount) { size_t ret = 0; @@ -364,7 +391,7 @@ return ret; } -FunctionDef[] generateFuncDefs(alias newFunc, Funcs...)() +FunctionDef[] genFuncDefs(alias newFunc, Funcs...)() { typeof(return) res; enum funcsCount = Funcs.length; @@ -446,10 +473,26 @@ return res ~ "}\n"; } +string generateMetaInfo(T)() +{ + Generator gen; + + gen.cdef.classname = T.stringof; + + gen.cdef.slotList = genFuncDefs!(newSignal, T.signals)(); + gen.cdef.signalList = genFuncDefs!(newSlot, T.slots)(); + gen.cdef.classInfoList = generateClassInfoDefs!T(); + + generateCode(gen); + + return gen.output; +} + mixin template Q_OBJECT() { import std.typetuple; import qtd.Marshal; + import std.stdio; import qt.core.QString; // for QStringUtil.toNative public: // required to override the outside scope protection. @@ -460,13 +503,10 @@ alias findSlots!(This) slots; alias TypeTuple!(signals, slots) methods; - mixin (generateSignalEmitters(signals.length)); mixin (generateSlotAliases(slots.length)); - - auto signalList = generateFuncDefs!(newSignal, signals)(); - auto slotList = generateFuncDefs!(newSlot, slots)(); - mixin (generateCode(typeof(this).stringof, signalList, slotList)); + //pragma(msg, generateMetaInfo!This()); + mixin (generateMetaInfo!This()); protected int qt_metacall(QMetaObject.Call _c, int _id, void **_a) { @@ -490,25 +530,38 @@ @property override QMetaObject metaObject() const { return staticMetaObject(); } - private static __gshared QMetaObject _staticMetaObject; - private static __gshared QMetaObjectNative _nativeStaticMetaObject; + private static + { + __gshared QMetaObject staticMetaObject_; + __gshared QMetaObjectNative nativeStaticMetaObject_; + bool staticMoInited_; + } @property static QMetaObject staticMetaObject() { - // TODO: synchronize or enable static constructors in circular modules - if(!_staticMetaObject) + // using a thread-local flag to mitigate + // the performance hit caused by lazy initialization + if(!staticMoInited_) { - alias BaseClassesTuple!(This)[0] Base; + synchronized(qtdMoLock) + { + if (!staticMetaObject_) + { + alias BaseClassesTuple!(This)[0] Base; - _nativeStaticMetaObject = QMetaObjectNative( - Base.staticMetaObject.nativeId, - qt_meta_stringdata.ptr, - qt_meta_data.ptr, null); + nativeStaticMetaObject_ = QMetaObjectNative( + Base.staticMetaObject.nativeId, + qt_meta_stringdata.ptr, + qt_meta_data.ptr, null); - QMetaObject.create!This(&_nativeStaticMetaObject); + QMetaObject.create!This(&nativeStaticMetaObject_); + } + } + staticMoInited_ = true; } - return _staticMetaObject; + + return staticMetaObject_; } /*internal*/ static void setStaticMetaObject(QMetaObject m)
--- a/d2/qtd/Marshal.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/Marshal.d Wed Jun 02 19:38:05 2010 +0300 @@ -8,7 +8,7 @@ import std.string : startsWith; -template isQObjectType(T) +template isQObjectType(T) // { enum isQObjectType = is(T.__isQObjectType); } @@ -33,7 +33,7 @@ enum isQtType = isQObjectType!(T) || isObjectType!(T) || isValueType!(T) || is(T.__isQtType); } */ -template isNativeType(T) // type that doesn't require conversion i.e. is the same in C++ and D +template isNativeType(T) { enum isNativeType = isNumeric!T || is(T == bool) || is(T == struct); } @@ -45,7 +45,7 @@ template isQList(T) { - enum isQList = startsWith(Unqual!(T).stringof, "QList!"); + enum isQList = startsWith(Unqual!(T).stringof, "QList!"); //hack } // returns full name of enum: @@ -64,7 +64,6 @@ enum enumFullName = qualifiedDName!T; } - // converts a D argument type to C++ for registering in Qt meta system string qtDeclArg(T)() { @@ -76,11 +75,10 @@ return "QString"; else static if (isQList!T) { - alias templateParam!T ElementType; - static if (is(ElementType == string)) + static if (is(T.ElementType == string)) return "QStringList"; else - return "QList<" ~ qtDeclArg!(templateParam!T)() ~ ">"; + return "QList<" ~ qtDeclArg!(T.ElementType)() ~ ">"; } else static if (is(T == enum)) return enumFullName!T; @@ -103,7 +101,7 @@ else static if (isValueType!(Args[${0}])) { // COMPILER BUG: 'new' chokes on Args[argIndex], hence the alias - alias Args[${0}] Args${0}; + alias Args[${0}] Args${0}; auto _out${0} = new Args${0}(Args[${0}].__constructNativeCopy(_a[${0}])); } else static if (isStringType!(Args[${0}]))
--- a/d2/qtd/QtdObject.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/QtdObject.d Wed Jun 02 19:38:05 2010 +0300 @@ -10,6 +10,7 @@ */ module qtd.QtdObject; +import qtd.Core; enum QtdObjectFlags : ubyte { @@ -61,14 +62,14 @@ } } -extern(C) void qtd_QtdObject_delete(void* dId) -{ - auto obj = cast(QtdObject)dId; +mixin(qtdExport("void", "QtdObject_delete", "void* dId", + q{ + auto obj = cast(QtdObject)dId; - if (!(obj.__flags & QtdObjectFlags.dOwnership)) - { - // Avoid deleting native object twice - obj.__setFlags(QtdObjectFlags.nativeOwnership, true); - delete obj; - } -} + if (!(obj.__flags & QtdObjectFlags.dOwnership)) + { + // Avoid deleting native object twice + obj.__setFlags(QtdObjectFlags.nativeOwnership, true); + delete obj; + } + }));
--- a/d2/qtd/String.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/String.d Wed Jun 02 19:38:05 2010 +0300 @@ -11,7 +11,9 @@ module qtd.String; -import core.stdc.string; +import + core.stdc.string, + qtd.Core; import std.utf : toUTF8; alias immutable(char)* stringz; @@ -67,10 +69,11 @@ return s ? s[0 .. strlen(s)].idup : cast(string)null; } -extern(C) void qtd_toUtf8(wchar* arr, uint size, string* str) -{ - *str = toUTF8(arr[0..size]); -} +mixin(qtdExport("void", "toUtf8", "wchar* arr, uint size, string* str", + q{ + *str = toUTF8(arr[0..size]); + })); +
--- a/d2/qtd/meta/Compiletime.d Tue May 25 20:14:04 2010 +0300 +++ b/d2/qtd/meta/Compiletime.d Wed Jun 02 19:38:05 2010 +0300 @@ -13,17 +13,8 @@ import std.string : startsWith; -/* -uint startsWith(string s, string pattern) -{ - if (pattern.length <= s.length && s[0..pattern.length] == pattern) - return pattern.length; - - return 0; -} -*/ - - +/** + */ enum standardNamespace = "qtd"; template Alias(A...) if (A.length == 1) @@ -43,12 +34,6 @@ alias A tuple; } -// returns the type of a template parameter if there is one -template templateParam(U : V!(U), alias V) -{ - alias U templateParam; -} - /** Returns a tuple with T repeated count times. @@ -497,14 +482,14 @@ version (QtdUnittest) { - mixin template MyAttribute(alias symbol, A...) + mixin template QtdCustomAttribute(alias symbol, A...) { - mixin Attribute!(symbol, "MyAttribute", AttributeOptions.allowMultiple, A); + mixin Attribute!(symbol, "QtdCustomAttribute", AttributeOptions.allowMultiple, A); } - mixin template ClassInfo(string name, alias value) + mixin template QtdCustomInnerAttribute(string name, alias value) { - mixin InnerAttribute!("ClassInfo", AttributeOptions.allowMultiple, name, value); + mixin InnerAttribute!("QtdCustomInnerAttribute", AttributeOptions.allowMultiple, name, value); } unittest @@ -513,45 +498,49 @@ { // inner C attributes mixin InnerAttribute!("Inner", 33); // generic - mixin ClassInfo!("version", 123); - mixin ClassInfo!("author", "James Bond"); + mixin QtdCustomInnerAttribute!("version", 123); + mixin QtdCustomInnerAttribute!("author", "James Bond"); void foo() {}; // foo attributes mixin Attribute!(foo, "SomeAttribute", 42); - mixin MyAttribute!(foo, 1, 2); - mixin MyAttribute!(foo, 3, 4); + mixin QtdCustomAttribute!(foo, 1, 2); + mixin QtdCustomAttribute!(foo, 3, 4); alias GetAttributes!(typeof(this), "Inner") innerAttrs; static assert(innerAttrs[0].tuple[0] == "Inner"); } // outer C attribute - mixin MyAttribute!(C, 24); + mixin QtdCustomAttribute!(C, 24); alias GetAttributes!(C, "Inner") innerAttrs; static assert(innerAttrs[0].tuple[0] == "Inner" && innerAttrs[0].tuple[2] == 33); - alias GetAttributes!(C, "ClassInfo") ciAttrs; + alias GetAttributes!(C, "QtdCustomInnerAttribute") ciAttrs; static assert(ciAttrs[0].tuple[2] == "version" && ciAttrs[0].tuple[3] == 123); + /+ Fails on Windows but passes on Linux alias GetAttributes!(C.foo, "SomeAttribute") someAttr; static assert(someAttr.length == 1); static assert(someAttr[0].tuple[0] == "SomeAttribute"); - alias GetAttributes!(C.foo, "MyAttribute") myAttrs; + alias GetAttributes!(C.foo, "QtdCustomAttribute") myAttrs; //COMPILER BUG: cannot 'alias myAttrs[0].tuple myAttrs_0'; - static assert(myAttrs[0].tuple[0] == "MyAttribute"); + + static assert(myAttrs[0].tuple[0] == "QtdCustomAttribute"); static assert(myAttrs[0].tuple[2] == 1 && myAttrs[0].tuple[3] == 2); - static assert(myAttrs[1].tuple[0] == "MyAttribute"); + static assert(myAttrs[1].tuple[0] == "QtdCustomAttribute"); static assert(myAttrs[1].tuple[2] == 3 && myAttrs[1].tuple[3] == 4); + +/ /+ BUG: Fails: local declarations cannot be accessed as parent.localDecl - alias GetAttributes!(C, "MyAttribute") myAttrs2; - static assert(myAttrs2[0].tuple[0] == "MyAttribute"); + alias GetAttributes!(C, "QtdCustomAttribute") myAttrs2; + static assert(myAttrs2[0].tuple[0] == "QtdCustomAttribute"); static assert(myAttrs2[0].tuple[1] == 24); +/ + } } \ No newline at end of file
--- a/examples/opengl/hellogl/window.d Tue May 25 20:14:04 2010 +0300 +++ b/examples/opengl/hellogl/window.d Wed Jun 02 19:38:05 2010 +0300 @@ -40,6 +40,7 @@ import qt.gui.QHBoxLayout; import glwidget; +import std.stdio; class Window : public QWidget { @@ -47,31 +48,32 @@ this() { glWidget = new GLWidget; - + xSlider = createSlider(); ySlider = createSlider(); zSlider = createSlider(); - + connect(xSlider, "valueChanged", glWidget, "setXRotation"); connect(glWidget, "xRotationChanged", xSlider, "setValue"); connect(ySlider, "valueChanged", glWidget, "setYRotation"); connect(glWidget, "yRotationChanged", ySlider, "setValue"); connect(zSlider, "valueChanged", glWidget, "setZRotation"); connect(glWidget, "zRotationChanged", zSlider, "setValue"); - + writeln("connected"); + QHBoxLayout mainLayout = new QHBoxLayout; mainLayout.addWidget(glWidget); mainLayout.addWidget(xSlider); mainLayout.addWidget(ySlider); mainLayout.addWidget(zSlider); setLayout(mainLayout); - + xSlider.setValue(15 * 16); ySlider.setValue(345 * 16); zSlider.setValue(0 * 16); setWindowTitle(tr("Hello GL")); } - + private: QSlider createSlider() { @@ -83,11 +85,11 @@ slider.setTickPosition(QSlider.TicksRight); return slider; } - + GLWidget glWidget; QSlider xSlider; QSlider ySlider; QSlider zSlider; - + mixin Q_OBJECT; } \ No newline at end of file
--- a/generator/abstractmetalang.cpp Tue May 25 20:14:04 2010 +0300 +++ b/generator/abstractmetalang.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -206,13 +206,16 @@ return false; } -QString AbstractMetaFunction::marshalledName(bool classIsOwner) const +QString AbstractMetaFunction::marshalledName(Options options) const { - QString returned = "qtd_"; - if(classIsOwner) + QString returned; + if (!(options & NoExternNamespace)) + returned += "qtd_"; + + if(options & DeclaringClass) + returned += declaringClass()->name(); + else returned += ownerClass()->name(); - else - returned += declaringClass()->name(); returned += "_" + name(); AbstractMetaArgumentList arguments = this->arguments();
--- a/generator/abstractmetalang.h Tue May 25 20:14:04 2010 +0300 +++ b/generator/abstractmetalang.h Wed Jun 02 19:38:05 2010 +0300 @@ -395,7 +395,7 @@ SignalFunction, EmptyFunction, SlotFunction, - GlobalScopeFunction + GlobalScopeFunction, }; enum CompareResult { @@ -415,6 +415,15 @@ NotEqual = 0x00001000 }; + enum Option + { + NoOptions = 0, + DeclaringClass = 0x01, + NoExternNamespace = 0x02 + }; + + typedef QFlags<Option> Options; + AbstractMetaFunction() : m_function_type(NormalFunction), m_type(0), @@ -444,7 +453,7 @@ QString minimalSignature(int reduce = 0) const; QStringList possibleIntrospectionCompatibleSignatures() const; - QString marshalledName(bool classIsOwner = true) const; + QString marshalledName(Options options = NoOptions) const; // true if one or more of the arguments are of QtJambiObject subclasses bool argumentsHaveNativeId() const
--- a/generator/containergenerator.cpp Tue May 25 20:14:04 2010 +0300 +++ b/generator/containergenerator.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -220,50 +220,29 @@ << "#include \"qtd_core.h\"" << endl << "#include \"ArrayOps_" << package << ".h\"" << endl << "#include \"ArrayOps_qt_core.h\"" << endl - << "#include \"ArrayOpsPrimitive.h\"" << endl << endl - << "#ifdef CPP_SHARED" << endl << endl; - + << "#include \"ArrayOpsPrimitive.h\"" << endl << endl; foreach (const TypeEntry *te, containerTypes) { if (te->javaPackage() == cls->package()) { const ComplexTypeEntry *centry = static_cast<const ComplexTypeEntry *>(te); QString cls_name = centry->name(); + QString module = packageToQtModule(cls->package()); setFuncNames(cls_name); - s << "QTD_EXPORT_VAR(" << all_name << ")" << endl - << "QTD_EXPORT_VAR(" << ass_name << ")" << endl - << "QTD_EXPORT_VAR(" << get_name << ")" << endl << endl; + s << "QTD_EXPORT(" << module << ", " << all_name << ")" << endl + << "QTD_EXPORT(" << module << ", " << ass_name << ")" << endl + << "QTD_EXPORT(" << module << ", " << get_name << ")" << endl << endl; } } - s << endl - << "extern \"C\" DLL_PUBLIC void qtd_" << cls->package().replace(".", "_") << "_ArrayOps_initCallBacks(pfunc_abstr *callbacks)" << endl - << "{" << endl; - - int num_funcs = 0; - foreach (const TypeEntry *te, containerTypes) { - if (te->javaPackage() == cls->package()) { - const ComplexTypeEntry *centry = static_cast<const ComplexTypeEntry *>(te); - QString cls_name = centry->name(); - - setFuncNames(cls_name); - s << " QTD_EXPORT_VAR_SET(" << all_name << ", callbacks[" << num_funcs + 0 << "]);" << endl - << " QTD_EXPORT_VAR_SET(" << ass_name << ", callbacks[" << num_funcs + 1 << "]);" << endl - << " QTD_EXPORT_VAR_SET(" << get_name << ", callbacks[" << num_funcs + 2 << "]);" << endl << endl; - - num_funcs += NUM_ARRAY_FUNCS; - } - } - s << "}" << endl - << "#endif" << endl; -/* + /* QMap<const TypeEntry*, AbstractMetaType*> typeList = signalEntries[cls->package()]; QMapIterator<const TypeEntry*, AbstractMetaType*> i(typeList); while (i.hasNext()) { i.next(); s << "// " << i.key()->targetLangName() << endl - << "extern \"C\" DLL_PUBLIC void qtd_" << package << "_" << i.key()->targetLangName() << "_to_d_array(void *cpp_ptr, DArray* __d_container) {" << endl; + << "QTD_EXTERN QTD_DLL_PUBLIC void qtd_" << package << "_" << i.key()->targetLangName() << "_to_d_array(void *cpp_ptr, DArray* __d_container) {" << endl; AbstractMetaType *arg_type = i.value(); m_cpp_impl_generator->writeTypeInfo(s, arg_type, NoOption); @@ -280,7 +259,7 @@ foreach(AbstractMetaType* arg_type, signalEntries[cls->package()]) { const TypeEntry *te = arg_type->instantiations().first()->typeEntry(); s << "// " << te->targetLangName() << endl - << "extern \"C\" DLL_PUBLIC void " << cppContainerConversionName(cls, arg_type, FromCpp) << "(void *cpp_ptr, DArray* __d_container) {" << endl; + << "QTD_EXTERN QTD_DLL_PUBLIC void " << cppContainerConversionName(cls, arg_type, FromCpp) << "(void *cpp_ptr, DArray* __d_container) {" << endl; m_cpp_impl_generator->writeTypeInfo(s, arg_type, NoOption); s << "container = (*reinterpret_cast< "; @@ -316,9 +295,9 @@ void ContainerGenerator::setFuncNames(const QString& cls_name) { - all_name = QString("qtd_allocate_%1_array").arg(cls_name); - ass_name = QString("qtd_assign_%1_array_element").arg(cls_name); - get_name = QString("qtd_get_%1_from_array").arg(cls_name); + all_name = QString("allocate_%1_array").arg(cls_name); + ass_name = QString("assign_%1_array_element").arg(cls_name); + get_name = QString("get_%1_from_array").arg(cls_name); } void ContainerGenerator::writeHeaderArrayFunctions(QTextStream &s, const ComplexTypeEntry *centry) @@ -337,17 +316,14 @@ setFuncNames(cls_name); - s << "QTD_EXPORT(void, " << all_name << ", (void* arr, size_t len))" << endl - << "QTD_EXPORT(void, " << ass_name << ", (void* arr, size_t pos, " << cpp_type << " elem))" << endl - << "QTD_EXPORT(void, " << get_name << ", (void* arr, size_t pos, " << cpp_type << " elem))" << endl; + QString module = packageToQtModule(centry->javaPackage()); - s << "#ifdef CPP_SHARED" << endl - << "#define " << all_name << " qtd_get_" << all_name << "()" << endl - << "#define " << ass_name << " qtd_get_" << ass_name << "()" << endl - << "#define " << get_name << " qtd_get_" << get_name << "()" << endl - << "#endif" << endl; + s << "QTD_EXPORT_DECL(" << module << ", void, " << all_name << ", (void* arr, size_t len))" << endl + << "QTD_EXPORT_DECL(" << module << ", void, " << ass_name << ", (void* arr, size_t pos, " << cpp_type << " elem))" << endl + << "QTD_EXPORT_DECL(" << module << ", void, " << get_name << ", (void* arr, size_t pos, " << cpp_type << " elem))" << endl; s << endl; + } void ContainerGenerator::writeDContent(QTextStream &s, AbstractMetaClass *cls) @@ -371,33 +347,6 @@ } if (num_funcs == 0) return; - - s << "version (cpp_shared) {" << endl - << " private extern (C) void qtd_" << cls->package().replace(".", "_") << "_ArrayOps_initCallBacks(void* callbacks);" << endl << endl - << " static this() {" << endl - << " void*[" << num_funcs << "] callbacks; " << endl << endl; - - num_funcs = 0; - foreach (const TypeEntry *te, containerTypes) { - if (te->javaPackage() == cls->package()) { - const ComplexTypeEntry *centry = static_cast<const ComplexTypeEntry *>(te); - - QString cls_name = centry->name(); - setFuncNames(cls_name); - - s << " callbacks[" << num_funcs + 0 << "] = &" << all_name << ";" << endl - << " callbacks[" << num_funcs + 1 << "] = &" << ass_name << ";" << endl - << " callbacks[" << num_funcs + 2 << "] = &" << get_name << ";" << endl; - - s << endl; - num_funcs += NUM_ARRAY_FUNCS; - } - } - s << " qtd_" << cls->package().replace(".", "_") << "_ArrayOps_initCallBacks(callbacks.ptr);" << endl - << " }" << endl - << "}" << endl; - - } void ContainerGenerator::writeDContent2(QTextStream &s, AbstractMetaClass *cls) @@ -422,6 +371,8 @@ << "****************************************************************************/" << endl << endl; } + +// TODO: rewrite void ContainerGenerator::writeArrayFunctions(QTextStream &s, const ComplexTypeEntry *centry) { QString cls_name = centry->name(); @@ -457,22 +408,16 @@ nativeId = ".__ptr_" + type_name; } - s << "private extern(C) void qtd_allocate_" << cls_name << "_array(" << type_name << "[]* arr, size_t len)" << endl - << "{" << endl - << INDENT << "*arr = new " << type_name << "[len];" << endl - << "}" << endl << endl; + DGenerator::writeDExport(s, "void", QString("allocate_%1_array").arg(cls_name), QString("%1[]* arr, size_t len").arg(type_name), + QString(" *arr = new %1[len]; ").arg(type_name)); - s << "private extern(C) void qtd_assign_" << cls_name << "_array_element(" << type_name << "[]* arr, size_t pos, " << cpp_type << " elem)" << endl - << "{" << endl - << INDENT << "(*arr)[pos] = " << convert << ";" << endl - << "}" << endl << endl + DGenerator::writeDExport(s, "void", QString("assign_%1_array_element").arg(cls_name), QString("%1[]* arr, size_t pos, %2 elem").arg(type_name, cpp_type), + QString(" (*arr)[pos] = %1; ").arg(convert)); - << "private extern(C) void qtd_get_" << cls_name << "_from_array(" << type_name << "* arr, size_t pos, " << cpp_assign_type << " elem)" << endl - << "{" << endl - << INDENT << "*elem = arr[pos]" << nativeId << ";" << endl - << "}" << endl << endl + DGenerator::writeDExport(s, "void", QString("get_%1_from_array").arg(cls_name), QString("%1* arr, size_t pos, %2 elem").arg(type_name, cpp_assign_type), + QString(" *elem = arr[pos]%1; ").arg(nativeId)); - << "package " << d_type << " qtd_" << cls_name << "_cpp_to_d(" << cpp_type << " ret)" << endl + s << "package " << d_type << " qtd_" << cls_name << "_cpp_to_d(" << cpp_type << " ret)" << endl << "{" << endl; marshalFromCppToD(s, centry);
--- a/generator/cppimplgenerator.cpp Tue May 25 20:14:04 2010 +0300 +++ b/generator/cppimplgenerator.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -382,7 +382,7 @@ QString s; if (options & CppImplGenerator::ExternC) - s += "extern \"C\" DLL_PUBLIC "; + s += "QTD_EXTERN QTD_DLL_PUBLIC "; /* qtd if (options & CppImplGenerator::JNIExport) s += "Q_DECL_EXPORT "; @@ -478,7 +478,7 @@ InterfaceTypeEntry *ite = static_cast<InterfaceTypeEntry*>(iface->typeEntry()); QString real_name = ite->origin()->qualifiedCppName(); - s << "extern \"C\" DLL_PUBLIC " << real_name << "* qtd_" << java_class->name() << "_cast_to_" << iface->qualifiedCppName() + s << "QTD_EXTERN QTD_DLL_PUBLIC " << real_name << "* qtd_" << java_class->name() << "_cast_to_" << iface->qualifiedCppName() << "(" << java_class->qualifiedCppName() << " *ptr)" << endl << "{" << endl; Indentation indent(INDENT); s << INDENT << "return dynamic_cast<" << real_name << "*>(ptr);" << endl; @@ -487,33 +487,6 @@ } } -void CppImplGenerator::writeInitCallbacks(QTextStream &s, const AbstractMetaClass *java_class) -{ - QString initArgs = "pfunc_abstr *virts"; - if (java_class->isQObject()) - initArgs += ", pfunc_abstr *sigs, pfunc_abstr qobj_del"; - - s << "extern \"C\" DLL_PUBLIC void qtd_" << java_class->name() - << QString("_initCallBacks(%1) {").arg(initArgs) << endl; - - // virtual functions handlers - AbstractMetaFunctionList virtualFunctions = java_class->virtualFunctions(); - for (int pos = 0; pos<virtualFunctions.size(); ++pos) { - const AbstractMetaFunction *function = virtualFunctions.at(pos); - if (!notWrappedYet(function) && java_class == function->declaringClass()) { // qtd2 - s << " " << function->marshalledName(false) << "_dispatch = " - "(pf" << function->marshalledName(false) << "_dispatch) virts[" << pos << "];" << endl; - } - } - // D-side signal callbacks - if (java_class->name() == "QObject") { - s << " qtd_QObject_qt_metacall_dispatch = (QtMetacallCallback)sigs[0];" << endl - << " qtd_QObject_metaObject_dispatch = (MetaObjectCallback)sigs[1];" << endl; - } - s << "}" << endl; -} - - void CppImplGenerator::write(QTextStream &s, const AbstractMetaClass *java_class) { @@ -575,8 +548,7 @@ writeFinalDestructor(s, java_class); if (java_class->isQObject()) { - writeQObjectEntity(s, java_class); - writeSignalsHandling(s, java_class); + writeQObjectEntity(s, java_class); } if (shellClass) { foreach (AbstractMetaFunction *function, java_class->functions()) { @@ -699,7 +671,7 @@ if (java_class->isQObject()) { s << endl << endl - << "extern \"C\" DLL_PUBLIC void* qtd_" << java_class->name() << "_staticMetaObject() {" << endl + << "QTD_EXTERN QTD_DLL_PUBLIC void* qtd_" << java_class->name() << "_staticMetaObject() {" << endl << " return (void*)&" << java_class->name() << "::staticMetaObject;" << endl << "}" << endl; } @@ -710,7 +682,7 @@ { QString argName = "orig"; s << endl << endl - << "extern \"C\" DLL_PUBLIC void qtd_" << java_class->name() << "_placed_copy(void* " + << "QTD_EXTERN QTD_DLL_PUBLIC void qtd_" << java_class->name() << "_placed_copy(void* " << argName << ", void* place) {" << endl << QString(" const %1& __qt_%2 = (const %1& ) *(%1 *)%2;").arg(shellClassName(java_class)).arg(argName) << endl << QString(" %1 *result = new (place) %1 (__qt_%2);").arg(java_class->qualifiedCppName()).arg(argName) << endl; @@ -718,7 +690,7 @@ s << "}"; s << endl << endl - << "extern \"C\" DLL_PUBLIC void* qtd_" << java_class->name() << "_native_copy(void* " << argName << ") {" << endl + << "QTD_EXTERN QTD_DLL_PUBLIC void* qtd_" << java_class->name() << "_native_copy(void* " << argName << ") {" << endl << QString(" const %1& __qt_%2 = (const %1& ) *(%1 *)%2;").arg(shellClassName(java_class)).arg(argName) << endl << QString(" %1 *result = new %1 (__qt_%2);").arg(java_class->qualifiedCppName()).arg(argName) << endl << " return result;" << endl; @@ -733,39 +705,46 @@ void CppImplGenerator::writeValueFunctions(QTextStream &s, const AbstractMetaClass *java_class) { - s << QString("extern \"C\" DLL_PUBLIC bool qtd_%1_QTypeInfo_isComplex() { return (bool) QTypeInfo<%2>::isComplex; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); - s << QString("extern \"C\" DLL_PUBLIC bool qtd_%1_QTypeInfo_isStatic() { return (bool) QTypeInfo<%2>::isStatic; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); - s << QString("extern \"C\" DLL_PUBLIC bool qtd_%1_QTypeInfo_isLarge() { return (bool) QTypeInfo<%2>::isLarge; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); - s << QString("extern \"C\" DLL_PUBLIC bool qtd_%1_QTypeInfo_isPointer() { return (bool) QTypeInfo<%2>::isPointer; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); - s << QString("extern \"C\" DLL_PUBLIC bool qtd_%1_QTypeInfo_isDummy() { return (bool) QTypeInfo<%2>::isDummy; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); + s << QString("QTD_EXTERN QTD_DLL_PUBLIC bool qtd_%1_QTypeInfo_isComplex() { return (bool) QTypeInfo<%2>::isComplex; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); + s << QString("QTD_EXTERN QTD_DLL_PUBLIC bool qtd_%1_QTypeInfo_isStatic() { return (bool) QTypeInfo<%2>::isStatic; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); + s << QString("QTD_EXTERN QTD_DLL_PUBLIC bool qtd_%1_QTypeInfo_isLarge() { return (bool) QTypeInfo<%2>::isLarge; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); + s << QString("QTD_EXTERN QTD_DLL_PUBLIC bool qtd_%1_QTypeInfo_isPointer() { return (bool) QTypeInfo<%2>::isPointer; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); + s << QString("QTD_EXTERN QTD_DLL_PUBLIC bool qtd_%1_QTypeInfo_isDummy() { return (bool) QTypeInfo<%2>::isDummy; }\n").arg(java_class->name()).arg(java_class->qualifiedCppName()); } void CppImplGenerator::writeVirtualDispatchFunction(QTextStream &s, const AbstractMetaFunction *function, const AbstractMetaClass *java_class, bool d_export) { - uint options2 = ReturnType | ExternC; - QString return_type = jniReturnName(function, options2); - QString f_name = function->marshalledName(false) + "_dispatch"; - - if(!d_export) - s << "extern \"C\" "; - - if (!cpp_shared || d_export) { - s << return_type << " " << f_name; - writeVirtualDispatchArguments(s, function, d_export); - if(!d_export) - s << ";"; - } else if (cpp_shared) { - if (function->declaringClass() == java_class) { - s << "typedef " << return_type << " " << "(*pf" << f_name << ")"; - writeVirtualDispatchArguments(s, function, false); - s << ";" << endl - << "pf" << f_name << " " << f_name << ";"; - } else { - s << "extern pf" << f_name << " " << f_name << ";"; - } - } - - s << endl; + uint options2 = ReturnType | ExternC; + QString return_type = jniReturnName(function, options2); + + AbstractMetaFunction::Options opts(AbstractMetaFunction::NoExternNamespace | AbstractMetaFunction::DeclaringClass); + QString f_name = function->marshalledName(opts) + "_dispatch"; + + if (d_export) { + QString qtdExtern = "extern(C)"; // TODO: should be settable via a generator switch + if (cpp_shared) { + + s << qtdExtern << "{ extern export " << return_type << " function"; + writeVirtualDispatchArguments(s, function, d_export); + s << " qtd_" << f_name << "; }" << endl; + + s << qtdExtern << " " << return_type << " qtd_export_" << f_name; + writeVirtualDispatchArguments(s, function, d_export); + + } else { + s << qtdExtern << " " << return_type << " qtd_" << f_name; + writeVirtualDispatchArguments(s, function, d_export); + } + } else { + QString module = packageToQtModule(java_class->package()); + s << "QTD_EXPORT_DECL(" << module << ", " << return_type << ", " << f_name << ", "; + writeVirtualDispatchArguments(s, function, d_export); + s << ")" << endl; + + if (function->declaringClass() == java_class) { + s << "QTD_EXPORT(" << module << ", " << f_name << ")" << endl; + } + } } void CppImplGenerator::writeShellVirtualFunction(QTextStream &s, const AbstractMetaFunction *function, @@ -861,7 +840,7 @@ s << "(" << f_type->typeEntry()->qualifiedCppName() <<") "; } - s << function->marshalledName(false) << "_dispatch("; + s << function->marshalledName(AbstractMetaFunction::DeclaringClass) << "_dispatch("; if (implementor->isQObject()) s << "QObjectLink::getLink(this)->dId"; else @@ -891,9 +870,6 @@ if (f_type) { if (f_type->name() == "QModelIndex") { s << INDENT << "QModelIndex __qt_return_value = qtd_to_QModelIndex( __d_return_value );" << endl; -#ifdef Q_OS_WIN32 -s << "qtd_dummy();" << endl; // hack!!! -#endif s << INDENT << "return __qt_return_value;" << endl; } else if (f_type->typeEntry()->isStructInD()) s << INDENT << "return __d_return_value;" << endl; @@ -921,6 +897,34 @@ // ---------------------------- } +void CppImplGenerator::writeInitCallbacks(QTextStream &s, const AbstractMetaClass *java_class) +{ + QString initArgs = "pfunc_abstr *virts"; + if (java_class->name() == "QObject") + initArgs += ", pfunc_abstr *sigs"; + + s << "QTD_EXTERN QTD_DLL_EXPORT void qtd_" << java_class->name() + << QString("_initCallBacks(%1) {").arg(initArgs) << endl; + + // virtual functions handlers + AbstractMetaFunctionList virtualFunctions = java_class->virtualFunctions(); + AbstractMetaFunction::Options opts(AbstractMetaFunction::DeclaringClass | AbstractMetaFunction::NoExternNamespace); + for (int pos = 0; pos<virtualFunctions.size(); ++pos) { + const AbstractMetaFunction *function = virtualFunctions.at(pos); + if (!notWrappedYet(function) && java_class == function->declaringClass()) { // qtd2 + QString mName = function->marshalledName(opts); + s << " qtd_" << mName << "_dispatch = " + "(qtd_" << mName << "_dispatch_t) virts[" << pos << "];" << endl; + } + } + // D-side signal callbacks + if (java_class->name() == "QObject") { + s << " qtd_QObject_qt_metacall_dispatch = (QtMetacallCallback)sigs[0];" << endl + << " qtd_QObject_metaObject_dispatch = (MetaObjectCallback)sigs[1];" << endl; + } + s << "}" << endl; +} + void CppImplGenerator::writeVirtualDispatchArguments(QTextStream &s, const AbstractMetaFunction *d_function, bool d_export) { uint nativeArgCount = 0; @@ -1284,7 +1288,7 @@ << " return -1;" << endl << "}" << endl << endl; */ - s << "extern \"C\" DLL_PUBLIC void qtd_" << className << "_createEntity(void *nativeId, void* dId)" << endl + s << "QTD_EXTERN QTD_DLL_PUBLIC void qtd_" << className << "_createEntity(void *nativeId, void* dId)" << endl << "{" << endl << " new " << entityName << "((QObject*)nativeId, dId);" << endl << "}" << endl << endl; @@ -1344,16 +1348,14 @@ << "}" << endl << endl; */ - if(cpp_shared) { - QString attr; - if (java_class->name() == "QObject") - attr = "extern "; - - s << attr << "MetaObjectCallback qtd_QObject_metaObject_dispatch;" << endl - << attr << "QtMetacallCallback qtd_QObject_qt_metacall_dispatch;" << endl; - } else { - s << "extern \"C\" const QMetaObject* qtd_QObject_metaObject_dispatch(void *dId);" << endl - << "extern \"C\" int qtd_QObject_qt_metacall_dispatch(void *dId, QMetaObject::Call _c, int _id, void **_a);" << endl; + QString module = packageToQtModule(java_class->package()); + + s << "QTD_EXPORT_DECL(" << module << ", const QMetaObject*, QObject_metaObject_dispatch, (void *dId))" << endl + << "QTD_EXPORT_DECL(" << module << ", int, QObject_qt_metacall_dispatch, (void *dId, QMetaObject::Call _c, int _id, void **_a))" << endl; + + if (java_class->name() == "QObject") { + s << "QTD_EXPORT(" << module << ", QObject_metaObject_dispatch)" << endl + << "QTD_EXPORT(" << module << ", QObject_qt_metacall_dispatch)" << endl; } // TODO: QMetaObject should be included in the typesystem @@ -1380,7 +1382,7 @@ << " return " << java_class->qualifiedCppName() << "::qt_metacall(_c, _id, _a);" << "}" << endl << endl - << "extern \"C\" DLL_PUBLIC int qtd_" << java_class->name() << "_qt_metacall(void* __this_nativeId, QMetaObject::Call _c, int _id, void **_a)" + << "QTD_EXTERN QTD_DLL_PUBLIC int qtd_" << java_class->name() << "_qt_metacall(void* __this_nativeId, QMetaObject::Call _c, int _id, void **_a)" << "{" << endl << " " << shellClassName(java_class) << " *__qt_this = (" << shellClassName(java_class) << " *) __this_nativeId;" << endl << " return __qt_this->__override_qt_metacall(_c, _id, _a);" << endl @@ -1432,41 +1434,6 @@ s << endl << endl; } -void CppImplGenerator::writeSignalsHandling(QTextStream &s, const AbstractMetaClass *java_class) -{ - return; // #TODO probably don't need this function at all - - s << "extern \"C\" typedef void (*EmitCallback)(void*, void**);" << endl; - AbstractMetaFunctionList signal_funcs = signalFunctions(java_class); - - if (cpp_shared) - if(signal_funcs.size() > 0) - s << "EmitCallback emit_callbacks_" << java_class->name() << "[" << signal_funcs.size() << "];" << endl; - else - s << "EmitCallback emit_callbacks_" << java_class->name() << "[1];" << endl; // Hack for msvc. - else { - // D-side signal callbacks - for(int i = 0; i < signal_funcs.size(); i++) { - AbstractMetaFunction *signal = signal_funcs.at(i); - s << "extern \"C\" DLL_PUBLIC void " << signalExternName(java_class, signal) << "_handle(void* dId, void** args);" << endl; - } - - if(signal_funcs.size() > 0) - s << "EmitCallback emit_callbacks_" << java_class->name() << "[" << signal_funcs.size() << "] = {" << endl; - else - s << "EmitCallback emit_callbacks_" << java_class->name() << "[1] = {" << endl; // Hack for msvc. - for(int i = 0; i < signal_funcs.size(); i++) { - AbstractMetaFunction *signal = signal_funcs.at(i); - s << endl; - if (i != 0) - s << ", "; - s << "&" << signalExternName(java_class, signal) << "_handle"; - } - s << endl << "};" << endl << endl; - } -} - - void CppImplGenerator::writeShellConstructor(QTextStream &s, const AbstractMetaFunction *java_function) { if (java_function->isModifiedRemoved(TypeSystem::ShellCode)) @@ -1834,7 +1801,7 @@ void CppImplGenerator::writeQtdEntityFunction(QTextStream &s, const AbstractMetaClass *java_class) { - s << "extern \"C\" DLL_PUBLIC void *__" << java_class->name() << "_entity(void *q_ptr)" << endl; + s << "QTD_EXTERN QTD_DLL_PUBLIC void *__" << java_class->name() << "_entity(void *q_ptr)" << endl; s << "{" << endl; { Indentation indent(INDENT); @@ -2393,12 +2360,12 @@ void CppImplGenerator::writeFinalDestructor(QTextStream &s, const AbstractMetaClass *cls) { if (cls->hasConstructors() && cls->isDestructorBase()) { - s << INDENT << "extern \"C\" DLL_PUBLIC void qtd_" << cls->name() << "_delete(void* nativeId)" << endl + s << INDENT << "QTD_EXTERN QTD_DLL_PUBLIC void qtd_" << cls->name() << "_delete(void* nativeId)" << endl << INDENT << "{" << endl << INDENT << " delete (" << shellClassName(cls) << "*)nativeId;" << endl << INDENT << "}" << endl << endl; - s << INDENT << "extern \"C\" DLL_PUBLIC void qtd_" << cls->name() << "_destroy(void* nativeId)" << endl + s << INDENT << "QTD_EXTERN QTD_DLL_PUBLIC void qtd_" << cls->name() << "_destroy(void* nativeId)" << endl << INDENT << "{" << endl << INDENT << " call_destructor((" << shellClassName(cls) << "*)nativeId);" << endl << INDENT << "}" << endl << endl;
--- a/generator/cppimplgenerator.h Tue May 25 20:14:04 2010 +0300 +++ b/generator/cppimplgenerator.h Wed Jun 02 19:38:05 2010 +0300 @@ -210,13 +210,12 @@ static void writeVirtualFunctionDispatchName(QTextStream &s, const AbstractMetaFunction *function, bool d_export = false); static void writeVirtualDispatchFunction(QTextStream &s, const AbstractMetaFunction *function, const AbstractMetaClass *java_class, bool d_export = false); static void writeInterfaceCasts(QTextStream &s, const AbstractMetaClass *java_class); - void writeSignalsHandling(QTextStream &s, const AbstractMetaClass *java_class); void writeQObjectLink(QTextStream &s, const AbstractMetaClass *java_class); void writeSignalEmitter(QTextStream &s, const AbstractMetaClass *java_class, AbstractMetaFunction *signal); - static void writeInitCallbacks(QTextStream &s, const AbstractMetaClass *java_class); static void writeQtdEntityFunction(QTextStream &s, const AbstractMetaClass *java_class); void writeRefArguments(QTextStream &s, const AbstractMetaFunction *java_function); void writeValueFunctions(QTextStream &s, const AbstractMetaClass *java_class); + void writeInitCallbacks(QTextStream &s, const AbstractMetaClass *java_class); private: void writeDefaultConstructedValues_helper(QSet<QString> &values,
--- a/generator/dgenerator.cpp Tue May 25 20:14:04 2010 +0300 +++ b/generator/dgenerator.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -2548,11 +2548,11 @@ if (cpp_shared && d_class->generateShellClass()) { initArgs = "void* virtuals"; - if (d_class->isQObject()) + if (d_class->name() == "QObject") initArgs += ", void* signals"; s << "private extern (C) void qtd_" << d_class->name() - << QString("_initCallBacks(%1);").arg(initArgs) << endl << endl; + << QString("_initCallBacks(%1);").arg(initArgs) << endl << endl; } s << "extern(C) void static_init_" << d_class->name() << "() {" << endl; @@ -2566,13 +2566,19 @@ } if (cpp_shared && d_class->generateShellClass()) { - // virtual functions + + AbstractMetaFunction::Options opts(AbstractMetaFunction::DeclaringClass | AbstractMetaFunction::NoExternNamespace); + + // virtual functions s << INDENT << "void*[" << virtualFunctions.size() << "] virt_arr;" << endl; for (int pos = 0; pos<virtualFunctions.size(); ++pos) { const AbstractMetaFunction *function = virtualFunctions.at(pos); - if (!notWrappedYet(function) && d_class == function->declaringClass()) // qtd2 - s << INDENT << "virt_arr[" << pos << "] = &" << function->marshalledName(false) << "_dispatch;" <<endl; + if (!notWrappedYet(function) && d_class == function->declaringClass()) { + QString mName = function->marshalledName(opts); + s << INDENT << "virt_arr[" << pos << "] = &qtd_export_" << mName << "_dispatch;" <<endl; + } } + if (virtualFunctions.size() == 0) initArgs = "null"; else @@ -2581,8 +2587,8 @@ if (d_class->name() == "QObject") { // qt_metacall, metaObject s << endl << INDENT << "void*[2] sign_arr;" << endl; - s << INDENT << "sign_arr[0] = &qtd_QObject_qt_metacall_dispatch;" << endl; - s << INDENT << "sign_arr[1] = &qtd_QObject_metaObject_dispatch;" << endl; + s << INDENT << "sign_arr[0] = &qtd_export_QObject_qt_metacall_dispatch;" << endl; + s << INDENT << "sign_arr[1] = &qtd_export_QObject_metaObject_dispatch;" << endl; initArgs += ", sign_arr.ptr"; } @@ -2680,21 +2686,24 @@ void DGenerator::writeQObjectFreeFunctions(QTextStream &s, const AbstractMetaClass *d_class) { - s << "private extern(C) QMetaObjectNative* qtd_" << d_class->name() << "_staticMetaObject();" << endl << endl - << "private extern(C) void qtd_" << d_class->name() << "_createEntity(void* nativeId, void* dId);" << endl << endl; - - if (!d_class->isFinal()) - s << "private extern(C) int qtd_" << d_class->name() << "_qt_metacall(void* __this_nativeId, QMetaObject.Call _c, int _id, void **_a);" - << "private extern(C) int qtd_" << d_class->name() << "_qt_metacall_dispatch(void *d_entity, QMetaObject.Call _c, int _id, void **_a) {" - << " auto d_object = cast(" << d_class->name() << ") d_entity;" - << " return d_object.qt_metacall(_c, _id, _a);" - << "}" << endl << endl - - << "private extern(C) void* qtd_" << d_class->name() << "_metaObject_dispatch(void *d_entity) {" - << " auto d_object = cast(" << d_class->name() << ") d_entity;" - << " return d_object.metaObject().nativeId();" - << "}" << endl << endl; - } + s << "extern(C) QMetaObjectNative* qtd_" << d_class->name() << "_staticMetaObject();" << endl << endl + << "extern(C) void qtd_" << d_class->name() << "_createEntity(void* nativeId, void* dId);" << endl << endl + << "extern(C) int qtd_" << d_class->name() << "_qt_metacall(void *nativeId, QMetaObject.Call _c, int _id, void **_a);" << endl; + + QString prefix = cpp_shared ? "qtd_export_" : "qtd_"; + + if (d_class->name() == "QObject") { + s << "extern(C) int " << prefix << "QObject_qt_metacall_dispatch(void *d_entity, QMetaObject.Call _c, int _id, void **_a) {" << endl + << " auto d_object = cast(QObject) d_entity;" << endl + << " return d_object.qt_metacall(_c, _id, _a);" << endl + << "};" << endl << endl; + + s << "extern(C) void* " << prefix << "QObject_metaObject_dispatch(void *d_entity) {" << endl + << " auto d_object = cast(QObject) d_entity;" << endl + << " return d_object.metaObject().nativeId();" << endl + << "};" << endl << endl; + } +} void writeMetaMethodSignatures(QTextStream &s, const QString &var_name, AbstractMetaFunctionList meta_funcs) { @@ -2726,63 +2735,64 @@ void DGenerator::writeQObjectFunctions(QTextStream &s, const AbstractMetaClass *d_class) { - AbstractMetaFunctionList d_funcs_gen = generatedClassFunctions(d_class); - AbstractMetaFunctionList slot_funcs; - for (int i=0; i<d_funcs_gen.size(); ++i) { + AbstractMetaFunctionList d_funcs_gen = generatedClassFunctions(d_class); + AbstractMetaFunctionList slot_funcs; + for (int i=0; i<d_funcs_gen.size(); ++i) { AbstractMetaFunction *function = d_funcs_gen.at(i); if(function->isSlot()) slot_funcs += function; - } - writeMetaMethodSignatures(s, "__slotSignatures", slot_funcs); - - if (d_class->isAbstract()) - s << "alias " << d_class->name() << "_ConcreteWrapper ConcreteType;" << endl; - - if (!d_class->isFinal()) - s << " int qt_metacall(QMetaObject.Call _c, int _id, void **_a) {" << endl - << " return qtd_" << d_class->name() << "_qt_metacall(__nativeId, _c, _id, _a);" << endl - << " }" << endl << endl; - - s << " private static __gshared QMetaObject _staticMetaObject;" << endl - << " protected static void setStaticMetaObject(QMetaObject m) {" << endl - << " _staticMetaObject = m;" << endl - << " }" << endl << endl - - << " @property QMetaObject metaObject() {" << endl - << " return _staticMetaObject;" << endl - << " }" << endl << endl - - << " @property static QMetaObject staticMetaObject() {" << endl - << " if (!_staticMetaObject)" << endl - << " QMetaObject.create!(typeof(this))(qtd_" << d_class->name() << "_staticMetaObject());" << endl - << " return _staticMetaObject;" << endl - << " }" << endl << endl - - << " static " << d_class->name() << " __getObject(void* nativeId) {" << endl - << " return static_cast!(" << d_class->name() << ")(_staticMetaObject.getObject(nativeId));" << endl - << " }" << endl << endl - - << " /* internal */ static void __createEntity(void* nativeId, void* dId) {" << endl - << " return qtd_" << d_class->name() << "_createEntity(nativeId, dId);" << endl - << " }" << endl << endl - - << " /* internal */ static void _populateMetaInfo() {" << endl - << " int index;" << endl << endl; - - AbstractMetaFunctionList signal_funcs = signalFunctions(d_class, false); - - int staticId = 0; - for (int i = 0; i < signal_funcs.size(); ++i) - { + } + writeMetaMethodSignatures(s, "__slotSignatures", slot_funcs); + + if (d_class->isAbstract()) + s << "alias " << d_class->name() << "_ConcreteWrapper ConcreteType;" << endl; + + if (!d_class->isFinal()) { + s << " int qt_metacall(QMetaObject.Call _c, int _id, void **_a) {" << endl + << " return qtd_" << d_class->name() << "_qt_metacall(__nativeId, _c, _id, _a);" << endl + << " }" << endl << endl; + } + + s << " private static __gshared QMetaObject _staticMetaObject;" << endl + << " protected static void setStaticMetaObject(QMetaObject m) {" << endl + << " _staticMetaObject = m;" << endl + << " }" << endl << endl + + << " @property QMetaObject metaObject() {" << endl + << " return _staticMetaObject;" << endl + << " }" << endl << endl + + << " @property static QMetaObject staticMetaObject() {" << endl + << " if (!_staticMetaObject)" << endl + << " QMetaObject.create!(typeof(this))(qtd_" << d_class->name() << "_staticMetaObject());" << endl + << " return _staticMetaObject;" << endl + << " }" << endl << endl + + << " static " << d_class->name() << " __getObject(void* nativeId) {" << endl + << " return static_cast!(" << d_class->name() << ")(_staticMetaObject.getObject(nativeId));" << endl + << " }" << endl << endl + + << " /* internal */ static void __createEntity(void* nativeId, void* dId) {" << endl + << " return qtd_" << d_class->name() << "_createEntity(nativeId, dId);" << endl + << " }" << endl << endl + + << " /* internal */ static void _populateMetaInfo() {" << endl + << " int index;" << endl << endl; + + AbstractMetaFunctionList signal_funcs = signalFunctions(d_class, false); + + int staticId = 0; + for (int i = 0; i < signal_funcs.size(); ++i) + { int j = 0; bool hasDefault = false; do // need this to look for default arguments and generate extra signatures { AbstractMetaFunction *fn = signal_funcs.at(i); - s << " index = _staticMetaObject.indexOfMethod_Cpp(__signalSignatures[" << staticId << "]);" << endl + s << " index = _staticMetaObject.indexOfMethod_Cpp(__signalSignatures[" << staticId << "]);" << endl << " _staticMetaObject.addMethod(new QMetaSignal(signature!("; writeMetaMethodArguments(s, fn, j); - s << ")(\"" << fn->name() << "\"), index));" << endl << endl; + s << ")(\"" << fn->name() << "\"), index));" << endl << endl; AbstractMetaArgumentList args = fn->arguments(); if(args.size() && j<args.size()) hasDefault = !args.at(args.size() - 1 - j)->defaultValueExpression().isEmpty(); @@ -2791,20 +2801,20 @@ j++; staticId++; } while (hasDefault); - } - - staticId = 0; - for (int i = 0; i < slot_funcs.size(); ++i) - { + } + + staticId = 0; + for (int i = 0; i < slot_funcs.size(); ++i) + { int j = 0; bool hasDefault = false; do // need this to look for default arguments and generate extra signatures { AbstractMetaFunction *fn = slot_funcs.at(i); - s << " index = _staticMetaObject.indexOfMethod_Cpp(__slotSignatures[" << staticId << "]);" << endl + s << " index = _staticMetaObject.indexOfMethod_Cpp(__slotSignatures[" << staticId << "]);" << endl << " _staticMetaObject.addMethod(new QMetaSlot(signature!("; writeMetaMethodArguments(s, fn, j); - s << ")(\"" << fn->name() << "\"), index));" << endl << endl; + s << ")(\"" << fn->name() << "\"), index));" << endl << endl; AbstractMetaArgumentList args = fn->arguments(); if(args.size() && j<args.size()) hasDefault = !args.at(args.size() - 1 - j)->defaultValueExpression().isEmpty(); @@ -2813,11 +2823,11 @@ j++; staticId++; } while (hasDefault); - } - - s << " }" << endl << endl; - - s << INDENT << "mixin Q_OBJECT_BIND;" << endl << endl; + } + + s << " }" << endl << endl; + + s << INDENT << "mixin Q_OBJECT_BIND;" << endl << endl; } void DGenerator::marshalFromCppToD(QTextStream &s, const ComplexTypeEntry* ctype) @@ -2948,7 +2958,6 @@ if (implementor != d_function->declaringClass()) return; - s << "private extern(C) "; CppImplGenerator::writeVirtualDispatchFunction(s, d_function, implementor, true); s << "{" << endl; @@ -3478,6 +3487,21 @@ << " native " << d_class->name() << " __qt_clone(long __this_nativeId);" << endl; } +void DGenerator::writeDExport(QTextStream &s, QString retType, QString name, QString args, QString funcBody) +{ + QString qtdExtern = "extern (C)"; // TODO: should be settable via a generator switch + if (cpp_shared) { + s << QString( + " %5 %1 qtd_export_%2(%3) { %4 }\n" + " %5 export void qtd_set_%2(VoidFunc func);\n" + " static this() { qtd_set_%2(cast(VoidFunc)&qtd_export_%2); }\n") + .arg(retType, name, args, funcBody, qtdExtern); + } else { + s << QString("%5 %1 qtd_%2(%3) { %4 }\n") + .arg(retType, name, args, funcBody, qtdExtern); + } +} + ClassFromEntry* ClassFromEntry::m_instance = NULL; ClassFromEntry::ClassFromEntry() @@ -3511,7 +3535,7 @@ void ClassFromEntry::print(QTextStream &s) { - s << "_fuck_" << m_instance->m_classes.size(); + s << m_instance->m_classes.size(); foreach (AbstractMetaClass *cls, m_instance->m_classes) { s << cls->name() << endl; }
--- a/generator/dgenerator.h Tue May 25 20:14:04 2010 +0300 +++ b/generator/dgenerator.h Wed Jun 02 19:38:05 2010 +0300 @@ -140,6 +140,9 @@ const AbstractMetaClass *implementor, int id); void marshalFromCppToD(QTextStream &s, const ComplexTypeEntry* ctype); + // generates output analogous to that of qtd.Core.qtdExport + static void writeDExport(QTextStream &s, QString retType, QString name, QString args, QString body); + private: QString subDirectoryForPackage(const QString &package) const { return QString(package).replace(".", "/"); } void writeInstantiatedType(QTextStream &s, const AbstractMetaType *abstractMetaType) const;
--- a/generator/generator.cpp Tue May 25 20:14:04 2010 +0300 +++ b/generator/generator.cpp Wed Jun 02 19:38:05 2010 +0300 @@ -140,6 +140,24 @@ return false; } +// hackery to get qt module names +QString Generator::packageToQtModule(QString package, ModuleNameType nameType) +{ + if (!package.startsWith("qt.")) + qFatal(qPrintable("Package " + package + " does not start with 'qt.'")); + + QString module = package.right(package.length() - 3); + + if (nameType == ShortUpper) + return module.toUpper(); + else if (nameType == LongCamel) { + module[0] = module[0].toTitleCase(); + return "Qt" + module; + } + else + Q_ASSERT(0); +} + bool isLinearContainer(const ContainerTypeEntry *type) { if (type->type() == ContainerTypeEntry::ListContainer
--- a/generator/generator.h Tue May 25 20:14:04 2010 +0300 +++ b/generator/generator.h Wed Jun 02 19:38:05 2010 +0300 @@ -95,6 +95,12 @@ ForceValueType = ExcludeReference | ExcludeConst }; + enum ModuleNameType + { + ShortUpper, + LongCamel + }; + Generator(); void setClasses(const AbstractMetaClassList &classes) { m_classes = classes; } @@ -115,6 +121,9 @@ bool hasDefaultConstructor(const AbstractMetaType *type); + // TODO: this should be a property of the generator set, not inferred from java package. + static QString packageToQtModule(QString package, ModuleNameType nameType = ShortUpper); + protected: void verifyDirectoryFor(const QFile &file);
--- a/generator/typesystem_core.xml Tue May 25 20:14:04 2010 +0300 +++ b/generator/typesystem_core.xml Wed Jun 02 19:38:05 2010 +0300 @@ -2363,17 +2363,17 @@ <object-type name="QObject"> <inject-code class="native"> -extern "C" DLL_PUBLIC void* qtd_get_d_qobject(void *nativeId) +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_get_d_qobject(void *nativeId) { return QObjectEntity::getDId((QObject*)nativeId); } -extern "C" DLL_PUBLIC void qtd_create_qobject_entity(void* nativeId, void *dId) +QTD_EXTERN QTD_DLL_PUBLIC void qtd_create_qobject_entity(void* nativeId, void *dId) { new QObjectLink((QObject*)nativeId, dId); } -extern "C" DLL_PUBLIC void* qtd_QObject_metaObject(void* nativeId) +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_QObject_metaObject(void* nativeId) { return (void*)((QObject*)nativeId)->metaObject(); } @@ -2384,9 +2384,6 @@ extern(C) void* qtd_get_d_qobject(void* nativeId); extern(C) void* qtd_create_qobject_entity(void* nativeId, void* dId); extern(C) void* qtd_QObject_metaObject(void* nativeId); -extern(C) void qtd_connect(void *nativeId, cstringz signal, int id, bool dynamicEntity); -extern(C) void qtd_disconnect(void *nativeId, cstringz signal, int id, bool dynamicEntity); - </inject-code> <modify-function signature="childEvent(QChildEvent*)">
--- a/generator/typesystem_gui.xml Tue May 25 20:14:04 2010 +0300 +++ b/generator/typesystem_gui.xml Wed Jun 02 19:38:05 2010 +0300 @@ -19,7 +19,7 @@ <template name="gui.class_from_variant_native"> // %CLASS_NAME from QVariant -extern "C" DLL_PUBLIC void* qtd_%CLASS_NAME_%CLASS_NAME_QVariant +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_%CLASS_NAME_%CLASS_NAME_QVariant (void *d_ptr, void* arg__1) { @@ -32,7 +32,7 @@ <template name="gui.class_from_variant_native_shell"> // %CLASS_NAME from QVariant -extern "C" DLL_PUBLIC void* qtd_%CLASS_NAME_%CLASS_NAME_QVariant +QTD_EXTERN QTD_DLL_PUBLIC void* qtd_%CLASS_NAME_%CLASS_NAME_QVariant (void *d_ptr, void* arg__1) { @@ -47,7 +47,7 @@ <insert-template name="gui.class_from_variant_java"> <replace from="%CLASS_NAME" to=""/> </insert-template> - </inject-code> + </inject-code> <inject-code class="java-free"> <insert-template name="gui.class_from_variant_java_free"> <replace from="%CLASS_NAME" to=""/> @@ -58,13 +58,13 @@ <replace from="%CLASS_NAME" to=""/> </insert-template> </inject-code> - + with shell <inject-code class="java"> <insert-template name="gui.class_from_variant_java"> <replace from="%CLASS_NAME" to=""/> </insert-template> - </inject-code> + </inject-code> <inject-code class="java-free"> <insert-template name="gui.class_from_variant_java_free"> <replace from="%CLASS_NAME" to=""/> @@ -77,7 +77,7 @@ </inject-code> --> - + <template name="gui.getter_returning_nativepointer"> public final %RETURN_TYPE %FUNCTION_NAME() { QNativePointer np = %FUNCTION_NAME_private(); @@ -222,9 +222,9 @@ <rejection class="*" field-name="d_ptr"/> <rejection class="*" field-name="d"/> - + <rejection class="QAccessibleTableInterface"/> - + <rejection class="QWindowsCEStyle"/> <rejection class="QWindowsMobileStyle"/> <rejection class="QAbstractUndoItem"/> @@ -712,7 +712,7 @@ <modify-function signature="operator/=(double)" access="private"/> <modify-function signature="operator*(QTransform)const" rename="multiplied"/> <modify-function signature="operator*=(QTransform)" access="private"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTransform___" quote-before-line="}// class"/> </inject-code> @@ -934,7 +934,7 @@ <remove-default-expression/> </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QBitmap___" quote-before-line="}// class"/> </inject-code> @@ -952,7 +952,7 @@ <modify-function signature="cursorToX(int*,QTextLine::Edge)const"> <remove/> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTextLine___" quote-before-line="}// class"/> </inject-code> @@ -999,7 +999,7 @@ <modify-function signature="inputFormats()" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="outputFormatList()" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="outputFormats()" remove="all"/> <!--### Obsolete in 4.3--> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPicture___" quote-before-line="}// class"/> </inject-code> @@ -1093,7 +1093,7 @@ <modify-function signature="operator&=(QRect)" remove="all"/> <modify-function signature="operator+=(QRect)" remove="all"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QRegion___" quote-before-line="}// class"/> </inject-code> @@ -1130,17 +1130,17 @@ <extra-includes> <include file-name="qt.core.QPoint" location="java"/> </extra-includes> - + <modify-function signature="QPolygon(int, const int *)" remove="all"/> <modify-function signature="operator+(QVector<QPoint>)const" remove="all"/> <modify-function signature="operator<<(QPoint)" remove="all"/> <modify-function signature="operator<<(QVector<QPoint>)" remove="all"/> - + <inject-code class="java"> public final void insert(int i, QPoint t) { qtd_QPolygon_insert_int_QPoint(__nativeId, i, t); } - + public final void insert(int i, int n, QPoint t) { qtd_QPolygon_insert_int_int_QPoint(__nativeId, i, n, t); } @@ -1156,7 +1156,7 @@ </inject-code> <inject-code class="native"> // QPolygon::insert(int i, const QPoint & t) -extern "C" DLL_PUBLIC void qtd_QPolygon_insert_int_QPoint +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QPolygon_insert_int_QPoint (void* __this_nativeId, int i0, QPoint t1) @@ -1167,7 +1167,7 @@ } // QPolygon::insert(int i, int n, const QPoint & t) -extern "C" DLL_PUBLIC void qtd_QPolygon_insert_int_int_QPoint +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QPolygon_insert_int_int_QPoint (void* __this_nativeId, int i0, int n1, @@ -1178,13 +1178,13 @@ } </inject-code> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPolygon___" quote-before-line="}// class"/> </inject-code> <!-- qtd2 <inject-code class="native"> - extern "C" JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QPolygon_add_1private) + QTD_EXTERN QTD_JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QPolygon_add_1private) (JNIEnv *__jni_env, jobject, jlong nativeId, jint x, jint y) { Q_UNUSED(__jni_env); @@ -1200,7 +1200,7 @@ <modify-function signature="operator+(QVector<QPointF>)const" remove="all"/> <modify-function signature="operator<<(QPointF)" remove="all"/> <modify-function signature="operator<<(QVector<QPointF>)" remove="all"/> - + <extra-includes> <include file-name="qt.core.QPoint" location="java"/> </extra-includes> @@ -1210,7 +1210,7 @@ </inject-code> <!-- <inject-code class="native"> - extern "C" JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QPolygonF_add_1private) + QTD_EXTERN QTD_JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QPolygonF_add_1private) (JNIEnv *__jni_env, jobject, jlong nativeId, jdouble x, jdouble y) { Q_UNUSED(__jni_env); @@ -1241,7 +1241,7 @@ </inject-code> <inject-code class="native"> // QPolygonF::insert(int i, const QPointF & t) -extern "C" DLL_PUBLIC void qtd_QPolygonF_insert_int_QPointF +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QPolygonF_insert_int_QPointF (void* __this_nativeId, int i0, QPointF t1) @@ -1252,7 +1252,7 @@ } // QPolygonF::insert(int i, int n, const QPointF & t) -extern "C" DLL_PUBLIC void qtd_QPolygonF_insert_int_int_QPointF +QTD_EXTERN QTD_DLL_PUBLIC void qtd_QPolygonF_insert_int_int_QPointF (void* __this_nativeId, int i0, int n1, @@ -1272,7 +1272,7 @@ <replace from="%CLASS_NAME" to="QIcon"/> </insert-template> - </inject-code> + </inject-code> <inject-code class="java-free"> <insert-template name="gui.class_from_variant_java_free"> <replace from="%CLASS_NAME" to="QIcon"/> @@ -1312,7 +1312,7 @@ <modify-function signature="operator=(QTextFrame::iterator)" remove="all"/> <modify-function signature="operator++()" access="private"/> <modify-function signature="operator--()" access="private"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTextFrame_iterator___" quote-before-line="}// class"/> </inject-code> @@ -1334,7 +1334,7 @@ <modify-function signature="operator++()" access="private"/> <modify-function signature="operator--()" access="private"/> <modify-function signature="operator*()const" access="private"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTreeWidgetItemIterator___" quote-before-line="}// class"/> </inject-code> @@ -1348,7 +1348,7 @@ <modify-function signature="operator--()" access="private"/> <modify-function signature="operator++(int)" remove="all"/> <modify-function signature="operator--(int)" remove="all"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTextBlock_iterator___" quote-before-line="}// class"/> </inject-code> @@ -1366,7 +1366,7 @@ <modify-function signature="operator QVariant()const" access="private"/> <modify-function signature="QPixmap(const char **)" access="private"/> <modify-function signature="serialNumber()const" remove="all"/> <!--### Obsolete in 4.3--> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPixmap___" quote-before-line="}// class"/> </inject-code> @@ -1381,12 +1381,12 @@ <include file-name="QBitmap" location="global"/> <include file-name="QMatrix" location="global"/> </extra-includes> - + <inject-code class="java"> <insert-template name="gui.class_from_variant_java"> <replace from="%CLASS_NAME" to="QPixmap"/> </insert-template> - </inject-code> + </inject-code> <inject-code class="java-free"> <insert-template name="gui.class_from_variant_java_free"> <replace from="%CLASS_NAME" to="QPixmap"/> @@ -1509,7 +1509,7 @@ <modify-function signature="selectedTableCells(int*,int*,int*,int*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTextCursor___" quote-before-line="}// class"/> </inject-code> @@ -1536,7 +1536,7 @@ <modify-function signature="operator+=(const QItemSelectionRange&)" remove="all"/> <modify-function signature="operator<<(const QList<QItemSelectionRange>&)" remove="all"/> <modify-function signature="operator<<(QItemSelectionRange)" remove="all"/> -<!-- +<!-- <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QItemSelection___" quote-before-line="}// class"/> </inject-code> @@ -1598,7 +1598,7 @@ <replace from="%ARGUMENT_NAMES" to="dx, dy"/> </insert-template> </inject-code> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QMatrix___" quote-before-line="}// class"/> </inject-code> @@ -1640,7 +1640,7 @@ <modify-field name="type" write="false"/> <include file-name="QPainterPath" location="global"/> <modify-function signature="operator QPointF()const" access="private"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPainterPath_Element___" quote-before-line="}// class"/> </inject-code> @@ -1766,7 +1766,7 @@ <modify-function signature="serialNumber()const" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="textLanguages()const" remove="all"/> <!--### Obsolete in 4.3--> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QImage___" quote-before-line="}// class"/> </inject-code> @@ -1871,7 +1871,7 @@ <include file-name="QPixmap" location="global"/> </extra-includes> <modify-function signature="operator=(QCursor)" remove="all"/> -<!-- +<!-- <template name="gui.cursor_bitmap_getter"> <insert-template name="gui.getter_returning_nativepointer"> <replace from="%RETURN_TYPE" to="QBitmap"/> @@ -1912,7 +1912,7 @@ </extra-includes> <modify-function signature="operator=(QPen)" remove="all"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPen___" quote-before-line="}// class"/> </inject-code> @@ -1923,11 +1923,11 @@ <modify-function signature="operator=(const QBrush &)" remove="all"/> <!-- restore later - abstract class not handled--> <modify-function signature="gradient() const" remove="all"/> - + <extra-includes> <include file-name="QPixmap" location="global"/> </extra-includes> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QBrush___" quote-before-line="}// class"/> </inject-code> @@ -1979,7 +1979,7 @@ <modify-function signature="dark(int)const" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="light(int)const" remove="all"/> <!--### Obsolete in 4.3--> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QColor___" quote-before-line="}// class"/> </inject-code> @@ -2022,7 +2022,7 @@ <remove-default-expression/> </modify-argument> </modify-function> - + <template name="gui.fontmetricsf_boundingrect"> <insert-template name="gui.fontmetrics_tabarray_function"> <replace from="%RETURN_TYPE" to="qt.core.QRectF"/> @@ -2096,7 +2096,7 @@ </modify-argument> </modify-function> - <!-- + <!-- <template name="gui.fontmetrics_tabarray_function"> public final %RETURN_TYPE %FUNCTION_NAME(%RECT_ARGUMENTSint flags, String text, int tabStops, int tabArray[]) { QNativePointer np = tabArray == null ? null : new QNativePointer(QNativePointer.Type.Int, tabArray.length + 1); @@ -2185,17 +2185,17 @@ </modify-field> </interface-type> <interface-type name="QPaintDevice"> - + <modify-function signature="paintEngine () const"> <store-result/> </modify-function> - + </interface-type> - + <interface-type name="QGraphicsItem" delete-in-main-thread="yes"> <modify-function signature="setExtension(QGraphicsItem::Extension,QVariant)" remove="all"/> <modify-function signature="supportsExtension(QGraphicsItem::Extension)const" remove="all"/> - + <modify-function signature="matrix()const" remove="all"/> <modify-function signature="resetMatrix()" remove="all"/> <modify-function signature="sceneMatrix()const" remove="all"/> @@ -2290,7 +2290,7 @@ <reference-count action="ignore"/> </modify-argument> </modify-function> - + <modify-function signature="QGraphicsItem(QGraphicsItem*,QGraphicsScene*)"> <inject-code position="end"> @@ -2390,7 +2390,7 @@ __rcDelegatesForRows = new HashMap!(int, QAbstractItemDelegate); </inject-code> </modify-function> - --> + --> <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QAbstractItemView___" quote-before-line="}// class"/> </inject-code> @@ -2495,7 +2495,7 @@ <object-type name="QAccessible2Interface"/> <!-- <object-type name="QAccessibleTableInterface"> <modify-function signature="qAccessibleTableCastHelper()" remove="all"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QAccessibleTableInterface___" quote-before-line="}// class"/> </inject-code> @@ -2709,10 +2709,10 @@ <modify-function signature="relationTo(int,const QAccessibleInterface*,int)const"> <modify-argument invalidate-after-use="yes" index="2"/> </modify-function> - + <!-- <modify-function signature="navigate(QAccessible::RelationFlag,int,QAccessibleInterface**)const" remove="all"/> --><!-- TODO --> -<!-- +<!-- <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QAccessibleInterface___" quote-before-line="}// class"/> </inject-code> @@ -2805,7 +2805,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionButton*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionButton"/> @@ -2857,7 +2857,7 @@ <reference-count action="ignore"/> <!-- Handled in injected code --> </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QDesktopServices___" quote-before-line="}// class"/> </inject-code> @@ -2930,7 +2930,7 @@ </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QWizardPage___" quote-before-line="}// class"/> </inject-code> @@ -3256,7 +3256,7 @@ <define-ownership class="shell" owner="c++"/> </modify-argument>--> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QIconEngineV2___" quote-before-line="}// class"/> </inject-code> @@ -3323,7 +3323,7 @@ <reference-count action="set" variable-name="__rcDefaultItemEditorFactory"/> </modify-argument> </modify-function> - + <modify-function signature="setDefaultFactory(QItemEditorFactory*)"> <modify-argument index="1"> <define-ownership class="java" owner="c++"/> @@ -3511,7 +3511,7 @@ <modify-function signature="addAction(QIcon,QString,const QObject*,const char*,QKeySequence)"> <remove/> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QMenu___" quote-before-line="}// class"/> </inject-code> @@ -3599,7 +3599,7 @@ <reference-count action="ignore"/> </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QMenuBar___" quote-before-line="}// class"/> </inject-code> @@ -3657,13 +3657,13 @@ <access modifier="private"/> </modify-function> - + <inject-code> public this(QIODevice ioDevice, string format) { this(ioDevice, toStringz(format)); } - + public this(string fileName, string format) { this(fileName, toStringz(format)); } @@ -3692,7 +3692,7 @@ <modify-function signature="find(QString,QPixmap&)"> <remove/> </modify-function> - + <!-- <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPixmapCache___" quote-before-line="}// class"/> @@ -3711,13 +3711,13 @@ <modify-function signature="accepted()" remove="all"/> <modify-function signature="open(QObject *, const char *)" remove="all"/> <!-- # TODO --> - </object-type> + </object-type> <object-type name="QPrintEngine"/> <object-type name="QProgressBar"> <!-- <modify-function signature="initStyleOption(QStyleOptionProgressBar*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionProgressBar"/> @@ -3766,7 +3766,7 @@ <remove-default-expression/> </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QShortcut___" quote-before-line="}// class"/> </inject-code> @@ -3788,7 +3788,7 @@ <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> - + <modify-function signature="appendColumn(const QList<QStandardItem *> &)"> <modify-argument index="1"> <define-ownership class="java" owner="c++"/> @@ -4157,7 +4157,7 @@ <define-ownership class="shell" owner="c++"/> </modify-argument> </modify-function> - + <modify-function signature="setDefaultWidget(QWidget*)"> <modify-argument index="1"> <define-ownership class="java" owner="c++"/> @@ -4307,7 +4307,7 @@ <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QStyle___" quote-before-line="}// class"/> </inject-code> @@ -4548,7 +4548,7 @@ </object-type> <object-type name="QLayout"> - + <modify-function signature="addItem(QLayoutItem*)"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> @@ -4595,7 +4595,7 @@ <modify-function signature="margin()const" remove="all"/> <!--### Obsolete in 4.3--> <!-- <modify-function signature="setMargin(int)" remove="all"/> --> <!--### Obsolete in 4.3--> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QLayout___" quote-before-line="}// class"/> </inject-code> @@ -4759,7 +4759,7 @@ <modify-function signature="getItemPosition(int,int*,int*,int*,int*)"> <access modifier="private"/> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QGridLayout___" quote-before-line="}// class"/> </inject-code> @@ -5019,7 +5019,7 @@ <reference-count action="set" variable-name="__rcFocusItem"/> </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QGraphicsScene___" quote-before-line="}// class"/> </inject-code> @@ -5299,11 +5299,11 @@ <modify-function signature="setTextColor(QColor)" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="textColor()const" remove="all"/> <!--### Obsolete in 4.3--> </object-type> - + <object-type name="QGraphicsObject"> <modify-function signature="children()const" remove="all"/> </object-type> - + <object-type name="QGraphicsTextItem"> <!-- a QObject so main-thread delete redundant --> <extra-includes> <include file-name="QTextCursor" location="global"/> @@ -5513,7 +5513,7 @@ </modify-argument> </modify-function> - + <!-- <modify-function signature="addItem(const QString &)" remove="all"/>--> <modify-function signature="addItems(const QStringList &)" remove="all"/> <modify-function signature="insertItem(int, const QString &)" remove="all"/> @@ -5621,7 +5621,7 @@ </modify-function> <inject-code class="native"> - extern "C" JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QWidget__1_1qt_1QMessageBox_1setWindowTitle) + QTD_EXTERN QTD_JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QWidget__1_1qt_1QMessageBox_1setWindowTitle) (JNIEnv *__jni_env, jclass, jlong __this_nativeId, @@ -5639,7 +5639,7 @@ </inject-code> <inject-code class="native"> - extern "C" JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QWidget__1_1qt_1QMessageBox_1setWindowModality) + QTD_EXTERN QTD_JNIEXPORT void JNICALL QTJAMBI_FUNCTION_PREFIX(Java_com_trolltech_qt_gui_QWidget__1_1qt_1QMessageBox_1setWindowModality) (JNIEnv *__jni_env, jclass, jlong __this_nativeId, @@ -5667,7 +5667,7 @@ <replace-default-expression with="RenderFlag.DrawWindowBackground, RenderFlag.DrawChildren"/> </modify-argument> </modify-function> ---> +--> <!-- <modify-function signature="setFocusProxy(QWidget*)"> <modify-argument index="1"> <reference-count action="set" variable-name="__rcFocusProxy"/> @@ -5752,7 +5752,7 @@ <modify-function signature="setShown(bool)" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="topLevelWidget()const" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="windowActivationChange(bool)" remove="all"/> <!--### Obsolete in 4.3--> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QWidget___" quote-before-line="}// class"/> </inject-code> @@ -5843,7 +5843,7 @@ <no-null-pointer/> </modify-argument> </modify-function> -<!-- +<!-- <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionSpinBox"/> @@ -6097,7 +6097,7 @@ <modify-function signature="clear()" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="filterChanged()" remove="all"/> <!--### Obsolete in 4.3--> - + <modify-function signature="match(QModelIndex, int, QVariant, int, QFlags<Qt::MatchFlag>) const"> <modify-argument index="5"> <replace-default-expression with="Qt.MatchFlag.MatchStartsWith | Qt.MatchFlag.MatchWrap"/> @@ -6109,7 +6109,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionSlider*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionSlider"/> @@ -6280,7 +6280,7 @@ </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QFileDialog___" quote-before-line="}// class"/> </inject-code> @@ -6353,7 +6353,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionTab*,int)const"> <access modifier="private"/> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTabBar___" quote-before-line="}// class"/> </inject-code> @@ -6455,7 +6455,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionButton*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionButton"/> @@ -6467,7 +6467,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionSlider*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionSlider"/> @@ -6487,7 +6487,7 @@ </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QClipboard___" quote-before-line="}// class"/> </inject-code> @@ -6534,7 +6534,7 @@ <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QAbstractScrollArea___" quote-before-line="}// class"/> </inject-code> @@ -6560,7 +6560,7 @@ <modify-function signature="resize(const QSize &)" rename="resizeRubberBand"/> <modify-function signature="setGeometry(int,int,int,int)" rename="setRubberBandGeometry"/> <modify-function signature="setGeometry(const QRect &)" rename="setRubberBandGeometry"/> - + <!-- <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionRubberBand"/> @@ -6653,7 +6653,7 @@ <define-ownership class="java" owner="c++"/> </modify-argument> </modify-function> -<!-- +<!-- <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QTextDocument___" quote-before-line="}// class"/> </inject-code> @@ -6675,7 +6675,7 @@ <reference-count action="ignore"/> </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QSplitter___" quote-before-line="}// class"/> </inject-code> @@ -6686,7 +6686,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionGroupBox*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionGroupBox"/> @@ -6724,7 +6724,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionSlider*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionSlider"/> @@ -6746,7 +6746,7 @@ <reference-count action="set" variable-name="__rcValidator"/> </modify-argument> </modify-function> -<!-- +<!-- <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionFrame"/> @@ -6772,7 +6772,7 @@ <!-- <modify-function signature="initStyleOption(QStyleOptionDockWidget*)const"> <access modifier="private"/> </modify-function> - + <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionDockWidget"/> @@ -6905,7 +6905,7 @@ <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QToolBar___" quote-before-line="}// class"/> </inject-code> -<!-- +<!-- <inject-code> <insert-template name="gui.init_style_option"> <replace from="%TYPE" to="QStyleOptionToolBar"/> @@ -6954,7 +6954,7 @@ <remove/> </modify-function> <modify-field name="state" read="false" write="false"/> -<!-- +<!-- <modify-function signature="drawLines(const QLine *, int)"> <modify-argument index="1"> <replace-type modified-type="qt.gui.QLine[]"/> @@ -7274,8 +7274,8 @@ </object-type> <object-type name="QPrinter" delete-in-main-thread="yes"> - - + + <modify-function signature="setEngines(QPrintEngine*,QPaintEngine*)"> <modify-argument index="1"> <reference-count action="set" variable-name="__rcPrintEngine"/> @@ -7284,7 +7284,7 @@ <reference-count action="set" variable-name="__rcPaintEngine"/> </modify-argument> </modify-function> - + <modify-function signature="getPageMargins(double*,double*,double*,double*,QPrinter::Unit)const" access="private"/> <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPrinter___" quote-before-line="}// class"/> @@ -7298,7 +7298,7 @@ </modify-argument> </modify-function> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QAction___" quote-before-line="}// class"/> </inject-code> @@ -7355,7 +7355,7 @@ <modify-function signature="drawPoints(const QPointF *, int)"> <access modifier="private"/> </modify-function> - + <modify-function signature="drawPolygon(const QPoint *, int, Qt::FillRule)"> <access modifier="private"/> </modify-function> @@ -7369,14 +7369,14 @@ <modify-function signature="drawPolyline(const QPointF *, int)"> <access modifier="private"/> </modify-function> - + <modify-function signature="drawRects(const QRect *, int)"> <access modifier="private"/> </modify-function> <modify-function signature="drawRects(const QRectF *, int)"> <access modifier="private"/> </modify-function> - + <!-- removed stuff --> <modify-function signature="drawRects(const QVector<QRect> &)"> <remove/> @@ -7443,7 +7443,7 @@ <modify-function signature="matrixEnabled()const" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="setMatrix(QMatrix, bool)" remove="all"/> <!--### Obsolete in 4.3--> <modify-function signature="setMatrixEnabled(bool)" remove="all"/> <!--### Obsolete in 4.3--> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QPainter___" quote-before-line="}// class"/> </inject-code> @@ -7592,13 +7592,13 @@ return %FUNCTION_NAME(%PRE_CALL_ARGUMENTS %COMMA className == null ? null : className.data()); } </template> - + <inject-code class="java-free"> QApplication qApp() { return cast(QApplication) QCoreApplication.instance(); } - </inject-code> + </inject-code> </object-type> <object-type name="QCommandLinkButton"/> @@ -7703,7 +7703,7 @@ <define-ownership class="java" owner="c++"/> </modify-argument> </modify-function> - + <modify-function signature="getLayoutPosition(QLayout*,int*,QFormLayout::ItemRole*)const" access="private"/> <modify-function signature="getWidgetPosition(QWidget*,int*,QFormLayout::ItemRole*)const" access="private"/> <modify-function signature="getItemPosition(int,int*,QFormLayout::ItemRole*)const" access="private"/> @@ -7738,7 +7738,7 @@ <reference-count action="set" variable-name="__rcParentLayoutItem"/> </modify-argument> </modify-function> - + <!-- <modify-function signature="getContentsMargins(double*,double*,double*,double*)const" access="private"/> --> <modify-function signature="getContentsMargins(double*,double*,double*,double*)const" remove="all"/> <inject-code> @@ -7755,17 +7755,17 @@ <reference-count action="set" variable-name="__rcParentLayoutItem"/> </modify-argument> </modify-function> - + <modify-function signature="getContentsMargins(double*,double*,double*,double*)const" access="private"/> <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class Subclass_of_QGraphicsLayoutItem___" quote-before-line="}// class"/> </inject-code> <inject-code class="interface"> public QMarginsF getContentsMargins(); - </inject-code> + </inject-code> --> </interface-type> - + <object-type name="QGraphicsLinearLayout" delete-in-main-thread="yes"> <modify-function signature="addItem(QGraphicsLayoutItem*)"> <modify-argument index="1"> @@ -7794,7 +7794,7 @@ </modify-function> </object-type> <object-type name="QGraphicsProxyWidget"> - <modify-function signature="getContentsMargins(double*,double*,double*,double*)const" remove="all" /> + <modify-function signature="getContentsMargins(double*,double*,double*,double*)const" remove="all" /> <!-- <modify-function signature="setWidget(QWidget*)"> <modify-argument index="1"> @@ -7872,7 +7872,7 @@ <!-- <modify-function signature="getContentsMargins(double*,double*,double*,double*)const" access="private"/> <modify-function signature="getWindowFrameMargins(double*,double*,double*,double*)const" access="private"/> - + <inject-code> <import-file name="typesystem_gui-java.java" quote-after-line="class QGraphicsWidget___" quote-before-line="}// class"/> <import-file name="typesystem_gui-java.java" quote-after-line="class Subclass_of_QGraphicsLayoutItem___" quote-before-line="}// class"/> @@ -7949,7 +7949,7 @@ <reference-count action="ignore"/> </modify-argument> </modify-function> -<!-- +<!-- <modify-function signature="initStyleOption(QStyleOptionViewItem*,QModelIndex)const"> <modify-argument index="1"> <conversion-rule class="shell">
--- a/include/ArrayOpsPrimitive.h Tue May 25 20:14:04 2010 +0300 +++ b/include/ArrayOpsPrimitive.h Wed Jun 02 19:38:05 2010 +0300 @@ -1,13 +1,7 @@ /** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> -* -* Copyright QtD Team, 2008-2009 -* Distributed under the Boost Software License, Version 1.0. -* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -* -*/ + Copyright: Copyright QtD Team, 2008-2010 + License: Boost License 1.0 + */ #ifndef ARRAY_OPS_PRIMITIVE_H #define ARRAY_OPS_PRIMITIVE_H @@ -15,65 +9,24 @@ #include "qtd_core.h" // int -QTD_EXPORT(void, qtd_allocate_int_array, (void* arr, size_t len)) -QTD_EXPORT(void, qtd_assign_int_array_element, (void* arr, size_t pos, int elem)) -QTD_EXPORT(void, qtd_get_int_from_array, (void* arr, size_t pos, int* elem)) +QTD_EXPORT_DECL(CORE, void, allocate_int_array, (void* arr, size_t len)) +QTD_EXPORT_DECL(CORE, void, assign_int_array_element, (void* arr, size_t pos, int elem)) +QTD_EXPORT_DECL(CORE, void, get_int_from_array, (void* arr, size_t pos, int* elem)) // uint -QTD_EXPORT(void, qtd_allocate_uint_array, (void* arr, size_t len)) -QTD_EXPORT(void, qtd_assign_uint_array_element, (void* arr, size_t pos, uint elem)) -QTD_EXPORT(void, qtd_get_uint_from_array, (void* arr, size_t pos, uint* elem)) +QTD_EXPORT_DECL(CORE, void, allocate_uint_array, (void* arr, size_t len)) +QTD_EXPORT_DECL(CORE, void, assign_uint_array_element, (void* arr, size_t pos, uint elem)) +QTD_EXPORT_DECL(CORE, void, get_uint_from_array, (void* arr, size_t pos, uint* elem)) // double -QTD_EXPORT(void, qtd_allocate_double_array, (void* arr, size_t len)) -QTD_EXPORT(void, qtd_assign_double_array_element, (void* arr, size_t pos, double elem)) -QTD_EXPORT(void, qtd_get_double_from_array, (void* arr, size_t pos, double* elem)) +QTD_EXPORT_DECL(CORE, void, allocate_double_array, (void* arr, size_t len)) +QTD_EXPORT_DECL(CORE, void, assign_double_array_element, (void* arr, size_t pos, double elem)) +QTD_EXPORT_DECL(CORE, void, get_double_from_array, (void* arr, size_t pos, double* elem)) // string -QTD_EXPORT(void, qtd_allocate_string_array, (void* arr, size_t len)) -QTD_EXPORT(void, qtd_assign_string_array_element, (void* arr, size_t pos, void* elem)) -QTD_EXPORT(void*, qtd_string_from_array, (void* arr, size_t pos)) -QTD_EXPORT(void, qtd_get_string_from_array, (void* arr, size_t pos, DArray* elem)) - -#ifdef CPP_SHARED - -#define qtd_allocate_int_array qtd_get_qtd_allocate_int_array() -#define qtd_assign_int_array_element qtd_get_qtd_assign_int_array_element() -#define qtd_get_int_from_array qtd_get_qtd_get_int_from_array() - -#define qtd_allocate_uint_array qtd_get_qtd_allocate_uint_array() -#define qtd_assign_uint_array_element qtd_get_qtd_assign_uint_array_element() -#define qtd_get_uint_from_array qtd_get_qtd_get_uint_from_array() - -#define qtd_allocate_double_array qtd_get_qtd_allocate_double_array() -#define qtd_assign_double_array_element qtd_get_qtd_assign_double_array_element() -#define qtd_get_double_from_array qtd_get_qtd_get_double_from_array() - -#define qtd_allocate_string_array qtd_get_qtd_allocate_string_array() -#define qtd_assign_string_array_element qtd_get_qtd_assign_string_array_element() -#define qtd_string_from_array qtd_get_qtd_string_from_array() -#define qtd_get_string_from_array qtd_get_qtd_get_string_from_array() - -#endif - -/* -// int -extern "C" void qtd_allocate_int_array(void* arr, size_t len); -extern "C" void qtd_assign_int_array_element(void* arr, size_t pos, int elem); - -// uint -extern "C" void qtd_allocate_uint_array(void* arr, size_t len); -extern "C" void qtd_assign_uint_array_element(void* arr, size_t pos, uint elem); - -// double -extern "C" void qtd_allocate_double_array(void* arr, size_t len); -extern "C" void qtd_assign_double_array_element(void* arr, size_t pos, double elem); - -// string -extern "C" void qtd_allocate_string_array(void* arr, size_t len); -extern "C" void qtd_assign_string_array_element(void* arr, size_t pos, void* elem); -extern "C" void* qtd_string_from_array(void* arr, size_t pos); -extern "C" void qtd_get_string_from_array(void* arr, size_t pos, char** elem, size_t* elem_size); -*/ +QTD_EXPORT_DECL(CORE, void, allocate_string_array, (void* arr, size_t len)) +QTD_EXPORT_DECL(CORE, void, assign_string_array_element, (void* arr, size_t pos, void* elem)) +QTD_EXPORT_DECL(CORE, void*, string_from_array, (void* arr, size_t pos)) +QTD_EXPORT_DECL(CORE, void, get_string_from_array, (void* arr, size_t pos, DArray* elem)) #endif // ARRAY_OPS_PRIMITIVE_H
--- a/include/qtd_core.h Tue May 25 20:14:04 2010 +0300 +++ b/include/qtd_core.h Wed Jun 02 19:38:05 2010 +0300 @@ -1,6 +1,6 @@ /** - * Copyright: Copyright QtD Team, 2008-2010 - * License: Boost Software License 1.0 + Copyright: Copyright QtD Team, 2008-2010 + License: Boost License 1.0 */ #ifndef QTD_CORE_H @@ -8,28 +8,84 @@ #include <QAbstractItemModel> -#if defined WIN32 - #define DLL_PUBLIC __declspec(dllexport) +#define QTD_EXTERN extern "C" + +#ifdef WIN32 + + #define QTD_DLL_EXPORT __declspec(dllexport) + #define QTD_DLL_IMPORT __declspec(dllimport) + + #ifdef CPP_SHARED + + QTD_EXTERN typedef void (*pfunc_abstr)(); + + #define QTD_EXPORT_DECL(MODULE, TYPE, NAME, ARGS) \ + QTD_EXTERN typedef TYPE (*qtd_##NAME##_t)ARGS; \ + QTD_EXTERN { extern QTD_##MODULE##_DLL_PUBLIC qtd_##NAME##_t qtd_##NAME; } + + #define QTD_EXPORT(MODULE, NAME) \ + QTD_EXTERN { QTD_##MODULE##_DLL_PUBLIC qtd_##NAME##_t qtd_##NAME; } \ + QTD_EXTERN QTD_DLL_EXPORT void qtd_set_##NAME(pfunc_abstr func) { qtd_##NAME = (qtd_##NAME##_t)func; } + + #endif + #else - #define DLL_PUBLIC + + #define QTD_DLL_EXPORT + #define QTD_DLL_IMPORT + + #define QTD_EXPORT_DECL(MODULE, TYPE, NAME, ARGS) \ + QTD_EXTERN TYPE qtd_##NAME ARGS; + + #define QTD_EXPORT(MODULE, NAME) + #endif -#ifdef CPP_SHARED - #define QTD_EXPORT(TYPE, NAME, ARGS) \ - extern "C" typedef TYPE (*pf_##NAME)ARGS; \ - extern "C" pf_##NAME qtd_get_##NAME(); - #define QTD_EXPORT_VAR(NAME) \ - pf_##NAME m_##NAME; \ - extern "C" DLL_PUBLIC pf_##NAME qtd_get_##NAME() { return m_##NAME; } -#define QTD_EXPORT_VAR_SET(NAME, VALUE) \ - m_##NAME = (pf_##NAME) VALUE +#define QTD_DLL_PUBLIC QTD_DLL_EXPORT + +#ifdef QTD_CORE + #define QTD_CORE_DLL_PUBLIC QTD_DLL_EXPORT #else - #define QTD_EXPORT(TYPE, NAME, ARGS) \ - extern "C" TYPE NAME ARGS; + #define QTD_CORE_DLL_PUBLIC QTD_DLL_IMPORT +#endif + +#ifdef QTD_GUI + #define QTD_GUI_DLL_PUBLIC QTD_DLL_EXPORT +#else + #define QTD_GUI_DLL_PUBLIC QTD_DLL_IMPORT +#endif + +#ifdef QTD_OPENGL + #define QTD_OPENGL_DLL_PUBLIC QTD_DLL_EXPORT +#else + #define QTD_OPENGL_DLL_PUBLIC QTD_DLL_IMPORT #endif -extern uint userDataId; +#ifdef QTD_NETWORK + #define QTD_NETWORK_DLL_PUBLIC QTD_DLL_EXPORT +#else + #define QTD_NETWORK_DLL_PUBLIC QTD_DLL_IMPORT +#endif + +#ifdef QTD_SVG + #define QTD_SVG_DLL_PUBLIC QTD_DLL_EXPORT +#else + #define QTD_SVG_DLL_PUBLIC QTD_DLL_IMPORT +#endif +#ifdef QTD_XML + #define QTD_XML_DLL_PUBLIC QTD_DLL_EXPORT +#else + #define QTD_XML_DLL_PUBLIC QTD_DLL_IMPORT +#endif + +#ifdef QTD_WEBKIT + #define QTD_WEBKIT_DLL_PUBLIC QTD_DLL_EXPORT +#else + #define QTD_WEBKIT_DLL_PUBLIC QTD_DLL_IMPORT +#endif + +//TODO: ditch struct QModelIndexAccessor { int row; int col; @@ -50,10 +106,10 @@ //gcManaged = 0x04 }; -class DLL_PUBLIC QtdObjectLink +class QTD_CORE_DLL_PUBLIC QtdObjectLink { public: - void* dId; // TODO: needs to be atomic + void* dId; QtdObjectLink(void* id) : dId(id) {} @@ -71,7 +127,7 @@ } }; -class DLL_PUBLIC QObjectLink : public QtdObjectLink, public QObjectUserData +class QTD_CORE_DLL_PUBLIC QObjectLink : public QtdObjectLink, public QObjectUserData { public: enum Flags @@ -81,6 +137,7 @@ }; Flags flags; + static uint userDataId; QObjectLink(QObject* qObject, void* dId); bool createdByD(); @@ -92,24 +149,15 @@ #define Array DArray -#ifdef CPP_SHARED -typedef void (*pfunc_abstr)(); -#endif - -QTD_EXPORT(void, qtd_toUtf8, (const unsigned short* arr, uint size, void* str)) -QTD_EXPORT(void, qtd_QtdObject_delete, (void* dId)) +QTD_EXPORT_DECL(CORE, void, toUtf8, (const unsigned short* arr, uint size, void* str)) +QTD_EXPORT_DECL(CORE, void, QtdObject_delete, (void* dId)) -#ifdef CPP_SHARED -#define qtd_toUtf8 qtd_get_qtd_toUtf8() -#define qtd_QtdObject_delete qtd_get_qtd_QtdObject_delete() -#endif +QTD_EXTERN QModelIndex qtd_to_QModelIndex(QModelIndexAccessor mia); +QTD_EXTERN QModelIndexAccessor qtd_from_QModelIndex(const QModelIndex &index); -extern "C" QModelIndex qtd_to_QModelIndex(QModelIndexAccessor mia); -extern "C" QModelIndexAccessor qtd_from_QModelIndex(const QModelIndex &index); - -extern "C" typedef void (*EmitCallback)(void*, void**); -extern "C" typedef int (*QtMetacallCallback)(void *d_entity, QMetaObject::Call _c, int _id, void **_a); -extern "C" typedef const QMetaObject* (*MetaObjectCallback)(void *d_entity); +QTD_EXTERN typedef void (*EmitCallback)(void*, void**); +QTD_EXTERN typedef int (*QtMetacallCallback)(void *d_entity, QMetaObject::Call _c, int _id, void **_a); +QTD_EXTERN typedef const QMetaObject* (*MetaObjectCallback)(void *d_entity); template <class T> void call_destructor(T *a)