* Add support for API_6 & API_7. * Fix issue for DO_INIT_MOVE that doesn't support API calls

This commit is contained in:
Patrick Pelissier committed 2019-12-15 19:43:26 +01:00
1 parent 1b7bcda4e1
commit 7128f5add2
1 file changed
+17 -9
+17 -9
View File
@@ -2117,13 +2117,17 @@ m_core_hash (const void *str, size_t length)
/* API Transformation :
API_0: default, API_1: oplist given,
API_2: by addr for first argument, API_3: oplist given,
API_4 :by affectation for first argument, 5: API_by affectation + oplist */
API_4 :by affectation for first argument, 5: API_by affectation + oplist
API_6 :by addr for two arguments, 5: API_by address for both + oplist
*/
#define M_OPLAPI_0(method, oplist, ...) ,method(__VA_ARGS__),
#define M_OPLAPI_1(method, oplist, ...) ,method(oplist, __VA_ARGS__),
#define M_OPLAPI_2(method, oplist, ...) ,method(& __VA_ARGS__),
#define M_OPLAPI_3(method, oplist, ...) ,method(oplist, &__VA_ARGS__),
#define M_OPLAPI_4(method, oplist, x, ...) ,x = method(__VA_ARGS__),
#define M_OPLAPI_5(method, oplist, x, ...) ,x = method(oplist, __VA_ARGS__),
#define M_OPLAPI_6(method, oplist, x, ...) ,method(&x, &__VA_ARGS__),
#define M_OPLAPI_7(method, oplist, x, ...) ,method(oplist, &x, &__VA_ARGS__),
/* API transformation support for indirection */
#define M_OPLAPI_INDIRECT_API_0(...) M_OPLAPI_0
#define M_OPLAPI_EXTRACT_API_0(...) __VA_ARGS__
@@ -2137,6 +2141,10 @@ m_core_hash (const void *str, size_t length)
#define M_OPLAPI_EXTRACT_API_4(...) __VA_ARGS__
#define M_OPLAPI_INDIRECT_API_5(...) M_OPLAPI_5
#define M_OPLAPI_EXTRACT_API_5(...) __VA_ARGS__
#define M_OPLAPI_INDIRECT_API_6(...) M_OPLAPI_6
#define M_OPLAPI_EXTRACT_API_6(...) __VA_ARGS__
#define M_OPLAPI_INDIRECT_API_7(...) M_OPLAPI_7
#define M_OPLAPI_EXTRACT_API_7(...) __VA_ARGS__
/* Define the no default function that generates a compiler error
if the method is expanded. Compiler extensions may have already defined
@@ -2345,19 +2353,19 @@ m_core_hash (const void *str, size_t length)
/* Perform an INIT_MOVE if present, or emulate it using INIT_SET/CLEAR */
#define M_DO_INIT_MOVE(oplist, dest, src) do { \
M_IF_METHOD(INIT_MOVE, oplist)(M_GET_INIT_MOVE oplist ((dest), (src)), \
M_GET_INIT_SET oplist ((dest), (src)) ; \
M_GET_CLEAR oplist (src) ); \
M_IF_METHOD(INIT_MOVE, oplist)(M_CALL_INIT_MOVE(oplist, (dest), (src)), \
M_CALL_INIT_SET(oplist, (dest), (src)) ; \
M_CALL_CLEAR(oplist, (src) )); \
} while (0)
/* Perform a MOVE if present, or emulate it using CLEAR/INIT_MOVE
if possible, or with SET/CLEAR otherwise */
#define M_DO_MOVE(oplist, dest, src) do { \
M_IF_METHOD(MOVE, oplist) (M_GET_MOVE oplist (dest, src), \
M_IF_METHOD(INIT_MOVE, oplist)(M_GET_CLEAR oplist (dest); \
M_GET_INIT_MOVE oplist(dest, src), \
M_GET_SET oplist(dest, src); \
M_GET_CLEAR oplist(src) \
M_IF_METHOD(MOVE, oplist) (M_CALL_MOVE(oplist, (dest), (src)), \
M_IF_METHOD(INIT_MOVE, oplist)(M_CALL_CLEAR(oplist, (dest)); \
M_CALL_INIT_MOVE(oplist, (dest), (src)), \
M_CALL_SET(oplist, (dest), (src)); \
M_CALL_CLEAR(oplist, (src)) \
)); \
} while (0)