diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-22 15:39:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-11-22 15:39:51 -0200 |
commit | 7d1499ba88fbb9275b6e5dea6005a49ff15347dd (patch) | |
tree | 3effbdda4848b26de22e12d8dd14d6c9e3da518b | |
parent | 29ede6aa13144ff7b69c57a87be1ee93f57ae896 (diff) | |
download | lua-7d1499ba88fbb9275b6e5dea6005a49ff15347dd.tar.gz lua-7d1499ba88fbb9275b6e5dea6005a49ff15347dd.tar.bz2 lua-7d1499ba88fbb9275b6e5dea6005a49ff15347dd.zip |
new macro luaL_openl
-rw-r--r-- | lauxlib.h | 16 | ||||
-rw-r--r-- | lbuiltin.c | 4 | ||||
-rw-r--r-- | ldblib.c | 4 | ||||
-rw-r--r-- | liolib.c | 5 | ||||
-rw-r--r-- | lmathlib.c | 4 | ||||
-rw-r--r-- | lstrlib.c | 7 |
6 files changed, 20 insertions, 20 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.h,v 1.13 1999/08/16 20:52:00 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.14 1999/11/22 13:12:07 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 | */ |
@@ -22,12 +22,13 @@ struct luaL_reg { | |||
22 | 22 | ||
23 | #define luaL_arg_check(L, cond,numarg,extramsg) if (!(cond)) \ | 23 | #define luaL_arg_check(L, cond,numarg,extramsg) if (!(cond)) \ |
24 | luaL_argerror(L, numarg,extramsg) | 24 | luaL_argerror(L, numarg,extramsg) |
25 | #define luaL_check_string(L, n) (luaL_check_lstr(L, (n), NULL)) | 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)) | 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)) | 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)) | 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)) | 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)) | 30 | #define luaL_opt_long(L,n,d) ((long)luaL_opt_number(L, n,d)) |
31 | #define luaL_openl(L,a) luaL_openlib(L, a, (sizeof(a)/sizeof(a[0]))) | ||
31 | 32 | ||
32 | #else | 33 | #else |
33 | 34 | ||
@@ -39,6 +40,7 @@ struct luaL_reg { | |||
39 | #define luaL_check_long(n) ((long)luaL_check_number(n)) | 40 | #define luaL_check_long(n) ((long)luaL_check_number(n)) |
40 | #define luaL_opt_int(n,d) ((int)luaL_opt_number(n,d)) | 41 | #define luaL_opt_int(n,d) ((int)luaL_opt_number(n,d)) |
41 | #define luaL_opt_long(n,d) ((long)luaL_opt_number(n,d)) | 42 | #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]))) | ||
42 | 44 | ||
43 | #endif | 45 | #endif |
44 | 46 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbuiltin.c,v 1.73 1999/11/16 12:50:48 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.74 1999/11/22 13:12:07 roberto Exp roberto $ |
3 | ** Built-in functions | 3 | ** Built-in functions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -810,7 +810,7 @@ void luaB_predefine (lua_State *L) { | |||
810 | /* pre-register mem error messages, to avoid loop when error arises */ | 810 | /* pre-register mem error messages, to avoid loop when error arises */ |
811 | luaS_newfixedstring(L, tableEM); | 811 | luaS_newfixedstring(L, tableEM); |
812 | luaS_newfixedstring(L, memEM); | 812 | luaS_newfixedstring(L, memEM); |
813 | luaL_openlib(L, builtin_funcs, (sizeof(builtin_funcs)/sizeof(builtin_funcs[0]))); | 813 | luaL_openl(L, builtin_funcs); |
814 | lua_pushstring(L, LUA_VERSION); | 814 | lua_pushstring(L, LUA_VERSION); |
815 | lua_setglobal(L, "_VERSION"); | 815 | lua_setglobal(L, "_VERSION"); |
816 | } | 816 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.6 1999/08/16 20:52:00 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.7 1999/11/22 13:12:07 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -214,6 +214,6 @@ static const struct luaL_reg dblib[] = { | |||
214 | 214 | ||
215 | 215 | ||
216 | void lua_dblibopen (lua_State *L) { | 216 | void lua_dblibopen (lua_State *L) { |
217 | luaL_openlib(L, dblib, (sizeof(dblib)/sizeof(dblib[0]))); | 217 | luaL_openl(L, dblib); |
218 | } | 218 | } |
219 | 219 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.50 1999/11/09 17:59:35 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.51 1999/11/22 13:12:07 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -632,8 +632,7 @@ static void openwithtags (lua_State *L) { | |||
632 | } | 632 | } |
633 | 633 | ||
634 | void lua_iolibopen (lua_State *L) { | 634 | void lua_iolibopen (lua_State *L) { |
635 | /* register lib functions */ | 635 | luaL_openl(L, iolib); |
636 | luaL_openlib(L, iolib, (sizeof(iolib)/sizeof(iolib[0]))); | ||
637 | openwithtags(L); | 636 | openwithtags(L); |
638 | } | 637 | } |
639 | 638 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.19 1999/08/18 14:40:51 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.20 1999/11/22 13:12:07 roberto Exp roberto $ |
3 | ** Lua standard mathematical library | 3 | ** Lua standard mathematical library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -199,7 +199,7 @@ static const struct luaL_reg mathlib[] = { | |||
199 | ** Open math library | 199 | ** Open math library |
200 | */ | 200 | */ |
201 | void lua_mathlibopen (lua_State *L) { | 201 | void lua_mathlibopen (lua_State *L) { |
202 | luaL_openlib(L, mathlib, (sizeof(mathlib)/sizeof(mathlib[0]))); | 202 | luaL_openl(L, mathlib); |
203 | lua_pushcfunction(L, math_pow); | 203 | lua_pushcfunction(L, math_pow); |
204 | lua_pushnumber(L, 0); /* to get its tag */ | 204 | lua_pushnumber(L, 0); /* to get its tag */ |
205 | lua_settagmethod(L, lua_tag(L, lua_pop(L)), "pow"); | 205 | lua_settagmethod(L, lua_tag(L, lua_pop(L)), "pow"); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.36 1999/11/11 16:45:04 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.37 1999/11/22 13:12:07 roberto Exp roberto $ |
3 | ** Standard library for strings and pattern-matching | 3 | ** Standard library for strings and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -614,7 +614,6 @@ static const struct luaL_reg strlib[] = { | |||
614 | /* | 614 | /* |
615 | ** Open string library | 615 | ** Open string library |
616 | */ | 616 | */ |
617 | void lua_strlibopen (lua_State *L) | 617 | void lua_strlibopen (lua_State *L) { |
618 | { | 618 | luaL_openl(L, strlib); |
619 | luaL_openlib(L, strlib, (sizeof(strlib)/sizeof(strlib[0]))); | ||
620 | } | 619 | } |