diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/include/lauxlib.h | 117 | ||||
-rw-r--r-- | lua/include/lua.h | 248 | ||||
-rw-r--r-- | lua/include/lualib.h | 23 |
3 files changed, 259 insertions, 129 deletions
diff --git a/lua/include/lauxlib.h b/lua/include/lauxlib.h index 24bf673ec..1b595503f 100644 --- a/lua/include/lauxlib.h +++ b/lua/include/lauxlib.h @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.h,v 1.1 2004/03/16 21:58:30 niemeyer Exp $ +** $Id: lauxlib.h,v 1.2 2004/03/23 02:27:55 jbj Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -22,45 +22,71 @@ typedef struct luaL_reg { +/*@null@*/ const char *name; +/*@dependent@*/ /*@null@*/ lua_CFunction func; } luaL_reg; LUALIB_API void luaL_openlib (lua_State *L, const char *libname, - const luaL_reg *l, int nup); -LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *e); -LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e); -LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname); -LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg); -LUALIB_API const char *luaL_checklstring (lua_State *L, int numArg, size_t *l); + const luaL_reg *l, int nup) + /*@*/; +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *e) + /*@*/; +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e) + /*@*/; +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) + /*@*/; +LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg) + /*@*/; +LUALIB_API const char *luaL_checklstring (lua_State *L, int numArg, size_t *l) + /*@*/; LUALIB_API const char *luaL_optlstring (lua_State *L, int numArg, - const char *def, size_t *l); -LUALIB_API lua_Number luaL_checknumber (lua_State *L, int numArg); -LUALIB_API lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number def); - -LUALIB_API void luaL_checkstack (lua_State *L, int sz, const char *msg); -LUALIB_API void luaL_checktype (lua_State *L, int narg, int t); -LUALIB_API void luaL_checkany (lua_State *L, int narg); - -LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname); -LUALIB_API void luaL_getmetatable (lua_State *L, const char *tname); -LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname); - -LUALIB_API void luaL_where (lua_State *L, int lvl); -LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...); - -LUALIB_API int luaL_findstring (const char *st, const char *const lst[]); - -LUALIB_API int luaL_ref (lua_State *L, int t); -LUALIB_API void luaL_unref (lua_State *L, int t, int ref); - -LUALIB_API int luaL_getn (lua_State *L, int t); -LUALIB_API void luaL_setn (lua_State *L, int t, int n); - -LUALIB_API int luaL_loadfile (lua_State *L, const char *filename); + const char *def, size_t *l) + /*@*/; +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int numArg) + /*@*/; +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number def) + /*@*/; + +LUALIB_API void luaL_checkstack (lua_State *L, int sz, const char *msg) + /*@*/; +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) + /*@*/; +LUALIB_API void luaL_checkany (lua_State *L, int narg) + /*@*/; + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) + /*@*/; +LUALIB_API void luaL_getmetatable (lua_State *L, const char *tname) + /*@*/; +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) + /*@*/; + +LUALIB_API void luaL_where (lua_State *L, int lvl) + /*@*/; +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) + /*@*/; + +LUALIB_API int luaL_findstring (const char *st, const char *const lst[]) + /*@*/; + +LUALIB_API int luaL_ref (lua_State *L, int t) + /*@*/; +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) + /*@*/; + +LUALIB_API int luaL_getn (lua_State *L, int t) + /*@*/; +LUALIB_API void luaL_setn (lua_State *L, int t, int n) + /*@*/; + +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) + /*@*/; LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, - const char *name); + const char *name) + /*@*/; @@ -105,12 +131,18 @@ typedef struct luaL_Buffer { #define luaL_addsize(B,n) ((B)->p += (n)) -LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B); -LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B); -LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l); -LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s); -LUALIB_API void luaL_addvalue (luaL_Buffer *B); -LUALIB_API void luaL_pushresult (luaL_Buffer *B); +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) + /*@*/; +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) + /*@*/; +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) + /*@*/; +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) + /*@*/; +LUALIB_API void luaL_addvalue (luaL_Buffer *B) + /*@*/; +LUALIB_API void luaL_pushresult (luaL_Buffer *B) + /*@*/; /* }====================================================== */ @@ -121,10 +153,13 @@ LUALIB_API void luaL_pushresult (luaL_Buffer *B); ** Compatibility macros and functions */ -LUALIB_API int lua_dofile (lua_State *L, const char *filename); -LUALIB_API int lua_dostring (lua_State *L, const char *str); +LUALIB_API int lua_dofile (lua_State *L, const char *filename) + /*@*/; +LUALIB_API int lua_dostring (lua_State *L, const char *str) + /*@*/; LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz, - const char *n); + const char *n) + /*@*/; #define luaL_check_lstr luaL_checklstring diff --git a/lua/include/lua.h b/lua/include/lua.h index 99838f4e0..ff4e97fb7 100644 --- a/lua/include/lua.h +++ b/lua/include/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.2 2004/03/19 21:14:32 niemeyer Exp $ +** $Id: lua.h,v 1.3 2004/03/23 02:27:55 jbj Exp $ ** Lua - An Extensible Extension Language ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil ** http://www.lua.org mailto:info@lua.org @@ -99,125 +99,194 @@ typedef LUA_NUMBER lua_Number; /* ** state manipulation */ -LUA_API lua_State *lua_open (void); -LUA_API void lua_close (lua_State *L); -LUA_API lua_State *lua_newthread (lua_State *L); +LUA_API lua_State *lua_open (void) + /*@*/; +LUA_API void lua_close (lua_State *L) + /*@modifies L @*/; +LUA_API lua_State *lua_newthread (lua_State *L) + /*@modifies L @*/; -LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf); +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) + /*@modifies L @*/; /* ** basic stack manipulation */ -LUA_API int lua_gettop (lua_State *L); -LUA_API void lua_settop (lua_State *L, int idx); -LUA_API void lua_pushvalue (lua_State *L, int idx); -LUA_API void lua_remove (lua_State *L, int idx); -LUA_API void lua_insert (lua_State *L, int idx); -LUA_API void lua_replace (lua_State *L, int idx); -LUA_API int lua_checkstack (lua_State *L, int sz); - -LUA_API void lua_xmove (lua_State *from, lua_State *to, int n); +LUA_API int lua_gettop (lua_State *L) + /*@*/; +LUA_API void lua_settop (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_pushvalue (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_remove (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_insert (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_replace (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API int lua_checkstack (lua_State *L, int sz) + /*@modifies L @*/; + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) + /*@modifies from, to @*/; /* ** access functions (stack -> C) */ -LUA_API int lua_isnumber (lua_State *L, int idx); -LUA_API int lua_isstring (lua_State *L, int idx); -LUA_API int lua_iscfunction (lua_State *L, int idx); -LUA_API int lua_isuserdata (lua_State *L, int idx); -LUA_API int lua_type (lua_State *L, int idx); -LUA_API const char *lua_typename (lua_State *L, int tp); - -LUA_API int lua_equal (lua_State *L, int idx1, int idx2); -LUA_API int lua_rawequal (lua_State *L, int idx1, int idx2); -LUA_API int lua_lessthan (lua_State *L, int idx1, int idx2); - -LUA_API lua_Number lua_tonumber (lua_State *L, int idx); -LUA_API int lua_toboolean (lua_State *L, int idx); -LUA_API const char *lua_tostring (lua_State *L, int idx); -LUA_API size_t lua_strlen (lua_State *L, int idx); -LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx); -LUA_API void *lua_touserdata (lua_State *L, int idx); -LUA_API lua_State *lua_tothread (lua_State *L, int idx); -LUA_API const void *lua_topointer (lua_State *L, int idx); +LUA_API int lua_isnumber (lua_State *L, int idx) + /*@*/; +LUA_API int lua_isstring (lua_State *L, int idx) + /*@*/; +LUA_API int lua_iscfunction (lua_State *L, int idx) + /*@*/; +LUA_API int lua_isuserdata (lua_State *L, int idx) + /*@*/; +LUA_API int lua_type (lua_State *L, int idx) + /*@*/; +/*@observer@*/ +LUA_API const char *lua_typename (lua_State *L, int tp) + /*@*/; + +LUA_API int lua_equal (lua_State *L, int idx1, int idx2) + /*@modifies L @*/; +LUA_API int lua_rawequal (lua_State *L, int idx1, int idx2) + /*@*/; +LUA_API int lua_lessthan (lua_State *L, int idx1, int idx2) + /*@modifies L @*/; + +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) + /*@*/; +LUA_API int lua_toboolean (lua_State *L, int idx) + /*@*/; +/*@observer@*/ +LUA_API const char *lua_tostring (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API size_t lua_strlen (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) + /*@*/; +LUA_API void *lua_touserdata (lua_State *L, int idx) + /*@*/; +LUA_API lua_State *lua_tothread (lua_State *L, int idx) + /*@*/; +LUA_API const void *lua_topointer (lua_State *L, int idx) + /*@*/; /* ** push functions (C -> stack) */ -LUA_API void lua_pushnil (lua_State *L); -LUA_API void lua_pushnumber (lua_State *L, lua_Number n); -LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t l); -LUA_API void lua_pushstring (lua_State *L, const char *s); +LUA_API void lua_pushnil (lua_State *L) + /*@modifies L @*/; +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) + /*@modifies L @*/; +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t l) + /*@modifies L @*/; +LUA_API void lua_pushstring (lua_State *L, const char *s) + /*@modifies L @*/; +/*@observer@*/ LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, - va_list argp); -LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...); -LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); -LUA_API void lua_pushboolean (lua_State *L, int b); -LUA_API void lua_pushlightuserdata (lua_State *L, void *p); + va_list argp) + /*@modifies L @*/; +/*@observer@*/ +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) + /*@modifies L @*/; +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) + /*@modifies L @*/; +LUA_API void lua_pushboolean (lua_State *L, int b) + /*@modifies L @*/; +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) + /*@modifies L @*/; /* ** get functions (Lua -> stack) */ -LUA_API void lua_gettable (lua_State *L, int idx); -LUA_API void lua_rawget (lua_State *L, int idx); -LUA_API void lua_rawgeti (lua_State *L, int idx, int n); -LUA_API void lua_newtable (lua_State *L); -LUA_API void *lua_newuserdata (lua_State *L, size_t sz); -LUA_API int lua_getmetatable (lua_State *L, int objindex); -LUA_API void lua_getfenv (lua_State *L, int idx); +LUA_API void lua_gettable (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_rawget (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) + /*@modifies L @*/; +LUA_API void lua_newtable (lua_State *L) + /*@modifies L @*/; +LUA_API void *lua_newuserdata (lua_State *L, size_t sz) + /*@modifies L @*/; +LUA_API int lua_getmetatable (lua_State *L, int objindex) + /*@modifies L @*/; +LUA_API void lua_getfenv (lua_State *L, int idx) + /*@modifies L @*/; /* ** set functions (stack -> Lua) */ -LUA_API void lua_settable (lua_State *L, int idx); -LUA_API void lua_rawset (lua_State *L, int idx); -LUA_API void lua_rawseti (lua_State *L, int idx, int n); -LUA_API int lua_setmetatable (lua_State *L, int objindex); -LUA_API int lua_setfenv (lua_State *L, int idx); +LUA_API void lua_settable (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_rawset (lua_State *L, int idx) + /*@modifies L @*/; +LUA_API void lua_rawseti (lua_State *L, int idx, int n) + /*@modifies L @*/; +LUA_API int lua_setmetatable (lua_State *L, int objindex) + /*@modifies L @*/; +LUA_API int lua_setfenv (lua_State *L, int idx) + /*@modifies L @*/; /* ** `load' and `call' functions (load and run Lua code) */ -LUA_API void lua_call (lua_State *L, int nargs, int nresults); -LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc); -LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud); +LUA_API void lua_call (lua_State *L, int nargs, int nresults) + /*@modifies L @*/; +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) + /*@modifies L @*/; +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) + /*@modifies L @*/; LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *dt, - const char *chunkname); + const char *chunkname) + /*@modifies L @*/; -LUA_API int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data); +LUA_API int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data) + /*@*/; /* ** coroutine functions */ -LUA_API int lua_yield (lua_State *L, int nresults); -LUA_API int lua_resume (lua_State *L, int narg); +LUA_API int lua_yield (lua_State *L, int nresults) + /*@modifies L @*/; +LUA_API int lua_resume (lua_State *L, int narg) + /*@modifies L @*/; /* ** garbage-collection functions */ -LUA_API int lua_getgcthreshold (lua_State *L); -LUA_API int lua_getgccount (lua_State *L); -LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold); +LUA_API int lua_getgcthreshold (lua_State *L) + /*@*/; +LUA_API int lua_getgccount (lua_State *L) + /*@*/; +LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) + /*@modifies L @*/; /* ** miscellaneous functions */ -LUA_API const char *lua_version (void); +/*@observer@*/ +LUA_API const char *lua_version (void) + /*@*/; -LUA_API int lua_error (lua_State *L); +LUA_API int lua_error (lua_State *L) + /*@modifies L @*/; -LUA_API int lua_next (lua_State *L, int idx); +LUA_API int lua_next (lua_State *L, int idx) + /*@modifies L @*/; -LUA_API void lua_concat (lua_State *L, int n); +LUA_API void lua_concat (lua_State *L, int n) + /*@modifies L @*/; @@ -259,7 +328,8 @@ LUA_API void lua_concat (lua_State *L, int n); */ -LUA_API int lua_pushupvalues (lua_State *L); +LUA_API int lua_pushupvalues (lua_State *L) + /*@modifies L @*/; #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) #define lua_setglobal(L,s) \ @@ -332,26 +402,44 @@ typedef struct lua_Debug lua_Debug; /* activation record */ 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 n); -LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); -LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); - -LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); -LUA_API lua_Hook lua_gethook (lua_State *L); -LUA_API int lua_gethookmask (lua_State *L); -LUA_API int lua_gethookcount (lua_State *L); +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) + /*@modifies L, ar @*/; +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) + /*@modifies L, ar @*/; +/*@observer@*/ +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) + /*@modifies L @*/; +/*@observer@*/ +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) + /*@modifies L @*/; +/*@observer@*/ +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) + /*@modifies L @*/; +/*@observer@*/ +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) + /*@modifies L @*/; + +LUA_API int lua_sethook (lua_State *L, /*@null@*/ lua_Hook func, int mask, int count) + /*@modifies L @*/; +LUA_API lua_Hook lua_gethook (lua_State *L) + /*@modifies L @*/; +LUA_API int lua_gethookmask (lua_State *L) + /*@modifies L @*/; +LUA_API int lua_gethookcount (lua_State *L) + /*@modifies L @*/; #define LUA_IDSIZE 60 struct lua_Debug { int event; +/*@observer@*/ const char *name; /* (n) */ +/*@observer@*/ const char *namewhat; /* (n) `global', `local', `field', `method' */ +/*@observer@*/ const char *what; /* (S) `Lua', `C', `main', `tail' */ +/*@observer@*/ const char *source; /* (S) */ int currentline; /* (l) */ int nups; /* (u) number of upvalues */ diff --git a/lua/include/lualib.h b/lua/include/lualib.h index 8c0218297..29f037e82 100644 --- a/lua/include/lualib.h +++ b/lua/include/lualib.h @@ -1,5 +1,5 @@ /* -** $Id: lualib.h,v 1.1 2004/03/16 21:58:30 niemeyer Exp $ +** $Id: lualib.h,v 1.2 2004/03/23 02:27:55 jbj Exp $ ** Lua standard libraries ** See Copyright Notice in lua.h */ @@ -17,26 +17,33 @@ #define LUA_COLIBNAME "coroutine" -LUALIB_API int luaopen_base (lua_State *L); +LUALIB_API int luaopen_base (lua_State *L) + /*@*/; #define LUA_TABLIBNAME "table" -LUALIB_API int luaopen_table (lua_State *L); +LUALIB_API int luaopen_table (lua_State *L) + /*@*/; #define LUA_IOLIBNAME "io" #define LUA_OSLIBNAME "os" -LUALIB_API int luaopen_io (lua_State *L); +LUALIB_API int luaopen_io (lua_State *L) + /*@*/; #define LUA_STRLIBNAME "string" -LUALIB_API int luaopen_string (lua_State *L); +LUALIB_API int luaopen_string (lua_State *L) + /*@*/; #define LUA_MATHLIBNAME "math" -LUALIB_API int luaopen_math (lua_State *L); +LUALIB_API int luaopen_math (lua_State *L) + /*@*/; #define LUA_DBLIBNAME "debug" -LUALIB_API int luaopen_debug (lua_State *L); +LUALIB_API int luaopen_debug (lua_State *L) + /*@*/; -LUALIB_API int luaopen_loadlib (lua_State *L); +LUALIB_API int luaopen_loadlib (lua_State *L) + /*@*/; /* to help testing the libraries */ |