[Kde-bindings] playground/bindings/kimono
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Fri Oct 20 19:46:16 UTC 2006
SVN commit 597576 by rdale:
* Added alloc_smokeqyoto_object() and free_smokeqyoto_object() f'ns
CCMAIL: kde-bindings at kde.org
M +4 -0 ChangeLog
M +2 -10 handlers.cpp
M +35 -21 qyoto.cpp
M +7 -0 qyoto.h
--- trunk/playground/bindings/kimono/ChangeLog #597575:597576
@@ -1,3 +1,7 @@
+2006-10-20 Richard Dale <rdale at foton.es>
+
+ * Added alloc_smokeqyoto_object() and free_smokeqyoto_object() f'ns
+
2006-10-19 Arno Rehn <arno at arnorehn.de>
* Fixed marshalling of QStringLists
--- trunk/playground/bindings/kimono/handlers.cpp #597575:597576
@@ -594,11 +594,7 @@
m->var().s_voidp = obj;
break;
}
- smokeqyoto_object * o = (smokeqyoto_object *) malloc(sizeof(smokeqyoto_object));
- o->smoke = m->smoke();
- o->classId = m->type().classId();
- o->ptr = p;
- o->allocated = false;
+ smokeqyoto_object * o = alloc_smokeqyoto_object(false, m->smoke(), m->type().classId(), p);
const char * classname = resolve_classname(o->smoke, o->classId, o->ptr);
@@ -943,11 +939,7 @@
// VALUE obj = getPointerObject(p);
// if(obj == Qnil) {
- smokeqyoto_object * o = (smokeqyoto_object *) malloc(sizeof(smokeqyoto_object));
- o->smoke = m->smoke();
- o->classId = o->smoke->idClass(ItemSTR);
- o->ptr = p;
- o->allocated = false;
+ smokeqyoto_object * o = alloc_smokeqyoto_object(false, m->smoke(),o->smoke->idClass(ItemSTR), p);
// obj = set_obj_info(className, o);
// }
--- trunk/playground/bindings/kimono/qyoto.cpp #597575:597576
@@ -273,6 +273,24 @@
}
}
+smokeqyoto_object *
+alloc_smokeqyoto_object(bool allocated, Smoke * smoke, int classId, void * ptr)
+{
+ smokeqyoto_object * o = (smokeqyoto_object *) malloc(sizeof(smokeqyoto_object));
+ o->classId = classId;
+ o->smoke = smoke;
+ o->ptr = ptr;
+ o->allocated = allocated;
+ return o;
+}
+
+void
+free_smokeqyoto_object(smokeqyoto_object * o)
+{
+ free(o);
+ return;
+}
+
smokeqyoto_object *value_obj_info(void * qyoto_value) { // ptr on success, null on fail
smokeqyoto_object * o = (smokeqyoto_object*) (*GetSmokeObject)(qyoto_value);
return o;
@@ -572,11 +590,7 @@
// A constructor
if (strcmp(_smoke->methodNames[method().name], _smoke->className(method().classId)) == 0) {
- smokeqyoto_object * o = (smokeqyoto_object *) malloc(sizeof(smokeqyoto_object));
- o->smoke = _smoke;
- o->classId = method().classId;
- o->ptr = _stack[0].s_voidp;
- o->allocated = true;
+ smokeqyoto_object * o = alloc_smokeqyoto_object(true, _smoke, method().classId, _stack[0].s_voidp);
(*SetSmokeObject)(_target, o);
mapPointer(_target, o, o->classId, 0);
}
@@ -1199,10 +1213,10 @@
#endif
// create smoke object
- smokeqyoto_object* m = (smokeqyoto_object*)malloc(sizeof(smokeqyoto_object));
- m->smoke = qt_Smoke;
- m->classId = qt_Smoke->idClass("QMetaObject");
- m->ptr = meta;
+ smokeqyoto_object * m = alloc_smokeqyoto_object( true,
+ qt_Smoke,
+ qt_Smoke->idClass("QMetaObject"),
+ meta );
// create wrapper C# instance
return set_obj_info("Qyoto.QMetaObject", m);
@@ -1293,30 +1307,30 @@
smokeqyoto_object*
NewQMainWindow()
{
- smokeqyoto_object * o = (smokeqyoto_object*)malloc(sizeof(smokeqyoto_object));
- o->smoke = qt_Smoke;
- o->classId = qt_Smoke->idClass("QMainWindow");
- o->ptr = (void*) new QMainWindow();
+ smokeqyoto_object * o = alloc_smokeqyoto_object( true,
+ qt_Smoke,
+ qt_Smoke->idClass("QMainWindow"),
+ (void*) new QMainWindow() );
return o;
}
smokeqyoto_object*
NewQMainWindow2(smokeqyoto_object* parent)
{
- smokeqyoto_object * o = (smokeqyoto_object*)malloc(sizeof(smokeqyoto_object));
- o->smoke = qt_Smoke;
- o->classId = qt_Smoke->idClass("QMainWindow");
- o->ptr = (void*) new QMainWindow((QWidget*) parent->ptr);
+ smokeqyoto_object * o = alloc_smokeqyoto_object( true,
+ qt_Smoke,
+ qt_Smoke->idClass("QMainWindow"),
+ new QMainWindow((QWidget*) parent->ptr) );
return o;
}
smokeqyoto_object*
NewQMainWindow3(smokeqyoto_object* parent, Qt::WindowFlags flags)
{
- smokeqyoto_object * o = (smokeqyoto_object*)malloc(sizeof(smokeqyoto_object));
- o->smoke = qt_Smoke;
- o->classId = qt_Smoke->idClass("QMainWindow");
- o->ptr = (void*) new QMainWindow((QWidget*) parent->ptr, flags);
+ smokeqyoto_object * o = alloc_smokeqyoto_object( true,
+ qt_Smoke,
+ qt_Smoke->idClass("QMainWindow"),
+ (void*) new QMainWindow((QWidget*) parent->ptr, flags) );
return o;
}
--- trunk/playground/bindings/kimono/qyoto.h #597575:597576
@@ -27,6 +27,13 @@
void *ptr;
};
+extern smokeqyoto_object * alloc_smokeqyoto_object( bool allocated,
+ Smoke * smoke,
+ int classId,
+ void * ptr );
+
+extern void free_smokeqyoto_object(smokeqyoto_object * o);
+
struct TypeHandler {
const char *name;
Marshall::HandlerFn fn;
More information about the Kde-bindings
mailing list