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
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** 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_CFunction old;
|
||||||
lua_lock(L);
|
lua_lock(L);
|
||||||
old = G(L)->panic;
|
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) {
|
const char *chunkname) {
|
||||||
ZIO z;
|
ZIO z;
|
||||||
int status;
|
int status;
|
||||||
int c;
|
int c;
|
||||||
lua_lock(L);
|
lua_lock(L);
|
||||||
if (!chunkname) chunkname = "?";
|
if (!chunkname) chunkname = "?";
|
||||||
luaZ_init(&z, getblock, ud, chunkname);
|
luaZ_init(&z, reader, data, chunkname);
|
||||||
c = luaZ_lookahead(&z);
|
c = luaZ_lookahead(&z);
|
||||||
status = luaD_protectedparser(L, &z, (c == LUA_SIGNATURE[0]));
|
status = luaD_protectedparser(L, &z, (c == LUA_SIGNATURE[0]));
|
||||||
lua_unlock(L);
|
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
|
** Lua stand-alone interpreter
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -370,7 +370,7 @@ int main (int argc, char *argv[]) {
|
||||||
int toclose = 0;
|
int toclose = 0;
|
||||||
(void)argc; /* to avoid warnings */
|
(void)argc; /* to avoid warnings */
|
||||||
L = lua_open(); /* create state */
|
L = lua_open(); /* create state */
|
||||||
lua_setpanicf(L, l_panic);
|
lua_atpanic(L, l_panic);
|
||||||
LUA_USERINIT(L); /* open libraries */
|
LUA_USERINIT(L); /* open libraries */
|
||||||
register_own(argv); /* create own function */
|
register_own(argv); /* create own function */
|
||||||
status = handle_luainit();
|
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
|
** Lua - An Extensible Extension Language
|
||||||
** Tecgraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||||
** e-mail: info@lua.org
|
** http://www.lua.org mailto:info@lua.org
|
||||||
** www: http://www.lua.org
|
|
||||||
** See Copyright Notice at the end of this file
|
** 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)
|
#define LUA_MULTRET (-1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@
|
||||||
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
|
#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_ERRRUN 1
|
||||||
#define LUA_ERRFILE 2
|
#define LUA_ERRFILE 2
|
||||||
#define LUA_ERRSYNTAX 3
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Lua numerical type */
|
/* type of Numbers in Lua */
|
||||||
#ifndef LUA_NUMBER
|
#ifndef LUA_NUMBER
|
||||||
#define LUA_NUMBER double
|
#define LUA_NUMBER double
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,7 +104,7 @@ LUA_API void lua_close (lua_State *L);
|
||||||
LUA_API lua_State *lua_newthread (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 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 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_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);
|
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_isnone(L,n) (lua_type(L,n) == LUA_TNONE)
|
||||||
#define lua_isnoneornil(L, n) (lua_type(L,n) <= 0)
|
#define lua_isnoneornil(L, n) (lua_type(L,n) <= 0)
|
||||||
|
|
||||||
#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \
|
#define lua_pushliteral(L, s) \
|
||||||
(sizeof(s)/sizeof(char))-1)
|
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
|
** a generic input stream interface
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
int luaZ_fill (ZIO *z) {
|
int luaZ_fill (ZIO *z) {
|
||||||
size_t size;
|
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;
|
if (buff == NULL || size == 0) return EOZ;
|
||||||
z->n = size - 1;
|
z->n = size - 1;
|
||||||
z->p = buff;
|
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) {
|
void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name) {
|
||||||
z->getblock = getblock;
|
z->reader = reader;
|
||||||
z->ud = ud;
|
z->data = data;
|
||||||
z->name = name;
|
z->name = name;
|
||||||
z->n = 0;
|
z->n = 0;
|
||||||
z->p = NULL;
|
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
|
** Buffered streams
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -24,7 +24,7 @@ typedef struct zio ZIO;
|
||||||
|
|
||||||
#define zname(z) ((z)->name)
|
#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 */
|
size_t luaZ_zread (ZIO* z, void* b, size_t n); /* read next n bytes */
|
||||||
int luaZ_lookahead (ZIO *z);
|
int luaZ_lookahead (ZIO *z);
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ int luaZ_lookahead (ZIO *z);
|
||||||
struct zio {
|
struct zio {
|
||||||
size_t n; /* bytes still unread */
|
size_t n; /* bytes still unread */
|
||||||
const char *p; /* current position in buffer */
|
const char *p; /* current position in buffer */
|
||||||
lua_Getblock getblock;
|
lua_Chunkreader reader;
|
||||||
void* ud; /* additional data */
|
void* data; /* additional data */
|
||||||
const char *name;
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue