summaryrefslogtreecommitdiffstats
path: root/lua/lua-plugin.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-06-07 15:07:31 +0800
committerPeng Wu <alexepico@gmail.com>2018-06-07 15:07:31 +0800
commit24cd9ed4274d9a7a7a25862537d08b8e83be30bf (patch)
tree3467b0f99a3b6d497bbd5752633426709eacf090 /lua/lua-plugin.h
parentc2e1912687bf89c6b0d8bb9529998f775e95ea51 (diff)
downloadibus-libpinyin-24cd9ed4274d9a7a7a25862537d08b8e83be30bf.tar.gz
ibus-libpinyin-24cd9ed4274d9a7a7a25862537d08b8e83be30bf.tar.xz
ibus-libpinyin-24cd9ed4274d9a7a7a25862537d08b8e83be30bf.zip
update lua-plugin.h
Diffstat (limited to 'lua/lua-plugin.h')
-rw-r--r--lua/lua-plugin.h61
1 files changed, 55 insertions, 6 deletions
diff --git a/lua/lua-plugin.h b/lua/lua-plugin.h
index 59a815a..8a265af 100644
--- a/lua/lua-plugin.h
+++ b/lua/lua-plugin.h
@@ -52,13 +52,15 @@ typedef struct _lua_command_candidate_t{
typedef struct _lua_trigger_t{
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;
- */
+ gchar **input_trigger_strings;
+ gchar **candidate_trigger_strings;
} lua_trigger_t;
+typedef struct _lua_converter_t{
+ const char * lua_function_name;
+ const char * description;
+} lua_converter_t;
+
/*
* Type macros.
*/
@@ -109,11 +111,43 @@ gboolean ibus_engine_plugin_add_command(IBusEnginePlugin * plugin, lua_command_t
/**
* retrieve all available lua plugin commands.
- * return array of command informations of type lua_command_t without copies.
+ * return array of command information of type lua_command_t without copies.
*/
const GArray * ibus_engine_plugin_get_available_commands(IBusEnginePlugin * plugin);
/**
+ * add a lua_trigger_t to plugin.
+ */
+gboolean ibus_engine_plugin_add_trigger(IBusEnginePlugin * plugin, lua_trigger_t * trigger);
+
+/**
+ * retrieve all available lua plugin triggers.
+ * return array of trigger information of type lua_trigger_t without copies.
+ */
+const GArray * ibus_engine_plugin_get_available_triggers(IBusEnginePlugin * plugin);
+
+/**
+ * add a lua_converter_t to plugin.
+ */
+gboolean ibus_engine_plugin_add_converter(IBusEnginePlugin * plugin, lua_converter_t * converter);
+
+/**
+ * retrieve all available lua plugin converters.
+ * return array of converter information of type lua_converter_t without copies.
+ */
+const GArray * ibus_engine_plugin_get_available_converters(IBusEnginePlugin * plugin);
+
+/**
+ * set the converter with the lua function name.
+ */
+gboolean ibus_engine_plugin_set_converter(IBusEnginePlugin * plugin, const char * lua_function_name);
+
+/**
+ * get the converter with the lua function name.
+ */
+const char * ibus_engine_plugin_get_converter(IBusEnginePlugin * plugin);
+
+/**
* Lookup a special command in ime lua extension.
* command must be an 2-char long string.
* return the matched command.
@@ -121,6 +155,16 @@ const GArray * ibus_engine_plugin_get_available_commands(IBusEnginePlugin * plug
const lua_command_t * ibus_engine_plugin_lookup_command(IBusEnginePlugin * plugin, const char * command_name);
/**
+ * retrieve the lua function name of the matched input for lua_trigger_t.
+ */
+gboolean ibus_engine_plugin_match_input(IBusEnginePlugin * plugin, const char * input, const char ** lua_function_name);
+
+/**
+ * retrieve the lua function name of the matched candidate for lua_trigger_t.
+ */
+gboolean ibus_engine_plugin_match_candidate(IBusEnginePlugin * plugin, const char * candidate, const char ** lua_function_name);
+
+/**
* retval int: returns the number of results,
* only support string or string array.
* the consequence call of ibus_engine_plugin_get_retval* must follow this call immediately.
@@ -128,6 +172,11 @@ const lua_command_t * ibus_engine_plugin_lookup_command(IBusEnginePlugin * plugi
int ibus_engine_plugin_call(IBusEnginePlugin * plugin, const char * lua_function_name, const char * argument /*optional, maybe NULL.*/);
/**
+ * retrieve the string value. (value has been copied.)
+ */
+const char * ibus_engine_plugin_get_result_string(IBusEnginePlugin * plugin);
+
+/**
* retrieve the retval string value. (value has been copied.)
*/
const lua_command_candidate_t * ibus_engine_plugin_get_retval(IBusEnginePlugin * plugin);