Add new macros _DEF_AS so that

user can define its own name for the generated types.
This commit is contained in:
Patrick Pelissier committed 2020-10-03 14:07:14 +02:00
1 parent 63eee6bba3
commit e04b120d41
4 files changed
+80 -6

No files matched your search

+12 -1
View File
@@ -37,12 +37,23 @@
M_END_PROTECTED_CODE
/* Define a dynamic array of the given type and its associated functions
as the provided type name_t with the iterator named it_t
USAGE: ARRAY_DEF_AS(name, name_t, it_t, type [, oplist_of_the_type]) */
#define ARRAY_DEF_AS(name, name_t, it_t, ...) \
M_BEGIN_PROTECTED_CODE \
ARRAYI_DEF_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \
((name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), name_t, it_t ), \
(name, __VA_ARGS__, name_t, it_t ))) \
M_END_PROTECTED_CODE
/* Define the oplist of a dynamic array given its name and its oplist.
If no oplist is given it is assumed to be M_DEFAULT_OPLIST
USAGE: ARRAY_OPLIST(name[, oplist of the type]) */
#define ARRAY_OPLIST(...) \
ARRAYI_OPLIST_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \
((__VA_ARGS__, M_DEFAULT_OPLIST), \
((__VA_ARGS__, M_DEFAULT_OPLIST), \
(__VA_ARGS__ )))