diff options
| -rw-r--r-- | lauxlib.c | 5 | ||||
| -rw-r--r-- | lauxlib.h | 5 | ||||
| -rw-r--r-- | ldebug.c | 16 | ||||
| -rw-r--r-- | ldo.c | 5 | ||||
| -rw-r--r-- | lua.h | 13 | ||||
| -rw-r--r-- | luadebug.h | 8 |
6 files changed, 23 insertions, 29 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.40 2000/10/20 16:39:03 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.41 2000/10/27 16:15:53 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -75,8 +75,7 @@ LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) { | |||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | 77 | ||
| 78 | LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, | 78 | LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) { |
| 79 | size_t *len) { | ||
| 80 | if (lua_isnull(L, narg)) { | 79 | if (lua_isnull(L, narg)) { |
| 81 | if (len) | 80 | if (len) |
| 82 | *len = (def ? strlen(def) : 0); | 81 | *len = (def ? strlen(def) : 0); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.h,v 1.28 2000/10/20 16:39:03 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.29 2000/10/27 16:15:53 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -29,8 +29,7 @@ struct luaL_reg { | |||
| 29 | LUALIB_API void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n); | 29 | LUALIB_API void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n); |
| 30 | LUALIB_API void luaL_argerror (lua_State *L, int numarg, const char *extramsg); | 30 | LUALIB_API void luaL_argerror (lua_State *L, int numarg, const char *extramsg); |
| 31 | LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, size_t *len); | 31 | LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, size_t *len); |
| 32 | LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, | 32 | LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, size_t *len); |
| 33 | size_t *len); | ||
| 34 | LUALIB_API double luaL_check_number (lua_State *L, int numArg); | 33 | LUALIB_API double luaL_check_number (lua_State *L, int numArg); |
| 35 | LUALIB_API double luaL_opt_number (lua_State *L, int numArg, double def); | 34 | LUALIB_API double luaL_opt_number (lua_State *L, int numArg, double def); |
| 36 | 35 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.48 2000/10/20 16:39:03 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.49 2000/10/27 11:39:52 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -148,29 +148,27 @@ static Proto *getluaproto (StkId f) { | |||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | 150 | ||
| 151 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, | 151 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { |
| 152 | int localnum) { | ||
| 153 | const char *name; | 152 | const char *name; |
| 154 | StkId f = ar->_func; | 153 | StkId f = ar->_func; |
| 155 | Proto *fp = getluaproto(f); | 154 | Proto *fp = getluaproto(f); |
| 156 | if (!fp) return NULL; /* `f' is not a Lua function? */ | 155 | if (!fp) return NULL; /* `f' is not a Lua function? */ |
| 157 | name = luaF_getlocalname(fp, localnum, currentpc(f)); | 156 | name = luaF_getlocalname(fp, n, currentpc(f)); |
| 158 | if (!name) return NULL; | 157 | if (!name) return NULL; |
| 159 | luaA_pushobject(L, (f+1)+(localnum-1)); /* push value */ | 158 | luaA_pushobject(L, (f+1)+(n-1)); /* push value */ |
| 160 | return name; | 159 | return name; |
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | 162 | ||
| 164 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, | 163 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { |
| 165 | int localnum) { | ||
| 166 | const char *name; | 164 | const char *name; |
| 167 | StkId f = ar->_func; | 165 | StkId f = ar->_func; |
| 168 | Proto *fp = getluaproto(f); | 166 | Proto *fp = getluaproto(f); |
| 169 | L->top--; /* pop new value */ | 167 | L->top--; /* pop new value */ |
| 170 | if (!fp) return NULL; /* `f' is not a Lua function? */ | 168 | if (!fp) return NULL; /* `f' is not a Lua function? */ |
| 171 | name = luaF_getlocalname(fp, localnum, currentpc(f)); | 169 | name = luaF_getlocalname(fp, n, currentpc(f)); |
| 172 | if (!name || name[0] == '(') return NULL; /* `(' starts private locals */ | 170 | if (!name || name[0] == '(') return NULL; /* `(' starts private locals */ |
| 173 | *((f+1)+(localnum-1)) = *L->top; | 171 | *((f+1)+(n-1)) = *L->top; |
| 174 | return name; | 172 | return name; |
| 175 | } | 173 | } |
| 176 | 174 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.107 2000/10/10 19:51:39 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.108 2000/10/20 16:39:03 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -301,8 +301,7 @@ static int parse_buffer (lua_State *L, const char *buff, size_t size, | |||
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | 303 | ||
| 304 | LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, | 304 | LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name) { |
| 305 | const char *name) { | ||
| 306 | int status = parse_buffer(L, buff, size, name); | 305 | int status = parse_buffer(L, buff, size, name); |
| 307 | if (status == 0) /* parse OK? */ | 306 | if (status == 0) /* parse OK? */ |
| 308 | status = lua_call(L, 0, LUA_MULTRET); /* call main */ | 307 | status = lua_call(L, 0, LUA_MULTRET); /* call main */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.76 2000/10/24 19:12:06 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.77 2000/10/26 12:47:05 roberto Exp roberto $ |
| 3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
| 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
| 5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
| @@ -16,16 +16,18 @@ | |||
| 16 | #include <stddef.h> | 16 | #include <stddef.h> |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | /* mark for all API functions */ | ||
| 19 | #ifndef LUA_API | 20 | #ifndef LUA_API |
| 20 | #define LUA_API extern | 21 | #define LUA_API extern |
| 21 | #endif | 22 | #endif |
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | #define LUA_VERSION "Lua 4.0 (beta)" | 25 | #define LUA_VERSION "Lua 4.0" |
| 25 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" | 26 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" |
| 26 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" | 27 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" |
| 27 | 28 | ||
| 28 | 29 | ||
| 30 | /* name of global variable with error handler */ | ||
| 29 | #define LUA_ERRORMESSAGE "_ERRORMESSAGE" | 31 | #define LUA_ERRORMESSAGE "_ERRORMESSAGE" |
| 30 | 32 | ||
| 31 | 33 | ||
| @@ -39,9 +41,11 @@ | |||
| 39 | #define LUA_NOTAG (-2) | 41 | #define LUA_NOTAG (-2) |
| 40 | 42 | ||
| 41 | 43 | ||
| 44 | /* option for multiple returns in lua_call */ | ||
| 42 | #define LUA_MULTRET (-1) | 45 | #define LUA_MULTRET (-1) |
| 43 | 46 | ||
| 44 | 47 | ||
| 48 | /* minimum stack avaiable for a C function */ | ||
| 45 | #define LUA_MINSTACK 20 | 49 | #define LUA_MINSTACK 20 |
| 46 | 50 | ||
| 47 | 51 | ||
| @@ -131,9 +135,7 @@ LUA_API void lua_rawget (lua_State *L, int index); | |||
| 131 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); | 135 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); |
| 132 | LUA_API void lua_getglobals (lua_State *L); | 136 | LUA_API void lua_getglobals (lua_State *L); |
| 133 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event); | 137 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event); |
| 134 | |||
| 135 | LUA_API int lua_getref (lua_State *L, int ref); | 138 | LUA_API int lua_getref (lua_State *L, int ref); |
| 136 | |||
| 137 | LUA_API void lua_newtable (lua_State *L); | 139 | LUA_API void lua_newtable (lua_State *L); |
| 138 | 140 | ||
| 139 | 141 | ||
| @@ -156,8 +158,7 @@ LUA_API int lua_call (lua_State *L, int nargs, int nresults); | |||
| 156 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults); | 158 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults); |
| 157 | LUA_API int lua_dofile (lua_State *L, const char *filename); | 159 | LUA_API int lua_dofile (lua_State *L, const char *filename); |
| 158 | LUA_API int lua_dostring (lua_State *L, const char *str); | 160 | LUA_API int lua_dostring (lua_State *L, const char *str); |
| 159 | LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, | 161 | LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name); |
| 160 | const char *name); | ||
| 161 | 162 | ||
| 162 | /* | 163 | /* |
| 163 | ** Garbage-collection functions | 164 | ** Garbage-collection functions |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luadebug.h,v 1.15 2000/09/12 18:38:02 roberto Exp roberto $ | 2 | ** $Id: luadebug.h,v 1.16 2000/10/20 16:39:03 roberto Exp roberto $ |
| 3 | ** Debugging API | 3 | ** Debugging API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -19,10 +19,8 @@ typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); | |||
| 19 | 19 | ||
| 20 | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); | 20 | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); |
| 21 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); | 21 | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); |
| 22 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, | 22 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); |
| 23 | int localnum); | 23 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); |
| 24 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, | ||
| 25 | int localnum); | ||
| 26 | 24 | ||
| 27 | LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func); | 25 | LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func); |
| 28 | LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func); | 26 | LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func); |
