2
0
Эх сурвалжийг харах

new names for standard libraries

Roberto Ierusalimschy 23 жил өмнө
parent
commit
5b8ee9fa8d
7 өөрчлөгдсөн 27 нэмэгдсэн , 15 устгасан
  1. 2 2
      lbaselib.c
  2. 2 2
      ldblib.c
  3. 4 4
      liolib.c
  4. 2 2
      lmathlib.c
  5. 2 2
      lstrlib.c
  6. 2 2
      ltablib.c
  7. 13 1
      lualib.h

+ 2 - 2
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.76 2002/06/03 20:11:41 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.77 2002/06/05 16:59:21 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -459,7 +459,7 @@ static const luaL_reg co_funcs[] = {
 
 
 static void co_open (lua_State *L) {
-  luaL_opennamedlib(L, "co", co_funcs, 0);
+  luaL_opennamedlib(L, LUA_COLIBNAME, co_funcs, 0);
   /* create metatable for coroutines */
   lua_pushliteral(L, "Coroutine");
   lua_newtable(L);

+ 2 - 2
ldblib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldblib.c,v 1.53 2002/05/16 18:39:46 roberto Exp roberto $
+** $Id: ldblib.c,v 1.54 2002/06/03 17:47:18 roberto Exp roberto $
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -246,7 +246,7 @@ static const luaL_reg dblib[] = {
 
 
 LUALIB_API int lua_dblibopen (lua_State *L) {
-  luaL_opennamedlib(L, "dbg", dblib, 0);
+  luaL_opennamedlib(L, LUA_DBLIBNAME, dblib, 0);
   lua_register(L, "_ERRORMESSAGE", errorfb);
   return 0;
 }

+ 4 - 4
liolib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: liolib.c,v 2.5 2002/05/06 19:05:10 roberto Exp roberto $
+** $Id: liolib.c,v 2.6 2002/06/05 16:59:37 roberto Exp roberto $
 ** Standard I/O (and system) library
 ** See Copyright Notice in lua.h
 */
@@ -594,12 +594,12 @@ static const luaL_reg syslib[] = {
 
 LUALIB_API int lua_iolibopen (lua_State *L) {
   createmeta(L);
-  luaL_opennamedlib(L, "os", syslib, 0);
+  luaL_opennamedlib(L, LUA_OSLIBNAME, syslib, 0);
   lua_pushliteral(L, FILEHANDLE);  /* S: FH */
   lua_rawget(L, LUA_REGISTRYINDEX);  /* S: mt */
   lua_pushvalue(L, -1);  /* S: mt mt */
-  luaL_opennamedlib(L, "io", iolib, 1);  /* S: mt */
-  lua_pushliteral(L, "io");  /* S: `io' mt */
+  luaL_opennamedlib(L, LUA_IOLIBNAME, iolib, 1);  /* S: mt */
+  lua_pushliteral(L, LUA_IOLIBNAME);  /* S: `io' mt */
   lua_gettable(L, LUA_GLOBALSINDEX);  /* S: io mt */
   /* put predefined file handles into `io' table */
   registerfile(L, stdin, "stdin", IO_INPUT);

+ 2 - 2
lmathlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lmathlib.c,v 1.44 2002/05/02 17:12:27 roberto Exp roberto $
+** $Id: lmathlib.c,v 1.45 2002/05/06 19:05:10 roberto Exp roberto $
 ** Standard mathematical library
 ** See Copyright Notice in lua.h
 */
@@ -231,7 +231,7 @@ static const luaL_reg mathlib[] = {
 ** Open math library
 */
 LUALIB_API int lua_mathlibopen (lua_State *L) {
-  lua_pushliteral(L, "math");
+  lua_pushliteral(L, LUA_MATHLIBNAME);
   lua_newtable(L);
   luaL_openlib(L, mathlib, 0);
   lua_pushliteral(L, "pi");

+ 2 - 2
lstrlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.81 2002/05/02 17:12:27 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.82 2002/05/06 19:05:10 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -726,7 +726,7 @@ static const luaL_reg strlib[] = {
 ** Open string library
 */
 LUALIB_API int lua_strlibopen (lua_State *L) {
-  luaL_opennamedlib(L, "str", strlib, 0);
+  luaL_opennamedlib(L, LUA_STRLIBNAME, strlib, 0);
   return 0;
 }
 

+ 2 - 2
ltablib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltablib.c,v 1.3 2002/05/02 17:12:27 roberto Exp roberto $
+** $Id: ltablib.c,v 1.4 2002/06/05 16:59:21 roberto Exp roberto $
 ** Library for Table Manipulation
 ** See Copyright Notice in lua.h
 */
@@ -226,7 +226,7 @@ static const luaL_reg tab_funcs[] = {
 
 
 LUALIB_API int lua_tablibopen (lua_State *L) {
-  luaL_opennamedlib(L, "tab", tab_funcs, 0);
+  luaL_opennamedlib(L, LUA_TABLIBNAME, tab_funcs, 0);
   return 0;
 }
 

+ 13 - 1
lualib.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lualib.h,v 1.21 2001/03/26 14:31:49 roberto Exp roberto $
+** $Id: lualib.h,v 1.22 2002/04/09 20:19:06 roberto Exp roberto $
 ** Lua standard libraries
 ** See Copyright Notice in lua.h
 */
@@ -18,11 +18,23 @@
 
 #define LUA_ALERT               "_ALERT"
 
+#define LUA_COLIBNAME	"coroutine"
 LUALIB_API int lua_baselibopen (lua_State *L);
+
+#define LUA_TABLIBNAME	"table"
 LUALIB_API int lua_tablibopen (lua_State *L);
+
+#define LUA_IOLIBNAME	"io"
+#define LUA_OSLIBNAME	"os"
 LUALIB_API int lua_iolibopen (lua_State *L);
+
+#define LUA_STRLIBNAME	"string"
 LUALIB_API int lua_strlibopen (lua_State *L);
+
+#define LUA_MATHLIBNAME	"math"
 LUALIB_API int lua_mathlibopen (lua_State *L);
+
+#define LUA_DBLIBNAME	"debug"
 LUALIB_API int lua_dblibopen (lua_State *L);