summaryrefslogtreecommitdiff
path: root/src/lua5/cdluapdf5.c
diff options
context:
space:
mode:
authorscuri <scuri>2008-10-17 06:10:33 +0000
committerscuri <scuri>2008-10-17 06:10:33 +0000
commit7b52cc13af4e85f1ca2deb6b6c77de9c95ea0dcf (patch)
treed0857278bde2eff784227c57dcaf930346ceb7ac /src/lua5/cdluapdf5.c
First commit - moving from LuaForge to SourceForge
Diffstat (limited to 'src/lua5/cdluapdf5.c')
-rw-r--r--src/lua5/cdluapdf5.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/lua5/cdluapdf5.c b/src/lua5/cdluapdf5.c
new file mode 100644
index 0000000..eb3f221
--- /dev/null
+++ b/src/lua5/cdluapdf5.c
@@ -0,0 +1,53 @@
+/** \file
+ * \brief PDF Canvas Lua 5 Binding
+ *
+ * See Copyright Notice in cd.h
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "cd.h"
+#include "cdpdf.h"
+
+#include <lua.h>
+#include <lauxlib.h>
+
+#include "cdlua.h"
+#include "cdluapdf.h"
+#include "cdlua5_private.h"
+
+
+static void *cdpdf_checkdata(lua_State *L, int param)
+{
+ return (void *)luaL_checkstring(L, param);
+}
+
+static cdluaContext cdluapdfctx =
+{
+ 0,
+ "PDF",
+ cdContextPDF,
+ cdpdf_checkdata,
+ NULL,
+ 0
+};
+
+int cdluapdf_open (lua_State *L)
+{
+ cdluaLuaState* cdL = cdlua_getstate(L);
+ lua_pushliteral(L, "cd");
+ lua_gettable(L, LUA_GLOBALSINDEX); /* leave "cd" table at the top of the stack */
+ cdlua_addcontext(L, cdL, &cdluapdfctx);
+ return 1;
+}
+
+int luaopen_cdluapdf(lua_State* L)
+{
+ return cdluapdf_open(L);
+}
+
+int luaopen_cdluapdf51(lua_State* L)
+{
+ return cdluapdf_open(L);
+}