aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-10-02 15:37:56 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-10-02 15:37:56 +0100
commitf2d1109c8f7a450febae4d160b23bdd8f2a27465 (patch)
tree277e53af859eaf360c5227babbd9c3bdbdeb0a8c /src/lua
parent33d45e26503db6e1a770e982e31f87ae31854ba7 (diff)
downloadrspamd-f2d1109c8f7a450febae4d160b23bdd8f2a27465.tar.gz
rspamd-f2d1109c8f7a450febae4d160b23bdd8f2a27465.zip
Add preliminary implementation of lua to rcl converter.
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/CMakeLists.txt4
-rw-r--r--src/lua/lua_common.h7
-rw-r--r--src/lua/lua_rcl.c22
3 files changed, 30 insertions, 3 deletions
diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt
index 762c9a10d..4713b3405 100644
--- a/src/lua/CMakeLists.txt
+++ b/src/lua/CMakeLists.txt
@@ -3,6 +3,7 @@ SET(LUASRC lua_common.c
lua_task.c
lua_message.c
lua_config.c
+ lua_rcl.c
lua_classifier.c
lua_cfg_file.c
lua_regexp.c
@@ -15,8 +16,7 @@ SET(LUASRC lua_common.c
lua_session.c
lua_buffer.c
lua_dns.c
- lua_rsa.c
- lua_rcl.c)
+ lua_rsa.c)
ADD_LIBRARY(rspamd-lua ${LINK_TYPE} ${LUASRC})
SET_TARGET_PROPERTIES(rspamd-lua PROPERTIES VERSION ${RSPAMD_VERSION})
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index c83433d81..7416297f7 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -110,6 +110,13 @@ void free_lua_locked (struct lua_locked_state *st);
gint lua_rcl_obj_push (lua_State *L, rspamd_cl_object_t *obj);
/**
+ * Extract rcl object from lua object
+ * @param L
+ * @return
+ */
+rspamd_cl_object_t * lua_rcl_obj_get (lua_State *L);
+
+/**
* Open libraries functions
*/
gint luaopen_message (lua_State *L);
diff --git a/src/lua/lua_rcl.c b/src/lua/lua_rcl.c
index c992b553e..1dc17bde5 100644
--- a/src/lua/lua_rcl.c
+++ b/src/lua/lua_rcl.c
@@ -41,7 +41,7 @@ static void
lua_rcl_obj_push_elt (lua_State *L, const char *key, rspamd_cl_object_t *obj)
{
lua_pushstring (L, key);
- lua_push_obj_simple (L, obj);
+ lua_rcl_obj_push (L, obj);
lua_settable (L, -3);
}
@@ -146,3 +146,23 @@ lua_rcl_obj_push (lua_State *L, rspamd_cl_object_t *obj)
return lua_rcl_obj_push_simple (L, obj);
}
}
+
+/**
+ * Extract rcl object from lua object
+ * @param L
+ * @return
+ */
+rspamd_cl_object_t *
+lua_rcl_obj_get (lua_State *L)
+{
+ rspamd_cl_object_t *obj;
+ gint t;
+
+ obj = rspamd_cl_object_new ();
+
+ if (obj != NULL) {
+ t = lua_type (L, 1);
+ }
+
+ return obj;
+}