diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-03-20 17:34:49 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-03-20 17:34:49 +0100 |
commit | 9b05d1d26d358bf836a7ad0b23c244836cb30a06 (patch) | |
tree | 74d28be5dd16d4e139a630fd65e58df58de93ced /src/deep.h | |
parent | df1113151aff47bfd1b401bf8d06a3fe8f6b9115 (diff) | |
download | lanes-9b05d1d26d358bf836a7ad0b23c244836cb30a06.tar.gz lanes-9b05d1d26d358bf836a7ad0b23c244836cb30a06.tar.bz2 lanes-9b05d1d26d358bf836a7ad0b23c244836cb30a06.zip |
C++ migration: removed most typedef, removed uint_t
Diffstat (limited to 'src/deep.h')
-rw-r--r-- | src/deep.h | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -17,27 +17,24 @@ extern "C" { | |||
17 | #include "uniquekey.h" | 17 | #include "uniquekey.h" |
18 | 18 | ||
19 | // forwards | 19 | // forwards |
20 | struct s_Universe; | 20 | struct Universe; |
21 | typedef struct s_Universe Universe; | ||
22 | 21 | ||
23 | enum eLookupMode | 22 | enum LookupMode |
24 | { | 23 | { |
25 | eLM_LaneBody, // send the lane body directly from the source to the destination lane | 24 | eLM_LaneBody, // send the lane body directly from the source to the destination lane |
26 | eLM_ToKeeper, // send a function from a lane to a keeper state | 25 | eLM_ToKeeper, // send a function from a lane to a keeper state |
27 | eLM_FromKeeper // send a function from a keeper state to a lane | 26 | eLM_FromKeeper // send a function from a keeper state to a lane |
28 | }; | 27 | }; |
29 | typedef enum eLookupMode LookupMode; | ||
30 | 28 | ||
31 | enum eDeepOp | 29 | enum DeepOp |
32 | { | 30 | { |
33 | eDO_new, | 31 | eDO_new, |
34 | eDO_delete, | 32 | eDO_delete, |
35 | eDO_metatable, | 33 | eDO_metatable, |
36 | eDO_module, | 34 | eDO_module, |
37 | }; | 35 | }; |
38 | typedef enum eDeepOp DeepOp; | ||
39 | 36 | ||
40 | typedef void* (*luaG_IdFunction)( lua_State* L, DeepOp op_); | 37 | using luaG_IdFunction = void*( lua_State* L, DeepOp op_); |
41 | 38 | ||
42 | // ################################################################################################ | 39 | // ################################################################################################ |
43 | 40 | ||
@@ -49,7 +46,7 @@ struct DeepPrelude | |||
49 | { | 46 | { |
50 | UniqueKey const magic{ DEEP_VERSION }; | 47 | UniqueKey const magic{ DEEP_VERSION }; |
51 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc | 48 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc |
52 | luaG_IdFunction idfunc { nullptr }; | 49 | luaG_IdFunction* idfunc { nullptr }; |
53 | // data is destroyed when refcount is 0 | 50 | // data is destroyed when refcount is 0 |
54 | volatile int refcount{ 0 }; | 51 | volatile int refcount{ 0 }; |
55 | }; | 52 | }; |
@@ -57,5 +54,5 @@ struct DeepPrelude | |||
57 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_); | 54 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_); |
58 | void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); | 55 | void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); |
59 | 56 | ||
60 | LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc, int nuv_); | 57 | LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction* idfunc, int nuv_); |
61 | LANES_API void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index); | 58 | LANES_API void* luaG_todeep( lua_State* L, luaG_IdFunction* idfunc, int index); |