diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-09-16 16:25:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-09-16 16:25:59 -0300 |
commit | 43a2ee6ea1b7825c1892de614cb38a3fe487a19f (patch) | |
tree | c2db158b379c56fb93c0c66ded2a6c8312102062 /ldo.h | |
parent | 4b91e9cde630573cb35bb20101eb74cf5cf79a27 (diff) | |
download | lua-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.h | 62 |
1 files changed, 62 insertions, 0 deletions
@@ -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 | |||
14 | typedef int StkId; /* index to luaD_stack.stack elements */ | ||
15 | |||
16 | #define MULT_RET 255 | ||
17 | |||
18 | |||
19 | extern struct Stack { | ||
20 | TObject *last; | ||
21 | TObject *stack; | ||
22 | TObject *top; | ||
23 | } luaD_stack; | ||
24 | |||
25 | |||
26 | extern 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 | |||
34 | extern 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 | |||
50 | void luaD_adjusttop (StkId newtop); | ||
51 | void luaD_openstack (int nelems); | ||
52 | void luaD_lineHook (int line); | ||
53 | void luaD_callHook (StkId base, lua_Type type, int isreturn); | ||
54 | void luaD_call (StkId base, int nResults); | ||
55 | void luaD_callTM (TObject *f, int nParams, int nResults); | ||
56 | int luaD_protectedrun (int nResults); | ||
57 | void luaD_gcIM (TObject *o); | ||
58 | void luaD_travstack (int (*fn)(TObject *)); | ||
59 | void luaD_checkstack (int n); | ||
60 | |||
61 | |||
62 | #endif | ||