diff options
| author | Benoit Germain <bnt.germain@gmail.com> | 2018-10-25 14:32:48 +0200 |
|---|---|---|
| committer | Benoit Germain <bnt.germain@gmail.com> | 2018-10-25 14:32:48 +0200 |
| commit | 0ba99f2ffa8b8d6a865a7fae8fb8d0a3a5d85e06 (patch) | |
| tree | c35ff800b669ff901e673b7b95ed6ac741c76c6a /src | |
| parent | 9645a86fbcb16ca83c5f4ff0dae0925ac71bb46b (diff) | |
| download | lanes-0ba99f2ffa8b8d6a865a7fae8fb8d0a3a5d85e06.tar.gz lanes-0ba99f2ffa8b8d6a865a7fae8fb8d0a3a5d85e06.tar.bz2 lanes-0ba99f2ffa8b8d6a865a7fae8fb8d0a3a5d85e06.zip | |
More MinGW buildfixes (I hope)
Diffstat (limited to 'src')
| -rw-r--r-- | src/deep.c | 6 | ||||
| -rw-r--r-- | src/deep.h | 4 | ||||
| -rw-r--r-- | src/keeper.c | 2 | ||||
| -rw-r--r-- | src/keeper.h | 4 | ||||
| -rw-r--r-- | src/tools.c | 26 | ||||
| -rw-r--r-- | src/tools.h | 9 |
6 files changed, 28 insertions, 23 deletions
| @@ -174,7 +174,7 @@ static void get_deep_lookup( lua_State* L) | |||
| 174 | * Return the registered ID function for 'index' (deep userdata proxy), | 174 | * Return the registered ID function for 'index' (deep userdata proxy), |
| 175 | * or NULL if 'index' is not a deep userdata proxy. | 175 | * or NULL if 'index' is not a deep userdata proxy. |
| 176 | */ | 176 | */ |
| 177 | static inline luaG_IdFunction get_idfunc( lua_State* L, int index, enum eLookupMode mode_) | 177 | static inline luaG_IdFunction get_idfunc( lua_State* L, int index, LookupMode mode_) |
| 178 | { | 178 | { |
| 179 | // when looking inside a keeper, we are 100% sure the object is a deep userdata | 179 | // when looking inside a keeper, we are 100% sure the object is a deep userdata |
| 180 | if( mode_ == eLM_FromKeeper) | 180 | if( mode_ == eLM_FromKeeper) |
| @@ -270,7 +270,7 @@ static int deep_userdata_gc( lua_State* L) | |||
| 270 | * used in this Lua state (metatable, registring it). Otherwise, increments the | 270 | * used in this Lua state (metatable, registring it). Otherwise, increments the |
| 271 | * reference count. | 271 | * reference count. |
| 272 | */ | 272 | */ |
| 273 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, enum eLookupMode mode_) | 273 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, LookupMode mode_) |
| 274 | { | 274 | { |
| 275 | DeepPrelude** proxy; | 275 | DeepPrelude** proxy; |
| 276 | 276 | ||
| @@ -519,7 +519,7 @@ void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index) | |||
| 519 | * the id function of the copied value, or NULL for non-deep userdata | 519 | * the id function of the copied value, or NULL for non-deep userdata |
| 520 | * (not copied) | 520 | * (not copied) |
| 521 | */ | 521 | */ |
| 522 | luaG_IdFunction copydeep( Universe* U, lua_State* L, lua_State* L2, int index, enum eLookupMode mode_) | 522 | luaG_IdFunction copydeep( Universe* U, lua_State* L, lua_State* L2, int index, LookupMode mode_) |
| 523 | { | 523 | { |
| 524 | char const* errmsg; | 524 | char const* errmsg; |
| 525 | luaG_IdFunction idfunc = get_idfunc( L, index, mode_); | 525 | luaG_IdFunction idfunc = get_idfunc( L, index, mode_); |
| @@ -11,6 +11,8 @@ | |||
| 11 | // forwards | 11 | // forwards |
| 12 | struct s_Universe; | 12 | struct s_Universe; |
| 13 | typedef struct s_Universe Universe; | 13 | typedef struct s_Universe Universe; |
| 14 | enum eLookupMode; | ||
| 15 | typedef enum eLookupMode LookupMode; | ||
| 14 | 16 | ||
| 15 | #if !defined LANES_API // when deep is compiled standalone outside Lanes | 17 | #if !defined LANES_API // when deep is compiled standalone outside Lanes |
| 16 | #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) | 18 | #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) |
| @@ -42,7 +44,7 @@ struct s_DeepPrelude | |||
| 42 | }; | 44 | }; |
| 43 | typedef struct s_DeepPrelude DeepPrelude; | 45 | typedef struct s_DeepPrelude DeepPrelude; |
| 44 | 46 | ||
| 45 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, enum eLookupMode mode_); | 47 | char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, LookupMode mode_); |
| 46 | void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); | 48 | void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); |
| 47 | 49 | ||
| 48 | extern LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc); | 50 | extern LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc); |
diff --git a/src/keeper.c b/src/keeper.c index 94cf8d6..907334f 100644 --- a/src/keeper.c +++ b/src/keeper.c | |||
| @@ -745,7 +745,7 @@ void keeper_release( Keeper* K) | |||
| 745 | if( K) MUTEX_UNLOCK( &K->keeper_cs); | 745 | if( K) MUTEX_UNLOCK( &K->keeper_cs); |
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, enum eLookupMode mode_) | 748 | void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, LookupMode mode_) |
| 749 | { | 749 | { |
| 750 | int i, n = lua_gettop( L); | 750 | int i, n = lua_gettop( L); |
| 751 | for( i = val_i_; i <= n; ++ i) | 751 | for( i = val_i_; i <= n; ++ i) |
diff --git a/src/keeper.h b/src/keeper.h index ac275c1..06cf3be 100644 --- a/src/keeper.h +++ b/src/keeper.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | // forwards | 7 | // forwards |
| 8 | struct s_Universe; | 8 | struct s_Universe; |
| 9 | typedef struct s_Universe Universe; | 9 | typedef struct s_Universe Universe; |
| 10 | enum eLookupMode; | ||
| 11 | typedef enum eLookupMode LookupMode; | ||
| 10 | 12 | ||
| 11 | struct s_Keeper | 13 | struct s_Keeper |
| 12 | { | 14 | { |
| @@ -29,7 +31,7 @@ void close_keepers( Universe* U, lua_State* L); | |||
| 29 | Keeper* keeper_acquire( Keepers* keepers_, ptrdiff_t magic_); | 31 | Keeper* keeper_acquire( Keepers* keepers_, ptrdiff_t magic_); |
| 30 | #define KEEPER_MAGIC_SHIFT 3 | 32 | #define KEEPER_MAGIC_SHIFT 3 |
| 31 | void keeper_release( Keeper* K); | 33 | void keeper_release( Keeper* K); |
| 32 | void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, enum eLookupMode const mode_); | 34 | void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, LookupMode const mode_); |
| 33 | int keeper_push_linda_storage( Universe* U, lua_State* L, void* ptr_, ptrdiff_t magic_); | 35 | int keeper_push_linda_storage( Universe* U, lua_State* L, void* ptr_, ptrdiff_t magic_); |
| 34 | 36 | ||
| 35 | #define NIL_SENTINEL ((void*)keeper_toggle_nil_sentinels) | 37 | #define NIL_SENTINEL ((void*)keeper_toggle_nil_sentinels) |
diff --git a/src/tools.c b/src/tools.c index 3e3efeb..ddc879e 100644 --- a/src/tools.c +++ b/src/tools.c | |||
| @@ -46,7 +46,7 @@ THE SOFTWARE. | |||
| 46 | #include "lanes.h" | 46 | #include "lanes.h" |
| 47 | 47 | ||
| 48 | // functions implemented in deep.c | 48 | // functions implemented in deep.c |
| 49 | extern luaG_IdFunction copydeep( Universe* U, lua_State* L, lua_State* L2, int index, enum eLookupMode mode_); | 49 | extern luaG_IdFunction copydeep( Universe* U, lua_State* L, lua_State* L2, int index, LookupMode mode_); |
| 50 | extern void push_registry_subtable( lua_State* L, void* key_); | 50 | extern void push_registry_subtable( lua_State* L, void* key_); |
| 51 | 51 | ||
| 52 | char const* const CONFIG_REGKEY = "ee932492-a654-4506-9da8-f16540bdb5d4"; | 52 | char const* const CONFIG_REGKEY = "ee932492-a654-4506-9da8-f16540bdb5d4"; |
| @@ -585,7 +585,7 @@ void populate_func_lookup_table( lua_State* L, int _i, char const* name_) | |||
| 585 | DEBUGSPEW_CODE( -- U->debugspew_indent_depth); | 585 | DEBUGSPEW_CODE( -- U->debugspew_indent_depth); |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | void call_on_state_create( Universe* U, lua_State* L, lua_State* from_, enum eLookupMode mode_) | 588 | void call_on_state_create( Universe* U, lua_State* L, lua_State* from_, LookupMode mode_) |
| 589 | { | 589 | { |
| 590 | if( U->on_state_create_func != NULL) | 590 | if( U->on_state_create_func != NULL) |
| 591 | { | 591 | { |
| @@ -828,7 +828,7 @@ static int table_lookup_sentinel( lua_State* L) | |||
| 828 | /* | 828 | /* |
| 829 | * retrieve the name of a function/table in the lookup database | 829 | * retrieve the name of a function/table in the lookup database |
| 830 | */ | 830 | */ |
| 831 | static char const* find_lookup_name( lua_State* L, uint_t i, enum eLookupMode mode_, char const* upName_, size_t* len_) | 831 | static char const* find_lookup_name( lua_State* L, uint_t i, LookupMode mode_, char const* upName_, size_t* len_) |
| 832 | { | 832 | { |
| 833 | DEBUGSPEW_CODE( Universe* const U = universe_get( L)); | 833 | DEBUGSPEW_CODE( Universe* const U = universe_get( L)); |
| 834 | char const* fqn; | 834 | char const* fqn; |
| @@ -899,7 +899,7 @@ static char const* find_lookup_name( lua_State* L, uint_t i, enum eLookupMode mo | |||
| 899 | /* | 899 | /* |
| 900 | * Push a looked-up table, or nothing if we found nothing | 900 | * Push a looked-up table, or nothing if we found nothing |
| 901 | */ | 901 | */ |
| 902 | static bool_t lookup_table( lua_State* L2, lua_State* L, uint_t i, enum eLookupMode mode_, char const* upName_) | 902 | static bool_t lookup_table( lua_State* L2, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) |
| 903 | { | 903 | { |
| 904 | // get the name of the table we want to send | 904 | // get the name of the table we want to send |
| 905 | size_t len; | 905 | size_t len; |
| @@ -1195,7 +1195,7 @@ int luaG_nameof( lua_State* L) | |||
| 1195 | /* | 1195 | /* |
| 1196 | * Push a looked-up native/LuaJIT function. | 1196 | * Push a looked-up native/LuaJIT function. |
| 1197 | */ | 1197 | */ |
| 1198 | static void lookup_native_func( lua_State* L2, lua_State* L, uint_t i, enum eLookupMode mode_, char const* upName_) | 1198 | static void lookup_native_func( lua_State* L2, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) |
| 1199 | { | 1199 | { |
| 1200 | // get the name of the function we want to send | 1200 | // get the name of the function we want to send |
| 1201 | size_t len; | 1201 | size_t len; |
| @@ -1276,9 +1276,9 @@ enum e_vt | |||
| 1276 | VT_KEY, | 1276 | VT_KEY, |
| 1277 | VT_METATABLE | 1277 | VT_METATABLE |
| 1278 | }; | 1278 | }; |
| 1279 | static bool_t inter_copy_one_( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum e_vt value_type, enum eLookupMode mode_, char const* upName_); | 1279 | static bool_t inter_copy_one_( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum e_vt value_type, LookupMode mode_, char const* upName_); |
| 1280 | 1280 | ||
| 1281 | static void inter_copy_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum eLookupMode mode_, char const* upName_) | 1281 | static void inter_copy_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) |
| 1282 | { | 1282 | { |
| 1283 | int n, needToPush; | 1283 | int n, needToPush; |
| 1284 | luaL_Buffer b; | 1284 | luaL_Buffer b; |
| @@ -1427,7 +1427,7 @@ static void inter_copy_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_ | |||
| 1427 | * | 1427 | * |
| 1428 | * Always pushes a function to 'L2'. | 1428 | * Always pushes a function to 'L2'. |
| 1429 | */ | 1429 | */ |
| 1430 | static void push_cached_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum eLookupMode mode_, char const* upName_) | 1430 | static void push_cached_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) |
| 1431 | { | 1431 | { |
| 1432 | FuncSubType funcSubType; | 1432 | FuncSubType funcSubType; |
| 1433 | /*lua_CFunction cfunc =*/ luaG_tocfunction( L, i, &funcSubType); // NULL for LuaJIT-fast && bytecode functions | 1433 | /*lua_CFunction cfunc =*/ luaG_tocfunction( L, i, &funcSubType); // NULL for LuaJIT-fast && bytecode functions |
| @@ -1480,7 +1480,7 @@ static void push_cached_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua | |||
| 1480 | } | 1480 | } |
| 1481 | } | 1481 | } |
| 1482 | 1482 | ||
| 1483 | static void inter_copy_keyvaluepair( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, enum e_vt vt, enum eLookupMode mode_, char const* upName_) | 1483 | static void inter_copy_keyvaluepair( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, enum e_vt vt, LookupMode mode_, char const* upName_) |
| 1484 | { | 1484 | { |
| 1485 | uint_t val_i = lua_gettop( L); | 1485 | uint_t val_i = lua_gettop( L); |
| 1486 | uint_t key_i = val_i - 1; | 1486 | uint_t key_i = val_i - 1; |
| @@ -1542,7 +1542,7 @@ static void inter_copy_keyvaluepair( Universe* U, lua_State* L2, uint_t L2_cache | |||
| 1542 | * | 1542 | * |
| 1543 | * Returns TRUE if value was pushed, FALSE if its type is non-supported. | 1543 | * Returns TRUE if value was pushed, FALSE if its type is non-supported. |
| 1544 | */ | 1544 | */ |
| 1545 | static bool_t inter_copy_one_( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum e_vt vt, enum eLookupMode mode_, char const* upName_) | 1545 | static bool_t inter_copy_one_( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum e_vt vt, LookupMode mode_, char const* upName_) |
| 1546 | { | 1546 | { |
| 1547 | bool_t ret = TRUE; | 1547 | bool_t ret = TRUE; |
| 1548 | bool_t ignore = FALSE; | 1548 | bool_t ignore = FALSE; |
| @@ -1809,7 +1809,7 @@ static bool_t inter_copy_one_( Universe* U, lua_State* L2, uint_t L2_cache_i, lu | |||
| 1809 | * | 1809 | * |
| 1810 | * Note: Parameters are in this order ('L' = from first) to be same as 'lua_xmove'. | 1810 | * Note: Parameters are in this order ('L' = from first) to be same as 'lua_xmove'. |
| 1811 | */ | 1811 | */ |
| 1812 | int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, enum eLookupMode mode_) | 1812 | int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_) |
| 1813 | { | 1813 | { |
| 1814 | uint_t top_L = lua_gettop( L); | 1814 | uint_t top_L = lua_gettop( L); |
| 1815 | uint_t top_L2 = lua_gettop( L2); | 1815 | uint_t top_L2 = lua_gettop( L2); |
| @@ -1867,14 +1867,14 @@ int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, enum eL | |||
| 1867 | } | 1867 | } |
| 1868 | 1868 | ||
| 1869 | 1869 | ||
| 1870 | int luaG_inter_move( Universe* U, lua_State* L, lua_State* L2, uint_t n, enum eLookupMode mode_) | 1870 | int luaG_inter_move( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_) |
| 1871 | { | 1871 | { |
| 1872 | int ret = luaG_inter_copy( U, L, L2, n, mode_); | 1872 | int ret = luaG_inter_copy( U, L, L2, n, mode_); |
| 1873 | lua_pop( L, (int) n); | 1873 | lua_pop( L, (int) n); |
| 1874 | return ret; | 1874 | return ret; |
| 1875 | } | 1875 | } |
| 1876 | 1876 | ||
| 1877 | int luaG_inter_copy_package( Universe* U, lua_State* L, lua_State* L2, int package_idx_, enum eLookupMode mode_) | 1877 | int luaG_inter_copy_package( Universe* U, lua_State* L, lua_State* L2, int package_idx_, LookupMode mode_) |
| 1878 | { | 1878 | { |
| 1879 | DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "luaG_inter_copy_package()\n" INDENT_END)); | 1879 | DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "luaG_inter_copy_package()\n" INDENT_END)); |
| 1880 | DEBUGSPEW_CODE( ++ U->debugspew_indent_depth); | 1880 | DEBUGSPEW_CODE( ++ U->debugspew_indent_depth); |
diff --git a/src/tools.h b/src/tools.h index ac69074..df429f7 100644 --- a/src/tools.h +++ b/src/tools.h | |||
| @@ -31,11 +31,12 @@ enum eLookupMode | |||
| 31 | eLM_ToKeeper, // send a function from a lane to a keeper state | 31 | eLM_ToKeeper, // send a function from a lane to a keeper state |
| 32 | eLM_FromKeeper // send a function from a keeper state to a lane | 32 | eLM_FromKeeper // send a function from a keeper state to a lane |
| 33 | }; | 33 | }; |
| 34 | typedef enum eLookupMode LookupMode; | ||
| 34 | 35 | ||
| 35 | int luaG_inter_copy_package( Universe* U, lua_State* L, lua_State* L2, int package_idx_, enum eLookupMode mode_); | 36 | int luaG_inter_copy_package( Universe* U, lua_State* L, lua_State* L2, int package_idx_, LookupMode mode_); |
| 36 | 37 | ||
| 37 | int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, enum eLookupMode mode_); | 38 | int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_); |
| 38 | int luaG_inter_move( Universe* U, lua_State* L, lua_State* L2, uint_t n, enum eLookupMode mode_); | 39 | int luaG_inter_move( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_); |
| 39 | 40 | ||
| 40 | int luaG_nameof( lua_State* L); | 41 | int luaG_nameof( lua_State* L); |
| 41 | int luaG_new_require( lua_State* L); | 42 | int luaG_new_require( lua_State* L); |
| @@ -43,7 +44,7 @@ int luaG_new_require( lua_State* L); | |||
| 43 | void populate_func_lookup_table( lua_State* L, int _i, char const* _name); | 44 | void populate_func_lookup_table( lua_State* L, int _i, char const* _name); |
| 44 | void serialize_require( Universe* U, lua_State *L); | 45 | void serialize_require( Universe* U, lua_State *L); |
| 45 | void initialize_on_state_create( Universe* U, lua_State* L); | 46 | void initialize_on_state_create( Universe* U, lua_State* L); |
| 46 | void call_on_state_create( Universe* U, lua_State* L, lua_State* from_, enum eLookupMode mode_); | 47 | void call_on_state_create( Universe* U, lua_State* L, lua_State* from_, LookupMode mode_); |
| 47 | 48 | ||
| 48 | // ################################################################################################ | 49 | // ################################################################################################ |
| 49 | 50 | ||
