From aae2c566368ddd45a60b47a4b571f845d7a19b01 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 13 Apr 2010 16:31:03 +0800 Subject: [PATCH] re-factor lua-plugin interface. --- lua/lua-plugin.h | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/lua/lua-plugin.h b/lua/lua-plugin.h index 084fe15..6284f02 100644 --- a/lua/lua-plugin.h +++ b/lua/lua-plugin.h @@ -15,6 +15,16 @@ typedef struct{ const char * help; /* optional. */ } lua_command_t; +typedef struct{ + const char * lua_function_name; + const char * description; + /*< private, skip it, and register it into Special Table directly with * wildcard. >*/ + /* + * list of input_trigger_strings; + * list of candidate_trigger_strings; + */ +} lua_trigger_t; + /* * Type macros. */ @@ -52,24 +62,37 @@ GType ibus_engine_plugin_get_type(void); IBusEnginePlugin * ibus_engine_plugin_new(); /** + * add a lua_command_t to plugin. + */ +gboolean ibus_engine_plugin_add_command(IBusEnginePlugin * plugin, lua_command_t * command); + +/** * retrieve all available lua plugin commands. * return array of command informations of type lua_command_t. */ -GArray * ibus_engine_plugin_ime_get_available_commands(IBusEnginePlugin * plugin); +GArray * ibus_engine_plugin_get_available_commands(IBusEnginePlugin * plugin); + +/** + * Lookup a special command in ime lua extension. + * command must be an 2-char long string. + * return the matched command. + */ +lua_command_t * ibus_engine_plugin_lookup_command(IBusEnginePlugin * plugin, const char * command); /** - * retval int: only support string or string array. + * retval int: returns the number of results, + * only support string or string array. */ -int ibus_engine_plugin_ime_call(IBusEnginePlugin * plugin, const lua_command_t * command, const char * argument /*optional, maybe NULL.*/); +int ibus_engine_plugin_call(IBusEnginePlugin * plugin, const lua_command_t * command, const char * argument /*optional, maybe NULL.*/); /** * retrieve the retval string value. (value has been copied.) */ -const char * ibus_engine_plugin_ime_get_retval(IBusEnginePlugin * plugin); +const char * ibus_engine_plugin_get_retval(IBusEnginePlugin * plugin); /** * retrieve the array of string values. (string values have been copied.) */ -GArray * ibus_engine_plugin_ime_get_retvals(IBusEnginePlugin * plugin); +GArray * ibus_engine_plugin_get_retvals(IBusEnginePlugin * plugin); /*< private >*/ -- 2.7.4