diff options
| -rw-r--r-- | lauxlib.h | 35 | ||||
| -rw-r--r-- | lua.h | 60 | ||||
| -rw-r--r-- | luadebug.h | 20 |
3 files changed, 61 insertions, 54 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.h,v 1.33 2001/02/02 19:02:40 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.34 2001/02/23 17:17:25 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 | */ |
| @@ -21,25 +21,30 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | typedef struct luaL_reg { | 23 | typedef struct luaL_reg { |
| 24 | const l_char *name; | 24 | const lua_char *name; |
| 25 | lua_CFunction func; | 25 | lua_CFunction func; |
| 26 | } luaL_reg; | 26 | } luaL_reg; |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int n); | 29 | LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int n); |
| 30 | LUALIB_API void luaL_argerror (lua_State *L, int numarg, const l_char *extramsg); | 30 | LUALIB_API void luaL_argerror (lua_State *L, int numarg, |
| 31 | LUALIB_API const l_char *luaL_check_lstr (lua_State *L, int numArg, size_t *len); | 31 | const lua_char *extramsg); |
| 32 | LUALIB_API const l_char *luaL_opt_lstr (lua_State *L, int numArg, const l_char *def, size_t *len); | 32 | LUALIB_API const lua_char *luaL_check_lstr (lua_State *L, int numArg, |
| 33 | size_t *len); | ||
| 34 | LUALIB_API const lua_char *luaL_opt_lstr (lua_State *L, int numArg, | ||
| 35 | const lua_char *def, size_t *len); | ||
| 33 | LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg); | 36 | LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg); |
| 34 | LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def); | 37 | LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def); |
| 35 | 38 | ||
| 36 | LUALIB_API void luaL_checkstack (lua_State *L, int space, const l_char *msg); | 39 | LUALIB_API void luaL_checkstack (lua_State *L, int space, const lua_char *msg); |
| 37 | LUALIB_API void luaL_checktype (lua_State *L, int narg, int t); | 40 | LUALIB_API void luaL_checktype (lua_State *L, int narg, int t); |
| 38 | LUALIB_API void luaL_checkany (lua_State *L, int narg); | 41 | LUALIB_API void luaL_checkany (lua_State *L, int narg); |
| 39 | LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, const l_char *name); | 42 | LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, |
| 43 | const lua_char *name); | ||
| 40 | 44 | ||
| 41 | LUALIB_API void luaL_verror (lua_State *L, const l_char *fmt, ...); | 45 | LUALIB_API void luaL_verror (lua_State *L, const lua_char *fmt, ...); |
| 42 | LUALIB_API int luaL_findstring (const l_char *name, const l_char *const list[]); | 46 | LUALIB_API int luaL_findstring (const lua_char *name, |
| 47 | const lua_char *const list[]); | ||
| 43 | 48 | ||
| 44 | 49 | ||
| 45 | 50 | ||
| @@ -73,22 +78,22 @@ LUALIB_API int luaL_findstring (const l_char *name, const l_char *const list[]); | |||
| 73 | 78 | ||
| 74 | 79 | ||
| 75 | typedef struct luaL_Buffer { | 80 | typedef struct luaL_Buffer { |
| 76 | l_char *p; /* current position in buffer */ | 81 | lua_char *p; /* current position in buffer */ |
| 77 | int level; | 82 | int level; |
| 78 | lua_State *L; | 83 | lua_State *L; |
| 79 | l_char buffer[LUAL_BUFFERSIZE]; | 84 | lua_char buffer[LUAL_BUFFERSIZE]; |
| 80 | } luaL_Buffer; | 85 | } luaL_Buffer; |
| 81 | 86 | ||
| 82 | #define luaL_putchar(B,c) \ | 87 | #define luaL_putchar(B,c) \ |
| 83 | ((void)((B)->p < &(B)->buffer[LUAL_BUFFERSIZE] || luaL_prepbuffer(B)), \ | 88 | ((void)((B)->p < &(B)->buffer[LUAL_BUFFERSIZE] || luaL_prepbuffer(B)), \ |
| 84 | (*(B)->p++ = (l_char)(c))) | 89 | (*(B)->p++ = (lua_char)(c))) |
| 85 | 90 | ||
| 86 | #define luaL_addsize(B,n) ((B)->p += (n)) | 91 | #define luaL_addsize(B,n) ((B)->p += (n)) |
| 87 | 92 | ||
| 88 | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B); | 93 | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B); |
| 89 | LUALIB_API l_char *luaL_prepbuffer (luaL_Buffer *B); | 94 | LUALIB_API lua_char *luaL_prepbuffer (luaL_Buffer *B); |
| 90 | LUALIB_API void luaL_addlstring (luaL_Buffer *B, const l_char *s, size_t l); | 95 | LUALIB_API void luaL_addlstring (luaL_Buffer *B, const lua_char *s, size_t l); |
| 91 | LUALIB_API void luaL_addstring (luaL_Buffer *B, const l_char *s); | 96 | LUALIB_API void luaL_addstring (luaL_Buffer *B, const lua_char *s); |
| 92 | LUALIB_API void luaL_addvalue (luaL_Buffer *B); | 97 | LUALIB_API void luaL_addvalue (luaL_Buffer *B); |
| 93 | LUALIB_API void luaL_pushresult (luaL_Buffer *B); | 98 | LUALIB_API void luaL_pushresult (luaL_Buffer *B); |
| 94 | 99 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.91 2001/03/09 18:05:05 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.92 2001/03/26 14:31:49 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 |
| @@ -86,7 +86,7 @@ typedef LUA_NUMBER lua_Number; | |||
| 86 | #ifndef L_CHAR | 86 | #ifndef L_CHAR |
| 87 | #define L_CHAR char | 87 | #define L_CHAR char |
| 88 | #endif | 88 | #endif |
| 89 | typedef L_CHAR l_char; | 89 | typedef L_CHAR lua_char; |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | /* mark for all API functions */ | 92 | /* mark for all API functions */ |
| @@ -117,23 +117,23 @@ LUA_API int lua_stackspace (lua_State *L); | |||
| 117 | ** access functions (stack -> C) | 117 | ** access functions (stack -> C) |
| 118 | */ | 118 | */ |
| 119 | 119 | ||
| 120 | LUA_API int lua_type (lua_State *L, int index); | 120 | LUA_API int lua_type (lua_State *L, int index); |
| 121 | LUA_API const l_char *lua_typename (lua_State *L, int t); | 121 | LUA_API const lua_char *lua_typename (lua_State *L, int t); |
| 122 | LUA_API const l_char *lua_xtype (lua_State *L, int index); | 122 | LUA_API const lua_char *lua_xtype (lua_State *L, int index); |
| 123 | LUA_API int lua_isnumber (lua_State *L, int index); | 123 | LUA_API int lua_isnumber (lua_State *L, int index); |
| 124 | LUA_API int lua_isstring (lua_State *L, int index); | 124 | LUA_API int lua_isstring (lua_State *L, int index); |
| 125 | LUA_API int lua_iscfunction (lua_State *L, int index); | 125 | LUA_API int lua_iscfunction (lua_State *L, int index); |
| 126 | LUA_API int lua_tag (lua_State *L, int index); | 126 | LUA_API int lua_tag (lua_State *L, int index); |
| 127 | 127 | ||
| 128 | LUA_API int lua_equal (lua_State *L, int index1, int index2); | 128 | LUA_API int lua_equal (lua_State *L, int index1, int index2); |
| 129 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2); | 129 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2); |
| 130 | 130 | ||
| 131 | LUA_API lua_Number lua_tonumber (lua_State *L, int index); | 131 | LUA_API lua_Number lua_tonumber (lua_State *L, int index); |
| 132 | LUA_API const l_char *lua_tostring (lua_State *L, int index); | 132 | LUA_API const lua_char *lua_tostring (lua_State *L, int index); |
| 133 | LUA_API size_t lua_strlen (lua_State *L, int index); | 133 | LUA_API size_t lua_strlen (lua_State *L, int index); |
| 134 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index); | 134 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index); |
| 135 | LUA_API void *lua_touserdata (lua_State *L, int index); | 135 | LUA_API void *lua_touserdata (lua_State *L, int index); |
| 136 | LUA_API const void *lua_topointer (lua_State *L, int index); | 136 | LUA_API const void *lua_topointer (lua_State *L, int index); |
| 137 | 137 | ||
| 138 | 138 | ||
| 139 | /* | 139 | /* |
| @@ -141,8 +141,8 @@ LUA_API const void *lua_topointer (lua_State *L, int index); | |||
| 141 | */ | 141 | */ |
| 142 | LUA_API void lua_pushnil (lua_State *L); | 142 | LUA_API void lua_pushnil (lua_State *L); |
| 143 | LUA_API void lua_pushnumber (lua_State *L, lua_Number n); | 143 | LUA_API void lua_pushnumber (lua_State *L, lua_Number n); |
| 144 | LUA_API void lua_pushlstring (lua_State *L, const l_char *s, size_t len); | 144 | LUA_API void lua_pushlstring (lua_State *L, const lua_char *s, size_t len); |
| 145 | LUA_API void lua_pushstring (lua_State *L, const l_char *s); | 145 | LUA_API void lua_pushstring (lua_State *L, const lua_char *s); |
| 146 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); | 146 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); |
| 147 | LUA_API int lua_pushuserdata (lua_State *L, void *u); | 147 | LUA_API int lua_pushuserdata (lua_State *L, void *u); |
| 148 | 148 | ||
| @@ -150,12 +150,12 @@ LUA_API int lua_pushuserdata (lua_State *L, void *u); | |||
| 150 | /* | 150 | /* |
| 151 | ** get functions (Lua -> stack) | 151 | ** get functions (Lua -> stack) |
| 152 | */ | 152 | */ |
| 153 | LUA_API void lua_getglobal (lua_State *L, const l_char *name); | 153 | LUA_API void lua_getglobal (lua_State *L, const lua_char *name); |
| 154 | LUA_API void lua_gettable (lua_State *L, int index); | 154 | LUA_API void lua_gettable (lua_State *L, int index); |
| 155 | LUA_API void lua_rawget (lua_State *L, int index); | 155 | LUA_API void lua_rawget (lua_State *L, int index); |
| 156 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); | 156 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); |
| 157 | LUA_API void lua_getglobals (lua_State *L); | 157 | LUA_API void lua_getglobals (lua_State *L); |
| 158 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const l_char *event); | 158 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event); |
| 159 | LUA_API int lua_getref (lua_State *L, int ref); | 159 | LUA_API int lua_getref (lua_State *L, int ref); |
| 160 | LUA_API void lua_newtable (lua_State *L); | 160 | LUA_API void lua_newtable (lua_State *L); |
| 161 | 161 | ||
| @@ -163,12 +163,12 @@ LUA_API void lua_newtable (lua_State *L); | |||
| 163 | /* | 163 | /* |
| 164 | ** set functions (stack -> Lua) | 164 | ** set functions (stack -> Lua) |
| 165 | */ | 165 | */ |
| 166 | LUA_API void lua_setglobal (lua_State *L, const l_char *name); | 166 | LUA_API void lua_setglobal (lua_State *L, const lua_char *name); |
| 167 | LUA_API void lua_settable (lua_State *L, int index); | 167 | LUA_API void lua_settable (lua_State *L, int index); |
| 168 | LUA_API void lua_rawset (lua_State *L, int index); | 168 | LUA_API void lua_rawset (lua_State *L, int index); |
| 169 | LUA_API void lua_rawseti (lua_State *L, int index, int n); | 169 | LUA_API void lua_rawseti (lua_State *L, int index, int n); |
| 170 | LUA_API void lua_setglobals (lua_State *L); | 170 | LUA_API void lua_setglobals (lua_State *L); |
| 171 | LUA_API void lua_settagmethod (lua_State *L, int tag, const l_char *event); | 171 | LUA_API void lua_settagmethod (lua_State *L, int tag, const lua_char *event); |
| 172 | LUA_API int lua_ref (lua_State *L, int lock); | 172 | LUA_API int lua_ref (lua_State *L, int lock); |
| 173 | 173 | ||
| 174 | 174 | ||
| @@ -177,10 +177,10 @@ LUA_API int lua_ref (lua_State *L, int lock); | |||
| 177 | */ | 177 | */ |
| 178 | LUA_API int lua_call (lua_State *L, int nargs, int nresults); | 178 | LUA_API int lua_call (lua_State *L, int nargs, int nresults); |
| 179 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults); | 179 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults); |
| 180 | LUA_API int lua_dofile (lua_State *L, const l_char *filename); | 180 | LUA_API int lua_dofile (lua_State *L, const lua_char *filename); |
| 181 | LUA_API int lua_dostring (lua_State *L, const l_char *str); | 181 | LUA_API int lua_dostring (lua_State *L, const lua_char *str); |
| 182 | LUA_API int lua_dobuffer (lua_State *L, const l_char *buff, size_t size, | 182 | LUA_API int lua_dobuffer (lua_State *L, const lua_char *buff, size_t size, |
| 183 | const l_char *name); | 183 | const lua_char *name); |
| 184 | 184 | ||
| 185 | /* | 185 | /* |
| 186 | ** Garbage-collection functions | 186 | ** Garbage-collection functions |
| @@ -192,12 +192,12 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold); | |||
| 192 | /* | 192 | /* |
| 193 | ** miscellaneous functions | 193 | ** miscellaneous functions |
| 194 | */ | 194 | */ |
| 195 | LUA_API int lua_newtype (lua_State *L, const l_char *name, int basictype); | 195 | LUA_API int lua_newtype (lua_State *L, const lua_char *name, int basictype); |
| 196 | LUA_API int lua_type2tag (lua_State *L, const l_char *name); | 196 | LUA_API int lua_type2tag (lua_State *L, const lua_char *name); |
| 197 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); | 197 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); |
| 198 | LUA_API void lua_settag (lua_State *L, int tag); | 198 | LUA_API void lua_settag (lua_State *L, int tag); |
| 199 | 199 | ||
| 200 | LUA_API void lua_error (lua_State *L, const l_char *s); | 200 | LUA_API void lua_error (lua_State *L, const lua_char *s); |
| 201 | 201 | ||
| 202 | LUA_API void lua_unref (lua_State *L, int ref); | 202 | LUA_API void lua_unref (lua_State *L, int ref); |
| 203 | 203 | ||
| @@ -233,7 +233,7 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size); | |||
| 233 | #define lua_getregistry(L) lua_getref(L, LUA_REFREGISTRY) | 233 | #define lua_getregistry(L) lua_getref(L, LUA_REFREGISTRY) |
| 234 | 234 | ||
| 235 | #define lua_pushliteral(L, s) lua_pushlstring(L, s, \ | 235 | #define lua_pushliteral(L, s) lua_pushlstring(L, s, \ |
| 236 | (sizeof(s)/sizeof(l_char))-1) | 236 | (sizeof(s)/sizeof(lua_char))-1) |
| 237 | 237 | ||
| 238 | 238 | ||
| 239 | 239 | ||
| @@ -249,6 +249,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size); | |||
| 249 | */ | 249 | */ |
| 250 | #ifdef LUA_PRIVATE | 250 | #ifdef LUA_PRIVATE |
| 251 | 251 | ||
| 252 | #define l_char lua_char | ||
| 253 | |||
| 252 | /* macro to control type of literal strings */ | 254 | /* macro to control type of literal strings */ |
| 253 | #ifndef l_s | 255 | #ifndef l_s |
| 254 | #define l_s(x) x | 256 | #define l_s(x) x |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luadebug.h,v 1.18 2001/02/23 17:17:25 roberto Exp roberto $ | 2 | ** $Id: luadebug.h,v 1.19 2001/03/07 18:09:25 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 | */ |
| @@ -18,9 +18,9 @@ typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); | |||
| 18 | 18 | ||
| 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 l_char *what, lua_Debug *ar); | 21 | LUA_API int lua_getinfo (lua_State *L, const lua_char *what, lua_Debug *ar); |
| 22 | LUA_API const l_char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); | 22 | LUA_API const lua_char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); |
| 23 | LUA_API const l_char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); | 23 | LUA_API const lua_char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); |
| 24 | 24 | ||
| 25 | 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); |
| 26 | 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); |
| @@ -29,15 +29,15 @@ LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func); | |||
| 29 | #define LUA_IDSIZE 60 | 29 | #define LUA_IDSIZE 60 |
| 30 | 30 | ||
| 31 | struct lua_Debug { | 31 | struct lua_Debug { |
| 32 | const l_char *event; /* `call', `return' */ | 32 | const lua_char *event; /* `call', `return' */ |
| 33 | int currentline; /* (l) */ | 33 | int currentline; /* (l) */ |
| 34 | const l_char *name; /* (n) */ | 34 | const lua_char *name; /* (n) */ |
| 35 | const l_char *namewhat; /* (n) `global', `tag method', `local', `field' */ | 35 | const lua_char *namewhat; /* (n) `global', `tag method', `local', `field' */ |
| 36 | int nups; /* (u) number of upvalues */ | 36 | int nups; /* (u) number of upvalues */ |
| 37 | int linedefined; /* (S) */ | 37 | int linedefined; /* (S) */ |
| 38 | const l_char *what; /* (S) `Lua' function, `C' function, Lua `main' */ | 38 | const lua_char *what; /* (S) `Lua' function, `C' function, Lua `main' */ |
| 39 | const l_char *source; /* (S) */ | 39 | const lua_char *source; /* (S) */ |
| 40 | l_char short_src[LUA_IDSIZE]; /* (S) */ | 40 | lua_char short_src[LUA_IDSIZE]; /* (S) */ |
| 41 | /* private part */ | 41 | /* private part */ |
| 42 | struct CallInfo *_ci; /* active function */ | 42 | struct CallInfo *_ci; /* active function */ |
| 43 | }; | 43 | }; |
