diff options
Diffstat (limited to 'lib/LuaHandle.cc')
-rw-r--r-- | lib/LuaHandle.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index e336f54..e2b621e 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -72,6 +72,8 @@ class sLuaHandle : public Base { static int get_nb_buffer(lua_State * L); static int zlib_inflate(lua_State * L); static int zlib_deflate(lua_State * L); + static int ucl_compress(lua_State * L); + static int ucl_decompress(lua_State * L); private: static int read(lua_State * L, int); static int write(lua_State * L, int); @@ -581,6 +583,46 @@ int sLuaHandle::zlib_deflate(lua_State * __L) { return 1; } +int sLuaHandle::ucl_compress(lua_State * __L) { + Lua * L = Lua::find(__L); + int n = L->gettop(); + Handle * s, * d; + int r; + + if (n != 2) { + L->error("Incorrect arguments to method `Handle::ucl_compress'"); + } + + s = (Handle *) LuaObject::getme(L, 1); + d = (Handle *) LuaObject::getme(L, 2); + + r = Handle::ucl_compress(s, d); + + L->push((lua_Number) r); + + return 1; +} + +int sLuaHandle::ucl_decompress(lua_State * __L) { + Lua * L = Lua::find(__L); + int n = L->gettop(); + Handle * s, * d; + int r; + + if (n != 2) { + L->error("Incorrect arguments to method `Handle::ucl_decompress'"); + } + + s = (Handle *) LuaObject::getme(L, 1); + d = (Handle *) LuaObject::getme(L, 2); + + r = Handle::ucl_decompress(s, d); + + L->push((lua_Number) r); + + return 1; +} + int sLuaHandle::seek(lua_State * __L) { Lua * L = Lua::find(__L); int n = L->gettop(); @@ -819,4 +861,6 @@ void LuaHandle::pushconstruct(Lua * L) { L->declarefunc("zlib_inflate", sLuaHandle::zlib_inflate); L->declarefunc("zlib_deflate", sLuaHandle::zlib_deflate); + L->declarefunc("ucl_compress", sLuaHandle::ucl_compress); + L->declarefunc("ucl_decompress", sLuaHandle::ucl_decompress); } |