diff options
author | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:56:41 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:59:33 -0800 |
commit | d577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch) | |
tree | 590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /cd/src/lua5/cdluapdf5.c |
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'cd/src/lua5/cdluapdf5.c')
-rwxr-xr-x | cd/src/lua5/cdluapdf5.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/cd/src/lua5/cdluapdf5.c b/cd/src/lua5/cdluapdf5.c new file mode 100755 index 0000000..eb3f221 --- /dev/null +++ b/cd/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); +} |