aboutsummaryrefslogtreecommitdiff
path: root/src/deep.h
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-03-20 17:34:49 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2024-03-20 17:34:49 +0100
commit9b05d1d26d358bf836a7ad0b23c244836cb30a06 (patch)
tree74d28be5dd16d4e139a630fd65e58df58de93ced /src/deep.h
parentdf1113151aff47bfd1b401bf8d06a3fe8f6b9115 (diff)
downloadlanes-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.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/deep.h b/src/deep.h
index d8a1772..5322525 100644
--- a/src/deep.h
+++ b/src/deep.h
@@ -17,27 +17,24 @@ extern "C" {
17#include "uniquekey.h" 17#include "uniquekey.h"
18 18
19// forwards 19// forwards
20struct s_Universe; 20struct Universe;
21typedef struct s_Universe Universe;
22 21
23enum eLookupMode 22enum 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};
29typedef enum eLookupMode LookupMode;
30 28
31enum eDeepOp 29enum 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};
38typedef enum eDeepOp DeepOp;
39 36
40typedef void* (*luaG_IdFunction)( lua_State* L, DeepOp op_); 37using 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
57char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_); 54char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_);
58void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); 55void free_deep_prelude( lua_State* L, DeepPrelude* prelude_);
59 56
60LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc, int nuv_); 57LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction* idfunc, int nuv_);
61LANES_API void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index); 58LANES_API void* luaG_todeep( lua_State* L, luaG_IdFunction* idfunc, int index);