# HG changeset patch # User Matti Hamalainen # Date 1580098197 -7200 # Node ID 7f1efa37288b3f1bd9d96c5ff52d58b3230606c1 # Parent 6510d76966f86aca8f616482e3389542eeeae9e8 Rename TH_PFUNC_* macros to TH_VPRINTF_INTFMT_* diff -r 6510d76966f8 -r 7f1efa37288b th_printf.c --- a/th_printf.c Mon Jan 27 06:02:22 2020 +0200 +++ b/th_printf.c Mon Jan 27 06:09:57 2020 +0200 @@ -1,5 +1,5 @@ /* - * A printf() implementation + * A simple and incomplete printf() implementation * Programmed and designed by Matti 'ccr' Hamalainen * (C) Copyright 2016-2020 Tecnic Software productions (TNSP) * @@ -102,15 +102,15 @@ } -#define TH_PFUNC_NAME th_vprintf_buf_int -#define TH_PFUNC_TYPE_S int -#define TH_PFUNC_TYPE_U unsigned int +#define TH_VPRINTF_INTFMT_NAME th_vprintf_buf_int +#define TH_VPRINTF_INTFMT_TYPE_S int +#define TH_VPRINTF_INTFMT_TYPE_U unsigned int #include "th_printf1.c" -#define TH_PFUNC_NAME th_vprintf_buf_int64 -#define TH_PFUNC_TYPE_S int64_t -#define TH_PFUNC_TYPE_U uint64_t +#define TH_VPRINTF_INTFMT_NAME th_vprintf_buf_int64 +#define TH_VPRINTF_INTFMT_TYPE_S int64_t +#define TH_VPRINTF_INTFMT_TYPE_U uint64_t #include "th_printf1.c" diff -r 6510d76966f8 -r 7f1efa37288b th_printf1.c --- a/th_printf1.c Mon Jan 27 06:02:22 2020 +0200 +++ b/th_printf1.c Mon Jan 27 06:09:57 2020 +0200 @@ -7,10 +7,10 @@ */ -int TH_PFUNC_NAME (char *buf, const int len, int *pos, - TH_PFUNC_TYPE_S pval, const int f_radix, const BOOL f_upcase, +int TH_VPRINTF_INTFMT_NAME (char *buf, const int len, int *pos, + TH_VPRINTF_INTFMT_TYPE_S pval, const int f_radix, const BOOL f_upcase, const BOOL f_unsig, BOOL *f_neg) -#ifdef TH_PFUNC_HEADER +#ifdef TH_VPRINTF_INTFMT_HEADER ; #else { @@ -27,7 +27,7 @@ *f_neg = FALSE; // Render the value to a string in buf (reversed) - TH_PFUNC_TYPE_U val = pval; + TH_VPRINTF_INTFMT_TYPE_U val = pval; // Special case for value of 0. This would seem like a // dirty kludge, but allows us to handle NULL ptr (nul) @@ -39,7 +39,7 @@ *pos = 0; do { - TH_PFUNC_TYPE_U digit = val % f_radix; + TH_VPRINTF_INTFMT_TYPE_U digit = val % f_radix; if (digit < 10) buf[*pos] = '0' + digit; @@ -57,8 +57,8 @@ #endif -#undef TH_PFUNC_NAME -#undef TH_PFUNC_SIGNED -#undef TH_PFUNC_TYPE_S -#undef TH_PFUNC_TYPE_U -#undef TH_PFUNC_HEADER +#undef TH_VPRINTF_INTFMT_NAME +#undef TH_VPRINTF_INTFMT_SIGNED +#undef TH_VPRINTF_INTFMT_TYPE_S +#undef TH_VPRINTF_INTFMT_TYPE_U +#undef TH_VPRINTF_INTFMT_HEADER diff -r 6510d76966f8 -r 7f1efa37288b th_string.h --- a/th_string.h Mon Jan 27 06:02:22 2020 +0200 +++ b/th_string.h Mon Jan 27 06:09:57 2020 +0200 @@ -161,17 +161,17 @@ BOOL f_neg, BOOL f_unsig, th_vprintf_altfmt_func f_alt); -#define TH_PFUNC_NAME th_vprintf_buf_int -#define TH_PFUNC_TYPE_S int -#define TH_PFUNC_TYPE_U unsigned int -#define TH_PFUNC_HEADER 1 +#define TH_VPRINTF_INTFMT_NAME th_vprintf_buf_int +#define TH_VPRINTF_INTFMT_TYPE_S int +#define TH_VPRINTF_INTFMT_TYPE_U unsigned int +#define TH_VPRINTF_INTFMT_HEADER 1 #include "th_printf1.c" -#define TH_PFUNC_NAME th_vprintf_buf_int64 -#define TH_PFUNC_TYPE_S int64_t -#define TH_PFUNC_TYPE_U uint64_t -#define TH_PFUNC_HEADER 1 +#define TH_VPRINTF_INTFMT_NAME th_vprintf_buf_int64 +#define TH_VPRINTF_INTFMT_TYPE_S int64_t +#define TH_VPRINTF_INTFMT_TYPE_U uint64_t +#define TH_VPRINTF_INTFMT_HEADER 1 #include "th_printf1.c"