summaryrefslogtreecommitdiff
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-github-6aabf4b15e7637c2ab4133abf3df0a77f34b6005.tar.gz
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 @@
#include "lua.h"
+
+/* Some header files included here need this definition */
+typedef struct CallInfo CallInfo;
+
+
#include "lobject.h"
#include "ltm.h"
#include "lzio.h"
@@ -169,7 +174,7 @@ typedef struct stringtable {
** - field 'transferinfo' is used only during call/returnhooks,
** before the function starts or after it ends.
*/
-typedef struct CallInfo {
+struct CallInfo {
StkIdRel func; /* function index in the stack */
StkIdRel top; /* top for this function */
struct CallInfo *previous, *next; /* dynamic call link */
@@ -196,7 +201,7 @@ typedef struct CallInfo {
} u2;
short nresults; /* expected number of results from this function */
unsigned short callstatus;
-} CallInfo;
+};
/*
@@ -291,7 +296,7 @@ typedef struct global_State {
struct lua_State *mainthread;
TString *memerrmsg; /* message for memory-allocation errors */
TString *tmname[TM_N]; /* array with tag-method names */
- struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */
+ struct Table *mt[LUA_NUMTYPES]; /* metatables for basic types */
TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */
lua_WarnFunction warnf; /* warning function */
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 @@
#include "lobject.h"
+#include "lstate.h"
/*
@@ -95,8 +96,8 @@ LUAI_FUNC int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2,
int inv, int isfloat, TMS event);
LUAI_FUNC void luaT_adjustvarargs (lua_State *L, int nfixparams,
- struct CallInfo *ci, const Proto *p);
-LUAI_FUNC void luaT_getvarargs (lua_State *L, struct CallInfo *ci,
+ CallInfo *ci, const Proto *p);
+LUAI_FUNC void luaT_getvarargs (lua_State *L, CallInfo *ci,
StkId where, int wanted);
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);
typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);
+/*
+** Type used by the debug API to collect debug information
+*/
+typedef struct lua_Debug lua_Debug;
+
+
+/*
+** Functions to be called by the debugger in specific events
+*/
+typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
/*
@@ -442,12 +452,6 @@ LUA_API void (lua_closeslot) (lua_State *L, int idx);
#define LUA_MASKLINE (1 << LUA_HOOKLINE)
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
-typedef struct lua_Debug lua_Debug; /* activation record */
-
-
-/* Functions to be called by the debugger in specific events */
-typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
-
LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);
LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);