From 9645a86fbcb16ca83c5f4ff0dae0925ac71bb46b Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Thu, 25 Oct 2018 14:03:32 +0200 Subject: Fix Lanes build by reorganizing types around a bit --- src/deep.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/deep.h') diff --git a/src/deep.h b/src/deep.h index 8e999d6..366c5a8 100644 --- a/src/deep.h +++ b/src/deep.h @@ -6,14 +6,19 @@ * said modules will have to link against lanes (it is not really possible to separate the 'deep userdata' implementation from the rest of Lanes) */ - #include "lua.h" +// forwards +struct s_Universe; +typedef struct s_Universe Universe; + +#if !defined LANES_API // when deep is compiled standalone outside Lanes #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) #define LANES_API __declspec(dllexport) #else #define LANES_API #endif // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) +#endif // LANES_API enum eDeepOp { @@ -25,6 +30,21 @@ enum eDeepOp typedef void* (*luaG_IdFunction)( lua_State* L, enum eDeepOp op_); +// ################################################################################################ + +// this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime +struct s_DeepPrelude +{ + volatile int refcount; + void* deep; + // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc + luaG_IdFunction idfunc; +}; +typedef struct s_DeepPrelude DeepPrelude; + +char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, enum eLookupMode mode_); +void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); + extern LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc); extern LANES_API void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index); extern LANES_API void luaG_pushdeepversion( lua_State* L); -- cgit v1.2.3-55-g6feb