Skip to content

Commit

Permalink
Add GENTYPE operator to all oplists
Browse files Browse the repository at this point in the history
  • Loading branch information
P-p-H-d committed Dec 30, 2023
1 parent 5ceb34d commit 422f3c2
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion m-array.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
,INIT_MOVE(M_F(name, _init_move)) \
,MOVE(M_F(name, _move)) \
,SWAP(M_F(name, _swap)) \
,TYPE(M_F(name,_ct)) \
,TYPE(M_F(name,_ct)) , GENTYPE(struct M_F(name,_s)*) \
,NAME(name) \
,SUBTYPE(M_F(name, _subtype_ct)) \
,EMPTY_P(M_F(name,_empty_p)) \
Expand Down
4 changes: 2 additions & 2 deletions m-bptree.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
MOVE(M_F(name, _move)), \
SWAP(M_F(name, _swap)), \
NAME(name), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*), \
SUBTYPE(M_F(name, _subtype_ct)), \
IT_TYPE(M_F(name, _it_ct)), \
IT_FIRST(M_F(name,_it)), \
Expand Down Expand Up @@ -215,7 +215,7 @@
MOVE(M_F(name, _move)), \
SWAP(M_F(name, _swap)), \
NAME(name), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*), \
SUBTYPE(M_F(name, _subtype_ct)), \
EMPTY_P(M_F(name,_empty_p)), \
IT_TYPE(M_F(name, _it_ct)), \
Expand Down
2 changes: 1 addition & 1 deletion m-buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ M_F(name, _init)(buffer_t v, size_t size) \
,SET(M_F(name, _set)) \
,CLEAR(M_F(name, _clear)) \
,NAME(name) \
,TYPE(M_F(name,_ct)) \
,TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*) \
,SUBTYPE(M_F(name, _subtype_ct)) \
,RESET(M_F(name,_reset)) \
,PUSH(M_F(name,_push)) \
Expand Down
2 changes: 1 addition & 1 deletion m-concurrent.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
,M_IF_METHOD(MOVE, oplist)(MOVE(M_F(name, _move)),) \
,M_IF_METHOD(SWAP,oplist)(SWAP(M_F(name, _swap)),) \
,NAME(name) \
,TYPE(M_F(name,_ct)) \
,TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*) \
,SUBTYPE(M_F(name, _subtype_ct)) \
,OPLIST(oplist) \
,M_IF_METHOD(EMPTY_P, oplist)(EMPTY_P(M_F(name,_empty_p)),) \
Expand Down
2 changes: 1 addition & 1 deletion m-deque.h
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@
,MOVE(M_F(name, _move)) \
,SWAP(M_F(name, _swap)) \
,NAME(name) \
,TYPE(M_F(name,_ct)) \
,TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*) \
,SUBTYPE(M_F(name, _subtype_ct)) \
,EMPTY_P(M_F(name,_empty_p)) \
,IT_TYPE(M_F(name,_it_ct)) \
Expand Down
4 changes: 2 additions & 2 deletions m-dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@
SWAP(M_F(name, _swap)), \
RESET(M_F(name, _reset)), \
NAME(name), \
TYPE(M_F(name, _ct)), \
TYPE(M_F(name, _ct)), GENTYPE(struct M_F(name,_s)*), \
SUBTYPE(M_F(name, _subtype_ct)), \
EMPTY_P(M_F(name,_empty_p)), \
IT_TYPE(M_F(name, _it_ct)), \
Expand Down Expand Up @@ -1126,7 +1126,7 @@
SWAP(M_F(name, _swap)), \
RESET(M_F(name, _reset)), \
NAME(name), \
TYPE(M_F(name, _ct)), \
TYPE(M_F(name, _ct)), GENTYPE(struct M_F(name,_s)*), \
SUBTYPE(M_F(name, _subtype_ct)), \
EMPTY_P(M_F(name,_empty_p)), \
PUSH(M_F(name,_push)), \
Expand Down
4 changes: 2 additions & 2 deletions m-funcobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
/* Specialization of the OPLIST in function if there is at least one member or not */
#define M_FUNC0BJ_INS_NO_ATTR_OPLIST(name) ( \
NAME(name), \
TYPE(M_F(name, _ct)), \
TYPE(M_F(name, _ct)), GENTYPE(struct M_F(name,_s)*), \
CLEAR(M_F(name, _clear)), \
INIT(M_F(name,_init)) \
)
Expand All @@ -127,7 +127,7 @@
/* Define the oplist of the instance */
#define M_FUNC0BJ_INS_ATTR_OPLIST_P3(name, ...) ( \
NAME(name), \
TYPE(M_F(name, _ct)), \
TYPE(M_F(name, _ct)), GENTYPE(struct M_F(name,_s)*), \
INIT_WITH(M_F(name, _init_with)), \
CLEAR(M_F(name, _clear)), \
M_IF_METHOD_ALL(INIT, __VA_ARGS__)(INIT(M_F(name,_init)),), \
Expand Down
2 changes: 1 addition & 1 deletion m-i-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ typedef struct m_il1st_head_s {
INIT_MOVE(M_F(name, _init_move)), \
MOVE(M_F(name, _move)), \
NAME(name), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*), \
RESET(M_F(name,_reset)), \
SUBTYPE(M_F(name,_subtype_ct)), \
EMPTY_P(M_F(name,_empty_p)), \
Expand Down
2 changes: 1 addition & 1 deletion m-i-shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ M_BEGIN_PROTECTED_CODE
CLEAR(M_F(name, _clear)), \
RESET(M_F(name, _reset) M_IPTR), \
NAME(name), \
TYPE(M_F(name, _ct)), \
TYPE(M_F(name, _ct)), GENTYPE(struct M_F(name,_s)*), \
OPLIST(oplist), \
SUBTYPE(M_F(name, _subtype_ct)) \
)
Expand Down
2 changes: 1 addition & 1 deletion m-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
INIT_MOVE(M_F(name, _init_move)), \
SWAP(M_F(name, _swap)), \
NAME(name), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)**), \
SUBTYPE(M_F(name,_subtype_ct)), \
EMPTY_P(M_F(name,_empty_p)), \
IT_TYPE(M_F(name, _it_ct)), \
Expand Down
2 changes: 1 addition & 1 deletion m-prioqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
,MOVE(M_F(name, _move)) \
,SWAP(M_F(name, _swap)) \
,NAME(name) \
,TYPE(M_F(name,_ct)) \
,TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*) \
,SUBTYPE(M_F(name, _subtype_ct)) \
,RESET(M_F(name,_reset)) \
,PUSH(M_F(name,_push)) \
Expand Down
2 changes: 1 addition & 1 deletion m-rbtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
MOVE(M_F(name, _move)), \
SWAP(M_F(name, _swap)), \
NAME(name), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*), \
SUBTYPE(M_F(name, _subtype_ct)), \
EMPTY_P(M_F(name,_empty_p)), \
GET_SIZE(M_F(name, _size)), \
Expand Down
2 changes: 1 addition & 1 deletion m-shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ M_BEGIN_PROTECTED_CODE
MOVE(M_F(name, _move)), \
SWAP(M_F(name, _swap)) \
,NAME(name) \
,TYPE(M_F(name, _ct)) \
,TYPE(M_F(name, _ct)), GENTYPE(struct M_F(name,_s)*) \
)

// OPLIST to handle a counter of atomic type
Expand Down
2 changes: 1 addition & 1 deletion m-snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ M_BEGIN_PROTECTED_CODE
,SET(M_F(name, _set)) \
,CLEAR(M_F(name, _clear)) \
,NAME(name) \
,TYPE(M_F(name, _ct)) \
,TYPE(M_F(name, _ct)) , GENTYPE(struct M_F(name,_s)*) \
,SUBTYPE(M_F(name, _subtype_ct)) \
,OPLIST(oplist) \
,M_IF_METHOD(INIT_MOVE, oplist)(INIT_MOVE(M_F(name, _init_move)),) \
Expand Down
6 changes: 3 additions & 3 deletions m-string.h
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@ namespace m_lib {
SWAP(m_string_swap), RESET(m_string_reset), \
EMPTY_P(m_string_empty_p), \
CLEAR(m_string_clear), HASH(m_string_hash), EQUAL(m_string_equal_p), \
CMP(m_string_cmp), TYPE(m_string_t), GENTYPE(struct m_string_s *), \
CMP(m_string_cmp), TYPE(m_string_t), GENTYPE(struct m_string_s*), \
PARSE_STR(m_string_parse_str), GET_STR(m_string_get_str), \
OUT_STR(m_string_out_str), IN_STR(m_string_in_str), \
OUT_SERIAL(m_string_out_serial), IN_SERIAL(m_string_in_serial), \
Expand Down Expand Up @@ -2197,7 +2197,7 @@ namespace m_lib {
/* Set the string a to the string (or C string) b */
#define m_string_set(a,b) M_STR1NG_SELECT2(m_string_set, m_string_set_cstr, a, b)

/* Concatene the string (or C string) b to the string a */
/* Concatenate the string (or C string) b to the string a */
#define m_string_cat(a,b) M_STR1NG_SELECT2(m_string_cat, m_string_cat_cstr, a, b)

/* Compare the string a to the string (or C string) b and return the sort order */
Expand Down Expand Up @@ -2273,7 +2273,7 @@ namespace m_lib {
HASH(M_F(name,_hash)), \
EQUAL(M_F(name,_equal_p)), \
CMP(M_F(name,_cmp)), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*), \
OOR_EQUAL(M_F(name,_oor_equal_p)), \
OOR_SET(M_F(name, _oor_set)), \
PARSE_STR(M_F(name,_parse_str)), \
Expand Down
2 changes: 1 addition & 1 deletion m-tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ namespace m_lib {
SET(M_F(name,_set)), \
CLEAR(M_F(name, _clear)), \
NAME(name), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*), \
OPLIST( (__VA_ARGS__) ), \
M_IF_METHOD_ALL(CMP, __VA_ARGS__)(CMP(M_F(name, _cmp)),), \
M_IF_METHOD_ALL(HASH, __VA_ARGS__)(HASH(M_F(name, _hash)),), \
Expand Down
2 changes: 1 addition & 1 deletion m-variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ M_INLINE void \
CLEAR(M_F(name, _clear)), \
RESET(M_F(name, _reset)), \
NAME(name), \
TYPE(M_F(name,_ct)), \
TYPE(M_F(name,_ct)), GENTYPE(struct M_F(name,_s)*), \
EMPTY_P(M_F(name,_empty_p)), \
M_IF_METHOD_ALL(HASH, __VA_ARGS__)(HASH(M_F(name, _hash)),), \
M_IF_METHOD_ALL(EQUAL, __VA_ARGS__)(EQUAL(M_F(name, _equal_p)),), \
Expand Down
6 changes: 2 additions & 4 deletions tests/test-mgeneric.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ const string_t gx;
CLEAR(M_NOTHING_DEFAULT) )
#define INT1 (GENTYPE(int), TYPE(int), INIT(M_INIT_BASIC), INIT_SET(M_SET_BASIC), SET(M_SET_BASIC), \
CLEAR(M_NOTHING_DEFAULT) )
#define ARRAY1 M_OPEXTEND(M_OPL_array_int_t(), GENTYPE(struct array_int_s *))
#define LIST1 M_OPEXTEND(M_OPL_list_int_t(), GENTYPE(struct list_int_s **))

//NOTE: string_t is registered by the CORE component of the MLIB organization

Expand All @@ -65,9 +63,9 @@ const string_t gx;

#define M_GENERIC_ORG_3() (ARRAY)
#define M_GENERIC_ORG_ARRAY_COMP_5() (AINT)
#define M_GENERIC_ORG_ARRAY_COMP_AINT_OPLIST_6() ARRAY1
#define M_GENERIC_ORG_ARRAY_COMP_AINT_OPLIST_6() M_OPL_array_int_t()
#define M_GENERIC_ORG_ARRAY_COMP_10() (LINT)
#define M_GENERIC_ORG_ARRAY_COMP_LINT_OPLIST_30() LIST1
#define M_GENERIC_ORG_ARRAY_COMP_LINT_OPLIST_30() M_OPL_list_int_t()

static bool test_empty(const string_t p)
{
Expand Down

0 comments on commit 422f3c2

Please sign in to comment.