mirror of https://github.com/rusefi/lua.git
names & names
This commit is contained in:
parent
f1c43bbe19
commit
16f4723398
8
lapi.c
8
lapi.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lapi.c,v 1.194 2002/06/03 17:46:34 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 1.195 2002/06/03 20:11:07 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -100,7 +100,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) {
|
|||
}
|
||||
|
||||
|
||||
LUA_API lua_CFunction lua_setpanicf (lua_State *L, lua_CFunction panicf) {
|
||||
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
|
||||
lua_CFunction old;
|
||||
lua_lock(L);
|
||||
old = G(L)->panic;
|
||||
|
@ -563,14 +563,14 @@ LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errf) {
|
|||
}
|
||||
|
||||
|
||||
LUA_API int lua_load (lua_State *L, lua_Getblock getblock, void *ud,
|
||||
LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data,
|
||||
const char *chunkname) {
|
||||
ZIO z;
|
||||
int status;
|
||||
int c;
|
||||
lua_lock(L);
|
||||
if (!chunkname) chunkname = "?";
|
||||
luaZ_init(&z, getblock, ud, chunkname);
|
||||
luaZ_init(&z, reader, data, chunkname);
|
||||
c = luaZ_lookahead(&z);
|
||||
status = luaD_protectedparser(L, &z, (c == LUA_SIGNATURE[0]));
|
||||
lua_unlock(L);
|
||||
|
|
4
lua.c
4
lua.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lua.c,v 1.88 2002/05/23 19:43:04 roberto Exp roberto $
|
||||
** $Id: lua.c,v 1.89 2002/06/03 20:11:41 roberto Exp roberto $
|
||||
** Lua stand-alone interpreter
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -370,7 +370,7 @@ int main (int argc, char *argv[]) {
|
|||
int toclose = 0;
|
||||
(void)argc; /* to avoid warnings */
|
||||
L = lua_open(); /* create state */
|
||||
lua_setpanicf(L, l_panic);
|
||||
lua_atpanic(L, l_panic);
|
||||
LUA_USERINIT(L); /* open libraries */
|
||||
register_own(argv); /* create own function */
|
||||
status = handle_luainit();
|
||||
|
|
25
lua.h
25
lua.h
|
@ -1,9 +1,8 @@
|
|||
/*
|
||||
** $Id: lua.h,v 1.136 2002/06/03 20:11:07 roberto Exp roberto $
|
||||
** $Id: lua.h,v 1.137 2002/06/05 12:34:19 roberto Exp roberto $
|
||||
** Lua - An Extensible Extension Language
|
||||
** Tecgraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
||||
** e-mail: info@lua.org
|
||||
** www: http://www.lua.org
|
||||
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||
** http://www.lua.org mailto:info@lua.org
|
||||
** See Copyright Notice at the end of this file
|
||||
*/
|
||||
|
||||
|
@ -26,7 +25,7 @@
|
|||
|
||||
|
||||
|
||||
/* option for multiple returns in `lua_call' */
|
||||
/* option for multiple returns in `lua_pcall' and `lua_rawcall' */
|
||||
#define LUA_MULTRET (-1)
|
||||
|
||||
|
||||
|
@ -38,7 +37,7 @@
|
|||
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
|
||||
|
||||
|
||||
/* error codes for `lua_load*' and `lua_pcall' */
|
||||
/* error codes for `lua_load' and `lua_pcall' */
|
||||
#define LUA_ERRRUN 1
|
||||
#define LUA_ERRFILE 2
|
||||
#define LUA_ERRSYNTAX 3
|
||||
|
@ -52,9 +51,9 @@ typedef int (*lua_CFunction) (lua_State *L);
|
|||
|
||||
|
||||
/*
|
||||
** function for loading Lua code
|
||||
** functions that read blocks when loading Lua chunk
|
||||
*/
|
||||
typedef const char * (*lua_Getblock) (void *ud, size_t *size);
|
||||
typedef const char * (*lua_Chunkreader) (void *ud, size_t *size);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -84,7 +83,7 @@ typedef const char * (*lua_Getblock) (void *ud, size_t *size);
|
|||
#endif
|
||||
|
||||
|
||||
/* Lua numerical type */
|
||||
/* type of Numbers in Lua */
|
||||
#ifndef LUA_NUMBER
|
||||
#define LUA_NUMBER double
|
||||
#endif
|
||||
|
@ -105,7 +104,7 @@ LUA_API void lua_close (lua_State *L);
|
|||
LUA_API lua_State *lua_newthread (lua_State *L);
|
||||
LUA_API void lua_closethread (lua_State *L, lua_State *thread);
|
||||
|
||||
LUA_API lua_CFunction lua_setpanicf (lua_State *L, lua_CFunction panicf);
|
||||
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -181,7 +180,7 @@ LUA_API void lua_setmetatable (lua_State *L, int objindex);
|
|||
*/
|
||||
LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults);
|
||||
LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errf);
|
||||
LUA_API int lua_load (lua_State *L, lua_Getblock getblock, void *ud,
|
||||
LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data,
|
||||
const char *chunkname);
|
||||
|
||||
|
||||
|
@ -244,8 +243,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size);
|
|||
#define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE)
|
||||
#define lua_isnoneornil(L, n) (lua_type(L,n) <= 0)
|
||||
|
||||
#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \
|
||||
(sizeof(s)/sizeof(char))-1)
|
||||
#define lua_pushliteral(L, s) \
|
||||
lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
|
||||
|
||||
|
||||
|
||||
|
|
10
lzio.c
10
lzio.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lzio.c,v 1.17 2002/06/03 17:46:34 roberto Exp roberto $
|
||||
** $Id: lzio.c,v 1.18 2002/06/03 20:11:07 roberto Exp roberto $
|
||||
** a generic input stream interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
int luaZ_fill (ZIO *z) {
|
||||
size_t size;
|
||||
const char *buff = z->getblock(z->ud, &size);
|
||||
const char *buff = z->reader(z->data, &size);
|
||||
if (buff == NULL || size == 0) return EOZ;
|
||||
z->n = size - 1;
|
||||
z->p = buff;
|
||||
|
@ -35,9 +35,9 @@ int luaZ_lookahead (ZIO *z) {
|
|||
}
|
||||
|
||||
|
||||
void luaZ_init (ZIO *z, lua_Getblock getblock, void *ud, const char *name) {
|
||||
z->getblock = getblock;
|
||||
z->ud = ud;
|
||||
void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name) {
|
||||
z->reader = reader;
|
||||
z->data = data;
|
||||
z->name = name;
|
||||
z->n = 0;
|
||||
z->p = NULL;
|
||||
|
|
8
lzio.h
8
lzio.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lzio.h,v 1.10 2002/06/03 17:46:34 roberto Exp roberto $
|
||||
** $Id: lzio.h,v 1.11 2002/06/03 20:11:07 roberto Exp roberto $
|
||||
** Buffered streams
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@ typedef struct zio ZIO;
|
|||
|
||||
#define zname(z) ((z)->name)
|
||||
|
||||
void luaZ_init (ZIO *z, lua_Getblock getblock, void *ud, const char *name);
|
||||
void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name);
|
||||
size_t luaZ_zread (ZIO* z, void* b, size_t n); /* read next n bytes */
|
||||
int luaZ_lookahead (ZIO *z);
|
||||
|
||||
|
@ -34,8 +34,8 @@ int luaZ_lookahead (ZIO *z);
|
|||
struct zio {
|
||||
size_t n; /* bytes still unread */
|
||||
const char *p; /* current position in buffer */
|
||||
lua_Getblock getblock;
|
||||
void* ud; /* additional data */
|
||||
lua_Chunkreader reader;
|
||||
void* data; /* additional data */
|
||||
const char *name;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue