summaryrefslogtreecommitdiff
path: root/ldo.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-09-16 16:25:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-09-16 16:25:59 -0300
commit43a2ee6ea1b7825c1892de614cb38a3fe487a19f (patch)
treec2db158b379c56fb93c0c66ded2a6c8312102062 /ldo.h
parent4b91e9cde630573cb35bb20101eb74cf5cf79a27 (diff)
downloadlua-43a2ee6ea1b7825c1892de614cb38a3fe487a19f.tar.gz
lua-43a2ee6ea1b7825c1892de614cb38a3fe487a19f.tar.bz2
lua-43a2ee6ea1b7825c1892de614cb38a3fe487a19f.zip
Stack and Call structure of Lua
Diffstat (limited to 'ldo.h')
-rw-r--r--ldo.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/ldo.h b/ldo.h
new file mode 100644
index 00000000..edcd1b93
--- /dev/null
+++ b/ldo.h
@@ -0,0 +1,62 @@
1/*
2** $Id: $
3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h
5*/
6
7#ifndef ldo_h
8#define ldo_h
9
10
11#include "lobject.h"
12
13
14typedef int StkId; /* index to luaD_stack.stack elements */
15
16#define MULT_RET 255
17
18
19extern struct Stack {
20 TObject *last;
21 TObject *stack;
22 TObject *top;
23} luaD_stack;
24
25
26extern struct C_Lua_Stack {
27 StkId base; /* when Lua calls C or C calls Lua, points to */
28 /* the first slot after the last parameter. */
29 StkId lua2C; /* points to first element of "array" lua2C */
30 int num; /* size of "array" lua2C */
31} luaD_Cstack;
32
33
34extern TObject luaD_errorim;
35
36
37/*
38** macro to increment stack top.
39** There must be always an empty slot at the luaD_stack.top
40*/
41#define incr_top { if (luaD_stack.top >= luaD_stack.last) luaD_checkstack(1); \
42 luaD_stack.top++; }
43
44
45/* macros to convert from lua_Object to (TObject *) and back */
46
47#define Address(lo) ((lo)+luaD_stack.stack-1)
48#define Ref(st) ((st)-luaD_stack.stack+1)
49
50void luaD_adjusttop (StkId newtop);
51void luaD_openstack (int nelems);
52void luaD_lineHook (int line);
53void luaD_callHook (StkId base, lua_Type type, int isreturn);
54void luaD_call (StkId base, int nResults);
55void luaD_callTM (TObject *f, int nParams, int nResults);
56int luaD_protectedrun (int nResults);
57void luaD_gcIM (TObject *o);
58void luaD_travstack (int (*fn)(TObject *));
59void luaD_checkstack (int n);
60
61
62#endif