diff options
Diffstat (limited to 'lauxlib.h')
-rw-r--r-- | lauxlib.h | 85 |
1 files changed, 63 insertions, 22 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.h,v 1.12 1999/03/10 14:19:41 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.13 1999/08/16 20:52:00 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,36 +18,77 @@ struct luaL_reg { | |||
18 | }; | 18 | }; |
19 | 19 | ||
20 | 20 | ||
21 | #ifdef LUA_REENTRANT | ||
22 | |||
23 | #define luaL_arg_check(L, cond,numarg,extramsg) if (!(cond)) \ | ||
24 | luaL_argerror(L, numarg,extramsg) | ||
25 | #define luaL_check_string(L, n) (luaL_check_lstr(L, (n), NULL)) | ||
26 | #define luaL_opt_string(L, n, d) (luaL_opt_lstr(L, (n), (d), NULL)) | ||
27 | #define luaL_check_int(L, n) ((int)luaL_check_number(L, n)) | ||
28 | #define luaL_check_long(L, n) ((long)luaL_check_number(L, n)) | ||
29 | #define luaL_opt_int(L, n,d) ((int)luaL_opt_number(L, n,d)) | ||
30 | #define luaL_opt_long(L, n,d) ((long)luaL_opt_number(L, n,d)) | ||
31 | |||
32 | #else | ||
33 | |||
21 | #define luaL_arg_check(cond,numarg,extramsg) if (!(cond)) \ | 34 | #define luaL_arg_check(cond,numarg,extramsg) if (!(cond)) \ |
22 | luaL_argerror(numarg,extramsg) | 35 | luaL_argerror(numarg,extramsg) |
23 | 36 | #define luaL_check_string(n) (luaL_check_lstr((n), NULL)) | |
24 | void luaL_openlib (const struct luaL_reg *l, int n); | 37 | #define luaL_opt_string(n, d) (luaL_opt_lstr((n), (d), NULL)) |
25 | void luaL_argerror (int numarg, const char *extramsg); | ||
26 | #define luaL_check_string(n) (luaL_check_lstr((n), NULL)) | ||
27 | const char *luaL_check_lstr (int numArg, long *len); | ||
28 | #define luaL_opt_string(n, d) (luaL_opt_lstr((n), (d), NULL)) | ||
29 | const char *luaL_opt_lstr (int numArg, const char *def, long *len); | ||
30 | double luaL_check_number (int numArg); | ||
31 | #define luaL_check_int(n) ((int)luaL_check_number(n)) | 38 | #define luaL_check_int(n) ((int)luaL_check_number(n)) |
32 | #define luaL_check_long(n) ((long)luaL_check_number(n)) | 39 | #define luaL_check_long(n) ((long)luaL_check_number(n)) |
33 | double luaL_opt_number (int numArg, double def); | ||
34 | #define luaL_opt_int(n,d) ((int)luaL_opt_number(n,d)) | 40 | #define luaL_opt_int(n,d) ((int)luaL_opt_number(n,d)) |
35 | #define luaL_opt_long(n,d) ((long)luaL_opt_number(n,d)) | 41 | #define luaL_opt_long(n,d) ((long)luaL_opt_number(n,d)) |
36 | lua_Object luaL_functionarg (int arg); | 42 | |
37 | lua_Object luaL_tablearg (int arg); | 43 | #endif |
38 | lua_Object luaL_nonnullarg (int numArg); | 44 | |
39 | void luaL_verror (const char *fmt, ...); | 45 | |
40 | char *luaL_openspace (int size); | 46 | void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n); |
41 | void luaL_resetbuffer (void); | 47 | void luaL_argerror (lua_State *L, int numarg, const char *extramsg); |
42 | void luaL_addchar (int c); | 48 | const char *luaL_check_lstr (lua_State *L, int numArg, long *len); |
43 | int luaL_getsize (void); | 49 | const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, long *len); |
44 | void luaL_addsize (int n); | 50 | double luaL_check_number (lua_State *L, int numArg); |
45 | int luaL_newbuffer (int size); | 51 | double luaL_opt_number (lua_State *L, int numArg, double def); |
46 | void luaL_oldbuffer (int old); | 52 | lua_Object luaL_functionarg (lua_State *L, int arg); |
47 | char *luaL_buffer (void); | 53 | lua_Object luaL_tablearg (lua_State *L, int arg); |
54 | lua_Object luaL_nonnullarg (lua_State *L, int numArg); | ||
55 | void luaL_verror (lua_State *L, const char *fmt, ...); | ||
56 | char *luaL_openspace (lua_State *L, int size); | ||
57 | void luaL_resetbuffer (lua_State *L); | ||
58 | void luaL_addchar (lua_State *L, int c); | ||
59 | int luaL_getsize (lua_State *L); | ||
60 | void luaL_addsize (lua_State *L, int n); | ||
61 | int luaL_newbuffer (lua_State *L, int size); | ||
62 | void luaL_oldbuffer (lua_State *L, int old); | ||
63 | char *luaL_buffer (lua_State *L); | ||
48 | int luaL_findstring (const char *name, const char *const list[]); | 64 | int luaL_findstring (const char *name, const char *const list[]); |
49 | void luaL_chunkid (char *out, const char *source, int len); | 65 | void luaL_chunkid (char *out, const char *source, int len); |
50 | void luaL_filesource (char *out, const char *filename, int len); | 66 | void luaL_filesource (char *out, const char *filename, int len); |
51 | 67 | ||
52 | 68 | ||
69 | #ifndef LUA_REENTRANT | ||
70 | |||
71 | #define luaL_openlib(l,n) (luaL_openlib)(lua_state,l,n) | ||
72 | #define luaL_argerror(numarg,extramsg) \ | ||
73 | (luaL_argerror)(lua_state,numarg,extramsg) | ||
74 | #define luaL_check_lstr(numArg,len) (luaL_check_lstr)(lua_state,numArg,len) | ||
75 | #define luaL_opt_lstr(numArg,def,len) \ | ||
76 | (luaL_opt_lstr)(lua_state,numArg,def,len) | ||
77 | #define luaL_check_number(numArg) (luaL_check_number)(lua_state,numArg) | ||
78 | #define luaL_opt_number(numArg,def) (luaL_opt_number)(lua_state,numArg,def) | ||
79 | #define luaL_functionarg(arg) (luaL_functionarg)(lua_state,arg) | ||
80 | #define luaL_tablearg(arg) (luaL_tablearg)(lua_state,arg) | ||
81 | #define luaL_nonnullarg(numArg) (luaL_nonnullarg)(lua_state,numArg) | ||
82 | #define luaL_openspace(size) (luaL_openspace)(lua_state,size) | ||
83 | #define luaL_resetbuffer() (luaL_resetbuffer)(lua_state) | ||
84 | #define luaL_addchar(c) (luaL_addchar)(lua_state,c) | ||
85 | #define luaL_getsize() (luaL_getsize)(lua_state) | ||
86 | #define luaL_addsize(n) (luaL_addsize)(lua_state,n) | ||
87 | #define luaL_newbuffer(size) (luaL_newbuffer)(lua_state,size) | ||
88 | #define luaL_oldbuffer(old) (luaL_oldbuffer)(lua_state,old) | ||
89 | #define luaL_buffer() (luaL_buffer)(lua_state) | ||
90 | |||
53 | #endif | 91 | #endif |
92 | |||
93 | #endif | ||
94 | |||