rawcall' -> upcall' (unprotected call)

This commit is contained in:
Roberto Ierusalimschy 2002-06-13 10:44:50 -03:00
parent 864c96f36c
commit eb3de8768a
8 changed files with 20 additions and 20 deletions

4
lapi.c
View File

@ -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 ** Lua API
** See Copyright Notice in lua.h ** 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) ** `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; StkId func;
lua_lock(L); lua_lock(L);
api_checknelems(L, nargs+1); api_checknelems(L, nargs+1);

View File

@ -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 ** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h ** 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; return 0;
} }
lua_pushvalue(L, obj); lua_pushvalue(L, obj);
lua_rawcall(L, 1, 1); lua_upcall(L, 1, 1);
return 1; return 1;
} }

View File

@ -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 ** Basic library
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -34,7 +34,7 @@ static int luaB_print (lua_State *L) {
const char *s; const char *s;
lua_pushvalue(L, -1); /* function to be called */ lua_pushvalue(L, -1); /* function to be called */
lua_pushvalue(L, i); /* value to print */ lua_pushvalue(L, i); /* value to print */
lua_rawcall(L, 1, 1); lua_upcall(L, 1, 1);
s = lua_tostring(L, -1); /* get result */ s = lua_tostring(L, -1); /* get result */
if (s == NULL) if (s == NULL)
return luaL_verror(L, "`tostring' must return a string to `print'"); return luaL_verror(L, "`tostring' must return a string to `print'");
@ -378,7 +378,7 @@ static int luaB_require (lua_State *L) {
} }
switch (status) { switch (status) {
case 0: { case 0: {
lua_rawcall(L, 0, 0); /* run loaded module */ lua_upcall(L, 0, 0); /* run loaded module */
lua_pushvalue(L, 1); lua_pushvalue(L, 1);
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
lua_settable(L, 2); /* mark it as loaded */ lua_settable(L, 2); /* mark it as loaded */

View File

@ -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 ** Interface from Lua to its debug API
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -117,7 +117,7 @@ static void hookf (lua_State *L, void *key) {
lua_rawget(L, LUA_REGISTRYINDEX); lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_isfunction(L, -1)) { if (lua_isfunction(L, -1)) {
lua_pushvalue(L, -2); /* original argument (below function) */ lua_pushvalue(L, -2); /* original argument (below function) */
lua_rawcall(L, 1, 0); lua_upcall(L, 1, 0);
} }
else else
lua_pop(L, 1); /* pop result from gettable */ lua_pop(L, 1); /* pop result from gettable */

View File

@ -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 ** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -548,7 +548,7 @@ static void add_s (MatchState *ms, luaL_Buffer *b,
int n; int n;
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
n = push_captures(ms, s, e); n = push_captures(ms, s, e);
lua_rawcall(L, n, 1); lua_upcall(L, n, 1);
if (lua_isstring(L, -1)) if (lua_isstring(L, -1))
luaL_addvalue(b); /* add return to accumulated result */ luaL_addvalue(b); /* add return to accumulated result */
else else

View File

@ -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 ** Library for Table Manipulation
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -25,7 +25,7 @@ static int luaB_foreachi (lua_State *L) {
lua_pushvalue(L, 2); /* function */ lua_pushvalue(L, 2); /* function */
lua_pushnumber(L, i); /* 1st argument */ lua_pushnumber(L, i); /* 1st argument */
lua_rawgeti(L, 1, i); /* 2nd argument */ lua_rawgeti(L, 1, i); /* 2nd argument */
lua_rawcall(L, 2, 1); lua_upcall(L, 2, 1);
if (!lua_isnil(L, -1)) if (!lua_isnil(L, -1))
return 1; return 1;
lua_pop(L, 1); /* remove nil result */ 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, 2); /* function */
lua_pushvalue(L, -3); /* key */ lua_pushvalue(L, -3); /* key */
lua_pushvalue(L, -3); /* value */ lua_pushvalue(L, -3); /* value */
lua_rawcall(L, 2, 1); lua_upcall(L, 2, 1);
if (!lua_isnil(L, -1)) if (!lua_isnil(L, -1))
return 1; return 1;
lua_pop(L, 2); /* remove value and result */ 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, 2);
lua_pushvalue(L, a-1); /* -1 to compensate function */ lua_pushvalue(L, a-1); /* -1 to compensate function */
lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */ 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); res = lua_toboolean(L, -1);
lua_pop(L, 1); lua_pop(L, 1);
return res; return res;

View File

@ -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 ** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -634,7 +634,7 @@ static int testC (lua_State *L) {
else if EQ("rawcall") { else if EQ("rawcall") {
int narg = getnum; int narg = getnum;
int nres = getnum; int nres = getnum;
lua_rawcall(L, narg, nres); lua_upcall(L, narg, nres);
} }
else if EQ("call") { else if EQ("call") {
int narg = getnum; int narg = getnum;

6
lua.h
View File

@ -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 ** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org ** http://www.lua.org mailto:info@lua.org
@ -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) #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) ** `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_pcall (lua_State *L, int nargs, int nresults, int errf);
LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data,
const char *chunkname); const char *chunkname);