Remove M_PRINT_ARG macro to simplify maintenance
(M_FPRINT_MACRO with stdout can be used instead)
This commit is contained in:
1 parent
fecece19cb
commit
d318493c6c
2 files changed
+3
-17
No files matched your search
@@ -6376,20 +6376,15 @@ Theses macros are only valid if the program is built in C11 mode:
|
|||||||
Return the printf format associated to the type of 'x'.
|
Return the printf format associated to the type of 'x'.
|
||||||
'x' shall be a basic C variable, printable with printf.
|
'x' shall be a basic C variable, printable with printf.
|
||||||
|
|
||||||
##### M\_PRINT\_ARG(x)
|
##### M\_FPRINT\_ARG(file, x)
|
||||||
|
|
||||||
Print using printf the variable 'x'.
|
Print into a file 'file' using fprintf the variable 'x'.
|
||||||
|
|
||||||
The format of 'x' is deduced provided that it is a standard numerical C type.
|
The format of 'x' is deduced provided that it is a standard numerical C type.
|
||||||
If m-string is included, it supports also the type 'string\_t' natively.
|
If m-string is included, it supports also the type 'string\_t' natively.
|
||||||
If the argument is extended (i.e. in the format '(var, optype)' with optype being either an oplist or a type
|
If the argument is extended (i.e. in the format '(var, optype)' with optype being either an oplist or a type
|
||||||
with a globally registered oplist), then it will call the OUT\_STR method of the oplist on the variable 'var'.
|
with a globally registered oplist), then it will call the OUT\_STR method of the oplist on the variable 'var'.
|
||||||
|
|
||||||
##### M\_FPRINT\_ARG(file, x)
|
|
||||||
|
|
||||||
Print into a file 'file' using fprintf the variable 'x'.
|
|
||||||
See M\_PRINT\_ARG for details on the supported variable.
|
|
||||||
|
|
||||||
##### M\_GET\_STRING\_ARG(string,x,append)
|
##### M\_GET\_STRING\_ARG(string,x,append)
|
||||||
|
|
||||||
Print into the string\_t 'string' the variable 'x'.
|
Print into the string\_t 'string' the variable 'x'.
|
||||||
|
|||||||
@@ -2629,15 +2629,6 @@ m_core_fopen(const char filename[], const char opt[])
|
|||||||
/* Can be overloaded by m-string to support string output too */
|
/* Can be overloaded by m-string to support string output too */
|
||||||
#define M_CORE_PRINTF_ARG(x) x
|
#define M_CORE_PRINTF_ARG(x) x
|
||||||
|
|
||||||
/* Print a C variable if it is a standard type (or extension) to stdout
|
|
||||||
If a variable is extended (i.e. like (x, type) ) it will use the
|
|
||||||
method associated to the OUT_STR operator.
|
|
||||||
*/
|
|
||||||
#define M_PRINT_ARG(x) \
|
|
||||||
M_IF(M_PARENTHESIS_P(x)) \
|
|
||||||
( M_FPRINT_ARG_OUT_STR(stdout, M_PAIR_2 x, M_PAIR_1 x), \
|
|
||||||
printf(M_PRINTF_FORMAT(x), M_CORE_PRINTF_ARG(x) ) )
|
|
||||||
|
|
||||||
/* Print a C variable if it is a standard type to the given file 'f'.
|
/* Print a C variable if it is a standard type to the given file 'f'.
|
||||||
If a variable is extended (i.e. like (x, type) ) it will use the
|
If a variable is extended (i.e. like (x, type) ) it will use the
|
||||||
method associated to the OUT_STR operator.
|
method associated to the OUT_STR operator.
|
||||||
@@ -2812,7 +2803,7 @@ M_PARSE_DEFAULT_TYPE_DEF(m_core_parse_ldouble, long double, strtold, )
|
|||||||
|
|
||||||
/* Generic PRINT macro: print all its inputs regardless of the type
|
/* Generic PRINT macro: print all its inputs regardless of the type
|
||||||
provided it is a generic "non-struct" type. */
|
provided it is a generic "non-struct" type. */
|
||||||
#define M_PRINT(...) do { M_REDUCE(M_PRINT_ARG, M_SEPARATE_PER_SEMICOLON, __VA_ARGS__); } while (0)
|
#define M_PRINT(...) do { M_REDUCE2(M_FPRINT_ARG, M_SEPARATE_PER_SEMICOLON, stdout, __VA_ARGS__); } while (0)
|
||||||
|
|
||||||
/* Generic FPRINT macro: print all its inputs regardless of the type
|
/* Generic FPRINT macro: print all its inputs regardless of the type
|
||||||
provided it is a generic "non-struct" type into the file 'f'. */
|
provided it is a generic "non-struct" type into the file 'f'. */
|
||||||
|
|||||||
Reference in new issue
Block a user