Преглед изворни кода

old signature for lua_open

Roberto Ierusalimschy пре 24 година
родитељ
комит
cb49b088b6
4 измењених фајлова са 11 додато и 9 уклоњено
  1. 2 2
      lstate.c
  2. 3 3
      ltests.c
  3. 2 2
      lua.c
  4. 4 2
      lua.h

+ 2 - 2
lstate.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.c,v 1.58 2001/03/02 17:27:50 roberto Exp roberto $
+** $Id: lstate.c,v 1.59 2001/03/07 18:09:25 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -90,7 +90,7 @@ static void f_luaopen (lua_State *L, void *ud) {
 }
 
 
-LUA_API lua_State *lua_open (lua_State *OL, int stacksize) {
+LUA_API lua_State *lua_newthread (lua_State *OL, int stacksize) {
   struct Sopen so;
   lua_State *L;
   if (OL) lua_lock(OL);

+ 3 - 3
ltests.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltests.c,v 1.74 2001/03/06 20:09:38 roberto Exp roberto $
+** $Id: ltests.c,v 1.75 2001/03/07 13:22:55 roberto Exp roberto $
 ** Internal Module for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 */
@@ -422,7 +422,7 @@ static int newtag (lua_State *L) {
 }
 
 static int doonnewstack (lua_State *L) {
-  lua_State *L1 = lua_open(L, luaL_check_int(L, 1));
+  lua_State *L1 = lua_newthread(L, luaL_check_int(L, 1));
   if (L1 == NULL) return 0;
   *((int **)L1) = &islocked;  /* initialize the lock */
   lua_dostring(L1, luaL_check_string(L, 2));
@@ -445,7 +445,7 @@ static int d2s (lua_State *L) {
 
 
 static int newstate (lua_State *L) {
-  lua_State *L1 = lua_open(NULL, luaL_check_int(L, 1));
+  lua_State *L1 = lua_open(luaL_check_int(L, 1));
   if (L1) {
     *((int **)L1) = &islocked;  /* initialize the lock */
     lua_pushnumber(L, (unsigned long)L1);

+ 2 - 2
lua.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lua.c,v 1.63 2001/02/23 17:28:12 roberto Exp roberto $
+** $Id: lua.c,v 1.64 2001/02/23 20:28:26 roberto Exp roberto $
 ** Lua stand-alone interpreter
 ** See Copyright Notice in lua.h
 */
@@ -327,7 +327,7 @@ int main (int argc, l_char *argv[]) {
   int status;
   opt.toclose = 0;
   getstacksize(argc, argv, &opt);  /* handle option `-s' */
-  L = lua_open(NULL, opt.stacksize);  /* create state */
+  L = lua_open(opt.stacksize);  /* create state */
   LUA_USERINIT(L);  /* open libraries */
   register_getargs(argv);  /* create `getargs' function */
   status = handle_argv(argv+1, &opt);

+ 4 - 2
lua.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lua.h,v 1.89 2001/02/23 17:17:25 roberto Exp roberto $
+** $Id: lua.h,v 1.90 2001/02/23 17:28:12 roberto Exp roberto $
 ** Lua - An Extensible Extension Language
 ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
 ** e-mail: [email protected]
@@ -93,7 +93,7 @@ typedef char l_char;
 /*
 ** state manipulation
 */
-LUA_API lua_State *lua_open (lua_State *L, int stacksize);
+LUA_API lua_State *lua_newthread (lua_State *L, int stacksize);
 LUA_API void       lua_close (lua_State *L);
 
 
@@ -210,6 +210,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size);
 ** ===============================================================
 */
 
+#define lua_open(n)		lua_newthread(NULL, (n))
+
 #define lua_pop(L,n)		lua_settop(L, -(n)-1)
 
 #define lua_register(L,n,f)	(lua_pushcfunction(L, f), lua_setglobal(L, n))