Browse Source

auxiliar function "luaD_calln".

Roberto Ierusalimschy 27 năm trước cách đây
mục cha
commit
ee912e5a7f
2 tập tin đã thay đổi với 9 bổ sung5 xóa
  1. 7 4
      ldo.c
  2. 2 1
      ldo.h

+ 7 - 4
ldo.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.c,v 1.26 1998/06/15 21:34:14 roberto Exp roberto $
+** $Id: ldo.c,v 1.27 1998/06/19 18:47:06 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -172,11 +172,10 @@ static StkId callCclosure (struct Closure *cl, lua_CFunction f, StkId base)
 }
 }
 
 
 
 
-void luaD_callTM (TObject *f, int nParams, int nResults)
-{
+void luaD_callTM (TObject *f, int nParams, int nResults) {
   luaD_openstack(nParams);
   luaD_openstack(nParams);
   *(L->stack.top-nParams-1) = *f;
   *(L->stack.top-nParams-1) = *f;
-  luaD_call((L->stack.top-L->stack.stack)-nParams, nResults);
+  luaD_calln(nParams, nResults);
 }
 }
 
 
 
 
@@ -230,6 +229,10 @@ void luaD_call (StkId base, int nResults)
 }
 }
 
 
 
 
+void luaD_calln (int nArgs, int nResults) {
+    luaD_call((L->stack.top-L->stack.stack)-nArgs, nResults);
+}
+
 
 
 /*
 /*
 ** Traverse all objects on L->stack.stack
 ** Traverse all objects on L->stack.stack

+ 2 - 1
ldo.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.h,v 1.3 1997/11/19 17:29:23 roberto Exp roberto $
+** $Id: ldo.h,v 1.4 1997/12/15 16:17:20 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -36,6 +36,7 @@ void luaD_openstack (int nelems);
 void luaD_lineHook (int line);
 void luaD_lineHook (int line);
 void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn);
 void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn);
 void luaD_call (StkId base, int nResults);
 void luaD_call (StkId base, int nResults);
+void luaD_calln (int nArgs, int nResults);
 void luaD_callTM (TObject *f, int nParams, int nResults);
 void luaD_callTM (TObject *f, int nParams, int nResults);
 int luaD_protectedrun (int nResults);
 int luaD_protectedrun (int nResults);
 void luaD_gcIM (TObject *o);
 void luaD_gcIM (TObject *o);