diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-14 13:41:38 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-14 13:41:38 -0200 |
| commit | 097edd388494bf8d294adb101b9c5fda688813e1 (patch) | |
| tree | ecf43d85ab01e5c939ae7b125befc15b9fa23c27 /lauxlib.h | |
| parent | 5c5d9b27031f0a7fcf61df86cd242105c38485d6 (diff) | |
| download | lua-097edd388494bf8d294adb101b9c5fda688813e1.tar.gz lua-097edd388494bf8d294adb101b9c5fda688813e1.tar.bz2 lua-097edd388494bf8d294adb101b9c5fda688813e1.zip | |
better names for auxiliar functions
Diffstat (limited to 'lauxlib.h')
| -rw-r--r-- | lauxlib.h | 53 |
1 files changed, 31 insertions, 22 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.h,v 1.53 2002/08/30 20:00:59 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.54 2002/09/16 19:49:45 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 | */ |
| @@ -27,22 +27,21 @@ typedef struct luaL_reg { | |||
| 27 | } luaL_reg; | 27 | } luaL_reg; |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | LUALIB_API void luaL_openlib (lua_State *L, const luaL_reg *l, int nup); | 30 | LUALIB_API void luaL_openlib (lua_State *L, const char *libname, |
| 31 | LUALIB_API void luaL_opennamedlib (lua_State *L, const char *libname, | 31 | const luaL_reg *l, int nup); |
| 32 | const luaL_reg *l, int nup); | ||
| 33 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *e); | 32 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *e); |
| 34 | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e); | 33 | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e); |
| 35 | LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname); | 34 | LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname); |
| 36 | LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg); | 35 | LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg); |
| 37 | LUALIB_API const char *luaL_check_lstr (lua_State *L, int numArg, size_t *l); | 36 | LUALIB_API const char *luaL_checklstring (lua_State *L, int numArg, size_t *l); |
| 38 | LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, | 37 | LUALIB_API const char *luaL_optlstring (lua_State *L, int numArg, |
| 39 | const char *def, size_t *l); | 38 | const char *def, size_t *l); |
| 40 | LUALIB_API lua_Number luaL_check_number (lua_State *L, int numArg); | 39 | LUALIB_API lua_Number luaL_checknumber (lua_State *L, int numArg); |
| 41 | LUALIB_API lua_Number luaL_opt_number (lua_State *L, int nArg, lua_Number def); | 40 | LUALIB_API lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number def); |
| 42 | 41 | ||
| 43 | LUALIB_API void luaL_check_stack (lua_State *L, int sz, const char *msg); | 42 | LUALIB_API void luaL_checkstack (lua_State *L, int sz, const char *msg); |
| 44 | LUALIB_API void luaL_check_type (lua_State *L, int narg, int t); | 43 | LUALIB_API void luaL_checktype (lua_State *L, int narg, int t); |
| 45 | LUALIB_API void luaL_check_any (lua_State *L, int narg); | 44 | LUALIB_API void luaL_checkany (lua_State *L, int narg); |
| 46 | 45 | ||
| 47 | LUALIB_API void luaL_where (lua_State *L, int lvl); | 46 | LUALIB_API void luaL_where (lua_State *L, int lvl); |
| 48 | LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...); | 47 | LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...); |
| @@ -64,14 +63,14 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, | |||
| 64 | ** =============================================================== | 63 | ** =============================================================== |
| 65 | */ | 64 | */ |
| 66 | 65 | ||
| 67 | #define luaL_arg_check(L, cond,numarg,extramsg) if (!(cond)) \ | 66 | #define luaL_argcheck(L, cond,numarg,extramsg) if (!(cond)) \ |
| 68 | luaL_argerror(L, numarg,extramsg) | 67 | luaL_argerror(L, numarg,extramsg) |
| 69 | #define luaL_check_string(L,n) (luaL_check_lstr(L, (n), NULL)) | 68 | #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) |
| 70 | #define luaL_opt_string(L,n,d) (luaL_opt_lstr(L, (n), (d), NULL)) | 69 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) |
| 71 | #define luaL_check_int(L,n) ((int)luaL_check_number(L, n)) | 70 | #define luaL_checkint(L,n) ((int)luaL_checknumber(L, n)) |
| 72 | #define luaL_check_long(L,n) ((long)luaL_check_number(L, n)) | 71 | #define luaL_checklong(L,n) ((long)luaL_checknumber(L, n)) |
| 73 | #define luaL_opt_int(L,n,d) ((int)luaL_opt_number(L, n,d)) | 72 | #define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,d)) |
| 74 | #define luaL_opt_long(L,n,d) ((long)luaL_opt_number(L, n,d)) | 73 | #define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,d)) |
| 75 | 74 | ||
| 76 | 75 | ||
| 77 | /* | 76 | /* |
| @@ -115,14 +114,24 @@ LUALIB_API void luaL_pushresult (luaL_Buffer *B); | |||
| 115 | ** Compatibility macros | 114 | ** Compatibility macros |
| 116 | */ | 115 | */ |
| 117 | 116 | ||
| 118 | #define luaL_checktype luaL_check_type | ||
| 119 | #define luaL_checkany luaL_check_any | ||
| 120 | |||
| 121 | LUALIB_API int lua_dofile (lua_State *L, const char *filename); | 117 | LUALIB_API int lua_dofile (lua_State *L, const char *filename); |
| 122 | LUALIB_API int lua_dostring (lua_State *L, const char *str); | 118 | LUALIB_API int lua_dostring (lua_State *L, const char *str); |
| 123 | LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz, | 119 | LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz, |
| 124 | const char *n); | 120 | const char *n); |
| 125 | 121 | ||
| 122 | /* | ||
| 123 | #define luaL_check_lstr luaL_checklstring | ||
| 124 | #define luaL_opt_lstr luaL_optlstring | ||
| 125 | #define luaL_check_number luaL_checknumber | ||
| 126 | #define luaL_opt_number luaL_optnumber | ||
| 127 | #define luaL_arg_check luaL_argcheck | ||
| 128 | #define luaL_check_string luaL_checkstring | ||
| 129 | #define luaL_opt_string luaL_optstring | ||
| 130 | #define luaL_check_int luaL_checkint | ||
| 131 | #define luaL_check_long luaL_checklong | ||
| 132 | #define luaL_opt_int luaL_optint | ||
| 133 | #define luaL_opt_long luaL_optlong | ||
| 134 | */ | ||
| 126 | 135 | ||
| 127 | #endif | 136 | #endif |
| 128 | 137 | ||
