[Kde-bindings] playground/bindings/phpqt/php_qt

Thomas Moenicke tm at php-qt.org
Thu Jun 21 21:40:56 UTC 2007


SVN commit 678641 by moenicke:

* improvements on smokephp_object, activeScope, activeCe

CCMAIL: kde-bindings at kde.org



 M  +5 -2      marshall_types.cpp  
 M  +3 -1      php_qt.cpp  
 M  +2 -1      php_qt.h  
 M  +2 -2      phpqt_internals.cpp  
 M  +1 -1      phpqt_internals.h  
 M  +3 -3      smokephp.cpp  


--- trunk/playground/bindings/phpqt/php_qt/marshall_types.cpp #678640:678641
@@ -26,6 +26,8 @@
 #include "marshall_types.h"
 #include "phpqt_internals.h"
 
+extern zval* activeScope;
+
 void
 smokeStackToQtStack(Smoke::Stack stack, void ** o, int items, MocArgument* args)
 {
@@ -439,8 +441,9 @@
 {
 	if (_called) return;
 	_called = true;
-
-	zval* retval = PHPQt::callPHPMethod(_obj, (char*) _smoke->methodNames[method().name], items(), __sp);
+// TODO _obj gets lost
+	_obj = activeScope;
+	zval* retval = PHPQt::callPHPMethod(_obj, _smoke->methodNames[method().name], items(), __sp);
 	VirtualMethodReturnValue r(_smoke, _method, _stack, retval);
 }
 
--- trunk/playground/bindings/phpqt/php_qt/php_qt.cpp #678640:678641
@@ -188,6 +188,7 @@
 // 	    ce_parent = ce->parent;
 	    ce = ce->parent; // orig
     }
+
     activeCe = ce;
 
     // get arguments
@@ -276,6 +277,7 @@
         } else {
         	activeScope = getThis();
         	ce = Z_OBJCE_P(getThis());
+        	activeCe = ce;
         }
     // static
     } else {
@@ -305,7 +307,7 @@
 	    if(getThis()){
 		smokephp_object* o = PHPQt::getSmokePHPObjectFromZval(getThis());
 		if(o->meta() != NULL){
-		    QMetaObject* mo = (QMetaObject*) o->meta();
+		    QMetaObject* mo = static_cast<QMetaObject*>(o->meta());
 		    QByteArray signalname(methodNameStack.top()->constData());
 		    signalname.replace("$","");
 		    signalname.replace("#","");
--- trunk/playground/bindings/phpqt/php_qt/php_qt.h #678640:678641
@@ -131,7 +131,8 @@
 			m_ce_ptr(ce),
 			m_parent_ce_ptr(ce),
 			m_zval_ptr(zval_ptr),
-			m_allocated(true)
+			m_allocated(true),
+			m_meta(0)
 	{
 	}
 
--- trunk/playground/bindings/phpqt/php_qt/phpqt_internals.cpp #678640:678641
@@ -176,7 +176,7 @@
 
 
 zval*
-PHPQt::callPHPMethod(const zval* this_ptr, char* methodName, zend_uint param_count, zval** args)
+PHPQt::callPHPMethod(const zval* this_ptr, const char* methodName, zend_uint param_count, zval** args)
 {
 
 	if(this_ptr == NULL){
@@ -185,7 +185,7 @@
 
     zval *function_name;
     MAKE_STD_ZVAL(function_name);
-    ZVAL_STRING(function_name,methodName,1);
+    ZVAL_STRING(function_name,const_cast<char*>(methodName),1);
 
     zval* retval;
     MAKE_STD_ZVAL(retval);
--- trunk/playground/bindings/phpqt/php_qt/phpqt_internals.h #678640:678641
@@ -32,7 +32,7 @@
 
 void 				destroyHashtable(zend_rsrc_list_entry *rsrc);
 
-zval* 				callPHPMethod(const zval* zend_ptr, char* methodname, zend_uint param_count, zval** params);
+zval* 				callPHPMethod(const zval* zend_ptr, const char* methodname, zend_uint param_count, zval** params);
 bool 				methodExists(const zend_class_entry* ce_ptr, const char* methodname);
 bool 				getMocData(zval* this_ptr, char* classname, const QMetaObject* superdata, QMetaObject* metachar, QString* meta_stringdata, uint* signature);
 int					metacall(smokephp_object* this_ptr, Smoke::StackItem* args, QMetaObject::Call _c, int _id, void **_a);
--- trunk/playground/bindings/phpqt/php_qt/smokephp.cpp #678640:678641
@@ -63,7 +63,7 @@
 			SmokeQtObjects.remove(o->ptr());
 		}
     }
-    virtual bool callMethod(Smoke::Index method, void* QtPtr, Smoke::Stack args, bool /*isAbstract*/) {
+    bool callMethod(Smoke::Index method, void* QtPtr, Smoke::Stack args, bool /*isAbstract*/) {
 
 		smokephp_object *o = (smokephp_object*) PHPQt::getSmokePHPObjectFromQt(QtPtr);
 
@@ -87,8 +87,8 @@
 
 		if(PHPQt::methodExists(o->ce_ptr(), (char*) methodName)){
 			activeScope = const_cast<zval*>(o->zval_ptr());
-			activeCe = Z_OBJCE_P(activeScope);
-
+			activeCe = const_cast<zend_class_entry*>(o->ce_ptr());
+check_qobject(activeScope);
 			zval* zmem = ALLOCA_N(zval, smoke->methods[method].numArgs);
 // 			zval* zmem = (zval*) safe_emalloc(sizeof(zval), smoke->methods[method].numArgs,0);
 		    VirtualMethodCall c(smoke, method, args, activeScope, &zmem, &activeScope);



More information about the Kde-bindings mailing list