aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-14 16:20:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-14 16:20:39 -0300
commit6aabf4b15e7637c2ab4133abf3df0a77f34b6005 (patch)
tree16ca80a0820c3ebca4b64736fe6f5c9b9de2a19d
parentfa2f294dd1269115bf9cf534dd38553e2f606801 (diff)
downloadlua-6aabf4b15e7637c2ab4133abf3df0a77f34b6005.tar.gz
lua-6aabf4b15e7637c2ab4133abf3df0a77f34b6005.tar.bz2
lua-6aabf4b15e7637c2ab4133abf3df0a77f34b6005.zip
Details in some header files
Identifier LUA_NUMTAGS was deprecated (changed to LUA_NUMTYPES) + better handling of some inclusion loops.
-rw-r--r--lstate.h11
-rw-r--r--ltm.h5
-rw-r--r--lua.h16
3 files changed, 21 insertions, 11 deletions
diff --git a/lstate.h b/lstate.h
index 2e907818..8bf6600e 100644
--- a/lstate.h
+++ b/lstate.h
@@ -9,6 +9,11 @@
9 9
10#include "lua.h" 10#include "lua.h"
11 11
12
13/* Some header files included here need this definition */
14typedef struct CallInfo CallInfo;
15
16
12#include "lobject.h" 17#include "lobject.h"
13#include "ltm.h" 18#include "ltm.h"
14#include "lzio.h" 19#include "lzio.h"
@@ -169,7 +174,7 @@ typedef struct stringtable {
169** - field 'transferinfo' is used only during call/returnhooks, 174** - field 'transferinfo' is used only during call/returnhooks,
170** before the function starts or after it ends. 175** before the function starts or after it ends.
171*/ 176*/
172typedef struct CallInfo { 177struct CallInfo {
173 StkIdRel func; /* function index in the stack */ 178 StkIdRel func; /* function index in the stack */
174 StkIdRel top; /* top for this function */ 179 StkIdRel top; /* top for this function */
175 struct CallInfo *previous, *next; /* dynamic call link */ 180 struct CallInfo *previous, *next; /* dynamic call link */
@@ -196,7 +201,7 @@ typedef struct CallInfo {
196 } u2; 201 } u2;
197 short nresults; /* expected number of results from this function */ 202 short nresults; /* expected number of results from this function */
198 unsigned short callstatus; 203 unsigned short callstatus;
199} CallInfo; 204};
200 205
201 206
202/* 207/*
@@ -291,7 +296,7 @@ typedef struct global_State {
291 struct lua_State *mainthread; 296 struct lua_State *mainthread;
292 TString *memerrmsg; /* message for memory-allocation errors */ 297 TString *memerrmsg; /* message for memory-allocation errors */
293 TString *tmname[TM_N]; /* array with tag-method names */ 298 TString *tmname[TM_N]; /* array with tag-method names */
294 struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ 299 struct Table *mt[LUA_NUMTYPES]; /* metatables for basic types */
295 TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ 300 TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */
296 lua_WarnFunction warnf; /* warning function */ 301 lua_WarnFunction warnf; /* warning function */
297 void *ud_warn; /* auxiliary data to 'warnf' */ 302 void *ud_warn; /* auxiliary data to 'warnf' */
diff --git a/ltm.h b/ltm.h
index 73b833c6..c309e2ae 100644
--- a/ltm.h
+++ b/ltm.h
@@ -9,6 +9,7 @@
9 9
10 10
11#include "lobject.h" 11#include "lobject.h"
12#include "lstate.h"
12 13
13 14
14/* 15/*
@@ -95,8 +96,8 @@ LUAI_FUNC int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2,
95 int inv, int isfloat, TMS event); 96 int inv, int isfloat, TMS event);
96 97
97LUAI_FUNC void luaT_adjustvarargs (lua_State *L, int nfixparams, 98LUAI_FUNC void luaT_adjustvarargs (lua_State *L, int nfixparams,
98 struct CallInfo *ci, const Proto *p); 99 CallInfo *ci, const Proto *p);
99LUAI_FUNC void luaT_getvarargs (lua_State *L, struct CallInfo *ci, 100LUAI_FUNC void luaT_getvarargs (lua_State *L, CallInfo *ci,
100 StkId where, int wanted); 101 StkId where, int wanted);
101 102
102 103
diff --git a/lua.h b/lua.h
index bfba4d1e..feb3dbc5 100644
--- a/lua.h
+++ b/lua.h
@@ -131,6 +131,16 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
131typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont); 131typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);
132 132
133 133
134/*
135** Type used by the debug API to collect debug information
136*/
137typedef struct lua_Debug lua_Debug;
138
139
140/*
141** Functions to be called by the debugger in specific events
142*/
143typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
134 144
135 145
136/* 146/*
@@ -442,12 +452,6 @@ LUA_API void (lua_closeslot) (lua_State *L, int idx);
442#define LUA_MASKLINE (1 << LUA_HOOKLINE) 452#define LUA_MASKLINE (1 << LUA_HOOKLINE)
443#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) 453#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
444 454
445typedef struct lua_Debug lua_Debug; /* activation record */
446
447
448/* Functions to be called by the debugger in specific events */
449typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
450
451 455
452LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); 456LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);
453LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); 457LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);