Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
3e81d3ed
Commit
3e81d3ed
authored
Mar 31, 2016
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: Add license to the C wrapper
parent
7d889277
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
7 deletions
+32
-7
src/lua/src/main.c
src/lua/src/main.c
+32
-7
No files found.
src/lua/src/main.c
View file @
3e81d3ed
/*
* 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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment