Browse Source

`rawcall' -> `upcall' (unprotected call)

Roberto Ierusalimschy 23 năm trước cách đây
mục cha
commit
eb3de8768a
8 tập tin đã thay đổi với 20 bổ sung20 xóa
  1. 2 2
      lapi.c
  2. 2 2
      lauxlib.c
  3. 3 3
      lbaselib.c
  4. 2 2
      ldblib.c
  5. 2 2
      lstrlib.c
  6. 4 4
      ltablib.c
  7. 2 2
      ltests.c
  8. 3 3
      lua.h

+ 2 - 2
lapi.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.c,v 1.197 2002/06/12 14:51:31 roberto Exp roberto $
+** $Id: lapi.c,v 1.198 2002/06/13 13:39:55 roberto Exp roberto $
 ** Lua API
 ** See Copyright Notice in lua.h
 */
@@ -555,7 +555,7 @@ LUA_API void lua_setmetatable (lua_State *L, int objindex) {
 ** `load' and `call' functions (run Lua code)
 */
 
-LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults) {
+LUA_API void lua_upcall (lua_State *L, int nargs, int nresults) {
   StkId func;
   lua_lock(L);
   api_checknelems(L, nargs+1);

+ 2 - 2
lauxlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lauxlib.c,v 1.72 2002/06/03 20:11:41 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.73 2002/06/05 16:59:37 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -150,7 +150,7 @@ LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
     return 0;
   }
   lua_pushvalue(L, obj);
-  lua_rawcall(L, 1, 1);
+  lua_upcall(L, 1, 1);
   return 1;
 }
 

+ 3 - 3
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.79 2002/06/06 12:39:48 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.80 2002/06/13 13:39:55 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -34,7 +34,7 @@ static int luaB_print (lua_State *L) {
     const char *s;
     lua_pushvalue(L, -1);  /* function to be called */
     lua_pushvalue(L, i);   /* value to print */
-    lua_rawcall(L, 1, 1);
+    lua_upcall(L, 1, 1);
     s = lua_tostring(L, -1);  /* get result */
     if (s == NULL)
       return luaL_verror(L, "`tostring' must return a string to `print'");
@@ -378,7 +378,7 @@ static int luaB_require (lua_State *L) {
   }
   switch (status) {
     case 0: {
-      lua_rawcall(L, 0, 0);  /* run loaded module */
+      lua_upcall(L, 0, 0);  /* run loaded module */
       lua_pushvalue(L, 1);
       lua_pushboolean(L, 1);
       lua_settable(L, 2);  /* mark it as loaded */

+ 2 - 2
ldblib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldblib.c,v 1.55 2002/06/05 17:24:04 roberto Exp roberto $
+** $Id: ldblib.c,v 1.56 2002/06/06 12:40:36 roberto Exp roberto $
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -117,7 +117,7 @@ static void hookf (lua_State *L, void *key) {
   lua_rawget(L, LUA_REGISTRYINDEX);
   if (lua_isfunction(L, -1)) {
     lua_pushvalue(L, -2);  /* original argument (below function) */
-    lua_rawcall(L, 1, 0);
+    lua_upcall(L, 1, 0);
   }
   else
     lua_pop(L, 1);  /* pop result from gettable */

+ 2 - 2
lstrlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.82 2002/05/06 19:05:10 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.83 2002/06/05 17:24:04 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -548,7 +548,7 @@ static void add_s (MatchState *ms, luaL_Buffer *b,
     int n;
     lua_pushvalue(L, 3);
     n = push_captures(ms, s, e);
-    lua_rawcall(L, n, 1);
+    lua_upcall(L, n, 1);
     if (lua_isstring(L, -1))
       luaL_addvalue(b);  /* add return to accumulated result */
     else

+ 4 - 4
ltablib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltablib.c,v 1.4 2002/06/05 16:59:21 roberto Exp roberto $
+** $Id: ltablib.c,v 1.5 2002/06/05 17:24:04 roberto Exp roberto $
 ** Library for Table Manipulation
 ** See Copyright Notice in lua.h
 */
@@ -25,7 +25,7 @@ static int luaB_foreachi (lua_State *L) {
     lua_pushvalue(L, 2);  /* function */
     lua_pushnumber(L, i);  /* 1st argument */
     lua_rawgeti(L, 1, i);  /* 2nd argument */
-    lua_rawcall(L, 2, 1);
+    lua_upcall(L, 2, 1);
     if (!lua_isnil(L, -1))
       return 1;
     lua_pop(L, 1);  /* remove nil result */
@@ -44,7 +44,7 @@ static int luaB_foreach (lua_State *L) {
     lua_pushvalue(L, 2);  /* function */
     lua_pushvalue(L, -3);  /* key */
     lua_pushvalue(L, -3);  /* value */
-    lua_rawcall(L, 2, 1);
+    lua_upcall(L, 2, 1);
     if (!lua_isnil(L, -1))
       return 1;
     lua_pop(L, 2);  /* remove value and result */
@@ -128,7 +128,7 @@ static int sort_comp (lua_State *L, int a, int b) {
     lua_pushvalue(L, 2);
     lua_pushvalue(L, a-1);  /* -1 to compensate function */
     lua_pushvalue(L, b-2);  /* -2 to compensate function and `a' */
-    lua_rawcall(L, 2, 1);
+    lua_upcall(L, 2, 1);
     res = lua_toboolean(L, -1);
     lua_pop(L, 1);
     return res;

+ 2 - 2
ltests.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltests.c,v 1.123 2002/06/03 20:11:41 roberto Exp roberto $
+** $Id: ltests.c,v 1.124 2002/06/11 16:23:47 roberto Exp roberto $
 ** Internal Module for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 */
@@ -634,7 +634,7 @@ static int testC (lua_State *L) {
     else if EQ("rawcall") {
       int narg = getnum;
       int nres = getnum;
-      lua_rawcall(L, narg, nres);
+      lua_upcall(L, narg, nres);
     }
     else if EQ("call") {
       int narg = getnum;

+ 3 - 3
lua.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lua.h,v 1.138 2002/06/06 12:40:22 roberto Exp roberto $
+** $Id: lua.h,v 1.139 2002/06/13 13:39:55 roberto Exp roberto $
 ** Lua - An Extensible Extension Language
 ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
 ** http://www.lua.org	mailto:[email protected]
@@ -25,7 +25,7 @@
 
 
 
-/* option for multiple returns in `lua_pcall' and `lua_rawcall' */
+/* option for multiple returns in `lua_pcall' and `lua_upcall' */
 #define LUA_MULTRET	(-1)
 
 
@@ -179,7 +179,7 @@ LUA_API void  lua_setmetatable (lua_State *L, int objindex);
 /*
 ** `load' and `call' functions (load and run Lua code)
 */
-LUA_API void  lua_rawcall (lua_State *L, int nargs, int nresults);
+LUA_API void  lua_upcall (lua_State *L, int nargs, int nresults);
 LUA_API int   lua_pcall (lua_State *L, int nargs, int nresults, int errf);
 LUA_API int   lua_load (lua_State *L, lua_Chunkreader reader, void *data,
                         const char *chunkname);