summaryrefslogtreecommitdiff
path: root/opcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-09-02 18:57:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-09-02 18:57:51 -0300
commitd289ac81d3629f8dc494a11929d16f03accd1007 (patch)
treeeacedd59740e5daf9171779b25ffb45a0431414f /opcode.c
parent15791f93fed507f73ae58aa89b3e8770b4d69406 (diff)
downloadlua-d289ac81d3629f8dc494a11929d16f03accd1007.tar.gz
lua-d289ac81d3629f8dc494a11929d16f03accd1007.tar.bz2
lua-d289ac81d3629f8dc494a11929d16f03accd1007.zip
functions may have tags CMARK and MARK, too.
Diffstat (limited to '')
-rw-r--r--opcode.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/opcode.c b/opcode.c
index 91904199..a51a9a9e 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 3.71 1996/07/24 17:55:57 roberto Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 3.72 1996/08/15 18:40:55 roberto Exp roberto $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -682,7 +682,8 @@ int lua_isstring (lua_Object object)
682int lua_isfunction (lua_Object object) 682int lua_isfunction (lua_Object object)
683{ 683{
684 int t = lua_type(object); 684 int t = lua_type(object);
685 return (t == LUA_T_FUNCTION) || (t == LUA_T_CFUNCTION); 685 return (t == LUA_T_FUNCTION) || (t == LUA_T_CFUNCTION) ||
686 (t == LUA_T_MARK) || (t == LUA_T_CMARK);
686} 687}
687 688
688/* 689/*
@@ -710,7 +711,8 @@ char *lua_getstring (lua_Object object)
710*/ 711*/
711lua_CFunction lua_getcfunction (lua_Object object) 712lua_CFunction lua_getcfunction (lua_Object object)
712{ 713{
713 if (object == LUA_NOOBJECT || tag(Address(object)) != LUA_T_CFUNCTION) 714 if (object == LUA_NOOBJECT || ((tag(Address(object)) != LUA_T_CFUNCTION) &&
715 (tag(Address(object)) != LUA_T_CMARK)))
714 return NULL; 716 return NULL;
715 else return (fvalue(Address(object))); 717 else return (fvalue(Address(object)));
716} 718}
@@ -847,7 +849,10 @@ void lua_pushobject (lua_Object o)
847{ 849{
848 if (o == LUA_NOOBJECT) 850 if (o == LUA_NOOBJECT)
849 lua_error("attempt to push a NOOBJECT"); 851 lua_error("attempt to push a NOOBJECT");
850 luaI_pushobject(Address(o)); 852 *top = *Address(o);
853 if (tag(top) == LUA_T_MARK) tag(top) = LUA_T_FUNCTION;
854 else if (tag(top) == LUA_T_CMARK) tag(top) = LUA_T_CFUNCTION;
855 incr_top;
851} 856}
852 857
853int lua_type (lua_Object o) 858int lua_type (lua_Object o)