From a0552f1f9f49b17c0be26f44cacf4b1011c71f90 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 28 Aug 2008 15:34:11 +0700 Subject: [PATCH] plugins : aap, system cache - for new plugin system --- silentbob/CMakeLists.txt | 4 ++-- silentbob/plugins/plugin_aap.cxx | 20 ++++++++++---------- silentbob/plugins/plugin_cache.cxx | 19 +++++++++---------- silentbob/src/modding.cxx | 2 ++ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/silentbob/CMakeLists.txt b/silentbob/CMakeLists.txt index ee151ae..4331d7d 100644 --- a/silentbob/CMakeLists.txt +++ b/silentbob/CMakeLists.txt @@ -58,7 +58,7 @@ add_dependencies (silent_bob sblib) -#add_library (plugin_cache SHARED plugins/plugin_cache.cxx) +add_library (plugin_cache SHARED plugins/plugin_cache.cxx) #add_library (plugin_editor SHARED plugins/plugin_editor.cxx) #add_library (plugin_grep SHARED plugins/plugin_grep.cxx) #add_library (plugin_perl SHARED plugins/plugin_perl.cxx) @@ -66,7 +66,7 @@ add_dependencies (silent_bob sblib) #add_library (plugin_python SHARED plugins/plugin_python.cxx) #for debug reason -#add_library (plugin_simple SHARED plugins/simple_plugin.cxx) +add_library (plugin_simple SHARED plugins/simple_plugin.cxx) install (TARGETS sblib silent_bob RUNTIME DESTINATION bin diff --git a/silentbob/plugins/plugin_aap.cxx b/silentbob/plugins/plugin_aap.cxx index 9c78fd8..da4434e 100644 --- a/silentbob/plugins/plugin_aap.cxx +++ b/silentbob/plugins/plugin_aap.cxx @@ -167,27 +167,27 @@ void aap_program_long_info () DArray * plugin_init (struct env_t *env) { - struct mod_feature * pm; + mod_t * plug; DArray * Ret; __aap_env = false; ENV = env; Ret = new DArray (1); - pm = CNEW (mod_feature, 1); - memset (pm, 0, sizeof (mod_feature)); - pm->mod.Type = TYPE_FEATURE; - pm->mod.Version = strdup ("0.1"); - pm->mod.short_info = aap_program_short_info; - pm->mod.long_info = aap_program_long_info; - pm->opt = aap_program_opt; - pm->opt2 = aap_program_opt2; + plug = CNEW (mod_t, 1); + memset (plug, 0, sizeof (mod_t)); + + plug->Version = strdup ("0.1"); + plug->short_info = aap_program_short_info; + plug->long_info = aap_program_long_info; + plug->opt = aap_program_opt; + plug->opt2 = aap_program_opt2; ENV->listOptions->add ("--aap-program"); ENV->listOptions->add ("--aap-shared"); ENV->listOptions->add ("--aap-static"); ENV->listOptions->add ("--aap-env"); - Ret->add (LPCHAR (pm)); + Ret->add (LPCHAR (plug)); return Ret; } diff --git a/silentbob/plugins/plugin_cache.cxx b/silentbob/plugins/plugin_cache.cxx index 985b746..0ee45ad 100644 --- a/silentbob/plugins/plugin_cache.cxx +++ b/silentbob/plugins/plugin_cache.cxx @@ -90,22 +90,21 @@ void cache_long_info () DArray * plugin_init (struct env_t *env) { DArray * Ret; - struct mod_feature * pm; + struct mod_t * plug; ENV = env; Ret = new DArray (1); - pm = CNEW (mod_feature, 1); - memset (pm, 0, sizeof (mod_feature)); - pm->mod.Type = TYPE_FEATURE; - pm->mod.Version = strdup ("1.0"); - pm->mod.Name = strdup ("Cache"); - pm->opt2 = cache_opt; - pm->mod.short_info = cache_short_info; - pm->mod.long_info = cache_long_info; + plug = CNEW (mod_t, 1); + memset (plug, 0, sizeof (mod_t)); + plug->Version = strdup ("1.0"); + plug->Name = strdup ("Cache"); + plug->opt2 = cache_opt; + plug->short_info = cache_short_info; + plug->long_info = cache_long_info; ENV->listOptions->add ("--cache-load"); ENV->listOptions->add ("--cache-free"); - Ret->add (LPCHAR (pm)); + Ret->add (LPCHAR (plug)); return Ret; } diff --git a/silentbob/src/modding.cxx b/silentbob/src/modding.cxx index ded6b58..2c48517 100644 --- a/silentbob/src/modding.cxx +++ b/silentbob/src/modding.cxx @@ -58,6 +58,8 @@ mod_t * find_language (char *S) for (i = 0; i < ENV->modding->get_size (); i++) { plug = (mod_t *) ENV->modding->get (i); + if (! plug->language) + continue; if (EQ (plug->language, S)) break; } -- 2.11.4.GIT