From b4d2d633cd88308487aa6e2b689a4328ce6023c1 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 21 Jul 2012 11:26:54 +0100 Subject: Initial framework for Supple --- lib/supple.lua | 23 +++++++++++++++++++++++ lib/supple/capi.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 lib/supple.lua create mode 100644 lib/supple/capi.c (limited to 'lib') diff --git a/lib/supple.lua b/lib/supple.lua new file mode 100644 index 0000000..5fc405b --- /dev/null +++ b/lib/supple.lua @@ -0,0 +1,23 @@ +-- lib/supple.lua +-- +-- Sandbox (for) Untrusted Procedure Partitioning (in) Lua Engine +-- +-- Copyright 2012 Daniel Silverstone +-- +-- For licence terms, see COPYING +-- + +local capi = require 'supple.capi' + +local _VERSION = 1 +local _ABI = 1 + +local VERSION = "Supple Version " .. tostring(_VERSION) + +return { + capi = capi, + _VERSION = _VERSION, + VERSION = VERSION, + _ABI = _ABI, + ABI = ABI, +} diff --git a/lib/supple/capi.c b/lib/supple/capi.c new file mode 100644 index 0000000..139cfe6 --- /dev/null +++ b/lib/supple/capi.c @@ -0,0 +1,35 @@ +/* supple/lib/supple/capi.c + * + * Sandbox (for) Untrusted Procedure Partitioning (in) Lua Engine - Supple + * + * Useful C methods for Supple including the userdata partitioning. + * + * Copyright 2012 Daniel Silverstone + * + * For licence terms, see COPYING + * + */ + +#include +#include + +/* The API exposed, increment on backward-compatible changes */ +#define CAPI_API 1 +/* The ABI exposed, increment on backward-incompatible changes */ +#define CAPI_ABI 1 + +static const struct luaL_Reg +supple_capi_functions[] = { + { NULL, NULL } +}; + +int +luaopen_supple_capi(lua_State *L) +{ + luaL_register(L, "supple.capi", supple_capi_functions); + lua_pushnumber(L, CAPI_API); + lua_setfield(L, -2, "_API"); + lua_pushnumber(L, CAPI_ABI); + lua_setfield(L, -2, "_ABI"); + return 1; +} -- cgit v1.2.1