summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlp Toker <alp@atoker.com>2006-08-25 04:17:00 +0100
committerAlp Toker <alp@atoker.com>2006-08-25 04:17:00 +0100
commitd1608f70ac633d8e6e2a3d54816ce89c9f6e3d3d (patch)
tree79a79c3c2313a9d69be150b98b3dde236ea80d96
parent8134211fffd1dc12266b1f5abf788c5cb79882b3 (diff)
downloadcompiz-cil-d1608f70ac633d8e6e2a3d54816ce89c9f6e3d3d.tar.gz
compiz-cil-d1608f70ac633d8e6e2a3d54816ce89c9f6e3d3d.tar.bz2
Decide on tabs for indentation and stick to it
Beats mix and match, and I don't like compiz indentation. Also remove dead comments.
-rw-r--r--glue/compiz-mono.c169
1 files changed, 72 insertions, 97 deletions
diff --git a/glue/compiz-mono.c b/glue/compiz-mono.c
index d577868..5083514 100644
--- a/glue/compiz-mono.c
+++ b/glue/compiz-mono.c
@@ -1,8 +1,6 @@
/*
*
- * Experimental plugin loader for compiz-sharp
- *
- * This code does not represent the final design.
+ * Plugin loader plugin for compiz-sharp
*
*/
@@ -15,7 +13,6 @@
#include <compiz.h>
#include <mono/jit/jit.h>
-//#include <mono/metadata/mono-config.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/environment.h>
#include <mono/metadata/object.h>
@@ -38,30 +35,29 @@ static UnloadPluginProc baseloaderUnloadPlugin;
static Bool
monoloaderLoadPlugin (CompPlugin *p, char *path, char *name)
{
- Bool status;
+ Bool status;
- fprintf (stderr, "monoloaderLoadPlugin %s %s\n", path, name);
+ fprintf (stderr, "monoloaderLoadPlugin %s %s\n", path, name);
- MonoMethodDesc *method_desc = mono_method_desc_new (":Load(intptr,string,string)", FALSE);
- //MonoMethodDesc *method_desc = mono_method_desc_new (":Load(CompPlugin,string,string)", FALSE);
- MonoMethod *method = mono_method_desc_search_in_class (method_desc, data->loader_class);
+ MonoMethodDesc *method_desc = mono_method_desc_new (":Load(intptr,string,string)", FALSE);
+ MonoMethod *method = mono_method_desc_search_in_class (method_desc, data->loader_class);
- gpointer params[3];
- params[0] = &p;
- params[1] = (gpointer*) mono_string_new (data->domain, path);
- params[2] = (gpointer*) mono_string_new (data->domain, name);
+ gpointer params[3];
+ params[0] = &p;
+ params[1] = (gpointer*) mono_string_new (data->domain, path);
+ params[2] = (gpointer*) mono_string_new (data->domain, name);
- MonoObject *mret = mono_runtime_invoke (method, data->loader_instance, params, NULL);
- status = *(Bool*)mono_object_unbox(mret);
+ MonoObject *mret = mono_runtime_invoke (method, data->loader_instance, params, NULL);
+ status = *(Bool*)mono_object_unbox(mret);
- fprintf (stderr, "ret %d\n", status);
+ fprintf (stderr, "ret %d\n", status);
- if (status)
- return status;
+ if (status)
+ return status;
- status = (*baseloaderLoadPlugin) (p, path, name);
+ status = (*baseloaderLoadPlugin) (p, path, name);
- return status;
+ return status;
}
static void
@@ -70,126 +66,105 @@ monoloaderUnloadPlugin (CompPlugin *p)
(*baseloaderUnloadPlugin) (p);
}
-//static LoadPluginProc loaderLoadPlugin = dlloaderLoadPlugin;
-//static UnloadPluginProc loaderUnloadPlugin = dlloaderUnloadPlugin;
-
static MonoObject *
plugin_loader_new (CompMonoData *data)
{
- MonoMethodDesc *method_desc = mono_method_desc_new (":.ctor()", FALSE);
- MonoMethod *method = mono_method_desc_search_in_class (method_desc, data->loader_class);
+ MonoMethodDesc *method_desc = mono_method_desc_new (":.ctor()", FALSE);
+ MonoMethod *method = mono_method_desc_search_in_class (method_desc, data->loader_class);
- MonoObject *object = mono_object_new (data->domain, data->loader_class);
- mono_runtime_invoke (method, object, NULL, NULL);
+ MonoObject *object = mono_object_new (data->domain, data->loader_class);
+ mono_runtime_invoke (method, object, NULL, NULL);
- return object;
+ return object;
}
static Bool
monoInit (CompPlugin *p)
{
- /*
- displayPrivateIndex = allocateDisplayPrivateIndex ();
-
- fprintf (stderr, "Init %d\n", displayPrivateIndex);
+ data = malloc (sizeof (CompMonoData));
- if (displayPrivateIndex < 0)
- return FALSE;
- */
+ //initialize Mono
+ mono_set_defaults (0, mono_parse_default_optimizations (NULL));
- data = malloc (sizeof (CompMonoData));
+ //set the domain name to the assembly name
+ //this seems to let the runtime pick up 2.0 deps
+ data->domain = mono_jit_init ("compiz-sharp.dll");
- //initialize Mono
- mono_set_defaults (0, mono_parse_default_optimizations (NULL));
- //mono_set_dirs (NULL, NULL);
+ //enable debugging
+ mono_debug_init (MONO_DEBUG_FORMAT_MONO);
+ mono_debug_init_1 (data->domain);
- //set the domain name to the assembly name
- //this seems to let the runtime pick up 2.0 deps
- data->domain = mono_jit_init ("compiz-sharp.dll");
+ data->assembly = mono_domain_assembly_open (data->domain, "compiz-sharp.dll");
+ mono_dllmap_insert (mono_assembly_get_image (data->assembly), "compiz", NULL, "__Internal", NULL);
+ mono_dllmap_insert (mono_assembly_get_image (data->assembly), "compmono", NULL, "__Internal", NULL);
+ data->loader_class = mono_class_from_name (mono_assembly_get_image (data->assembly), "Compiz", "PluginLoader");
+ mono_debug_init_2 (data->assembly);
- //enable debugging
- mono_debug_init (MONO_DEBUG_FORMAT_MONO);
- mono_debug_init_1 (data->domain);
+ mono_class_init (data->loader_class);
- data->assembly = mono_domain_assembly_open (data->domain, "compiz-sharp.dll");
- //mono_config_parse (NULL);
- mono_dllmap_insert (mono_assembly_get_image (data->assembly), "compiz", NULL, "__Internal", NULL);
- mono_dllmap_insert (mono_assembly_get_image (data->assembly), "compmono", NULL, "__Internal", NULL);
- data->loader_class = mono_class_from_name (mono_assembly_get_image (data->assembly), "Compiz", "PluginLoader");
- mono_debug_init_2 (data->assembly);
+ //create a new loader instance
+ data->loader_instance = plugin_loader_new (data);
- mono_class_init (data->loader_class);
+ //save existing loader load/unload callbacks
+ baseloaderLoadPlugin = loaderLoadPlugin;
+ baseloaderUnloadPlugin = loaderUnloadPlugin;
- //create a new loader instance
- data->loader_instance = plugin_loader_new (data);
+ //install our new loader load/unload callbacks
+ loaderLoadPlugin = monoloaderLoadPlugin;
+ loaderUnloadPlugin = monoloaderUnloadPlugin;
- //save existing loader load/unload callbacks
- baseloaderLoadPlugin = loaderLoadPlugin;
- baseloaderUnloadPlugin = loaderUnloadPlugin;
-
- //install our new loader load/unload callbacks
- loaderLoadPlugin = monoloaderLoadPlugin;
- loaderUnloadPlugin = monoloaderUnloadPlugin;
-
- return TRUE;
+ return TRUE;
}
static void
monoFini (CompPlugin *p)
{
- /*
- fprintf (stderr, "Fini %d\n", displayPrivateIndex);
-
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
-
- */
- //restore saved loader load/unload callbacks
- loaderLoadPlugin = baseloaderLoadPlugin;
- loaderUnloadPlugin = baseloaderUnloadPlugin;
+ //restore saved loader load/unload callbacks
+ loaderLoadPlugin = baseloaderLoadPlugin;
+ loaderUnloadPlugin = baseloaderUnloadPlugin;
- mono_jit_cleanup (data->domain);
- free (data);
+ mono_jit_cleanup (data->domain);
+ free (data);
}
static Bool
monoInitDisplay (CompPlugin *p, CompDisplay *d)
{
- fprintf (stderr, "InitDisplay\n");
+ fprintf (stderr, "InitDisplay\n");
- return TRUE;
+ return TRUE;
}
static void
monoFiniDisplay (CompPlugin *p, CompDisplay *d)
{
- fprintf (stderr, "FiniDisplay\n");
+ fprintf (stderr, "FiniDisplay\n");
}
CompPluginVTable monoVTable = {
- "compmono",
- "Mono Loader",
- "Experimental plugin loader",
- monoInit,
- monoFini,
- monoInitDisplay,
- monoFiniDisplay,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
+ "compmono",
+ "Mono Loader",
+ "Experimental plugin loader",
+ monoInit,
+ monoFini,
+ monoInitDisplay,
+ monoFiniDisplay,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
};
CompPluginVTable *
getCompPluginInfo (void)
{
- fprintf (stderr, "getCompPluginInfo\n");
+ fprintf (stderr, "getCompPluginInfo\n");
- return &monoVTable;
+ return &monoVTable;
}