embtextf  20130407
Embedded System Text Formatting
 All Files Functions Typedefs Macros Pages
Macros | Functions
stdio.h File Reference

Declarations for functions implementing libc stdio functions. More...

Go to the source code of this file.

Macros

#define EOF   -1
 

Functions

int setvbuf (void *stream, char *buf, int mode, size_t size)
 
int putchar (int c)
 
int puts (const char *s)
 
int printf (const char *fmt,...)
 
int sprintf (char *s, const char *fmt,...)
 
int snprintf (char *s, size_t size, const char *fmt,...)
 

Detailed Description

Declarations for functions implementing libc stdio functions.

Using EMBTEXTF_PROVIDE_LIBC embtextf can provide implementations for standard libc functions such as printf(), puts(), etc. based on an application-provided putchar() implementation.

These functions are provided: printf(), sprintf(), snprintf(), setvbuf()

These functions are required: putchar()

These functions are not provided: fprintf(), fputc(), fputs(), putc()

Stream-oriented functions (viz. those that reference a libc FILE object) are not included as one might conceivably want to use FILE to hold the embtextf_putchar_fn instance that is used to perform output to that stream. If such an interface is desired it can be provided by the application.

Note
You must link libembtextf-libc.a along with libembtextf to incorporate the libc-related function wrappers into your application.
See Also
<embtextf/stdarg.h>.
Homepage
http://github.com/pabigot/embtextf

Macro Definition Documentation

#define EOF   -1

The <stdio.h> constant that indicates an error.

Warning
This is declared for documentation purposes only. The actual value is obtained from the toolchain's <stdio.h> header. Normally one should expect its value to be -1.

Function Documentation

int printf ( const char *  fmt,
  ... 
)

ISO C standard function based on embtextf_vuprintf() dependent on EMBTEXTF_PROVIDE_LIBC.

int putchar ( int  c)

Write a single character, cast to an unsigned char, to an output device.

Parameters
cthe character to be emitted.
Returns
the character, or EOF if an error occurs.
Note
The implementation of this function must be provided externally to embtextf.
The implementation of functions that use putchar() may ignore any error return from putchar().
int puts ( const char *  s)

ISO C standard function based on putchar() dependent on EMBTEXTF_PROVIDE_LIBC.

Parameters
sthe string to be written. The terminating NUL is not emitted.
Returns
A non-negative number on success, or EOF if an error is encountered.
int setvbuf ( void *  stream,
char *  buf,
int  mode,
size_t  size 
)

Declaration for stream-dependent function

This function is defined at the link-level because some BSPs (e.g. for Energy Micro's chips) assume it is available when using GCC and newlib. Since a major purpose of this module is to bypass newlib's bloated i/o infrastructure we stub the function so that it's ignored.

Note that because the real function prototype depends on FILE and we don't know that type we're describing the corresponding argument as if it were a pointer-to-void; in fact, this prototype is present only in the documentation, not in the actual header used when building the library or applications that use it. We assume that at the binary interface level a pointer-to-void will be passed in the same manner as a pointer-to-FILE.

The implementation does nothing but return EOF.

int snprintf ( char *  s,
size_t  size,
const char *  fmt,
  ... 
)

ISO C standard function based on embtextf_vuprintf() dependent on EMBTEXTF_PROVIDE_LIBC.

int sprintf ( char *  s,
const char *  fmt,
  ... 
)

ISO C standard function based on embtextf_vuprintf() dependent on EMBTEXTF_PROVIDE_LIBC.