[Kde-bindings] KDE/kdebindings/csharp/kimono

Arno Rehn kde at arnorehn.de
Tue Aug 12 11:40:57 UTC 2008


SVN commit 845782 by arnorehn:

* Make the KSharedPointer marshaller more generic and add one for
  KSharedPtr<KMimeType>.
* Parse the main mono config after the domain was initialized. This
  fixes some libs being not found (like libc).

CCMAIL: kde-bindings at kde.org
  


 M  +7 -0      ChangeLog  
 M  +23 -14    src/kdehandlers.cpp  
 M  +2 -0      src/kimonopluginfactory.cpp  


--- trunk/KDE/kdebindings/csharp/kimono/ChangeLog #845781:845782
@@ -1,3 +1,10 @@
+2008-08-13  Arno Rehn  <arno at arnorehn.de>
+
+    * Make the KSharedPointer marshaller more generic and add one for
+      KSharedPtr<KMimeType>.
+    * Parse the main mono config after the domain was initialized. This
+      fixes some libs being not found (like libc).
+
 2008-08-05  Richard Dale  <richard.j.dale at gmail.com>
 
 	* Make KApplication and KUniqueApplication partial classes and add the
--- trunk/KDE/kdebindings/csharp/kimono/src/kdehandlers.cpp #845781:845782
@@ -49,7 +49,11 @@
 #include <kurl.h>
 #include <kuser.h>
 
-void marshall_KSharedConfigPtr(Marshall *m) {
+#define DEF_KSHAREDPTR_MARSHALLER(Item) namespace { char Item##STR[] = #Item; }  \
+        Marshall::HandlerFn marshall_KSharedPtr_##Item = marshall_KSharedPtr<Item,Item##STR>;
+
+template<class Item, const char *ItemSTR>
+void marshall_KSharedPtr(Marshall *m) {
 	switch(m->action()) {
 	case Marshall::FromObject:
 	{
@@ -67,7 +71,7 @@
 		    m->item().s_class = 0;
 		    break;
 		}
-		m->item().s_class = new KSharedConfigPtr((KSharedConfig*) o->ptr);
+		m->item().s_class = new KSharedPtr<Item>((Item*) o->ptr);
 		(*FreeGCHandle)(m->var().s_class);
 		break;
 	}
@@ -78,12 +82,12 @@
 		    break;
 		}
 
-		KSharedPtr<KSharedConfig> *ptr = new KSharedPtr<KSharedConfig>(*(KSharedPtr<KSharedConfig>*)m->item().s_voidp);
+		KSharedPtr<Item> *ptr = new KSharedPtr<Item>(*(KSharedPtr<Item>*)m->item().s_voidp);
 		if (ptr == 0) {
 			m->var().s_voidp = 0;
 			break;
 		}
-	    KSharedConfig * config = ptr->data();
+	    Item * config = ptr->data();
 
 		void * obj = (*GetInstance)(config, true);
 		if(obj != 0) {
@@ -91,12 +95,12 @@
 		    break;
 		}
 		
-		Smoke::ModuleIndex id = m->smoke()->findClass("KConfig");
+		Smoke::ModuleIndex id = m->smoke()->findClass(ItemSTR);
 		smokeqyoto_object  * o = alloc_smokeqyoto_object(false, id.smoke, id.index, config);
-		
-		obj = (*CreateInstance)("Kimono.KSharedConfig", o);
+		const char *resolved = qyoto_modules[id.smoke].resolve_classname(o);
+		obj = (*CreateInstance)(resolved, o);
 		if (do_debug & qtdb_calls) {
-			printf("allocating %s %p -> %p\n", "KConfig", o->ptr, (void*)obj);
+			printf("allocating %s %p -> %p\n", ItemSTR, o->ptr, (void*)obj);
 		}
 
 		if (m->type().isStack()) {
@@ -114,6 +118,9 @@
 	}
 }
 
+DEF_KSHAREDPTR_MARSHALLER(KSharedConfig)
+DEF_KSHAREDPTR_MARSHALLER(KMimeType)
+
 DEF_LIST_MARSHALLER( KActionList, QList<KAction*>, KAction )
 DEF_LIST_MARSHALLER( KActionCollectionList, QList<KActionCollection*>, KActionCollection )
 DEF_LIST_MARSHALLER( KAutoSaveFileList, QList<KAutoSaveFile*>, KAutoSaveFile )
@@ -156,17 +163,19 @@
     { "KFileItemList", marshall_KFileItemList },
     { "KFileItemList*", marshall_KFileItemList },
     { "KFileItemList&", marshall_KFileItemList },
+    { "KSharedPtr<KMimeType>", marshall_KSharedPtr_KMimeType },
+    { "KSharedPtr<KMimeType>&", marshall_KSharedPtr_KMimeType },
     { "KNS::Entry::List", marshall_KNSEntryList },
     { "KPluginInfo::List", marshall_KPluginInfoList },
     { "KPluginInfo::List&", marshall_KPluginInfoList },
 //    { "KService::List", marshall_KServiceList },
 //    { "KService::Ptr", marshall_KServicePtr },
-    { "KSharedConfig::Ptr", marshall_KSharedConfigPtr },
-    { "KSharedConfig::Ptr&", marshall_KSharedConfigPtr },
-    { "KSharedConfigPtr", marshall_KSharedConfigPtr },
-    { "KSharedConfigPtr&", marshall_KSharedConfigPtr },
-    { "KSharedPtr<KSharedConfig>", marshall_KSharedConfigPtr },
-    { "KSharedPtr<KSharedConfig>&", marshall_KSharedConfigPtr },
+    { "KSharedConfig::Ptr", marshall_KSharedPtr_KSharedConfig },
+    { "KSharedConfig::Ptr&", marshall_KSharedPtr_KSharedConfig },
+    { "KSharedConfigPtr", marshall_KSharedPtr_KSharedConfig },
+    { "KSharedConfigPtr&", marshall_KSharedPtr_KSharedConfig },
+    { "KSharedPtr<KSharedConfig>", marshall_KSharedPtr_KSharedConfig },
+    { "KSharedPtr<KSharedConfig>&", marshall_KSharedPtr_KSharedConfig },
     { "KUrl::List", marshall_KUrlList },
     { "KUrl::List&", marshall_KUrlList },
     { "KUrlList", marshall_KUrlList },
--- trunk/KDE/kdebindings/csharp/kimono/src/kimonopluginfactory.cpp #845781:845782
@@ -36,6 +36,7 @@
 #include <mono/jit/jit.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/debug-helpers.h>
+#include <mono/metadata/mono-config.h>
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -171,6 +172,7 @@
 	// initialize the JIT
 	if (!domain) {
 		domain = mono_jit_init((const char*) path.toLatin1());
+		mono_config_parse(NULL);
 // 		printf("(kimonopluginfactory.cpp:%d) new domain (ptr: %p)\n", __LINE__, domain);
 		atexit(atexitfn);
 	}



More information about the Kde-bindings mailing list