aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/cancel.h10
-rw-r--r--src/deep.cpp14
-rw-r--r--src/deep.h17
-rw-r--r--src/keeper.cpp8
-rw-r--r--src/keeper.h16
-rw-r--r--src/lanes.cpp12
-rw-r--r--src/lanes_private.h7
-rw-r--r--src/linda.cpp6
-rw-r--r--src/threading.cpp4
-rw-r--r--src/threading.h18
-rw-r--r--src/threading_osx.h5
-rw-r--r--src/tools.cpp48
-rw-r--r--src/tools.h12
-rw-r--r--src/universe.h15
14 files changed, 87 insertions, 105 deletions
diff --git a/src/cancel.h b/src/cancel.h
index c1bee4e..be4d781 100644
--- a/src/cancel.h
+++ b/src/cancel.h
@@ -15,7 +15,7 @@ extern "C" {
15 15
16// ################################################################################################ 16// ################################################################################################
17 17
18typedef struct s_Lane Lane; // forward 18struct Lane; // forward
19 19
20/* 20/*
21 * Lane cancellation request modes 21 * Lane cancellation request modes
@@ -27,14 +27,14 @@ enum e_cancel_request
27 CANCEL_HARD // user wants the lane to be interrupted (meaning code won't return from those functions) from inside linda:send/receive calls 27 CANCEL_HARD // user wants the lane to be interrupted (meaning code won't return from those functions) from inside linda:send/receive calls
28}; 28};
29 29
30typedef enum 30enum cancel_result
31{ 31{
32 CR_Timeout, 32 CR_Timeout,
33 CR_Cancelled, 33 CR_Cancelled,
34 CR_Killed 34 CR_Killed
35} cancel_result; 35};
36 36
37typedef enum 37enum CancelOp
38{ 38{
39 CO_Invalid = -2, 39 CO_Invalid = -2,
40 CO_Hard = -1, 40 CO_Hard = -1,
@@ -43,7 +43,7 @@ typedef enum
43 CO_Line = LUA_MASKLINE, 43 CO_Line = LUA_MASKLINE,
44 CO_Call = LUA_MASKCALL, 44 CO_Call = LUA_MASKCALL,
45 CO_Ret = LUA_MASKRET, 45 CO_Ret = LUA_MASKRET,
46} CancelOp; 46};
47 47
48// crc64/we of string "CANCEL_ERROR" generated at http://www.nitrxgen.net/hashgen/ 48// crc64/we of string "CANCEL_ERROR" generated at http://www.nitrxgen.net/hashgen/
49static constexpr UniqueKey CANCEL_ERROR{ 0xe97d41626cc97577ull }; // 'cancel_error' sentinel 49static constexpr UniqueKey CANCEL_ERROR{ 0xe97d41626cc97577ull }; // 'cancel_error' sentinel
diff --git a/src/deep.cpp b/src/deep.cpp
index ee08cdd..c9e3655 100644
--- a/src/deep.cpp
+++ b/src/deep.cpp
@@ -108,7 +108,7 @@ static void get_deep_lookup( lua_State* L)
108* Return the registered ID function for 'index' (deep userdata proxy), 108* Return the registered ID function for 'index' (deep userdata proxy),
109* or nullptr if 'index' is not a deep userdata proxy. 109* or nullptr if 'index' is not a deep userdata proxy.
110*/ 110*/
111static inline luaG_IdFunction get_idfunc( lua_State* L, int index, LookupMode mode_) 111static inline luaG_IdFunction* get_idfunc( lua_State* L, int index, LookupMode mode_)
112{ 112{
113 // when looking inside a keeper, we are 100% sure the object is a deep userdata 113 // when looking inside a keeper, we are 100% sure the object is a deep userdata
114 if( mode_ == eLM_FromKeeper) 114 if( mode_ == eLM_FromKeeper)
@@ -122,7 +122,7 @@ static inline luaG_IdFunction get_idfunc( lua_State* L, int index, LookupMode mo
122 // essentially we are making sure that the metatable of the object we want to copy is stored in our metatable/idfunc database 122 // essentially we are making sure that the metatable of the object we want to copy is stored in our metatable/idfunc database
123 // it is the only way to ensure that the userdata is indeed a deep userdata! 123 // it is the only way to ensure that the userdata is indeed a deep userdata!
124 // of course, we could just trust the caller, but we won't 124 // of course, we could just trust the caller, but we won't
125 luaG_IdFunction ret; 125 luaG_IdFunction* ret;
126 STACK_GROW( L, 1); 126 STACK_GROW( L, 1);
127 STACK_CHECK( L, 0); 127 STACK_CHECK( L, 0);
128 128
@@ -134,7 +134,7 @@ static inline luaG_IdFunction get_idfunc( lua_State* L, int index, LookupMode mo
134 // replace metatable with the idfunc pointer, if it is actually a deep userdata 134 // replace metatable with the idfunc pointer, if it is actually a deep userdata
135 get_deep_lookup( L); // deep ... idfunc|nil 135 get_deep_lookup( L); // deep ... idfunc|nil
136 136
137 ret = (luaG_IdFunction) lua_touserdata( L, -1); // nullptr if not a userdata 137 ret = (luaG_IdFunction*) lua_touserdata( L, -1); // nullptr if not a userdata
138 lua_pop( L, 1); 138 lua_pop( L, 1);
139 STACK_END( L, 0); 139 STACK_END( L, 0);
140 return ret; 140 return ret;
@@ -377,7 +377,7 @@ char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, in
377* 377*
378* Returns: 'proxy' userdata for accessing the deep data via 'luaG_todeep()' 378* Returns: 'proxy' userdata for accessing the deep data via 'luaG_todeep()'
379*/ 379*/
380int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc, int nuv_) 380int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction* idfunc, int nuv_)
381{ 381{
382 char const* errmsg; 382 char const* errmsg;
383 383
@@ -424,7 +424,7 @@ int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc, int nuv_)
424* Reference count is not changed, and access to the deep userdata is not 424* Reference count is not changed, and access to the deep userdata is not
425* serialized. It is the module's responsibility to prevent conflicting usage. 425* serialized. It is the module's responsibility to prevent conflicting usage.
426*/ 426*/
427void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index) 427void* luaG_todeep( lua_State* L, luaG_IdFunction* idfunc, int index)
428{ 428{
429 DeepPrelude** proxy; 429 DeepPrelude** proxy;
430 430
@@ -449,10 +449,10 @@ void* luaG_todeep( lua_State* L, luaG_IdFunction idfunc, int index)
449 * the id function of the copied value, or nullptr for non-deep userdata 449 * the id function of the copied value, or nullptr for non-deep userdata
450 * (not copied) 450 * (not copied)
451 */ 451 */
452bool copydeep( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) 452bool copydeep(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, LookupMode mode_, char const* upName_)
453{ 453{
454 char const* errmsg; 454 char const* errmsg;
455 luaG_IdFunction idfunc = get_idfunc( L, i, mode_); 455 luaG_IdFunction* idfunc = get_idfunc( L, i, mode_);
456 int nuv = 0; 456 int nuv = 0;
457 457
458 if (idfunc == nullptr) 458 if (idfunc == nullptr)
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);
diff --git a/src/keeper.cpp b/src/keeper.cpp
index 17f5df2..6fb22a9 100644
--- a/src/keeper.cpp
+++ b/src/keeper.cpp
@@ -59,12 +59,12 @@
59#define __min( a, b) (((a) < (b)) ? (a) : (b)) 59#define __min( a, b) (((a) < (b)) ? (a) : (b))
60#endif // __min 60#endif // __min
61 61
62typedef struct 62struct keeper_fifo
63{ 63{
64 lua_Integer first; 64 lua_Integer first;
65 lua_Integer count; 65 lua_Integer count;
66 lua_Integer limit; 66 lua_Integer limit;
67} keeper_fifo; 67};
68 68
69static int const CONTENTS_TABLE = 1; 69static int const CONTENTS_TABLE = 1;
70 70
@@ -643,7 +643,7 @@ void init_keepers( Universe* U, lua_State* L)
643 (void) luaL_error( L, "Bad number of keepers (%d)", nb_keepers); 643 (void) luaL_error( L, "Bad number of keepers (%d)", nb_keepers);
644 } 644 }
645 645
646 // Keepers contains an array of 1 s_Keeper, adjust for the actual number of keeper states 646 // Keepers contains an array of 1 Keeper, adjust for the actual number of keeper states
647 { 647 {
648 size_t const bytes = sizeof( Keepers) + (nb_keepers - 1) * sizeof( Keeper); 648 size_t const bytes = sizeof( Keepers) + (nb_keepers - 1) * sizeof( Keeper);
649 { 649 {
@@ -793,7 +793,7 @@ void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, LookupMode const mod
793* 793*
794* Returns: number of return values (pushed to 'L') or -1 in case of error 794* Returns: number of return values (pushed to 'L') or -1 in case of error
795*/ 795*/
796int keeper_call( Universe* U, lua_State* K, keeper_api_t func_, lua_State* L, void* linda, uint_t starting_index) 796int keeper_call(Universe* U, lua_State* K, keeper_api_t func_, lua_State* L, void* linda, int starting_index)
797{ 797{
798 int const args = starting_index ? (lua_gettop( L) - starting_index + 1) : 0; 798 int const args = starting_index ? (lua_gettop( L) - starting_index + 1) : 0;
799 int const Ktos = lua_gettop( K); 799 int const Ktos = lua_gettop( K);
diff --git a/src/keeper.h b/src/keeper.h
index 4cf3605..ce9742a 100644
--- a/src/keeper.h
+++ b/src/keeper.h
@@ -12,25 +12,21 @@ extern "C" {
12#include "uniquekey.h" 12#include "uniquekey.h"
13 13
14// forwards 14// forwards
15struct s_Universe; 15struct Universe;
16typedef struct s_Universe Universe; 16enum LookupMode;
17enum eLookupMode;
18typedef enum eLookupMode LookupMode;
19 17
20struct s_Keeper 18struct Keeper
21{ 19{
22 MUTEX_T keeper_cs; 20 MUTEX_T keeper_cs;
23 lua_State* L; 21 lua_State* L;
24 //int count; 22 //int count;
25}; 23};
26typedef struct s_Keeper Keeper;
27 24
28struct s_Keepers 25struct Keepers
29{ 26{
30 int nb_keepers; 27 int nb_keepers;
31 Keeper keeper_array[1]; 28 Keeper keeper_array[1];
32}; 29};
33typedef struct s_Keepers Keepers;
34 30
35void init_keepers( Universe* U, lua_State* L); 31void init_keepers( Universe* U, lua_State* L);
36void close_keepers( Universe* U); 32void close_keepers( Universe* U);
@@ -45,7 +41,7 @@ int keeper_push_linda_storage( Universe* U, lua_State* L, void* ptr_, ptrdiff_t
45// crc64/we of string "NIL_SENTINEL" generated at http://www.nitrxgen.net/hashgen/ 41// crc64/we of string "NIL_SENTINEL" generated at http://www.nitrxgen.net/hashgen/
46static constexpr UniqueKey NIL_SENTINEL{ 0x7eaafa003a1d11a1ull }; 42static constexpr UniqueKey NIL_SENTINEL{ 0x7eaafa003a1d11a1ull };
47 43
48typedef lua_CFunction keeper_api_t; 44using keeper_api_t = lua_CFunction;
49#define KEEPER_API( _op) keepercall_ ## _op 45#define KEEPER_API( _op) keepercall_ ## _op
50#define PUSH_KEEPER_FUNC lua_pushcfunction 46#define PUSH_KEEPER_FUNC lua_pushcfunction
51// lua_Cfunctions to run inside a keeper state (formerly implemented in Lua) 47// lua_Cfunctions to run inside a keeper state (formerly implemented in Lua)
@@ -58,4 +54,4 @@ int keepercall_get( lua_State* L);
58int keepercall_set( lua_State* L); 54int keepercall_set( lua_State* L);
59int keepercall_count( lua_State* L); 55int keepercall_count( lua_State* L);
60 56
61int keeper_call( Universe* U, lua_State* K, keeper_api_t _func, lua_State* L, void* linda, uint_t starting_index); 57int keeper_call(Universe* U, lua_State* K, keeper_api_t _func, lua_State* L, void* linda, int starting_index);
diff --git a/src/lanes.cpp b/src/lanes.cpp
index 246e772..e3f53c0 100644
--- a/src/lanes.cpp
+++ b/src/lanes.cpp
@@ -609,7 +609,7 @@ static int selfdestruct_gc( lua_State* L)
609// 609//
610LUAG_FUNC( set_singlethreaded) 610LUAG_FUNC( set_singlethreaded)
611{ 611{
612 uint_t cores = luaG_optunsigned( L, 1, 1); 612 lua_Integer cores = luaL_optinteger(L, 1, 1);
613 (void) cores; // prevent "unused" warning 613 (void) cores; // prevent "unused" warning
614 614
615#ifdef PLATFORM_OSX 615#ifdef PLATFORM_OSX
@@ -1048,10 +1048,10 @@ LUAG_FUNC( lane_new)
1048 char const* libs_str = lua_tostring( L, 2); 1048 char const* libs_str = lua_tostring( L, 2);
1049 bool const have_priority{ !lua_isnoneornil(L, 3) }; 1049 bool const have_priority{ !lua_isnoneornil(L, 3) };
1050 int const priority = have_priority ? (int) lua_tointeger( L, 3) : THREAD_PRIO_DEFAULT; 1050 int const priority = have_priority ? (int) lua_tointeger( L, 3) : THREAD_PRIO_DEFAULT;
1051 uint_t const globals_idx = lua_isnoneornil( L, 4) ? 0 : 4; 1051 int const globals_idx = lua_isnoneornil( L, 4) ? 0 : 4;
1052 uint_t const package_idx = lua_isnoneornil( L, 5) ? 0 : 5; 1052 int const package_idx = lua_isnoneornil(L, 5) ? 0 : 5;
1053 uint_t const required_idx = lua_isnoneornil( L, 6) ? 0 : 6; 1053 int const required_idx = lua_isnoneornil(L, 6) ? 0 : 6;
1054 uint_t const gc_cb_idx = lua_isnoneornil( L, 7) ? 0 : 7; 1054 int const gc_cb_idx = lua_isnoneornil(L, 7) ? 0 : 7;
1055 1055
1056#define FIXED_ARGS 7 1056#define FIXED_ARGS 7
1057 int const nargs = lua_gettop(L) - FIXED_ARGS; 1057 int const nargs = lua_gettop(L) - FIXED_ARGS;
@@ -1456,7 +1456,7 @@ LUAG_FUNC( thread_join)
1456 { 1456 {
1457 case DONE: 1457 case DONE:
1458 { 1458 {
1459 uint_t n = lua_gettop( L2); // whole L2 stack 1459 int n = lua_gettop( L2); // whole L2 stack
1460 if( (n > 0) && (luaG_inter_move( U, L2, L, n, eLM_LaneBody) != 0)) 1460 if( (n > 0) && (luaG_inter_move( U, L2, L, n, eLM_LaneBody) != 0))
1461 { 1461 {
1462 return luaL_error( L, "tried to copy unsupported types"); 1462 return luaL_error( L, "tried to copy unsupported types");
diff --git a/src/lanes_private.h b/src/lanes_private.h
index 27635fa..cd0c388 100644
--- a/src/lanes_private.h
+++ b/src/lanes_private.h
@@ -13,7 +13,7 @@ enum ThreadStatus
13// NOTE: values to be changed by either thread, during execution, without 13// NOTE: values to be changed by either thread, during execution, without
14// locking, are marked "volatile" 14// locking, are marked "volatile"
15// 15//
16struct s_Lane 16struct Lane
17{ 17{
18 THREAD_T thread; 18 THREAD_T thread;
19 // 19 //
@@ -59,19 +59,18 @@ struct s_Lane
59 // M: sets to NORMAL, if issued a kill changes to KILLED 59 // M: sets to NORMAL, if issued a kill changes to KILLED
60 // S: not used 60 // S: not used
61 61
62 struct s_Lane* volatile selfdestruct_next; 62 Lane* volatile selfdestruct_next;
63 // 63 //
64 // M: sets to non-nullptr if facing lane handle '__gc' cycle but the lane 64 // M: sets to non-nullptr if facing lane handle '__gc' cycle but the lane
65 // is still running 65 // is still running
66 // S: cleans up after itself if non-nullptr at lane exit 66 // S: cleans up after itself if non-nullptr at lane exit
67 67
68#if HAVE_LANE_TRACKING() 68#if HAVE_LANE_TRACKING()
69 struct s_Lane* volatile tracking_next; 69 Lane* volatile tracking_next;
70#endif // HAVE_LANE_TRACKING() 70#endif // HAVE_LANE_TRACKING()
71 // 71 //
72 // For tracking only 72 // For tracking only
73}; 73};
74typedef struct s_Lane Lane;
75 74
76// To allow free-running threads (longer lifespan than the handle's) 75// To allow free-running threads (longer lifespan than the handle's)
77// 'Lane' are malloc/free'd and the handle only carries a pointer. 76// 'Lane' are malloc/free'd and the handle only carries a pointer.
diff --git a/src/linda.cpp b/src/linda.cpp
index 4cc356a..10ee08b 100644
--- a/src/linda.cpp
+++ b/src/linda.cpp
@@ -125,7 +125,7 @@ LUAG_FUNC( linda_send)
125 enum e_cancel_request cancel = CANCEL_NONE; 125 enum e_cancel_request cancel = CANCEL_NONE;
126 int pushed; 126 int pushed;
127 time_d timeout = -1.0; 127 time_d timeout = -1.0;
128 uint_t key_i = 2; // index of first key, if timeout not there 128 int key_i = 2; // index of first key, if timeout not there
129 129
130 if( lua_type( L, 2) == LUA_TNUMBER) // we don't want to use lua_isnumber() because of autocoercion 130 if( lua_type( L, 2) == LUA_TNUMBER) // we don't want to use lua_isnumber() because of autocoercion
131 { 131 {
@@ -150,7 +150,7 @@ LUAG_FUNC( linda_send)
150 STACK_GROW( L, 1); 150 STACK_GROW( L, 1);
151 151
152 // make sure there is something to send 152 // make sure there is something to send
153 if( (uint_t)lua_gettop( L) == key_i) 153 if( lua_gettop( L) == key_i)
154 { 154 {
155 if( as_nil_sentinel) 155 if( as_nil_sentinel)
156 { 156 {
@@ -277,7 +277,7 @@ LUAG_FUNC( linda_receive)
277 keeper_api_t keeper_receive; 277 keeper_api_t keeper_receive;
278 278
279 time_d timeout = -1.0; 279 time_d timeout = -1.0;
280 uint_t key_i = 2; 280 int key_i = 2;
281 281
282 if( lua_type( L, 2) == LUA_TNUMBER) // we don't want to use lua_isnumber() because of autocoercion 282 if( lua_type( L, 2) == LUA_TNUMBER) // we don't want to use lua_isnumber() because of autocoercion
283 { 283 {
diff --git a/src/threading.cpp b/src/threading.cpp
index 636fe91..afeb184 100644
--- a/src/threading.cpp
+++ b/src/threading.cpp
@@ -594,7 +594,7 @@ bool THREAD_WAIT_IMPL( THREAD_T *ref, double secs)
594# endif // pthread_attr_setschedpolicy() 594# endif // pthread_attr_setschedpolicy()
595# endif // defined(__MINGW32__) || defined(__MINGW64__) 595# endif // defined(__MINGW32__) || defined(__MINGW64__)
596 596
597 static void _PT_FAIL( int rc, const char *name, const char *file, uint_t line ) { 597 static void _PT_FAIL( int rc, const char *name, const char *file, int line ) {
598 const char *why= (rc==EINVAL) ? "EINVAL" : 598 const char *why= (rc==EINVAL) ? "EINVAL" :
599 (rc==EBUSY) ? "EBUSY" : 599 (rc==EBUSY) ? "EBUSY" :
600 (rc==EPERM) ? "EPERM" : 600 (rc==EPERM) ? "EPERM" :
@@ -847,7 +847,7 @@ void THREAD_CREATE( THREAD_T* ref, THREAD_RETURN_T (*func)( void*), void* data,
847 /* 847 /*
848 // Wait slightly if thread creation has exchausted the system 848 // Wait slightly if thread creation has exchausted the system
849 // 849 //
850 { uint_t retries; 850 { int retries;
851 for( retries=0; retries<THREAD_CREATE_RETRIES_MAX; retries++ ) { 851 for( retries=0; retries<THREAD_CREATE_RETRIES_MAX; retries++ ) {
852 852
853 int rc= pthread_create( ref, &a, func, data ); 853 int rc= pthread_create( ref, &a, func, data );
diff --git a/src/threading.h b/src/threading.h
index 608f916..38a021f 100644
--- a/src/threading.h
+++ b/src/threading.h
@@ -7,8 +7,6 @@
7 */ 7 */
8#include "platform.h" 8#include "platform.h"
9 9
10typedef unsigned int uint_t;
11
12#include <time.h> 10#include <time.h>
13 11
14/* Note: ERROR is a defined entity on Win32 12/* Note: ERROR is a defined entity on Win32
@@ -60,14 +58,14 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED };
60 58
61 #if _WIN32_WINNT < 0x0600 // CONDITION_VARIABLE aren't available, use a signal 59 #if _WIN32_WINNT < 0x0600 // CONDITION_VARIABLE aren't available, use a signal
62 60
63 typedef struct 61 struct SIGNAL_T
64 { 62 {
65 CRITICAL_SECTION signalCS; 63 CRITICAL_SECTION signalCS;
66 CRITICAL_SECTION countCS; 64 CRITICAL_SECTION countCS;
67 HANDLE waitEvent; 65 HANDLE waitEvent;
68 HANDLE waitDoneEvent; 66 HANDLE waitDoneEvent;
69 LONG waitersCount; 67 LONG waitersCount;
70 } SIGNAL_T; 68 };
71 69
72 70
73 #define MUTEX_T HANDLE 71 #define MUTEX_T HANDLE
@@ -89,7 +87,7 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED };
89 87
90 #define MUTEX_RECURSIVE_INIT(ref) MUTEX_INIT(ref) /* always recursive in Win32 */ 88 #define MUTEX_RECURSIVE_INIT(ref) MUTEX_INIT(ref) /* always recursive in Win32 */
91 89
92 typedef unsigned int THREAD_RETURN_T; 90 using THREAD_RETURN_T = unsigned int;
93 91
94 #define YIELD() Sleep(0) 92 #define YIELD() Sleep(0)
95 #define THREAD_CALLCONV __stdcall 93 #define THREAD_CALLCONV __stdcall
@@ -124,9 +122,9 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED };
124 #define MUTEX_LOCK(ref) pthread_mutex_lock(ref) 122 #define MUTEX_LOCK(ref) pthread_mutex_lock(ref)
125 #define MUTEX_UNLOCK(ref) pthread_mutex_unlock(ref) 123 #define MUTEX_UNLOCK(ref) pthread_mutex_unlock(ref)
126 124
127 typedef void * THREAD_RETURN_T; 125 using THREAD_RETURN_T = void *;
128 126
129 typedef pthread_cond_t SIGNAL_T; 127 using SIGNAL_T = pthread_cond_t;
130 128
131 void SIGNAL_ONE( SIGNAL_T *ref ); 129 void SIGNAL_ONE( SIGNAL_T *ref );
132 130
@@ -154,7 +152,7 @@ void SIGNAL_ALL( SIGNAL_T *ref );
154* 0.0 for instant check 152* 0.0 for instant check
155* >0.0 absolute timeout in secs + ms 153* >0.0 absolute timeout in secs + ms
156*/ 154*/
157typedef double time_d; 155using time_d = double;
158time_d now_secs(void); 156time_d now_secs(void);
159 157
160time_d SIGNAL_TIMEOUT_PREPARE( double rel_secs ); 158time_d SIGNAL_TIMEOUT_PREPARE( double rel_secs );
@@ -169,7 +167,7 @@ bool SIGNAL_WAIT( SIGNAL_T *ref, MUTEX_T *mu, time_d timeout );
169 167
170#if THREADAPI == THREADAPI_WINDOWS 168#if THREADAPI == THREADAPI_WINDOWS
171 169
172 typedef HANDLE THREAD_T; 170 using THREAD_T = HANDLE;
173# define THREAD_ISNULL( _h) (_h == 0) 171# define THREAD_ISNULL( _h) (_h == 0)
174 void THREAD_CREATE( THREAD_T* ref, THREAD_RETURN_T (__stdcall *func)( void*), void* data, int prio /* -3..+3 */); 172 void THREAD_CREATE( THREAD_T* ref, THREAD_RETURN_T (__stdcall *func)( void*), void* data, int prio /* -3..+3 */);
175 173
@@ -197,7 +195,7 @@ bool SIGNAL_WAIT( SIGNAL_T *ref, MUTEX_T *mu, time_d timeout );
197# endif 195# endif
198# endif 196# endif
199 197
200 typedef pthread_t THREAD_T; 198 using THREAD_T = pthread_t;
201# define THREAD_ISNULL( _h) 0 // pthread_t may be a structure: never 'null' by itself 199# define THREAD_ISNULL( _h) 0 // pthread_t may be a structure: never 'null' by itself
202 200
203 void THREAD_CREATE( THREAD_T* ref, THREAD_RETURN_T (*func)( void*), void* data, int prio /* -3..+3 */); 201 void THREAD_CREATE( THREAD_T* ref, THREAD_RETURN_T (*func)( void*), void* data, int prio /* -3..+3 */);
diff --git a/src/threading_osx.h b/src/threading_osx.h
index 93da8c3..b47d2f6 100644
--- a/src/threading_osx.h
+++ b/src/threading_osx.h
@@ -11,9 +11,10 @@
11 11
12#define SYSCTL_CORE_COUNT "machdep.cpu.core_count" 12#define SYSCTL_CORE_COUNT "machdep.cpu.core_count"
13 13
14typedef struct cpu_set { 14struct cpu_set_t
15{
15 uint32_t count; 16 uint32_t count;
16} cpu_set_t; 17} ;
17 18
18static inline void CPU_ZERO(cpu_set_t *cs) { cs->count = 0; } 19static inline void CPU_ZERO(cpu_set_t *cs) { cs->count = 0; }
19static inline void CPU_SET(int num, cpu_set_t *cs) { cs->count |= (1 << num); } 20static inline void CPU_SET(int num, cpu_set_t *cs) { cs->count |= (1 << num); }
diff --git a/src/tools.cpp b/src/tools.cpp
index 8242c82..88e7e2b 100644
--- a/src/tools.cpp
+++ b/src/tools.cpp
@@ -48,7 +48,7 @@ THE SOFTWARE.
48#include "uniquekey.h" 48#include "uniquekey.h"
49 49
50// functions implemented in deep.c 50// functions implemented in deep.c
51extern bool copydeep( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, LookupMode mode_, char const* upName_); 51extern bool copydeep(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, LookupMode mode_, char const* upName_);
52extern void push_registry_subtable( lua_State* L, UniqueKey key_); 52extern void push_registry_subtable( lua_State* L, UniqueKey key_);
53 53
54DEBUGSPEW_CODE( char const* debugspew_indent = "----+----!----+----!----+----!----+----!----+----!----+----!----+----!----+"); 54DEBUGSPEW_CODE( char const* debugspew_indent = "----+----!----+----!----+----!----+----!----+----!----+----!----+----!----+");
@@ -287,12 +287,12 @@ static int dummy_writer( lua_State* L, void const* p, size_t sz, void* ud)
287 * +-----------------+----------+------------+----------+ 287 * +-----------------+----------+------------+----------+
288 */ 288 */
289 289
290typedef enum 290enum FuncSubType
291{ 291{
292 FST_Bytecode, 292 FST_Bytecode,
293 FST_Native, 293 FST_Native,
294 FST_FastJIT 294 FST_FastJIT
295} FuncSubType; 295} ;
296 296
297FuncSubType luaG_getfuncsubtype( lua_State *L, int _i) 297FuncSubType luaG_getfuncsubtype( lua_State *L, int _i)
298{ 298{
@@ -694,7 +694,7 @@ static int userdata_clone_sentinel( lua_State* L)
694/* 694/*
695 * retrieve the name of a function/table in the lookup database 695 * retrieve the name of a function/table in the lookup database
696 */ 696 */
697static char const* find_lookup_name( lua_State* L, uint_t i, LookupMode mode_, char const* upName_, size_t* len_) 697static char const* find_lookup_name(lua_State* L, int i, LookupMode mode_, char const* upName_, size_t* len_)
698{ 698{
699 DEBUGSPEW_CODE( Universe* const U = universe_get( L)); 699 DEBUGSPEW_CODE( Universe* const U = universe_get( L));
700 char const* fqn; 700 char const* fqn;
@@ -766,7 +766,7 @@ static char const* find_lookup_name( lua_State* L, uint_t i, LookupMode mode_, c
766/* 766/*
767 * Push a looked-up table, or nothing if we found nothing 767 * Push a looked-up table, or nothing if we found nothing
768 */ 768 */
769static bool lookup_table( lua_State* L2, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) 769static bool lookup_table(lua_State* L2, lua_State* L, int i, LookupMode mode_, char const* upName_)
770{ 770{
771 // get the name of the table we want to send 771 // get the name of the table we want to send
772 size_t len; 772 size_t len;
@@ -842,7 +842,7 @@ static bool lookup_table( lua_State* L2, lua_State* L, uint_t i, LookupMode mode
842 * Returns true if the table was cached (no need to fill it!); false if 842 * Returns true if the table was cached (no need to fill it!); false if
843 * it's a virgin. 843 * it's a virgin.
844 */ 844 */
845static bool push_cached_table( lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i) 845static bool push_cached_table(lua_State* L2, int L2_cache_i, lua_State* L, int i)
846{ 846{
847 bool not_found_in_cache; // L2 847 bool not_found_in_cache; // L2
848 void const* p{ lua_topointer(L, i) }; 848 void const* p{ lua_topointer(L, i) };
@@ -1071,7 +1071,7 @@ int luaG_nameof( lua_State* L)
1071/* 1071/*
1072 * Push a looked-up native/LuaJIT function. 1072 * Push a looked-up native/LuaJIT function.
1073 */ 1073 */
1074static void lookup_native_func( lua_State* L2, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) 1074static void lookup_native_func(lua_State* L2, lua_State* L, int i, LookupMode mode_, char const* upName_)
1075{ 1075{
1076 // get the name of the function we want to send 1076 // get the name of the function we want to send
1077 size_t len; 1077 size_t len;
@@ -1186,7 +1186,7 @@ static int buf_writer( lua_State* L, void const* b, size_t size, void* ud)
1186 return 0; 1186 return 0;
1187} 1187}
1188 1188
1189static void copy_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) 1189static void copy_func(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, LookupMode mode_, char const* upName_)
1190{ 1190{
1191 int n, needToPush; 1191 int n, needToPush;
1192 luaL_Buffer B; 1192 luaL_Buffer B;
@@ -1199,7 +1199,7 @@ static void copy_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State*
1199 1199
1200 // 'lua_dump()' needs the function at top of stack 1200 // 'lua_dump()' needs the function at top of stack
1201 // if already on top of the stack, no need to push again 1201 // if already on top of the stack, no need to push again
1202 needToPush = (i != (uint_t)lua_gettop( L)); 1202 needToPush = (i != lua_gettop( L));
1203 if( needToPush) 1203 if( needToPush)
1204 { 1204 {
1205 lua_pushvalue( L, i); // ... f 1205 lua_pushvalue( L, i); // ... f
@@ -1338,7 +1338,7 @@ static void copy_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State*
1338 * 1338 *
1339 * Always pushes a function to 'L2'. 1339 * Always pushes a function to 'L2'.
1340 */ 1340 */
1341static void copy_cached_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, LookupMode mode_, char const* upName_) 1341static void copy_cached_func(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, LookupMode mode_, char const* upName_)
1342{ 1342{
1343 FuncSubType funcSubType; 1343 FuncSubType funcSubType;
1344 /*lua_CFunction cfunc =*/ luaG_tocfunction( L, i, &funcSubType); // nullptr for LuaJIT-fast && bytecode functions 1344 /*lua_CFunction cfunc =*/ luaG_tocfunction( L, i, &funcSubType); // nullptr for LuaJIT-fast && bytecode functions
@@ -1391,7 +1391,7 @@ static void copy_cached_func( Universe* U, lua_State* L2, uint_t L2_cache_i, lua
1391 } 1391 }
1392} 1392}
1393 1393
1394static bool push_cached_metatable( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t i, enum eLookupMode mode_, char const* upName_) 1394static bool push_cached_metatable(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, LookupMode mode_, char const* upName_)
1395{ 1395{
1396 STACK_CHECK( L, 0); 1396 STACK_CHECK( L, 0);
1397 if( lua_getmetatable( L, i)) // ... mt 1397 if( lua_getmetatable( L, i)) // ... mt
@@ -1440,10 +1440,10 @@ static bool push_cached_metatable( Universe* U, lua_State* L2, uint_t L2_cache_i
1440 return false; 1440 return false;
1441} 1441}
1442 1442
1443static 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_) 1443static void inter_copy_keyvaluepair(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, enum e_vt vt, LookupMode mode_, char const* upName_)
1444{ 1444{
1445 uint_t val_i = lua_gettop( L); 1445 int val_i = lua_gettop(L);
1446 uint_t key_i = val_i - 1; 1446 int key_i = val_i - 1;
1447 1447
1448 // Only basic key types are copied over; others ignored 1448 // Only basic key types are copied over; others ignored
1449 if( inter_copy_one( U, L2, 0 /*key*/, L, key_i, VT_KEY, mode_, upName_)) 1449 if( inter_copy_one( U, L2, 0 /*key*/, L, key_i, VT_KEY, mode_, upName_))
@@ -1510,7 +1510,7 @@ static void inter_copy_keyvaluepair( Universe* U, lua_State* L2, uint_t L2_cache
1510*/ 1510*/
1511static constexpr UniqueKey CLONABLES_CACHE_KEY{ 0xD04EE018B3DEE8F5ull }; 1511static constexpr UniqueKey CLONABLES_CACHE_KEY{ 0xD04EE018B3DEE8F5ull };
1512 1512
1513static bool copyclone( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t source_i_, LookupMode mode_, char const* upName_) 1513static bool copyclone(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int source_i_, LookupMode mode_, char const* upName_)
1514{ 1514{
1515 void* const source = lua_touserdata( L, source_i_); 1515 void* const source = lua_touserdata( L, source_i_);
1516 source_i_ = lua_absindex( L, source_i_); 1516 source_i_ = lua_absindex( L, source_i_);
@@ -1623,7 +1623,7 @@ static bool copyclone( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State*
1623 return true; 1623 return true;
1624} 1624}
1625 1625
1626static bool inter_copy_userdata( 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_) 1626static bool inter_copy_userdata(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, enum e_vt vt, LookupMode mode_, char const* upName_)
1627{ 1627{
1628 STACK_CHECK( L, 0); 1628 STACK_CHECK( L, 0);
1629 STACK_CHECK( L2, 0); 1629 STACK_CHECK( L2, 0);
@@ -1671,7 +1671,7 @@ static bool inter_copy_userdata( Universe* U, lua_State* L2, uint_t L2_cache_i,
1671 return true; 1671 return true;
1672} 1672}
1673 1673
1674static bool inter_copy_function( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L, uint_t source_i_, enum e_vt vt, LookupMode mode_, char const* upName_) 1674static bool inter_copy_function(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int source_i_, enum e_vt vt, LookupMode mode_, char const* upName_)
1675{ 1675{
1676 if( vt == VT_KEY) 1676 if( vt == VT_KEY)
1677 { 1677 {
@@ -1764,7 +1764,7 @@ static bool inter_copy_function( Universe* U, lua_State* L2, uint_t L2_cache_i,
1764 return true; 1764 return true;
1765} 1765}
1766 1766
1767static bool inter_copy_table( 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_) 1767static bool inter_copy_table(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, enum e_vt vt, LookupMode mode_, char const* upName_)
1768{ 1768{
1769 if( vt == VT_KEY) 1769 if( vt == VT_KEY)
1770 { 1770 {
@@ -1834,7 +1834,7 @@ static bool inter_copy_table( Universe* U, lua_State* L2, uint_t L2_cache_i, lua
1834* 1834*
1835* Returns true if value was pushed, false if its type is non-supported. 1835* Returns true if value was pushed, false if its type is non-supported.
1836*/ 1836*/
1837bool 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_) 1837bool inter_copy_one(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, enum e_vt vt, LookupMode mode_, char const* upName_)
1838{ 1838{
1839 bool ret{ true }; 1839 bool ret{ true };
1840 int val_type = lua_type( L, i); 1840 int val_type = lua_type( L, i);
@@ -1957,11 +1957,11 @@ bool inter_copy_one( Universe* U, lua_State* L2, uint_t L2_cache_i, lua_State* L
1957* 1957*
1958* Note: Parameters are in this order ('L' = from first) to be same as 'lua_xmove'. 1958* Note: Parameters are in this order ('L' = from first) to be same as 'lua_xmove'.
1959*/ 1959*/
1960int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_) 1960int luaG_inter_copy(Universe* U, lua_State* L, lua_State* L2, int n, LookupMode mode_)
1961{ 1961{
1962 uint_t top_L = lua_gettop( L); // ... {}n 1962 int top_L = lua_gettop(L); // ... {}n
1963 uint_t top_L2 = lua_gettop( L2); // ... 1963 int top_L2 = lua_gettop(L2); // ...
1964 uint_t i, j; 1964 int i, j;
1965 char tmpBuf[16]; 1965 char tmpBuf[16];
1966 char const* pBuf = U->verboseErrors ? tmpBuf : "?"; 1966 char const* pBuf = U->verboseErrors ? tmpBuf : "?";
1967 bool copyok{ true }; 1967 bool copyok{ true };
@@ -2020,7 +2020,7 @@ int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupM
2020} 2020}
2021 2021
2022 2022
2023int luaG_inter_move( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_) 2023int luaG_inter_move(Universe* U, lua_State* L, lua_State* L2, int n, LookupMode mode_)
2024{ 2024{
2025 int ret = luaG_inter_copy( U, L, L2, n, mode_); 2025 int ret = luaG_inter_copy( U, L, L2, n, mode_);
2026 lua_pop( L, (int) n); 2026 lua_pop( L, (int) n);
diff --git a/src/tools.h b/src/tools.h
index 928a149..95324ee 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -6,14 +6,10 @@
6#include "macros_and_utils.h" 6#include "macros_and_utils.h"
7 7
8// forwards 8// forwards
9struct s_Universe; 9struct Universe;
10typedef struct s_Universe Universe;
11 10
12// ################################################################################################ 11// ################################################################################################
13 12
14#define luaG_optunsigned(L,i,d) ((uint_t) luaL_optinteger(L,i,d))
15#define luaG_tounsigned(L,i) ((uint_t) lua_tointeger(L,i))
16
17#ifdef _DEBUG 13#ifdef _DEBUG
18void luaG_dump( lua_State* L); 14void luaG_dump( lua_State* L);
19#endif // _DEBUG 15#endif // _DEBUG
@@ -29,14 +25,14 @@ enum e_vt
29 VT_KEY, 25 VT_KEY,
30 VT_METATABLE 26 VT_METATABLE
31}; 27};
32bool 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_); 28bool inter_copy_one(Universe* U, lua_State* L2, int L2_cache_i, lua_State* L, int i, enum e_vt vt, LookupMode mode_, char const* upName_);
33 29
34// ################################################################################################ 30// ################################################################################################
35 31
36int luaG_inter_copy_package( Universe* U, lua_State* L, lua_State* L2, int package_idx_, LookupMode mode_); 32int luaG_inter_copy_package( Universe* U, lua_State* L, lua_State* L2, int package_idx_, LookupMode mode_);
37 33
38int luaG_inter_copy( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_); 34int luaG_inter_copy(Universe* U, lua_State* L, lua_State* L2, int n, LookupMode mode_);
39int luaG_inter_move( Universe* U, lua_State* L, lua_State* L2, uint_t n, LookupMode mode_); 35int luaG_inter_move(Universe* U, lua_State* L, lua_State* L2, int n, LookupMode mode_);
40 36
41int luaG_nameof( lua_State* L); 37int luaG_nameof( lua_State* L);
42 38
diff --git a/src/universe.h b/src/universe.h
index 3f61945..34cef33 100644
--- a/src/universe.h
+++ b/src/universe.h
@@ -13,10 +13,8 @@ extern "C" {
13 13
14// forwards 14// forwards
15struct DeepPrelude; 15struct DeepPrelude;
16struct s_Keepers; 16struct Keepers;
17typedef struct s_Keepers Keepers; 17struct Lane;
18struct s_Lane;
19typedef struct s_Lane Lane;
20 18
21// ################################################################################################ 19// ################################################################################################
22 20
@@ -28,27 +26,25 @@ typedef struct s_Lane Lane;
28// ################################################################################################ 26// ################################################################################################
29 27
30// everything we need to provide to lua_newstate() 28// everything we need to provide to lua_newstate()
31struct AllocatorDefinition_s 29struct AllocatorDefinition
32{ 30{
33 lua_Alloc allocF; 31 lua_Alloc allocF;
34 void* allocUD; 32 void* allocUD;
35}; 33};
36typedef struct AllocatorDefinition_s AllocatorDefinition;
37 34
38// mutex-protected allocator for use with Lua states that share a non-threadsafe allocator 35// mutex-protected allocator for use with Lua states that share a non-threadsafe allocator
39struct ProtectedAllocator_s 36struct ProtectedAllocator
40{ 37{
41 AllocatorDefinition definition; 38 AllocatorDefinition definition;
42 MUTEX_T lock; 39 MUTEX_T lock;
43}; 40};
44typedef struct ProtectedAllocator_s ProtectedAllocator;
45 41
46// ################################################################################################ 42// ################################################################################################
47 43
48// everything regarding the Lanes universe is stored in that global structure 44// everything regarding the Lanes universe is stored in that global structure
49// held as a full userdata in the master Lua state that required it for the first time 45// held as a full userdata in the master Lua state that required it for the first time
50// don't forget to initialize all members in LG_configure() 46// don't forget to initialize all members in LG_configure()
51struct s_Universe 47struct Universe
52{ 48{
53 // for verbose errors 49 // for verbose errors
54 bool verboseErrors; 50 bool verboseErrors;
@@ -98,7 +94,6 @@ struct s_Universe
98 // The terminal desinit sequence should wait for all such processing to terminate before force-killing threads 94 // The terminal desinit sequence should wait for all such processing to terminate before force-killing threads
99 int volatile selfdestructing_count; 95 int volatile selfdestructing_count;
100}; 96};
101typedef struct s_Universe Universe;
102 97
103Universe* universe_get( lua_State* L); 98Universe* universe_get( lua_State* L);
104Universe* universe_create( lua_State* L); 99Universe* universe_create( lua_State* L);