Revert "shell: support floating point output with newlib"
This reverts commit e812ee6c21
.
This is the initial step towards replacing the core Zephyr formatting
infrastructure with a common functionally-complete solution.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
74fd3a8143
commit
abb3a28c94
4 changed files with 10 additions and 3 deletions
|
@ -15,6 +15,7 @@ zephyr_library_sources(
|
|||
source/string/strstr.c
|
||||
source/string/string.c
|
||||
source/string/strspn.c
|
||||
source/stdout/prf.c
|
||||
source/stdout/stdout_console.c
|
||||
source/stdout/sprintf.c
|
||||
source/stdout/fprintf.c
|
||||
|
|
|
@ -23,9 +23,6 @@ zephyr_sources(
|
|||
heap-validate.c
|
||||
)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_MINIMAL_LIBC prf.c)
|
||||
zephyr_sources_ifdef(CONFIG_SHELL prf.c)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_JSON_LIBRARY json.c)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_RING_BUFFER ring_buffer.c)
|
||||
|
|
|
@ -7,7 +7,12 @@
|
|||
#include <shell/shell_fprintf.h>
|
||||
#include <shell/shell.h>
|
||||
|
||||
#ifdef CONFIG_NEWLIB_LIBC
|
||||
typedef int (*out_func_t)(int c, void *ctx);
|
||||
extern void z_vprintk(out_func_t out, void *ctx, const char *fmt, va_list ap);
|
||||
#else
|
||||
extern int z_prf(int (*func)(), void *dest, char *format, va_list vargs);
|
||||
#endif
|
||||
|
||||
static int out_func(int c, void *ctx)
|
||||
{
|
||||
|
@ -34,7 +39,11 @@ static int out_func(int c, void *ctx)
|
|||
void shell_fprintf_fmt(const struct shell_fprintf *sh_fprintf,
|
||||
const char *fmt, va_list args)
|
||||
{
|
||||
#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCH_POSIX)
|
||||
(void)z_prf(out_func, (void *)sh_fprintf, (char *)fmt, args);
|
||||
#else
|
||||
z_vprintk(out_func, (void *)sh_fprintf, fmt, args);
|
||||
#endif
|
||||
|
||||
if (sh_fprintf->ctrl_blk->autoflush) {
|
||||
shell_fprintf_buffer_flush(sh_fprintf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue