begin lua-plugin integration.
authorPeng Wu <epico@dhcp-65-116.nay.redhat.com>
Thu, 1 Apr 2010 08:34:21 +0000 (16:34 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 19 May 2010 02:09:32 +0000 (10:09 +0800)
lua/lua-plugin.h
lua/test-lua-plugin.c

index b2fe8e5..2ffdeed 100644 (file)
@@ -5,6 +5,34 @@ int lua_plugin_init(lua_State * L);
 int lua_plugin_fini(lua_State * L);
 
 #define LUA_IMELIBNAME   "ime"
-LUALIB_API int (luaopen_ime) (lua_State *L);
+LUALIB_API int (luaopen_ime) (lua_State * L);
+
+typedef struct{
+  const char * command_name;
+  const char * lua_function_name;
+  const char * description;
+  const char * leading; /* optional, default "digit". */
+  const char * help; /* optional. */
+} lua_command_t;
+
+/**
+ * retrieve all available lua plugin commands.
+ * return array of command informations of type lua_command_t.
+ */
+GArray * lua_plugin_ime_get_available_commands(lua_State * L);
+
+/**
+ * retval int: only support string or string array.
+ */
+int lua_plugin_ime_call(lua_State * L, const lua_command_t * command, const char * argument /*optional, maybe NULL.*/);
+
+/**
+ * retrieve the retval string value. (value has been copied.)
+ */
+const char * lua_plugin_ime_get_retval(lua_State * L);
+/**
+ * retrieve the array of string values. (string values have been copied.)
+ */
+GArray * lua_plugin_ime_get_retvals(lua_State * L);
 
 #endif
index 5dec834..c2de597 100644 (file)
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <glib.h>
 
 #include "lua.h"
 #include "lualib.h"