Maintenance

This commit is contained in:
Patrick Pelissier committed 2023-03-03 22:50:14 +01:00
1 parent 942cf32519
commit 2f76652f2b
18 files changed
+209 -115

No files matched your search

+14 -1
View File
@@ -92,7 +92,9 @@
M_ALG0_INSERT_AT(contDst, M_GLOBAL_OPLIST(contDstOp), position, contSrc, M_GLOBAL_OPLIST(contSrcOp) )
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/******************************** INTERNAL ***********************************/
/*****************************************************************************/
/* Try to expand the algorithms */
#define M_ALG0_DEF_P1(name, cont_oplist) \
@@ -1039,6 +1041,7 @@
// fast _uniq for array
// _flatten (takes a set of containers and returns a new container containing all flatten objects)
/******************************** INTERNAL ***********************************/
#define M_ALG0_FOR_EACH(container, cont_oplist, func) do { \
for M_EACH(_item, container, cont_oplist) { \
@@ -1053,6 +1056,8 @@
} while (0)
/******************************** INTERNAL ***********************************/
#define M_ALG0_TRANSFORM(contD, contDop, contS, contSop, func) do { \
M_CALL_RESET(contDop, contD); \
for M_EACH(_item, contS, contSop) { \
@@ -1076,6 +1081,8 @@
} while (0)
/******************************** INTERNAL ***********************************/
#define M_ALG0_EXTRACT(contDst, contDstOplist, contSrc, contSrcOplist) \
M_ALG0_EXTRACT_P1(contDst, M_GLOBAL_OPLIST(contDstOplist), contSrc, M_GLOBAL_OPLIST(contSrcOplist))
#define M_ALG0_EXTRACT_P1(contDst, contDstOplist, contSrc, contSrcOplist) do{ \
@@ -1127,6 +1134,8 @@
} while (0)
/******************************** INTERNAL ***********************************/
#define M_ALG0_REDUCE_DISPATCH(dest, destOp, dest_t, cont, contOp, ...) \
M_IF_NARGS_EQ1(__VA_ARGS__) \
(M_ALG0_REDUCE_BASIC(dest, dest_t, destOp, cont, contOp, __VA_ARGS__), \
@@ -1202,6 +1211,8 @@
} while (0)
/******************************** INTERNAL ***********************************/
#define M_ALG0_INSERT_AT(contDst, contDstOp, position, contSrc, contSrcOp) do { \
M_GET_IT_TYPE contSrcOp _itSrc; \
M_GET_IT_TYPE contDstOp _itDst; \
@@ -1215,6 +1226,8 @@
} while (0)
/******************************** INTERNAL ***********************************/
#if M_USE_SMALL_NAME
#define ALGO_DEF M_ALGO_DEF
#define ALGO_FOR_EACH M_ALGO_FOR_EACH
+70 -63
View File
@@ -60,6 +60,7 @@
#define M_ARRAY_INIT_VALUE() \
{ { 0, 0, NULL } }
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
@@ -136,6 +137,8 @@
)
/********************************** INTERNAL *********************************/
/* Define the internal contract of an array */
#define M_ARRA4_CONTRACT(a) do { \
M_ASSERT (a != NULL); \
@@ -172,6 +175,7 @@
M_ARRA4_DEF_TYPE(name, type, oplist, array_t, it_t) \
M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \
M_ARRA4_DEF_CORE(name, type, oplist, array_t, it_t) \
M_ARRA4_DEF_IO(name, type, oplist, array_t, it_t) \
M_EMPLACE_QUEUE_DEF(name, array_t, M_C(name, _emplace_back), oplist, M_ARRA4_EMPLACE_DEF)
/* Define the types */
@@ -902,6 +906,70 @@
\
,) /* IF CMP oplist */ \
\
M_IF_METHOD(EQUAL, oplist)( \
static inline bool \
M_C(name, _equal_p)(const array_t array1, \
const array_t array2) \
{ \
M_ARRA4_CONTRACT(array1); \
M_ARRA4_CONTRACT(array2); \
if (array1->size != array2->size) return false; \
size_t i; \
for(i = 0; i < array1->size; i++) { \
type const *item1 = M_C(name, _cget)(array1, i); \
type const *item2 = M_C(name, _cget)(array2, i); \
bool b = M_CALL_EQUAL(oplist, *item1, *item2); \
if (!b) return false; \
} \
return i == array1->size; \
} \
, /* no EQUAL */ ) \
\
M_IF_METHOD(HASH, oplist)( \
static inline size_t \
M_C(name, _hash)(const array_t array) \
{ \
M_ARRA4_CONTRACT(array); \
M_HASH_DECL(hash); \
for(size_t i = 0 ; i < array->size; i++) { \
size_t hi = M_CALL_HASH(oplist, array->ptr[i]); \
M_HASH_UP(hash, hi); \
} \
return M_HASH_FINAL (hash); \
} \
, /* no HASH */ ) \
\
static inline void \
M_C(name, _splice)(array_t a1, array_t a2) \
{ \
M_ARRA4_CONTRACT(a1); \
M_ARRA4_CONTRACT(a2); \
if (M_LIKELY (a2->size > 0)) { \
size_t newSize = a1->size + a2->size; \
/* To overflow newSize, we need to a1 and a2 a little bit above \
SIZE_MAX/2, which is not possible in the classic memory model as we \
should have exhausted all memory before reaching such sizes. */ \
M_ASSERT(newSize > a1->size); \
if (newSize > a1->alloc) { \
type *ptr = M_CALL_REALLOC(oplist, type, a1->ptr, newSize); \
if (M_UNLIKELY (ptr == NULL) ) { \
M_MEMORY_FULL(sizeof (type) * newSize); \
} \
a1->ptr = ptr; \
a1->alloc = newSize; \
} \
M_ASSERT(a1->ptr != NULL); \
M_ASSERT(a2->ptr != NULL); \
memcpy(&a1->ptr[a1->size], &a2->ptr[0], a2->size * sizeof (type)); \
/* a2 is now empty */ \
a2->size = 0; \
/* a1 has been expanded with the items of a2 */ \
a1->size = newSize; \
} \
} \
/* Define the I/O functions */
#define M_ARRA4_DEF_IO(name, type, oplist, array_t, it_t) \
\
M_IF_METHOD(GET_STR, oplist)( \
static inline void \
@@ -1051,69 +1119,6 @@
return ret; \
} \
, /* no IN_SERIAL & INIT */ ) \
\
M_IF_METHOD(EQUAL, oplist)( \
static inline bool \
M_C(name, _equal_p)(const array_t array1, \
const array_t array2) \
{ \
M_ARRA4_CONTRACT(array1); \
M_ARRA4_CONTRACT(array2); \
if (array1->size != array2->size) return false; \
size_t i; \
for(i = 0; i < array1->size; i++) { \
type const *item1 = M_C(name, _cget)(array1, i); \
type const *item2 = M_C(name, _cget)(array2, i); \
bool b = M_CALL_EQUAL(oplist, *item1, *item2); \
if (!b) return false; \
} \
return i == array1->size; \
} \
, /* no EQUAL */ ) \
\
M_IF_METHOD(HASH, oplist)( \
static inline size_t \
M_C(name, _hash)(const array_t array) \
{ \
M_ARRA4_CONTRACT(array); \
M_HASH_DECL(hash); \
for(size_t i = 0 ; i < array->size; i++) { \
size_t hi = M_CALL_HASH(oplist, array->ptr[i]); \
M_HASH_UP(hash, hi); \
} \
return M_HASH_FINAL (hash); \
} \
, /* no HASH */ ) \
\
static inline void \
M_C(name, _splice)(array_t a1, array_t a2) \
{ \
M_ARRA4_CONTRACT(a1); \
M_ARRA4_CONTRACT(a2); \
if (M_LIKELY (a2->size > 0)) { \
size_t newSize = a1->size + a2->size; \
/* To overflow newSize, we need to a1 and a2 a little bit above \
SIZE_MAX/2, which is not possible in the classic memory model as we \
should have exhausted all memory before reaching such sizes. */ \
M_ASSERT(newSize > a1->size); \
if (newSize > a1->alloc) { \
type *ptr = M_CALL_REALLOC(oplist, type, a1->ptr, newSize); \
if (M_UNLIKELY (ptr == NULL) ) { \
M_MEMORY_FULL(sizeof (type) * newSize); \
} \
a1->ptr = ptr; \
a1->alloc = newSize; \
} \
M_ASSERT(a1->ptr != NULL); \
M_ASSERT(a2->ptr != NULL); \
memcpy(&a1->ptr[a1->size], &a2->ptr[0], a2->size * sizeof (type)); \
/* a2 is now empty */ \
a2->size = 0; \
/* a1 has been expanded with the items of a2 */ \
a1->size = newSize; \
} \
} \
/* Definition of the emplace_back function for arrays */
#define M_ARRA4_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
@@ -1127,6 +1132,8 @@
M_EMPLACE_CALL_FUNC(a, init_func, oplist, *data, exp_emplace_type); \
} \
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define ARRAY_DEF M_ARRAY_DEF
#define ARRAY_DEF_AS M_ARRAY_DEF_AS
+7 -3
View File
@@ -139,8 +139,9 @@
(__VA_ARGS__ )))
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/******************************** INTERNAL ***********************************/
/*****************************************************************************/
/* Deferred evaluation for the oplist definition,
so that all arguments are evaluated before further expansion */
@@ -252,6 +253,7 @@
)
/******************************** INTERNAL ***********************************/
/* Internal contract of a B+TREE of size 'N' for a node 'node' or root 'root' */
#ifdef NDEBUG
@@ -297,7 +299,7 @@
Worst case is when all nodes are only half full.
Worst case is with the mininum size of a node (2)
Maximum number of elements: SIZE_MAX = 2 ^ (CHAR_BIT*sizeof (size_t)) - 1
Height of such a tree if inferior to:
Height of such a tree if inferior to:
Ceil(Log2(2 ^ (CHAR_BIT*sizeof (size_t)))) + 1
"+ 1" due to final line composed of nodes.
*/
@@ -1485,6 +1487,8 @@
, /* no in_serial */ ) \
/******************************** INTERNAL ***********************************/
#if M_USE_SMALL_NAME
#define BPTREE_DEF2 M_BPTREE_DEF2
#define BPTREE_DEF2_AS M_BPTREE_DEF2_AS
+5 -6
View File
@@ -210,7 +210,7 @@ m_buff3r_number_dec(m_buff3r_number_ct n, unsigned int policy)
return n->u --;
}
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/* Test if the size is only run-time or build time */
#define M_BUFF3R_IF_CTE_SIZE(m_size) M_IF(M_BOOL(m_size))
@@ -748,7 +748,7 @@ M_C(name, _init)(buffer_t v, size_t size) \
} \
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/* Definition of a a QUEUE for Many Produccer / Many Consummer
for high bandwidth scenario:
@@ -984,8 +984,7 @@ M_C(name, _init)(buffer_t v, size_t size) \
} \
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/* Definition of a a QUEUE for Single Producer / Single Consummer
for high bandwidth scenario:
@@ -1288,7 +1287,7 @@ M_C(name, _init)(buffer_t v, size_t size) \
} \
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/* Deferred evaluation for the definition,
so that all arguments are evaluated before further expansion */
@@ -1320,7 +1319,7 @@ M_C(name, _init)(buffer_t v, size_t size) \
)
/*****************************************************************************/
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define BUFFER_DEF M_BUFFER_DEF
+10 -2
View File
@@ -76,7 +76,9 @@
(__VA_ARGS__ )))
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/******************************** INTERNAL ***********************************/
/*****************************************************************************/
/* Deferred evaluation for the oplist definition,
so that all arguments are evaluated before further expansion */
@@ -134,12 +136,14 @@
)
/******************************** INTERNAL ***********************************/
/* Internal contract
NOTE: Can't check too much without locking the container itself
*/
#define M_C0NCURRENT_CONTRACT(c) do { \
M_ASSERT ((c) != NULL); \
M_ASSERT ( (c)->self == (c)); \
M_ASSERT ((c)->self == (c)); \
} while (0)
/* Deferred evaluation for the concurrent definition,
@@ -744,6 +748,7 @@
,) \
/******************************** INTERNAL ***********************************/
/* Deferred evaluation for the RP concurrent definition,
so that all arguments are evaluated before further expansion */
@@ -765,6 +770,7 @@
*/
#define M_C0NCURRENT_RP_DEF_P3(name, type, oplist, concurrent_t) \
M_C0NCURRENT_RP_DEF_TYPE(name, type, oplist, concurrent_t) \
M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \
M_C0NCURRENT_RP_DEF_CORE(name, type, oplist, concurrent_t) \
M_C0NCURRENT_DEF_COMMON(name, type, oplist, concurrent_t)
@@ -909,6 +915,8 @@
} \
/******************************** INTERNAL ***********************************/
#if M_USE_SMALL_NAME
#define CONCURRENT_DEF M_CONCURRENT_DEF
#define CONCURRENT_DEF_AS M_CONCURRENT_DEF_AS
+8 -5
View File
@@ -98,7 +98,9 @@
#define M_D3QU3_DEF_P3(name, type, oplist, deque_t, it_t, node_t) \
M_D3QU3_DEF_TYPE(name, type, oplist, deque_t, it_t, node_t) \
M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \
M_D3QU3_DEF_CORE(name, type, oplist, deque_t, it_t, node_t)
M_D3QU3_DEF_CORE(name, type, oplist, deque_t, it_t, node_t) \
M_EMPLACE_QUEUE_DEF(name, deque_t, M_C(name, _emplace_back), oplist, M_D3QUE_EMPLACE_BACK_DEF) \
M_EMPLACE_QUEUE_DEF(name, deque_t, M_C(name, _emplace_front), oplist, M_D3QUE_EMPLACE_FRONT_DEF)
/* Define the types.
It is a linked list of buckets of the types,
@@ -1052,10 +1054,6 @@
return ret; \
} \
, /* no IN_SERIAL & INIT */ ) \
\
M_EMPLACE_QUEUE_DEF(name, deque_t, M_C(name, _emplace_back), oplist, M_D3QUE_EMPLACE_BACK_DEF) \
M_EMPLACE_QUEUE_DEF(name, deque_t, M_C(name, _emplace_front), oplist, M_D3QUE_EMPLACE_FRONT_DEF)
/* Definition of the emplace_back function for deque */
#define M_D3QUE_EMPLACE_BACK_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
@@ -1083,6 +1081,8 @@
}
/********************************* INTERNAL **********************************/
/* Deferred evaluation for the oplist definition,
so that all arguments are evaluated before further expansion */
#define M_D3QU3_OPLIST_P1(arg) M_D3QU3_OPLIST_P2 arg
@@ -1140,6 +1140,9 @@
,M_IF_METHOD(DEL, oplist)(DEL(M_GET_DEL oplist),) \
)
/********************************* INTERNAL **********************************/
#if M_USE_SMALL_NAME
#define DEQUE_DEF M_DEQUE_DEF
#define DEQUE_DEF_AS M_DEQUE_DEF_AS
+10 -5
View File
@@ -177,8 +177,9 @@
M_D1CT_SET_OPLIST_P1((__VA_ARGS__ )))
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/******************************** INTERNAL ***********************************/
/*****************************************************************************/
/* Define a dictionary from the key key_type to the value value_type.
It is defined as an array of singly linked list (each list
@@ -1037,6 +1038,9 @@
\
M_EMPLACE_ASS_ARRAY_OR_QUEUE_DEF(isSet, name, dict_t, key_oplist, value_oplist)
/******************************** INTERNAL ***********************************/
/* Deferred evaluation for the definition,
so that all arguments are evaluated before further expansion */
#define M_D1CT_OPLIST_P1(arg) M_D1CT_OPLIST_P2 arg
@@ -1180,9 +1184,7 @@
} while (0)
/****************************************************************************************/
/* Open Addressing implementation */
/****************************************************************************************/
/******************************** INTERNAL ***********************************/
enum m_d1ct_oa_element_e {
M_D1CT_OA_EMPTY = 0, M_D1CT_OA_DELETED = 1
@@ -1969,6 +1971,9 @@ enum m_d1ct_oa_element_e {
\
M_D1CT_FUNC_ADDITIONAL_DEF2(name, key_type, key_oplist, value_type, value_oplist, isSet, dict_t, dict_it_t, it_deref_t)
/******************************** INTERNAL ***********************************/
#if M_USE_SMALL_NAME
#define DICT_DEF2 M_DICT_DEF2
#define DICT_DEF2_AS M_DICT_DEF2_AS
+10 -3
View File
@@ -91,9 +91,9 @@
/********************************************************************************/
/********************************** INTERNAL ************************************/
/********************************************************************************/
/*****************************************************************************/
/******************************** INTERNAL ***********************************/
/*****************************************************************************/
/* To be used by M_IF_FUNCOBJ macro defined in m-core.
NOTE: It is reversed (0 instead of 1) so that it can be used in M_IF reliabely.
@@ -135,6 +135,8 @@
)
/******************************** INTERNAL ***********************************/
/* Specialization of the definition a function object interface of name 'name'
* with a function like "retcode (void)" that doesn't have any input parameters.
* Define the following types to be used by instance:
@@ -205,6 +207,8 @@
}
/******************************** INTERNAL ***********************************/
/* Specialization of the definition a function object instance of name 'name'
* with no member attribute.
*/
@@ -397,6 +401,9 @@
#define M_FUNC0BJ_CONTROL_OPLIST(name, a) \
M_CHECK_COMPATIBLE_OPLIST(name, M_RET_ARG1 a, M_RET_ARG2 a, M_RET_ARG3 a)
/******************************** INTERNAL ***********************************/
#if M_USE_SMALL_NAME
#define FUNC_OBJ_ITF_DEF M_FUNC_OBJ_ITF_DEF
#define FUNC_OBJ_ITF_DEF_AS M_FUNC_OBJ_ITF_DEF_AS
+7 -1
View File
@@ -72,7 +72,9 @@
(__VA_ARGS__ )))
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/******************************** INTERNAL ***********************************/
/*****************************************************************************/
/* Define the basic structure to be added in all objects. */
typedef struct m_il1st_head_s {
@@ -123,6 +125,8 @@ typedef struct m_il1st_head_s {
)
/******************************** INTERNAL ***********************************/
/* Contract respected by all intrusive lists */
#define M_IL1ST_CONTRACT(name, list) do { \
M_ASSERT(list != NULL); \
@@ -665,6 +669,8 @@ typedef struct m_il1st_head_s {
} \
/******************************** INTERNAL ***********************************/
#if M_USE_SMALL_NAME
#define ILIST_INTERFACE M_ILIST_INTERFACE
#define ILIST_DEF M_ILIST_DEF
+7 -1
View File
@@ -72,7 +72,9 @@ M_BEGIN_PROTECTED_CODE
M_END_PROTECTED_CODE
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/******************************** INTERNAL ***********************************/
/*****************************************************************************/
// Deferred evaluation
#define M_ISHAR3D_PTR_OPLIST_P1(arg) M_ISHAR3D_PTR_OPLIST_P2 arg
@@ -102,6 +104,8 @@ M_BEGIN_PROTECTED_CODE
)
/******************************** INTERNAL ***********************************/
// Deferred evaluatioin
#define M_ISHAR3D_PTR_DEF_P1(arg) M_ID( M_ISHAR3D_PTR_DEF_P2 arg )
@@ -240,6 +244,8 @@ M_BEGIN_PROTECTED_CODE
M_END_PROTECTED_CODE
/******************************** INTERNAL ***********************************/
#if M_USE_SMALL_NAME
#define ISHARED_PTR_OPLIST M_ISHARED_PTR_OPLIST
#define ISHARED_PTR_INTERFACE M_ISHARED_PTR_INTERFACE
+5 -1
View File
@@ -66,7 +66,9 @@
#endif
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
/*
Technically, it uses a list of memory regions, where multiple
@@ -194,6 +196,8 @@
} while (0)
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define MEMPOOL_DEF M_MEMPOOL_DEF
#define MEMPOOL_DEF_AS M_MEMPOOL_DEF_AS
+7 -2
View File
@@ -55,8 +55,9 @@
(__VA_ARGS__ )))
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
/* Deferred evaluation for the definition,
so that all arguments are evaluated before further expansion */
@@ -107,6 +108,8 @@
)
/********************************** INTERNAL *********************************/
/* Deferred evaluation for the definition,
so that all arguments are evaluated before further expansion */
#define M_PR1OQUEUE_DEF_P1(arg) M_ID( M_PR1OQUEUE_DEF_P2 arg )
@@ -494,6 +497,8 @@
// TODO: set all & remove all function
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define PRIOQUEUE_DEF M_PRIOQUEUE_DEF
#define PRIOQUEUE_DEF_AS M_PRIOQUEUE_DEF_AS
+4
View File
@@ -115,6 +115,8 @@
)
/********************************** INTERNAL *********************************/
/* Max depth of the binary tree
It is at worst twice the depth of a perfectly even tree with maximum elements.
The maximum number of elements is the max of size_t.
@@ -1175,6 +1177,8 @@ typedef enum {
\
/********************************** INTERNAL *********************************/
// TODO: specialized _sort shall do nothing, but shall check the requested order. How ?
#if M_USE_SMALL_NAME
#define RBTREE_DEF M_RBTREE_DEF
+8 -4
View File
@@ -93,7 +93,9 @@ M_BEGIN_PROTECTED_CODE
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
// deferred evaluation
#define M_SHAR3D_PTR_OPLIST_P1(arg) M_SHAR3D_PTR_OPLIST_P2 arg
@@ -142,7 +144,8 @@ static inline int m_shar3d_integer_add(int *p, int val) { int r = *p; *p += val
static inline int m_shar3d_integer_sub(int *p, int val) { int r = *p; *p -= val; return r; }
static inline int m_shar3d_integer_cref(int *p) { return *p; }
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/* Contract of a shared pointer */
#define M_SHAR3D_CONTRACT(shared, cpt_oplist) do { \
@@ -360,10 +363,9 @@ static inline int m_shar3d_integer_cref(int *p) { return *p; }
M_ASSERT (data != NULL); \
return data; \
} \
/********************************** SHARED RESOURCE ************************************/
/********************************** INTERNAL *********************************/
#define M_SHAR3D_RESOURCE_CONTRACT(s) do { \
M_ASSERT (s != NULL); \
@@ -511,6 +513,8 @@ static inline int m_shar3d_integer_cref(int *p) { return *p; }
M_END_PROTECTED_CODE
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define SHARED_PTR_OPLIST M_SHARED_PTR_OPLIST
#define SHARED_PTR_DEF M_SHARED_PTR_DEF
+11 -8
View File
@@ -90,7 +90,9 @@ M_BEGIN_PROTECTED_CODE
(__VA_ARGS__ )))
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
// deferred evaluation of the input
#define M_SNAPSH0T_OPLIST_P1(arg) M_SNAPSH0T_OPLIST_P2 arg
@@ -118,7 +120,7 @@ M_BEGIN_PROTECTED_CODE
)
/******************************** INTERNAL SPSC **********************************/
/********************************** INTERNAL *********************************/
/* Flag defining the atomic state of a snapshot:
* - r: Index of the read buffer Range [0..2]
@@ -344,8 +346,7 @@ M_BEGIN_PROTECTED_CODE
} \
/******************************** INTERNAL SPMC **********************************/
/********************************** INTERNAL *********************************/
#define M_SNAPSH0T_SPMC_INT_FLAG(w, n) ( ((w) << 1) | (n) )
#define M_SNAPSH0T_SPMC_INT_FLAG_W(f) ((f) >> 1)
@@ -589,6 +590,9 @@ m_snapsh0t_mrsw_read_end(m_snapsh0t_mrsw_ct s, unsigned int idx)
M_SNAPSH0T_SPMC_INT_CONTRACT(s);
}
/********************************** INTERNAL *********************************/
/* Contract of a SPMC snapshot.
Nothing notable as it can be accessed concurrently */
#define M_SNAPSH0T_SPMC_CONTRACT(snap) do { \
@@ -705,11 +709,8 @@ m_snapsh0t_mrsw_read_end(m_snapsh0t_mrsw_ct s, unsigned int idx)
} \
\
//FIXME: Evaluate the needs for the methods _set_, _init_set.
/******************************** INTERNAL MPMC **********************************/
/********************************** INTERNAL *********************************/
// MPMC is built upon SPMC
@@ -798,6 +799,8 @@ m_snapsh0t_mrsw_read_end(m_snapsh0t_mrsw_ct s, unsigned int idx)
M_END_PROTECTED_CODE
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define SNAPSHOT_SPSC_DEF M_SNAPSHOT_SPSC_DEF
#define SNAPSHOT_SPSC_DEF_AS M_SNAPSHOT_SPSC_DEF_AS
+5 -3
View File
@@ -54,9 +54,9 @@
#endif
/********************************************************************************/
/********************************** INTERNAL ************************************/
/********************************************************************************/
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
# define M_TR33_NODE_CONTRACT(node, tree) do { \
M_ASSERT( (tree)->size > 0); \
@@ -1568,6 +1568,8 @@ exit: \
// * OPLIST ?
// * _previous ?
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define TREE_DEF M_TREE_DEF
#define TREE_DEF_AS M_TREE_DEF_AS
+9 -3
View File
@@ -27,8 +27,6 @@
#include "m-core.h"
/********************** External interface *************************/
/* Define the tuple type and functions.
USAGE:
TUPLE_DEF2(name, [(field1, type1[, oplist1]), (field2, type2[, oplist2]), ...] ) */
@@ -81,7 +79,9 @@ namespace m_lib {
#endif
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
/* Contract of a tuple. Nothing notable */
#define M_TUPL3_CONTRACT(tup) do { \
@@ -643,6 +643,8 @@ namespace m_lib {
M_TUPL3_CALL_RESET(a, el1 -> M_TUPL3_GET_FIELD a);
/********************************** INTERNAL *********************************/
/* INIT_WITH macro enabling recursive INIT_WITH initialization
tuple = { int, m_string_t, array<m_string_t> }
USAGE:
@@ -696,6 +698,8 @@ namespace m_lib {
M_TEST_METHOD_P(method, op)
/********************************** INTERNAL *********************************/
/* Macros for testing for the presence of a method in all the params */
#define M_TUPL3_IF_ALL(method, ...) \
M_IF(M_REDUCE2(M_TUPL3_TEST_METHOD_P, M_AND, method, __VA_ARGS__))
@@ -748,6 +752,8 @@ namespace m_lib {
#define M_TUPL3_OPLIST_SUBTYPE(name, num) \
M_C4(name, _type_, num, _ct)
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define TUPLE_DEF2 M_TUPLE_DEF2
#define TUPLE_DEF2_AS M_TUPLE_DEF2_AS
+12 -4
View File
@@ -27,9 +27,6 @@
#include "m-core.h"
/********************** External interface *************************/
/* Define the variant type and functions.
USAGE:
VARIANT_DEF2(name, [(field1, type1, oplist1), (field2, type2, oplist2), ...] ) */
@@ -55,7 +52,9 @@
M_VAR1ANT_OPLIST_P1((__VA_ARGS__ )))
/********************************** INTERNAL ************************************/
/*****************************************************************************/
/********************************** INTERNAL *********************************/
/*****************************************************************************/
/* Contract of a variant. */
#define M_VAR1ANT_CONTRACT(name, my) do { \
@@ -753,6 +752,9 @@ static inline void \
M_C(name, _init)(my); \
} \
/********************************** INTERNAL *********************************/
/* deferred evaluation of the oplist */
#define M_VAR1ANT_OPLIST_P1(arg) M_VAR1ANT_OPLIST_P2 arg
@@ -790,6 +792,9 @@ static inline void \
M_IF_METHOD(DEL, M_RET_ARG1(__VA_ARGS__,))(DEL(M_DELAY2(M_GET_DEL) M_RET_ARG1(__VA_ARGS__,)),), \
)
/********************************** INTERNAL *********************************/
/* Macros for testing for method presence */
#define M_VAR1ANT_TEST_METHOD_P2(method, f, t, op) \
M_TEST_METHOD_P(method, op)
@@ -805,6 +810,9 @@ static inline void \
#define M_VAR1ANT_IF_ALL2(method1, method2, ...) \
M_IF(M_REDUCE2(M_VAR1ANT_TEST_METHOD2_P, M_AND, (method1, method2), __VA_ARGS__))
/********************************** INTERNAL *********************************/
#if M_USE_SMALL_NAME
#define VARIANT_DEF2 M_VARIANT_DEF2
#define VARIANT_DEF2_AS M_VARIANT_DEF2_AS