From 81089a04be031bcad76badaa6c05e01f6e393cad Mon Sep 17 00:00:00 2001 From: Oleg Puchinin Date: Thu, 28 Aug 2008 15:59:12 +0700 Subject: [PATCH] Plugins for new plugin system --- silentbob/CMakeLists.txt | 10 ++++----- silentbob/plugins/plugin_editor.cxx | 22 +++++++++---------- silentbob/plugins/plugin_grep.cxx | 20 ++++++++---------- silentbob/plugins/plugin_perl.cxx | 35 ++++++++++++++----------------- silentbob/plugins/plugin_perlpackages.cxx | 19 ++++++++--------- silentbob/plugins/plugin_python.cxx | 22 +++++++++---------- 6 files changed, 59 insertions(+), 69 deletions(-) diff --git a/silentbob/CMakeLists.txt b/silentbob/CMakeLists.txt index 4331d7d..80448eb 100644 --- a/silentbob/CMakeLists.txt +++ b/silentbob/CMakeLists.txt @@ -59,11 +59,11 @@ add_dependencies (silent_bob sblib) 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) -#add_library (plugin_perlpackages SHARED plugins/plugin_perlpackages.cxx) -#add_library (plugin_python SHARED plugins/plugin_python.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) +add_library (plugin_perlpackages SHARED plugins/plugin_perlpackages.cxx) +add_library (plugin_python SHARED plugins/plugin_python.cxx) #for debug reason add_library (plugin_simple SHARED plugins/simple_plugin.cxx) diff --git a/silentbob/plugins/plugin_editor.cxx b/silentbob/plugins/plugin_editor.cxx index 2f7ee95..8627d32 100644 --- a/silentbob/plugins/plugin_editor.cxx +++ b/silentbob/plugins/plugin_editor.cxx @@ -96,18 +96,15 @@ void long_info () DArray * plugin_init (struct env_t *env) { DArray * Ret; - struct mod_feature * pm; + 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->opt = editor_opt; - pm->mod.Name = strdup ("Editors"); - pm->mod.short_info = short_info; - pm->mod.long_info = long_info; + plug = CNEW (mod_t, 1); + memset (plug, 0, sizeof (mod_t)); + plug->Version = strdup ("1.0"); + plug->opt = editor_opt; + plug->Name = strdup ("Editors"); + plug->short_info = short_info; + plug->long_info = long_info; ENV->listOptions->add ( "-g"); ENV->listOptions->add ( "--gvim"); @@ -115,6 +112,7 @@ DArray * plugin_init (struct env_t *env) ENV->listOptions->add ( "--nano"); editor = NULL; - Ret->add (LPCHAR (pm)); + Ret = new DArray (1); + Ret->add (LPCHAR (plug)); return Ret; } diff --git a/silentbob/plugins/plugin_grep.cxx b/silentbob/plugins/plugin_grep.cxx index dd685a4..d2894d6 100644 --- a/silentbob/plugins/plugin_grep.cxx +++ b/silentbob/plugins/plugin_grep.cxx @@ -188,22 +188,20 @@ void grep_long_info () DArray * plugin_init (struct env_t *env) { DArray * Ret; - struct mod_feature * pm; + 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.short_info = grep_short_info; - pm->mod.long_info = grep_long_info; - pm->opt = grep_opt; - pm->opt2 = grep_opt2; + plug = CNEW (mod_t, 1); + memset (plug, 0, sizeof (mod_t)); + plug->Version = strdup ("1.0"); + plug->short_info = grep_short_info; + plug->long_info = grep_long_info; + plug->opt = grep_opt; + plug->opt2 = grep_opt2; ENV->listOptions->add ("--grep"); - Ret->add (LPCHAR (pm)); + Ret->add (LPCHAR (plug)); return Ret; } diff --git a/silentbob/plugins/plugin_perl.cxx b/silentbob/plugins/plugin_perl.cxx index ae8a3e7..f9775d4 100644 --- a/silentbob/plugins/plugin_perl.cxx +++ b/silentbob/plugins/plugin_perl.cxx @@ -237,33 +237,30 @@ void perl_files_long_info () DArray * perl_init () { DArray * Ret; - struct mod_feature * pm; - struct mod_feature * mod_perlfiles; - struct mod_language * pm_lang; + struct mod_t * pm; + struct mod_t * mod_perlfiles; + struct mod_t * pm_lang; Ret = new DArray (2); - pm = CNEW (mod_feature, 1); - pm_lang = CNEW (mod_language, 1); - mod_perlfiles = CNEW (mod_feature, 1); + pm = CNEW (mod_t, 1); + pm_lang = CNEW (mod_t, 1); + mod_perlfiles = CNEW (mod_t, 1); - memset (pm, 0, sizeof (mod_feature)); - memset (pm_lang, 0, sizeof (mod_language)); - memset (mod_perlfiles, 0, sizeof (mod_feature)); + memset (pm, 0, sizeof (mod_t)); + memset (pm_lang, 0, sizeof (mod_t)); + memset (mod_perlfiles, 0, sizeof (mod_t)); - pm->mod.Type = TYPE_FEATURE; - pm->mod.Version = strdup ("0.1"); + pm->Version = strdup ("0.1"); pm->opt = perl_opt; - mod_perlfiles->mod.Type = TYPE_FEATURE; - mod_perlfiles->mod.Version = strdup ("1.0"); - mod_perlfiles->mod.short_info = perl_files_short_info; - mod_perlfiles->mod.long_info = perl_files_long_info; + mod_perlfiles->Version = strdup ("1.0"); + mod_perlfiles->short_info = perl_files_short_info; + mod_perlfiles->long_info = perl_files_long_info; mod_perlfiles->opt = perl_files_opt; - pm_lang->mod.Type = TYPE_LANGUAGE; - pm_lang->mod.Version = strdup ("1.0-rc1"); - pm_lang->mod.short_info = perl_plugin_short_info; - pm_lang->mod.long_info = perl_plugin_long_info; + pm_lang->Version = strdup ("1.0-rc1"); + pm_lang->short_info = perl_plugin_short_info; + pm_lang->long_info = perl_plugin_long_info; pm_lang->language = strdup ("Perl"); pm_lang->the = THE_FLY::fly_for_file; pm_lang->print_tags = perl_print_tags; diff --git a/silentbob/plugins/plugin_perlpackages.cxx b/silentbob/plugins/plugin_perlpackages.cxx index 8258898..7ea0c27 100644 --- a/silentbob/plugins/plugin_perlpackages.cxx +++ b/silentbob/plugins/plugin_perlpackages.cxx @@ -21,7 +21,7 @@ char t_op2 (char ** d_in, char ** d_prev); void __perl_files (char * f_name) { unlink (f_name); - sblib_find ("./", "*.pm", f_name); + sblib_find ("./", "*.plug", f_name); sblib_find ("./", "*.pl", f_name); sblib_find ("./", "*.ph", f_name); } @@ -118,21 +118,20 @@ void plug_long_info () DArray * plugin_init (struct env_t * env) { DArray * Ret; - struct mod_feature * pm; + mod_t * plug; ENV = env; Ret = new DArray (32); - pm = CNEW (mod_feature, 1); - memset (pm, 0, sizeof (mod_feature)); - pm->mod.Type = TYPE_FEATURE; - pm->mod.Version = strdup ("1.0"); - pm->mod.short_info = plug_short_info; - pm->mod.long_info = plug_long_info; - pm->opt2 = pl_opt; + plug = CNEW (mod_t, 1); + memset (plug, 0, sizeof (mod_t)); + plug->Version = strdup ("1.0"); + plug->short_info = plug_short_info; + plug->long_info = plug_long_info; + plug->opt2 = pl_opt; ENV->listOptions->add ("--packages"); - Ret->add (LPCHAR (pm)); + Ret->add (LPCHAR (plug)); return Ret; } diff --git a/silentbob/plugins/plugin_python.cxx b/silentbob/plugins/plugin_python.cxx index ee2a0c1..d11dfdc 100644 --- a/silentbob/plugins/plugin_python.cxx +++ b/silentbob/plugins/plugin_python.cxx @@ -204,28 +204,26 @@ void py_long_info () DArray * plugin_init (struct env_t *env) { - struct mod_feature * pm; - struct mod_language * pm_lang; + struct mod_t * pm; + struct mod_t * pm_lang; DArray * Ret; - pm = CNEW (mod_feature, 1); - pm_lang = CNEW (mod_language, 1); + pm = CNEW (mod_t, 1); + pm_lang = CNEW (mod_t, 1); - memset (pm, 0, sizeof (struct mod_feature)); - memset (pm_lang, 0, sizeof (struct mod_language)); + memset (pm, 0, sizeof (struct mod_t)); + memset (pm_lang, 0, sizeof (struct mod_t)); - pm_lang->mod.Version = strdup ("1.0"); - pm_lang->mod.Type = TYPE_LANGUAGE; + pm_lang->Version = strdup ("1.0"); pm_lang->the = PYTHON::py_tt_file; pm_lang->make_ctags = python_ctags; pm_lang->language = strdup ("Python"); - pm->mod.Version = strdup ("1.0"); + pm->Version = strdup ("1.0"); pm->opt = py_opt; pm->opt2 = py_opt2; - pm->mod.Type = TYPE_FEATURE; - pm->mod.short_info = py_short_info; - pm->mod.long_info = py_long_info; + pm->short_info = py_short_info; + pm->long_info = py_long_info; ENV->listOptions->add ( "--python"); ENV->listOptions->add ( "--files"); -- 2.11.4.GIT