diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-29 14:24:03 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-29 14:24:03 -0200 |
| commit | 4fbe775154ff281bf9c04cf92d68824a82593402 (patch) | |
| tree | 1333d8526bc4d404af5939cf3d9bc6a6f5bb75a9 | |
| parent | aabefe9d68be29c81e7afe00bf00c5bfbf243dc5 (diff) | |
| download | lua-4fbe775154ff281bf9c04cf92d68824a82593402.tar.gz lua-4fbe775154ff281bf9c04cf92d68824a82593402.tar.bz2 lua-4fbe775154ff281bf9c04cf92d68824a82593402.zip | |
details
| -rw-r--r-- | lauxlib.h | 65 |
1 files changed, 37 insertions, 28 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.h,v 1.15 1999/11/22 17:39:51 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.16 1999/12/03 11:26:23 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 | */ |
| @@ -18,8 +18,37 @@ struct luaL_reg { | |||
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n); | ||
| 22 | void luaL_argerror (lua_State *L, int numarg, const char *extramsg); | ||
| 23 | const char *luaL_check_lstr (lua_State *L, int numArg, long *len); | ||
| 24 | const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, long *len); | ||
| 25 | double luaL_check_number (lua_State *L, int numArg); | ||
| 26 | double luaL_opt_number (lua_State *L, int numArg, double def); | ||
| 27 | lua_Object luaL_functionarg (lua_State *L, int arg); | ||
| 28 | lua_Object luaL_tablearg (lua_State *L, int arg); | ||
| 29 | lua_Object luaL_nonnullarg (lua_State *L, int numArg); | ||
| 30 | void luaL_verror (lua_State *L, const char *fmt, ...); | ||
| 31 | char *luaL_openspace (lua_State *L, int size); | ||
| 32 | void luaL_resetbuffer (lua_State *L); | ||
| 33 | void luaL_addchar (lua_State *L, int c); | ||
| 34 | int luaL_getsize (lua_State *L); | ||
| 35 | void luaL_addsize (lua_State *L, int n); | ||
| 36 | int luaL_newbuffer (lua_State *L, int size); | ||
| 37 | void luaL_oldbuffer (lua_State *L, int old); | ||
| 38 | char *luaL_buffer (lua_State *L); | ||
| 39 | int luaL_findstring (const char *name, const char *const list[]); | ||
| 40 | void luaL_chunkid (char *out, const char *source, int len); | ||
| 41 | void luaL_filesource (char *out, const char *filename, int len); | ||
| 42 | |||
| 43 | |||
| 21 | #ifdef LUA_REENTRANT | 44 | #ifdef LUA_REENTRANT |
| 22 | 45 | ||
| 46 | /* | ||
| 47 | ** =============================================================== | ||
| 48 | ** some useful macros | ||
| 49 | ** =============================================================== | ||
| 50 | */ | ||
| 51 | |||
| 23 | #define luaL_arg_check(L, cond,numarg,extramsg) if (!(cond)) \ | 52 | #define luaL_arg_check(L, cond,numarg,extramsg) if (!(cond)) \ |
| 24 | luaL_argerror(L, numarg,extramsg) | 53 | luaL_argerror(L, numarg,extramsg) |
| 25 | #define luaL_check_string(L,n) (luaL_check_lstr(L, (n), NULL)) | 54 | #define luaL_check_string(L,n) (luaL_check_lstr(L, (n), NULL)) |
| @@ -32,6 +61,13 @@ struct luaL_reg { | |||
| 32 | 61 | ||
| 33 | #else | 62 | #else |
| 34 | 63 | ||
| 64 | |||
| 65 | /* | ||
| 66 | ** =============================================================== | ||
| 67 | ** Macros for single-state use | ||
| 68 | ** =============================================================== | ||
| 69 | */ | ||
| 70 | |||
| 35 | #define luaL_arg_check(cond,numarg,extramsg) if (!(cond)) \ | 71 | #define luaL_arg_check(cond,numarg,extramsg) if (!(cond)) \ |
| 36 | luaL_argerror(numarg,extramsg) | 72 | luaL_argerror(numarg,extramsg) |
| 37 | #define luaL_check_string(n) (luaL_check_lstr((n), NULL)) | 73 | #define luaL_check_string(n) (luaL_check_lstr((n), NULL)) |
| @@ -42,33 +78,6 @@ struct luaL_reg { | |||
| 42 | #define luaL_opt_long(n,d) ((long)luaL_opt_number(n,d)) | 78 | #define luaL_opt_long(n,d) ((long)luaL_opt_number(n,d)) |
| 43 | #define luaL_openl(a) luaL_openlib(a, (sizeof(a)/sizeof(a[0]))) | 79 | #define luaL_openl(a) luaL_openlib(a, (sizeof(a)/sizeof(a[0]))) |
| 44 | 80 | ||
| 45 | #endif | ||
| 46 | |||
| 47 | |||
| 48 | void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n); | ||
| 49 | void luaL_argerror (lua_State *L, int numarg, const char *extramsg); | ||
| 50 | const char *luaL_check_lstr (lua_State *L, int numArg, long *len); | ||
| 51 | const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, long *len); | ||
| 52 | double luaL_check_number (lua_State *L, int numArg); | ||
| 53 | double luaL_opt_number (lua_State *L, int numArg, double def); | ||
| 54 | lua_Object luaL_functionarg (lua_State *L, int arg); | ||
| 55 | lua_Object luaL_tablearg (lua_State *L, int arg); | ||
| 56 | lua_Object luaL_nonnullarg (lua_State *L, int numArg); | ||
| 57 | void luaL_verror (lua_State *L, const char *fmt, ...); | ||
| 58 | char *luaL_openspace (lua_State *L, int size); | ||
| 59 | void luaL_resetbuffer (lua_State *L); | ||
| 60 | void luaL_addchar (lua_State *L, int c); | ||
| 61 | int luaL_getsize (lua_State *L); | ||
| 62 | void luaL_addsize (lua_State *L, int n); | ||
| 63 | int luaL_newbuffer (lua_State *L, int size); | ||
| 64 | void luaL_oldbuffer (lua_State *L, int old); | ||
| 65 | char *luaL_buffer (lua_State *L); | ||
| 66 | int luaL_findstring (const char *name, const char *const list[]); | ||
| 67 | void luaL_chunkid (char *out, const char *source, int len); | ||
| 68 | void luaL_filesource (char *out, const char *filename, int len); | ||
| 69 | |||
| 70 | |||
| 71 | #ifndef LUA_REENTRANT | ||
| 72 | 81 | ||
| 73 | #define luaL_openlib(l,n) (luaL_openlib)(lua_state,l,n) | 82 | #define luaL_openlib(l,n) (luaL_openlib)(lua_state,l,n) |
| 74 | #define luaL_argerror(numarg,extramsg) \ | 83 | #define luaL_argerror(numarg,extramsg) \ |
