annotate lib/lua/lua-5.2.2/lua.h @ 2235:6ab7d7c112bb

adding int_get_vector_length calls where the calls were inlined
author Grumpy7
date Sun, 23 Feb 2014 03:07:46 +0100
parents 41cc4dd3c122
children
rev   line source
1866
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
1 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
2 ** $Id: lua.h,v 1.285 2013/03/15 13:04:22 roberto Exp $
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
3 ** Lua - A Scripting Language
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
4 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
5 ** See Copyright Notice at the end of this file
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
6 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
7
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
8
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
9 #ifndef lua_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
10 #define lua_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
11
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
12 #include <stdarg.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
13 #include <stddef.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
14
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
15
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
16 #include "luaconf.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
17
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
18
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
19 #define LUA_VERSION_MAJOR "5"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
20 #define LUA_VERSION_MINOR "2"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
21 #define LUA_VERSION_NUM 502
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
22 #define LUA_VERSION_RELEASE "2"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
23
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
24 #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
25 #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
26 #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2013 Lua.org, PUC-Rio"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
27 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
28
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
29
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
30 /* mark for precompiled code ('<esc>Lua') */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
31 #define LUA_SIGNATURE "\033Lua"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
32
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
33 /* option for multiple returns in 'lua_pcall' and 'lua_call' */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
34 #define LUA_MULTRET (-1)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
35
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
36
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
37 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
38 ** pseudo-indices
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
39 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
40 #define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
41 #define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
42
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
43
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
44 /* thread status */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
45 #define LUA_OK 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
46 #define LUA_YIELD 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
47 #define LUA_ERRRUN 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
48 #define LUA_ERRSYNTAX 3
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
49 #define LUA_ERRMEM 4
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
50 #define LUA_ERRGCMM 5
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
51 #define LUA_ERRERR 6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
52
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
53
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
54 typedef struct lua_State lua_State;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
55
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
56 typedef int (*lua_CFunction) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
57
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
58
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
59 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
60 ** functions that read/write blocks when loading/dumping Lua chunks
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
61 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
62 typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
63
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
64 typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
65
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
66
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
67 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
68 ** prototype for memory-allocation functions
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
69 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
70 typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
71
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
72
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
73 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
74 ** basic types
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
75 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
76 #define LUA_TNONE (-1)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
77
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
78 #define LUA_TNIL 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
79 #define LUA_TBOOLEAN 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
80 #define LUA_TLIGHTUSERDATA 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
81 #define LUA_TNUMBER 3
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
82 #define LUA_TSTRING 4
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
83 #define LUA_TTABLE 5
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
84 #define LUA_TFUNCTION 6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
85 #define LUA_TUSERDATA 7
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
86 #define LUA_TTHREAD 8
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
87
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
88 #define LUA_NUMTAGS 9
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
89
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
90
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
91
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
92 /* minimum Lua stack available to a C function */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
93 #define LUA_MINSTACK 20
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
94
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
95
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
96 /* predefined values in the registry */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
97 #define LUA_RIDX_MAINTHREAD 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
98 #define LUA_RIDX_GLOBALS 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
99 #define LUA_RIDX_LAST LUA_RIDX_GLOBALS
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
100
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
101
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
102 /* type of numbers in Lua */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
103 typedef LUA_NUMBER lua_Number;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
104
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
105
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
106 /* type for integer functions */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
107 typedef LUA_INTEGER lua_Integer;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
108
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
109 /* unsigned integer type */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
110 typedef LUA_UNSIGNED lua_Unsigned;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
111
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
112
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
113
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
114 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
115 ** generic extra include file
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
116 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
117 #if defined(LUA_USER_H)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
118 #include LUA_USER_H
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
119 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
120
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
121
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
122 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
123 ** RCS ident string
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
124 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
125 extern const char lua_ident[];
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
126
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
127
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
128 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
129 ** state manipulation
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
130 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
131 LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
132 LUA_API void (lua_close) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
133 LUA_API lua_State *(lua_newthread) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
134
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
135 LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
136
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
137
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
138 LUA_API const lua_Number *(lua_version) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
139
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
140
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
141 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
142 ** basic stack manipulation
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
143 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
144 LUA_API int (lua_absindex) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
145 LUA_API int (lua_gettop) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
146 LUA_API void (lua_settop) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
147 LUA_API void (lua_pushvalue) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
148 LUA_API void (lua_remove) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
149 LUA_API void (lua_insert) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
150 LUA_API void (lua_replace) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
151 LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
152 LUA_API int (lua_checkstack) (lua_State *L, int sz);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
153
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
154 LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
155
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
156
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
157 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
158 ** access functions (stack -> C)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
159 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
160
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
161 LUA_API int (lua_isnumber) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
162 LUA_API int (lua_isstring) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
163 LUA_API int (lua_iscfunction) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
164 LUA_API int (lua_isuserdata) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
165 LUA_API int (lua_type) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
166 LUA_API const char *(lua_typename) (lua_State *L, int tp);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
167
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
168 LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
169 LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
170 LUA_API lua_Unsigned (lua_tounsignedx) (lua_State *L, int idx, int *isnum);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
171 LUA_API int (lua_toboolean) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
172 LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
173 LUA_API size_t (lua_rawlen) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
174 LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
175 LUA_API void *(lua_touserdata) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
176 LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
177 LUA_API const void *(lua_topointer) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
178
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
179
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
180 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
181 ** Comparison and arithmetic functions
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
182 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
183
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
184 #define LUA_OPADD 0 /* ORDER TM */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
185 #define LUA_OPSUB 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
186 #define LUA_OPMUL 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
187 #define LUA_OPDIV 3
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
188 #define LUA_OPMOD 4
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
189 #define LUA_OPPOW 5
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
190 #define LUA_OPUNM 6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
191
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
192 LUA_API void (lua_arith) (lua_State *L, int op);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
193
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
194 #define LUA_OPEQ 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
195 #define LUA_OPLT 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
196 #define LUA_OPLE 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
197
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
198 LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
199 LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
200
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
201
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
202 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
203 ** push functions (C -> stack)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
204 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
205 LUA_API void (lua_pushnil) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
206 LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
207 LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
208 LUA_API void (lua_pushunsigned) (lua_State *L, lua_Unsigned n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
209 LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t l);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
210 LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
211 LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
212 va_list argp);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
213 LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
214 LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
215 LUA_API void (lua_pushboolean) (lua_State *L, int b);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
216 LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
217 LUA_API int (lua_pushthread) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
218
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
219
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
220 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
221 ** get functions (Lua -> stack)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
222 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
223 LUA_API void (lua_getglobal) (lua_State *L, const char *var);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
224 LUA_API void (lua_gettable) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
225 LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
226 LUA_API void (lua_rawget) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
227 LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
228 LUA_API void (lua_rawgetp) (lua_State *L, int idx, const void *p);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
229 LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
230 LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
231 LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
232 LUA_API void (lua_getuservalue) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
233
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
234
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
235 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
236 ** set functions (stack -> Lua)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
237 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
238 LUA_API void (lua_setglobal) (lua_State *L, const char *var);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
239 LUA_API void (lua_settable) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
240 LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
241 LUA_API void (lua_rawset) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
242 LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
243 LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
244 LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
245 LUA_API void (lua_setuservalue) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
246
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
247
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
248 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
249 ** 'load' and 'call' functions (load and run Lua code)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
250 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
251 LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
252 lua_CFunction k);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
253 #define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
254
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
255 LUA_API int (lua_getctx) (lua_State *L, int *ctx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
256
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
257 LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
258 int ctx, lua_CFunction k);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
259 #define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
260
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
261 LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
262 const char *chunkname,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
263 const char *mode);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
264
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
265 LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
266
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
267
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
268 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
269 ** coroutine functions
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
270 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
271 LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
272 lua_CFunction k);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
273 #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
274 LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
275 LUA_API int (lua_status) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
276
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
277 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
278 ** garbage-collection function and options
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
279 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
280
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
281 #define LUA_GCSTOP 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
282 #define LUA_GCRESTART 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
283 #define LUA_GCCOLLECT 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
284 #define LUA_GCCOUNT 3
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
285 #define LUA_GCCOUNTB 4
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
286 #define LUA_GCSTEP 5
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
287 #define LUA_GCSETPAUSE 6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
288 #define LUA_GCSETSTEPMUL 7
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
289 #define LUA_GCSETMAJORINC 8
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
290 #define LUA_GCISRUNNING 9
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
291 #define LUA_GCGEN 10
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
292 #define LUA_GCINC 11
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
293
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
294 LUA_API int (lua_gc) (lua_State *L, int what, int data);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
295
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
296
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
297 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
298 ** miscellaneous functions
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
299 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
300
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
301 LUA_API int (lua_error) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
302
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
303 LUA_API int (lua_next) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
304
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
305 LUA_API void (lua_concat) (lua_State *L, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
306 LUA_API void (lua_len) (lua_State *L, int idx);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
307
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
308 LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
309 LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
310
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
311
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
312
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
313 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
314 ** ===============================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
315 ** some useful macros
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
316 ** ===============================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
317 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
318
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
319 #define lua_tonumber(L,i) lua_tonumberx(L,i,NULL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
320 #define lua_tointeger(L,i) lua_tointegerx(L,i,NULL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
321 #define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
322
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
323 #define lua_pop(L,n) lua_settop(L, -(n)-1)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
324
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
325 #define lua_newtable(L) lua_createtable(L, 0, 0)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
326
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
327 #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
328
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
329 #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
330
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
331 #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
332 #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
333 #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
334 #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
335 #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
336 #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
337 #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
338 #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
339
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
340 #define lua_pushliteral(L, s) \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
341 lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
342
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
343 #define lua_pushglobaltable(L) \
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
344 lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
345
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
346 #define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
347
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
348
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
349
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
350 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
351 ** {======================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
352 ** Debug API
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
353 ** =======================================================================
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
354 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
355
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
356
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
357 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
358 ** Event codes
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
359 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
360 #define LUA_HOOKCALL 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
361 #define LUA_HOOKRET 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
362 #define LUA_HOOKLINE 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
363 #define LUA_HOOKCOUNT 3
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
364 #define LUA_HOOKTAILCALL 4
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
365
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
366
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
367 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
368 ** Event masks
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
369 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
370 #define LUA_MASKCALL (1 << LUA_HOOKCALL)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
371 #define LUA_MASKRET (1 << LUA_HOOKRET)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
372 #define LUA_MASKLINE (1 << LUA_HOOKLINE)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
373 #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
374
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
375 typedef struct lua_Debug lua_Debug; /* activation record */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
376
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
377
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
378 /* Functions to be called by the debugger in specific events */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
379 typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
380
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
381
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
382 LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
383 LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
384 LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
385 LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
386 LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
387 LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
388
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
389 LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
390 LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
391 int fidx2, int n2);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
392
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
393 LUA_API int (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
394 LUA_API lua_Hook (lua_gethook) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
395 LUA_API int (lua_gethookmask) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
396 LUA_API int (lua_gethookcount) (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
397
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
398
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
399 struct lua_Debug {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
400 int event;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
401 const char *name; /* (n) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
402 const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
403 const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
404 const char *source; /* (S) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
405 int currentline; /* (l) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
406 int linedefined; /* (S) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
407 int lastlinedefined; /* (S) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
408 unsigned char nups; /* (u) number of upvalues */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
409 unsigned char nparams;/* (u) number of parameters */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
410 char isvararg; /* (u) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
411 char istailcall; /* (t) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
412 char short_src[LUA_IDSIZE]; /* (S) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
413 /* private part */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
414 struct CallInfo *i_ci; /* active function */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
415 };
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
416
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
417 /* }====================================================================== */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
418
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
419
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
420 /******************************************************************************
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
421 * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
422 *
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
423 * Permission is hereby granted, free of charge, to any person obtaining
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
424 * a copy of this software and associated documentation files (the
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
425 * "Software"), to deal in the Software without restriction, including
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
426 * without limitation the rights to use, copy, modify, merge, publish,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
427 * distribute, sublicense, and/or sell copies of the Software, and to
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
428 * permit persons to whom the Software is furnished to do so, subject to
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
429 * the following conditions:
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
430 *
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
431 * The above copyright notice and this permission notice shall be
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
432 * included in all copies or substantial portions of the Software.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
433 *
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
434 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
435 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
436 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
437 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
438 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
439 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
440 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
441 ******************************************************************************/
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
442
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
443
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
444 #endif