diff options
author | Benoit Germain <b n t DOT g e r m a i n AT g m a i l DOT c o m> | 2018-10-29 13:39:49 +0100 |
---|---|---|
committer | Benoit Germain <b n t DOT g e r m a i n AT g m a i l DOT c o m> | 2018-10-29 13:39:49 +0100 |
commit | ea9e8a3af1c2357c454ef18c8136c14a22b8675a (patch) | |
tree | 0b089ae8b94d7901db8c86051fb001bf5936bc54 /src/deep.h | |
parent | e2908369e92b14e661b16401b6389d6d4a026278 (diff) | |
parent | debc6b3403077fc5bd1d144d779806fdd22ab55e (diff) | |
download | lanes-ea9e8a3af1c2357c454ef18c8136c14a22b8675a.tar.gz lanes-ea9e8a3af1c2357c454ef18c8136c14a22b8675a.tar.bz2 lanes-ea9e8a3af1c2357c454ef18c8136c14a22b8675a.zip |
Merge changes
Diffstat (limited to 'src/deep.h')
-rw-r--r-- | src/deep.h | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -6,14 +6,22 @@ | |||
6 | * said modules will have to link against lanes (it is not really possible to separate the 'deep userdata' implementation from the rest of Lanes) | 6 | * said modules will have to link against lanes (it is not really possible to separate the 'deep userdata' implementation from the rest of Lanes) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | |||
10 | #include "lua.h" | 9 | #include "lua.h" |
10 | #include "platform.h" | ||
11 | |||
12 | // forwards | ||
13 | struct s_Universe; | ||
14 | typedef struct s_Universe Universe; | ||
15 | enum eLookupMode; | ||
16 | typedef enum eLookupMode LookupMode; | ||
11 | 17 | ||
18 | #if !defined LANES_API // when deep is compiled standalone outside Lanes | ||
12 | #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) | 19 | #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) |
13 | #define LANES_API __declspec(dllexport) | 20 | #define LANES_API __declspec(dllexport) |
14 | #else | 21 | #else |
15 | #define LANES_API | 22 | #define LANES_API |
16 | #endif // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) | 23 | #endif // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) |
24 | #endif // LANES_API | ||
17 | 25 | ||
18 | enum eDeepOp | 26 | enum eDeepOp |
19 | { | 27 | { |
@@ -25,6 +33,21 @@ enum eDeepOp | |||
25 | 33 | ||
26 | typedef void* (*luaG_IdFunction)( lua_State* L, enum eDeepOp op_); | 34 | typedef void* (*luaG_IdFunction)( lua_State* L, enum eDeepOp op_); |
27 | 35 | ||
36 | // ################################################################################################ | ||
37 | |||
38 | // this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime | ||
39 | struct s_DeepPrelude | ||
40 | { | ||
41 | volatile int refcount; | ||
42 | void* deep; | ||
43 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc | ||
44 | luaG_IdFunction idfunc; | ||
45 | }; | ||
46 | typedef struct s_DeepPrelude DeepPrelude; | ||
47 | |||
48 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, LookupMode mode_); | ||
49 | void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); | ||
50 | |||
28 | extern LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc); | 51 | extern LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc); |
29 | extern LANES_API void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index); | 52 | extern LANES_API void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index); |
30 | extern LANES_API void luaG_pushdeepversion( lua_State* L); | 53 | extern LANES_API void luaG_pushdeepversion( lua_State* L); |