mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Compiles with ZDS-II
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@540 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+81
-79
@@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* lib_libvsprintf.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@@ -31,15 +31,15 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Compilation Switches
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/compiler.h>
|
||||
#include <sys/types.h>
|
||||
@@ -48,9 +48,9 @@
|
||||
|
||||
#include "lib_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -98,13 +98,13 @@ enum
|
||||
#define IS_NEGATE(f) (((f) & FLAG_NEGATE) != 0)
|
||||
#define IS_SIGNED(f) (((f) & (FLAG_SHOWPLUS|FLAG_NEGATE)) != 0)
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/* Pointer to ASCII conversion */
|
||||
|
||||
@@ -166,31 +166,31 @@ static void postjustify(struct lib_stream_s *obj, ubyte fmt,
|
||||
ubyte flags, int fieldwidth, int numwidth);
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Global Constant Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Constant Data
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static const char g_nullstring[] = "(null)";
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: ptohex
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PTR_IS_NOT_INT
|
||||
static void ptohex(struct lib_stream_s *obj, ubyte flags, void *p)
|
||||
@@ -229,9 +229,9 @@ static void ptohex(struct lib_stream_s *obj, ubyte flags, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: getpsize
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
|
||||
static int getpsize(ubyte flags, void *p)
|
||||
@@ -247,9 +247,9 @@ static int getpsize(ubyte flags, void *p)
|
||||
#endif /* CONFIG_NOPRINTF_FIELDWIDTH */
|
||||
#endif /* CONFIG_PTR_IS_NOT_INT */
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: utodec
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void utodec(struct lib_stream_s *obj, unsigned int n)
|
||||
{
|
||||
@@ -264,9 +264,9 @@ static void utodec(struct lib_stream_s *obj, unsigned int n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: utohex
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void utohex(struct lib_stream_s *obj, unsigned int n, ubyte a)
|
||||
{
|
||||
@@ -297,9 +297,9 @@ static void utohex(struct lib_stream_s *obj, unsigned int n, ubyte a)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: utooct
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void utooct(struct lib_stream_s *obj, unsigned int n)
|
||||
{
|
||||
@@ -314,9 +314,9 @@ static void utooct(struct lib_stream_s *obj, unsigned int n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: utobin
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void utobin(struct lib_stream_s *obj, unsigned int n)
|
||||
{
|
||||
@@ -331,9 +331,9 @@ static void utobin(struct lib_stream_s *obj, unsigned int n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: lutoascii
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void utoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned int n)
|
||||
{
|
||||
@@ -442,9 +442,9 @@ static void utoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: fixup
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
|
||||
static void fixup(ubyte fmt, ubyte *flags, int *n)
|
||||
@@ -485,9 +485,9 @@ static void fixup(ubyte fmt, ubyte *flags, int *n)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: getusize
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int getusize(ubyte fmt, ubyte flags, unsigned int n)
|
||||
{
|
||||
@@ -500,9 +500,9 @@ static int getusize(ubyte fmt, ubyte flags, unsigned int n)
|
||||
#endif /* CONFIG_NOPRINTF_FIELDWIDTH */
|
||||
|
||||
#ifdef CONFIG_LONG_IS_NOT_INT
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: lutodec
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void lutodec(struct lib_stream_s *obj, unsigned long n)
|
||||
{
|
||||
@@ -517,9 +517,9 @@ static void lutodec(struct lib_stream_s *obj, unsigned long n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: lutohex
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void lutohex(struct lib_stream_s *obj, unsigned long n, ubyte a)
|
||||
{
|
||||
@@ -550,9 +550,9 @@ static void lutohex(struct lib_stream_s *obj, unsigned long n, ubyte a)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: lutooct
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void lutooct(struct lib_stream_s *obj, unsigned long n)
|
||||
{
|
||||
@@ -567,9 +567,9 @@ static void lutooct(struct lib_stream_s *obj, unsigned long n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: lutobin
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void lutobin(struct lib_stream_s *obj, unsigned long n)
|
||||
{
|
||||
@@ -584,9 +584,9 @@ static void lutobin(struct lib_stream_s *obj, unsigned long n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: lutoascii
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void lutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long ln)
|
||||
{
|
||||
@@ -690,9 +690,9 @@ static void lutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: lfixup
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
|
||||
static void lfixup(ubyte fmt, ubyte *flags, long *ln)
|
||||
@@ -733,9 +733,9 @@ static void lfixup(ubyte fmt, ubyte *flags, long *ln)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: getlusize
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int getlusize(ubyte fmt, ubyte flags, unsigned long ln)
|
||||
{
|
||||
@@ -750,9 +750,9 @@ static int getlusize(ubyte fmt, ubyte flags, unsigned long ln)
|
||||
#endif /* CONFIG_LONG_IS_NOT_INT */
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: llutodec
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void llutodec(struct lib_stream_s *obj, unsigned long long n)
|
||||
{
|
||||
@@ -767,9 +767,9 @@ static void llutodec(struct lib_stream_s *obj, unsigned long long n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: llutohex
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void llutohex(struct lib_stream_s *obj, unsigned long long n, ubyte a)
|
||||
{
|
||||
@@ -800,9 +800,9 @@ static void llutohex(struct lib_stream_s *obj, unsigned long long n, ubyte a)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: llutooct
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void llutooct(struct lib_stream_s *obj, unsigned long long n)
|
||||
{
|
||||
@@ -817,9 +817,9 @@ static void llutooct(struct lib_stream_s *obj, unsigned long long n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: llutobin
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void llutobin(struct lib_stream_s *obj, unsigned long long n)
|
||||
{
|
||||
@@ -834,9 +834,9 @@ static void llutobin(struct lib_stream_s *obj, unsigned long long n)
|
||||
obj->put(obj, (remainder + (unsigned int)'0'));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: llutoascii
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void llutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long long lln)
|
||||
{
|
||||
@@ -940,9 +940,9 @@ static void llutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigne
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: llfixup
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
|
||||
static void llfixup(ubyte fmt, ubyte *flags, long long *lln)
|
||||
@@ -983,9 +983,9 @@ static void llfixup(ubyte fmt, ubyte *flags, long long *lln)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: getllusize
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int getllusize(ubyte fmt, ubyte flags, unsigned long long lln)
|
||||
{
|
||||
@@ -1000,9 +1000,9 @@ static int getllusize(ubyte fmt, ubyte flags, unsigned long long lln)
|
||||
#endif /* CONFIG_NOPRINTF_FIELDWIDTH */
|
||||
#endif /* CONFIG_HAVE_LONG_LONG */
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: prejustify
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void prejustify(struct lib_stream_s *obj, ubyte fmt,
|
||||
ubyte flags, int fieldwidth, int numwidth)
|
||||
@@ -1064,9 +1064,9 @@ static void prejustify(struct lib_stream_s *obj, ubyte fmt,
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Name: postjustify
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static void postjustify(struct lib_stream_s *obj, ubyte fmt,
|
||||
ubyte flags, int fieldwidth, int numwidth)
|
||||
@@ -1095,13 +1095,13 @@ static void postjustify(struct lib_stream_s *obj, ubyte fmt,
|
||||
break;
|
||||
}
|
||||
}
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* lib_vsprintf
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int lib_vsprintf(struct lib_stream_s *obj, const char *src, va_list ap)
|
||||
{
|
||||
@@ -1465,7 +1465,9 @@ int lib_vsprintf(struct lib_stream_s *obj, const char *src, va_list ap)
|
||||
|
||||
else if (strchr("eEfgG", *src))
|
||||
{
|
||||
#warning "No floating point support"
|
||||
#ifdef CONFIG_CPP_HAVE_WARNING
|
||||
# warning "No floating point support"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user