diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-12-18 21:57:14 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-12-18 21:57:14 +0100 |
commit | 62766425fe3a552440228c78f13a2c1dd62e228b (patch) | |
tree | c82f82df9317bd3a98de3f43de44f6a9edf178d3 /tmp | |
parent | 022daa0619f7d571db6e81c09ab5c0f0af389c18 (diff) | |
download | stm32f103-playground-62766425fe3a552440228c78f13a2c1dd62e228b.tar.gz stm32f103-playground-62766425fe3a552440228c78f13a2c1dd62e228b.tar.bz2 stm32f103-playground-62766425fe3a552440228c78f13a2c1dd62e228b.tar.xz stm32f103-playground-62766425fe3a552440228c78f13a2c1dd62e228b.zip |
o Functional and tested printf.
Diffstat (limited to 'tmp')
-rwxr-xr-x | tmp/printf/printf.c | 10 | ||||
-rwxr-xr-x | tmp/printf/printf.h | 15 |
2 files changed, 15 insertions, 10 deletions
diff --git a/tmp/printf/printf.c b/tmp/printf/printf.c index 3950a5f..f10f61f 100755 --- a/tmp/printf/printf.c +++ b/tmp/printf/printf.c @@ -105,9 +105,9 @@ static int a2d(char ch) else return -1; } -static char a2i(char ch, char** src,int base,int* nump) +static char a2i(char ch, const char** src,int base,int* nump) { - char* p= *src; + const char* p= *src; int num=0; int digit; while ((digit=a2d(ch))>=0) { @@ -133,7 +133,7 @@ static void putchw(void* putp,putcf putf,int n, char z, char* bf) putf(putp,ch); } -void tfp_format(void* putp,putcf putf,char *fmt, va_list va) +void tfp_format(void* putp,putcf putf,const char *fmt, va_list va) { char bf[12]; @@ -218,7 +218,7 @@ void init_printf(void* putp,void (*putf) (void*,char)) stdout_putp=putp; } -void tfp_printf(char *fmt, ...) +void tfp_printf(const char *fmt, ...) { va_list va; va_start(va,fmt); @@ -233,7 +233,7 @@ static void putcp(void* p,char c) -void tfp_sprintf(char* s,char *fmt, ...) +void tfp_sprintf(char* s,const char *fmt, ...) { va_list va; va_start(va,fmt); diff --git a/tmp/printf/printf.h b/tmp/printf/printf.h index 9723b0f..f697ea6 100755 --- a/tmp/printf/printf.h +++ b/tmp/printf/printf.h @@ -108,17 +108,22 @@ regs Kusti, 23.10.2004 #include <stdarg.h> +#ifdef __cplusplus +extern "C" { +#endif + void init_printf(void* putp,void (*putf) (void*,char)); -void tfp_printf(char *fmt, ...); -void tfp_sprintf(char* s,char *fmt, ...); +void tfp_printf(const char *fmt, ...); +void tfp_sprintf(char* s,const char *fmt, ...); -void tfp_format(void* putp,void (*putf) (void*,char),char *fmt, va_list va); +void tfp_format(void* putp,void (*putf) (void*,char),const char *fmt, va_list va); #define printf tfp_printf #define sprintf tfp_sprintf +#ifdef __cplusplus +}; #endif - - +#endif |