forked from nuttx/nuttx-update
Re-design vsprintf so that it does not use so much stack; handle 8051's 2-byte generic pointers.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@38 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
24f2e6a0a4
commit
af1289c019
11 changed files with 1342 additions and 619 deletions
|
@ -111,6 +111,12 @@ defconfig -- This is a configuration file similar to the Linux
|
|||
CONFIG_DISABLE_CLOCK, CONFIG_DISABLE_PTHREAD.
|
||||
CONFIG_DISABLE_SIGNALS, CONFIG_DISABLE_MQUEUE
|
||||
|
||||
|
||||
Misc libc settings
|
||||
|
||||
CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
little smaller if we do not support fieldwidthes
|
||||
|
||||
Allow for architecture optimized implementations
|
||||
|
||||
The architecture can provide optimized versions of the
|
||||
|
|
|
@ -135,6 +135,14 @@ CONFIG_DISABLE_PTHREAD=n
|
|||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
|
||||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
# little smaller if we do not support fieldwidthes
|
||||
#
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=n
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
|
|
|
@ -102,6 +102,14 @@ CONFIG_DISABLE_PTHREAD=y
|
|||
CONFIG_DISABLE_SIGNALS=y
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
|
||||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
# little smaller if we do not support fieldwidthes
|
||||
#
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=y
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
|
|
|
@ -69,11 +69,15 @@
|
|||
|
||||
void up_irqinitialize(void)
|
||||
{
|
||||
#if 1 /* remove me */
|
||||
IE = 0;
|
||||
#else
|
||||
/* Enable interrupts globally, but disable all interrupt
|
||||
* sources.
|
||||
*/
|
||||
|
||||
IE = 0x80;
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
|
|
|
@ -102,6 +102,14 @@ CONFIG_DISABLE_PTHREAD=n
|
|||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
|
||||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
# little smaller if we do not support fieldwidthes
|
||||
#
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=n
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
|
|
|
@ -80,6 +80,14 @@
|
|||
|
||||
# undef CONFIG_SMALL_MEMORY
|
||||
|
||||
/* Long and int are (probably) the same size */
|
||||
|
||||
# undef CONFIG_LONG_IS_NOT_INT
|
||||
|
||||
/* The pointers and int are the same size */
|
||||
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
|
||||
/* GCC supports inlined functions */
|
||||
|
||||
# define CONFIG_HAVE_INLINE 1
|
||||
|
@ -140,6 +148,14 @@
|
|||
|
||||
# define CONFIG_SMALL_MEMORY 1
|
||||
|
||||
/* Long and int are not the same size */
|
||||
|
||||
# define CONFIG_LONG_IS_NOT_INT 1
|
||||
|
||||
/* The generic point and int are not the same size */
|
||||
|
||||
# define CONFIG_PTR_IS_NOT_INT 1
|
||||
|
||||
/* SDCC does not support inline functions */
|
||||
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
|
@ -172,6 +188,8 @@
|
|||
# define CODE
|
||||
|
||||
# undef CONFIG_SMALL_MEMORY
|
||||
# undef CONFIG_LONG_IS_NOT_INT
|
||||
# undef CONFIG_PTR_IS_NOT_INT
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
# undef CONFIG_HAVE_LONG_LONG
|
||||
# undef CONFIG_HAVE_DOUBLE
|
||||
|
|
|
@ -52,7 +52,8 @@ STDIO_SRCS = lib_fopen.c lib_fclose.c \
|
|||
lib_ungetc.c \
|
||||
lib_printf.c lib_vprintf.c lib_fprintf.c lib_rawprintf.c lib_lowprintf.c \
|
||||
lib_vfprintf.c lib_sprintf.c lib_libsprintf.c lib_vsprintf.c \
|
||||
lib_libvsprintf.c lib_stdstream.c lib_memstream.c lib_rawstream.c lib_lowstream.c \
|
||||
lib_libvsprintf.c lib_stdstream.c lib_memstream.c \
|
||||
lib_rawstream.c lib_lowstream.c lib_nullstream.c \
|
||||
lib_sscanf.c
|
||||
STDLIB_SRCS = lib_getenv.c lib_rand.c
|
||||
MATH_SRCS = lib_rint.c
|
||||
|
|
|
@ -128,6 +128,10 @@ extern void lib_rawstream(struct lib_rawstream_s *rawstream,
|
|||
extern void lib_lowstream(struct lib_stream_s *rawstream);
|
||||
#endif
|
||||
|
||||
/* Defined in lib_nullstream.c */
|
||||
|
||||
extern void lib_nullstream(struct lib_stream_s *nullstream);
|
||||
|
||||
/* Defined in lib_libsprintf.c */
|
||||
|
||||
extern int lib_sprintf (struct lib_stream_s *obj,
|
||||
|
|
File diff suppressed because it is too large
Load diff
62
lib/lib_nullstream.c
Normal file
62
lib/lib_nullstream.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/************************************************************
|
||||
* lib_nullstream.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* 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
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "lib_internal.h"
|
||||
|
||||
/************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
|
||||
static void nullstream_putc(struct lib_stream_s *this, int ch)
|
||||
{
|
||||
this->nput++;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* Public Functions
|
||||
************************************************************/
|
||||
|
||||
void lib_nullstream(struct lib_stream_s *nullstream)
|
||||
{
|
||||
nullstream->put = nullstream_putc;
|
||||
nullstream->nput = 0;
|
||||
}
|
||||
|
Loading…
Reference in a new issue