Commit 3e81d3ed authored by Vicent Marti's avatar Vicent Marti

lua: Add license to the C wrapper

parent 7d889277
/*
* Copyright 2016 GitHub, Inc
*
* Based on lua.c, the Lua C Interpreter
* Copyright (C) 1994-2012 Lua.org, PUC-Rio. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -11,20 +36,20 @@
static lua_State *globalL = NULL;
static const char *progname = NULL;
static void lstop (lua_State *L, lua_Debug *ar)
static void lstop(lua_State *L, lua_Debug *ar)
{
(void)ar; /* unused arg. */
lua_sethook(L, NULL, 0, 0);
luaL_error(L, "interrupted!");
}
static void laction (int i)
static void laction(int i)
{
signal(i, SIG_DFL);
lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
}
static void l_message (const char *pname, const char *msg)
static void l_message(const char *pname, const char *msg)
{
if (pname) fprintf(stderr, "%s: ", pname);
fprintf(stderr, "%s\n", msg);
......@@ -42,7 +67,7 @@ static int report(lua_State *L, int status)
return status;
}
static int traceback (lua_State *L)
static int traceback(lua_State *L)
{
if (!lua_isstring(L, 1)) /* 'message' not a string? */
return 1; /* keep it intact */
......@@ -62,7 +87,7 @@ static int traceback (lua_State *L)
return 1;
}
static int docall (lua_State *L, int narg, int clear)
static int docall(lua_State *L, int narg, int clear)
{
int status;
int base = lua_gettop(L) - narg; /* function index */
......@@ -77,7 +102,7 @@ static int docall (lua_State *L, int narg, int clear)
return status;
}
static int dolibrary (lua_State *L, const char *name, int clear)
static int dolibrary(lua_State *L, const char *name, int clear)
{
lua_getglobal(L, "require");
lua_pushstring(L, name);
......@@ -156,7 +181,7 @@ static int pmain(lua_State *L)
return 0;
}
int main (int argc, char **argv)
int main(int argc, char **argv)
{
int status;
struct Smain s;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment