[Kde-bindings] KDE/kdebindings/php/phpqt/src
Thomas Moenicke
tm at php-qt.org
Sun Jul 13 10:11:03 UTC 2008
SVN commit 831775 by moenicke:
* adapted reference counting to PHP 5.3, a macro ensures it still builds and runs with former versions
* adapted opcode handlers to 5.3
CCMAIL: kde-bindings at kde.org
M +8 -0 config.h.in
M +8 -6 phpqt_internals.cpp
M +8 -2 zend_handlers.cpp
M +2 -2 zend_handlers.h
--- trunk/KDE/kdebindings/php/phpqt/src/config.h.in #831774:831775
@@ -16,4 +16,12 @@
#cmakedefine PHPQT_MAPHANDLE_DEBUG 1
#cmakedefine PHPQT_UNMAPHANDLE_DEBUG 1
+#if PHP_MAJOR_VERSION > 5 && PHP_MINOR_VERSION > 2
+#define refcount__GC refcount__gc
+#define is_ref__GC is_ref__gc
+#else
+#define refcount__GC refcount
+#define is_ref__GC is_ref
+#endif
+
#endif
\ No newline at end of file
--- trunk/KDE/kdebindings/php/phpqt/src/phpqt_internals.cpp #831774:831775
@@ -20,6 +20,8 @@
*
*/
+#include "config.h"
+
#include <QtCore/QMetaMethod>
#include <QtCore/QHash>
#include <QDebug>
@@ -455,8 +457,8 @@
// example: QVariant
zval* z = (zval*) emalloc( sizeof(zval) );
z->type = IS_OBJECT;
- z->refcount = 3;
- z->is_ref = 0;
+ z->refcount__GC = 3;
+ z->is_ref__GC = 0;
z->value.obj.handle = o->handle();
Z_OBJ_HT_P( z ) = &php_qt_handler;
o->setZvalPtr( z );
@@ -590,8 +592,8 @@
qDebug() << "\t zval => " << zobject << endl;
if(Z_TYPE_P(zobject) == IS_OBJECT)
qDebug() << "\tclass entry => " << Z_OBJCE_P(zobject)->name << endl;
- qDebug() << "\t ref count => " << zobject->refcount << endl;
- qDebug() << "\t is_ref => " << (int) zobject->is_ref << endl;
+ qDebug() << "\t ref count => " << zobject->refcount__GC << endl;
+ qDebug() << "\t is_ref => " << (int) zobject->is_ref__GC << endl;
qDebug() << "\t type => " << printType(Z_TYPE_P(zobject)) << endl;
if(Z_TYPE_P(zobject) == IS_OBJECT)
@@ -610,8 +612,8 @@
qDebug() << "\t zval => " << zobject << endl;
// qDebug() << "\tclass entry => " << Z_OBJCE_P(zobject)->name << endl;
qDebug() << "\tclass entry => " << o->ce_ptr()->name << endl;
- qDebug() << "\t ref count => " << zobject->refcount << endl;
- qDebug() << "\t is_ref => " << (int) zobject->is_ref << endl;
+ qDebug() << "\t ref count => " << zobject->refcount__GC << endl;
+ qDebug() << "\t is_ref => " << (int) zobject->is_ref__GC << endl;
qDebug() << "\t type => " << printType(Z_TYPE_P(zobject)) << endl;
if(Z_TYPE_P(zobject) == 5)
--- trunk/KDE/kdebindings/php/phpqt/src/zend_handlers.cpp #831774:831775
@@ -36,9 +36,14 @@
int (*originalConstantMethodHandler)(ZEND_OPCODE_HANDLER_ARGS);
int (*originalCloneSpecCvHandler)(ZEND_OPCODE_HANDLER_ARGS);
opcode_handler_t *phpqt_original_opcode_handlers;
+
+#if PHP_MAJOR_VERSION > 5 && PHP_MINOR_VERSION > 2
+user_opcode_handler_t phpqt_opcode_handlers[PHPQT_OPHANDLER_COUNT];
+#else
opcode_handler_t phpqt_opcode_handlers[PHPQT_OPHANDLER_COUNT];
+#endif
-
+extern "C" {
/**
* proxy handler, called by the zend engine
*/
@@ -220,7 +225,7 @@
// overwrite :: operator, see zend_vm_execute.h
memcpy(phpqt_opcode_handlers, zend_opcode_handlers, sizeof(phpqt_opcode_handlers));
phpqt_original_opcode_handlers = zend_opcode_handlers;
- zend_opcode_handlers = phpqt_opcode_handlers;
+ zend_opcode_handlers = (opcode_handler_t*) phpqt_opcode_handlers;
// overwrite the clone handler
originalCloneSpecCvHandler = phpqt_opcode_handlers[(ZEND_CLONE*25) + 20];
@@ -240,3 +245,4 @@
phpqt_opcode_handlers[2845] = constantMethodHandler;
}
+}
--- trunk/KDE/kdebindings/php/phpqt/src/zend_handlers.h #831774:831775
@@ -33,7 +33,7 @@
#define ZEND_VM_CONTINUE() return 0
namespace ZendHandlers {
-
+extern "C" {
/*!
* handler for regular method calls
*/
@@ -69,5 +69,5 @@
void installZendHandlers();
} // namespace ZendHandlers
-
+}
#endif
More information about the Kde-bindings
mailing list