diff --git a/README.md b/README.md index 745ee38d..4bf54ffc 100644 --- a/README.md +++ b/README.md @@ -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'. '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. 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 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) Print into the string\_t 'string' the variable 'x'. diff --git a/m-core.h b/m-core.h index e15d507d..2b3b0423 100644 --- a/m-core.h +++ b/m-core.h @@ -2629,15 +2629,6 @@ m_core_fopen(const char filename[], const char opt[]) /* Can be overloaded by m-string to support string output too */ #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'. If a variable is extended (i.e. like (x, type) ) it will use the 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 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 provided it is a generic "non-struct" type into the file 'f'. */