summaryrefslogtreecommitdiff
path: root/core/src/xmake/machine.c
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-10 07:05:41 +0800
committerTitanSnow <[email protected]>2017-05-10 07:52:11 +0800
commitc8a1edb15828a188b2c2e2139a366aad006aaf0e (patch)
tree9f568a58f65e6846894a744d9f3e0ec9ece178ac /core/src/xmake/machine.c
parentd80214fcfaa2f90b2ba6ec6991329d38901cff66 (diff)
add module readline
Diffstat (limited to 'core/src/xmake/machine.c')
-rw-r--r--core/src/xmake/machine.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c
index b9977d92a..8eca36a8b 100644
--- a/core/src/xmake/machine.c
+++ b/core/src/xmake/machine.c
@@ -103,6 +103,11 @@ tb_int_t xm_process_close(lua_State* lua);
// the sandbox functions
tb_int_t xm_sandbox_interactive(lua_State* lua);
+#ifdef XM_CONFIG_API_HAVE_READLINE
+// the readline functions
+tb_int_t xm_readline_readline(lua_State* lua);
+#endif
+
/* //////////////////////////////////////////////////////////////////////////////////////
* globals
*/
@@ -173,6 +178,15 @@ static luaL_Reg const g_sandbox_functions[] =
, { tb_null, tb_null }
};
+#ifdef XM_CONFIG_API_HAVE_READLINE
+// the readline functions
+static luaL_Reg const g_readline_functions[] =
+{
+ { "readline", xm_readline_readline }
+, { tb_null, tb_null }
+};
+#endif
+
/* //////////////////////////////////////////////////////////////////////////////////////
* private implementation
*/
@@ -379,6 +393,11 @@ xm_machine_ref_t xm_machine_init()
// bind sandbox functions
luaL_register(impl->lua, "sandbox", g_sandbox_functions);
+#ifdef XM_CONFIG_API_HAVE_READLINE
+ // bind readline functions
+ luaL_register(impl->lua, "readline", g_readline_functions);
+#endif
+
// init host
#if defined(TB_CONFIG_OS_WINDOWS)
lua_pushstring(impl->lua, "windows");