aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-11-22 15:39:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-11-22 15:39:51 -0200
commit7d1499ba88fbb9275b6e5dea6005a49ff15347dd (patch)
tree3effbdda4848b26de22e12d8dd14d6c9e3da518b
parent29ede6aa13144ff7b69c57a87be1ee93f57ae896 (diff)
downloadlua-7d1499ba88fbb9275b6e5dea6005a49ff15347dd.tar.gz
lua-7d1499ba88fbb9275b6e5dea6005a49ff15347dd.tar.bz2
lua-7d1499ba88fbb9275b6e5dea6005a49ff15347dd.zip
new macro luaL_openl
-rw-r--r--lauxlib.h16
-rw-r--r--lbuiltin.c4
-rw-r--r--ldblib.c4
-rw-r--r--liolib.c5
-rw-r--r--lmathlib.c4
-rw-r--r--lstrlib.c7
6 files changed, 20 insertions, 20 deletions
diff --git a/lauxlib.h b/lauxlib.h
index 708297f5..b996a6f1 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -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
diff --git a/lbuiltin.c b/lbuiltin.c
index da8a573c..13b111de 100644
--- a/lbuiltin.c
+++ b/lbuiltin.c
@@ -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}
diff --git a/ldblib.c b/ldblib.c
index 0bd3cc52..3c3dd468 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -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
216void lua_dblibopen (lua_State *L) { 216void lua_dblibopen (lua_State *L) {
217 luaL_openlib(L, dblib, (sizeof(dblib)/sizeof(dblib[0]))); 217 luaL_openl(L, dblib);
218} 218}
219 219
diff --git a/liolib.c b/liolib.c
index 1a414a9d..e2bac28c 100644
--- a/liolib.c
+++ b/liolib.c
@@ -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
634void lua_iolibopen (lua_State *L) { 634void 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
diff --git a/lmathlib.c b/lmathlib.c
index ee688a50..83c8e0bc 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -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*/
201void lua_mathlibopen (lua_State *L) { 201void 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");
diff --git a/lstrlib.c b/lstrlib.c
index c973d0e4..4f67a72c 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -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*/
617void lua_strlibopen (lua_State *L) 617void lua_strlibopen (lua_State *L) {
618{ 618 luaL_openl(L, strlib);
619 luaL_openlib(L, strlib, (sizeof(strlib)/sizeof(strlib[0])));
620} 619}