summaryrefslogtreecommitdiff
path: root/nuttx/lib/lib_libvsprintf.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-05-08 03:10:51 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-05-08 03:10:51 +0000
commit50b7bdacbd6d4af3bb3128c038e4e0e2cd0d50df (patch)
tree4ecda8d995277191f4a8545ce758b5cd1cc4b9c5 /nuttx/lib/lib_libvsprintf.c
parent56651d825a6651d0f70ec59d798c5d7f584786d1 (diff)
downloadpx4-nuttx-50b7bdacbd6d4af3bb3128c038e4e0e2cd0d50df.tar.gz
px4-nuttx-50b7bdacbd6d4af3bb3128c038e4e0e2cd0d50df.tar.bz2
px4-nuttx-50b7bdacbd6d4af3bb3128c038e4e0e2cd0d50df.zip
Add floating point support to printf
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2656 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib/lib_libvsprintf.c')
-rw-r--r--nuttx/lib/lib_libvsprintf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/nuttx/lib/lib_libvsprintf.c b/nuttx/lib/lib_libvsprintf.c
index 1d28c1a6c..7ad2184eb 100644
--- a/nuttx/lib/lib_libvsprintf.c
+++ b/nuttx/lib/lib_libvsprintf.c
@@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_libvsprintf.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -186,6 +186,12 @@ static const char g_nullstring[] = "(null)";
* Private Functions
****************************************************************************/
+/* Include floating point functions */
+
+#ifdef CONFIG_LIBC_FLOATINGPOINT
+# include "lib_libdtoa.c"
+#endif
+
/****************************************************************************
* Name: ptohex
****************************************************************************/
@@ -1468,9 +1474,8 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, const char *src, va_list ap)
#ifdef CONFIG_LIBC_FLOATINGPOINT
else if (strchr("eEfgG", *src))
{
-#ifdef CONFIG_CPP_HAVE_WARNING
-# warning "No floating point support"
-#endif
+ double dblval = va_arg(ap, double);
+ lib_dtoa(obj, *src, trunc, flags, dblval);
}
#endif
}