summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-04 15:47:59 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-04 15:47:59 -0200
commit568794956025183fc9a9b79e0c818a885e3d0aeb (patch)
tree02d1a74d7c9a16ca06e94ab4308694ad04f49012 /ldo.c
parent19de5b22054f6da2c3e0eb3138cc7a1195aab4fd (diff)
downloadlua-568794956025183fc9a9b79e0c818a885e3d0aeb.tar.gz
lua-568794956025183fc9a9b79e0c818a885e3d0aeb.tar.bz2
lua-568794956025183fc9a9b79e0c818a885e3d0aeb.zip
"lua_debug", "lua_callhook" and "lua_linehook" must be inside "lua_state".
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ldo.c b/ldo.c
index 4e895c0a..16f79c51 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.29 1998/08/21 17:43:44 roberto Exp $ 2** $Id: ldo.c,v 1.30 1999/01/15 11:38:33 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -94,7 +94,7 @@ void luaD_lineHook (int line)
94 struct C_Lua_Stack oldCLS = L->Cstack; 94 struct C_Lua_Stack oldCLS = L->Cstack;
95 StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; 95 StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack;
96 L->Cstack.num = 0; 96 L->Cstack.num = 0;
97 (*lua_linehook)(line); 97 (*L->linehook)(line);
98 L->stack.top = L->stack.stack+old_top; 98 L->stack.top = L->stack.stack+old_top;
99 L->Cstack = oldCLS; 99 L->Cstack = oldCLS;
100} 100}
@@ -106,13 +106,13 @@ void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn)
106 StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; 106 StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack;
107 L->Cstack.num = 0; 107 L->Cstack.num = 0;
108 if (isreturn) 108 if (isreturn)
109 (*lua_callhook)(LUA_NOOBJECT, "(return)", 0); 109 (*L->callhook)(LUA_NOOBJECT, "(return)", 0);
110 else { 110 else {
111 TObject *f = L->stack.stack+base-1; 111 TObject *f = L->stack.stack+base-1;
112 if (tf) 112 if (tf)
113 (*lua_callhook)(Ref(f), tf->fileName->str, tf->lineDefined); 113 (*L->callhook)(Ref(f), tf->fileName->str, tf->lineDefined);
114 else 114 else
115 (*lua_callhook)(Ref(f), "(C)", -1); 115 (*L->callhook)(Ref(f), "(C)", -1);
116 } 116 }
117 L->stack.top = L->stack.stack+old_top; 117 L->stack.top = L->stack.stack+old_top;
118 L->Cstack = oldCLS; 118 L->Cstack = oldCLS;
@@ -133,10 +133,10 @@ static StkId callC (lua_CFunction f, StkId base)
133 CS->num = numarg; 133 CS->num = numarg;
134 CS->lua2C = base; 134 CS->lua2C = base;
135 CS->base = base+numarg; /* == top-stack */ 135 CS->base = base+numarg; /* == top-stack */
136 if (lua_callhook) 136 if (L->callhook)
137 luaD_callHook(base, NULL, 0); 137 luaD_callHook(base, NULL, 0);
138 (*f)(); /* do the actual call */ 138 (*f)(); /* do the actual call */
139 if (lua_callhook) /* func may have changed lua_callhook */ 139 if (L->callhook) /* func may have changed lua_callhook */
140 luaD_callHook(base, NULL, 1); 140 luaD_callHook(base, NULL, 1);
141 firstResult = CS->base; 141 firstResult = CS->base;
142 *CS = oldCLS; 142 *CS = oldCLS;