|
sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
|
Small stand-alone implementation of the printf family of functions ((v)printf, (v)s(n)printf etc., geared towards use on embedded systems with a very limited resources. More...
#include <stdarg.h>#include <stddef.h>Go to the source code of this file.
Macros | |
| #define | ATTR_PRINTF((one_based_format_index) |
| #define | ATTR_VPRINTF(one_based_format_index) |
| #define | PRINTF_ALIAS_STANDARD_FUNCTION_NAMES 0 |
| #define | PRINTF_VISIBILITY |
Functions | |
| PRINTF_VISIBILITY void | putchar_ (char c) |
| PRINTF_VISIBILITY int | fctprintf (void(*out)(char c, void *extra_arg), void *extra_arg, const char *format,...) ATTR_PRINTF(3 |
| PRINTF_VISIBILITY int PRINTF_VISIBILITY int | vfctprintf (void(*out)(char c, void *extra_arg), void *extra_arg, const char *format, va_list arg) ATTR_VPRINTF(3) |
| PRINTF_VISIBILITY int | printf_ (const char *format,...) ATTR_PRINTF(1 |
| PRINTF_VISIBILITY int PRINTF_VISIBILITY int | vprintf_ (const char *format, va_list arg) ATTR_VPRINTF(1) |
| PRINTF_VISIBILITY int | sprintf_ (char *s, const char *format,...) ATTR_PRINTF(2 |
| PRINTF_VISIBILITY int PRINTF_VISIBILITY int | vsprintf_ (char *s, const char *format, va_list arg) ATTR_VPRINTF(2) |
| PRINTF_VISIBILITY int | snprintf_ (char *s, size_t count, const char *format,...) ATTR_PRINTF(3 |
| PRINTF_VISIBILITY int PRINTF_VISIBILITY int | vsnprintf_ (char *s, size_t count, const char *format, va_list arg) ATTR_VPRINTF(3) |
Small stand-alone implementation of the printf family of functions ((v)printf, (v)s(n)printf etc., geared towards use on embedded systems with a very limited resources.
@license The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file printf.h.
| PRINTF_VISIBILITY int fctprintf | ( | void(* | out )(char c, void *extra_arg), |
| void * | extra_arg, | ||
| const char * | format, | ||
| ... ) |
printf/vprintf with user-specified output function
An alternative to printf_, in which the output function is specified dynamically (rather than putchar_ being used)
| out | An output function which takes one character and a type-erased additional parameters |
| extra_arg | The type-erased argument to pass to the output function out with each call |
| format | A string specifying the format of the output, with %-marked specifiers of how to interpret additional arguments. |
| arg | Additional arguments to the function, one for each specifier in format |
| PRINTF_VISIBILITY int printf_ | ( | const char * | format, |
| ... ) |
An implementation of the C standard's printf/vprintf
| format | A string specifying the format of the output, with %-marked specifiers of how to interpret additional arguments. |
| arg | Additional arguments to the function, one for each %-specifier in format string |
s, not counting the terminating null character | PRINTF_VISIBILITY int snprintf_ | ( | char * | s, |
| size_t | count, | ||
| const char * | format, | ||
| ... ) |
An implementation of the C standard's snprintf/vsnprintf
| s | An array in which to store the formatted string. It must be large enough to fit either the entire formatted output, or at least n characters. Alternatively, it can be NULL, in which case nothing will be printed, and only the number of characters which could have been printed is tallied and returned. |
| n | The maximum number of characters to write to the array, including a terminating null character |
| format | A string specifying the format of the output, with %-marked specifiers of how to interpret additional arguments. |
| arg | Additional arguments to the function, one for each specifier in format |
s, not counting the terminating null character. A value equal or larger than n indicates truncation. Only when the returned value is non-negative and less than n, the null-terminated string has been fully and successfully printed. | PRINTF_VISIBILITY int sprintf_ | ( | char * | s, |
| const char * | format, | ||
| ... ) |
An implementation of the C standard's sprintf/vsprintf
| s | An array in which to store the formatted string. It must be large enough to fit the formatted output! |
| format | A string specifying the format of the output, with %-marked specifiers of how to interpret additional arguments. |
| arg | Additional arguments to the function, one for each specifier in format |
s, not counting the terminating null character | PRINTF_VISIBILITY int PRINTF_VISIBILITY int vfctprintf | ( | void(* | out )(char c, void *extra_arg), |
| void * | extra_arg, | ||
| const char * | format, | ||
| va_list | arg ) |
| PRINTF_VISIBILITY int PRINTF_VISIBILITY int vsnprintf_ | ( | char * | s, |
| size_t | count, | ||
| const char * | format, | ||
| va_list | arg ) |