all API functions are declared in a single line (to facilitate pre-processing).

This commit is contained in:
Roberto Ierusalimschy 2000-10-30 10:38:50 -02:00
parent 728ff20701
commit f379d06e24
6 changed files with 23 additions and 29 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.40 2000/10/20 16:39:03 roberto Exp roberto $
** $Id: lauxlib.c,v 1.41 2000/10/27 16:15:53 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -75,8 +75,7 @@ LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) {
}
LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def,
size_t *len) {
LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) {
if (lua_isnull(L, narg)) {
if (len)
*len = (def ? strlen(def) : 0);

View File

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.h,v 1.28 2000/10/20 16:39:03 roberto Exp roberto $
** $Id: lauxlib.h,v 1.29 2000/10/27 16:15:53 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -29,8 +29,7 @@ struct luaL_reg {
LUALIB_API void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n);
LUALIB_API void luaL_argerror (lua_State *L, int numarg, const char *extramsg);
LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, size_t *len);
LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def,
size_t *len);
LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, size_t *len);
LUALIB_API double luaL_check_number (lua_State *L, int numArg);
LUALIB_API double luaL_opt_number (lua_State *L, int numArg, double def);

View File

@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 1.48 2000/10/20 16:39:03 roberto Exp roberto $
** $Id: ldebug.c,v 1.49 2000/10/27 11:39:52 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@ -148,29 +148,27 @@ static Proto *getluaproto (StkId f) {
}
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar,
int localnum) {
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
const char *name;
StkId f = ar->_func;
Proto *fp = getluaproto(f);
if (!fp) return NULL; /* `f' is not a Lua function? */
name = luaF_getlocalname(fp, localnum, currentpc(f));
name = luaF_getlocalname(fp, n, currentpc(f));
if (!name) return NULL;
luaA_pushobject(L, (f+1)+(localnum-1)); /* push value */
luaA_pushobject(L, (f+1)+(n-1)); /* push value */
return name;
}
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar,
int localnum) {
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
const char *name;
StkId f = ar->_func;
Proto *fp = getluaproto(f);
L->top--; /* pop new value */
if (!fp) return NULL; /* `f' is not a Lua function? */
name = luaF_getlocalname(fp, localnum, currentpc(f));
name = luaF_getlocalname(fp, n, currentpc(f));
if (!name || name[0] == '(') return NULL; /* `(' starts private locals */
*((f+1)+(localnum-1)) = *L->top;
*((f+1)+(n-1)) = *L->top;
return name;
}

5
ldo.c
View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 1.107 2000/10/10 19:51:39 roberto Exp roberto $
** $Id: ldo.c,v 1.108 2000/10/20 16:39:03 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@ -301,8 +301,7 @@ static int parse_buffer (lua_State *L, const char *buff, size_t size,
}
LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size,
const char *name) {
LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name) {
int status = parse_buffer(L, buff, size, name);
if (status == 0) /* parse OK? */
status = lua_call(L, 0, LUA_MULTRET); /* call main */

13
lua.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.76 2000/10/24 19:12:06 roberto Exp roberto $
** $Id: lua.h,v 1.77 2000/10/26 12:47:05 roberto Exp roberto $
** Lua - An Extensible Extension Language
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
** e-mail: lua@tecgraf.puc-rio.br
@ -16,16 +16,18 @@
#include <stddef.h>
/* mark for all API functions */
#ifndef LUA_API
#define LUA_API extern
#endif
#define LUA_VERSION "Lua 4.0 (beta)"
#define LUA_VERSION "Lua 4.0"
#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio"
#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
/* name of global variable with error handler */
#define LUA_ERRORMESSAGE "_ERRORMESSAGE"
@ -39,9 +41,11 @@
#define LUA_NOTAG (-2)
/* option for multiple returns in lua_call */
#define LUA_MULTRET (-1)
/* minimum stack avaiable for a C function */
#define LUA_MINSTACK 20
@ -131,9 +135,7 @@ LUA_API void lua_rawget (lua_State *L, int index);
LUA_API void lua_rawgeti (lua_State *L, int index, int n);
LUA_API void lua_getglobals (lua_State *L);
LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event);
LUA_API int lua_getref (lua_State *L, int ref);
LUA_API void lua_newtable (lua_State *L);
@ -156,8 +158,7 @@ LUA_API int lua_call (lua_State *L, int nargs, int nresults);
LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults);
LUA_API int lua_dofile (lua_State *L, const char *filename);
LUA_API int lua_dostring (lua_State *L, const char *str);
LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size,
const char *name);
LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name);
/*
** Garbage-collection functions

View File

@ -1,5 +1,5 @@
/*
** $Id: luadebug.h,v 1.15 2000/09/12 18:38:02 roberto Exp roberto $
** $Id: luadebug.h,v 1.16 2000/10/20 16:39:03 roberto Exp roberto $
** Debugging API
** See Copyright Notice in lua.h
*/
@ -19,10 +19,8 @@ typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar,
int localnum);
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar,
int localnum);
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);
LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);