Generic stream formatted print implementation. More...
#include <util.h>#include <string.h>#include <stream.h>#include <compiler.h>Go to the source code of this file.
Data Structures | |
| struct | string_stream |
| string stream object to convert from a string buffer to a struct stream object. More... | |
Defines | |
| #define | BUFFER_STREAM_BUFFER_SIZE 32 |
| Internal string stream buffer. | |
Functions | |
| static struct string_stream * | string_stream_of (struct stream *s) |
| Return the buffer stream containing the stream s. | |
| static void | snprintf_stream_commit (struct stream *s) |
| static void | sprintf_stream_commit (struct stream *s) |
| static bool | string_stream_make_room (struct stream *s, unsigned int goal) |
| int | snprintf (char *str, size_t size, const char *format,...) |
| Streamed formatted size limited output conversion. | |
| int | sprintf (char *str, const char *format,...) |
| Streamed formatted output conversion. | |
Generic stream formatted print implementation.
Copyright (C) 2010 Atmel Corporation. All rights reserved.
Definition in file stream_string.c.
| #define BUFFER_STREAM_BUFFER_SIZE 32 |
Internal string stream buffer.
For internal use only.
Definition at line 47 of file stream_string.c.
Referenced by snprintf(), and sprintf().
| int snprintf | ( | char * | str, | |
| size_t | size, | |||
| const char * | format, | |||
| ... | ||||
| ) |
Streamed formatted size limited output conversion.
This is simply a convenience wrapper around stream_printf(), which will translate a character buffer in memory into a stream object. It will at most write size bytes to the str buffer from the format stream, and it does also take a variable number of arguments.
Definition at line 152 of file stream_string.c.
References string_stream::buffer, BUFFER_STREAM_BUFFER_SIZE, stream::data, memset(), string_stream::offset, string_stream::stream, and stream_vprintf().
Referenced by sub_frame_draw_handler().
| static void snprintf_stream_commit | ( | struct stream * | s | ) | [static] |
For internal use only.
Definition at line 80 of file stream_string.c.
References string_stream::offset, string_stream::size, stream_buf_extract_char(), stream_buf_has_data(), string_stream::string, and string_stream_of().
| int sprintf | ( | char * | str, | |
| const char * | format, | |||
| ... | ||||
| ) |
Streamed formatted output conversion.
This is simply a convenience wrapper around stream_printf(), which will translate a character buffer in memory into a stream object. It will write to the str buffer from the format stream until it reaches the null byte terminator, hence the user must be careful to avoid buffer overflow. It does also take a variable number of arguments.
Definition at line 196 of file stream_string.c.
References string_stream::buffer, BUFFER_STREAM_BUFFER_SIZE, stream::data, memset(), string_stream::offset, string_stream::stream, and stream_vprintf().
| static void sprintf_stream_commit | ( | struct stream * | s | ) | [static] |
For internal use only.
Definition at line 111 of file stream_string.c.
References string_stream::offset, stream_buf_extract_char(), stream_buf_has_data(), string_stream::string, and string_stream_of().
| static bool string_stream_make_room | ( | struct stream * | s, | |
| unsigned int | goal | |||
| ) | [static] |
For internal use only.
Definition at line 128 of file stream_string.c.
References stream_ops::commit, and stream::ops.
| static struct string_stream* string_stream_of | ( | struct stream * | s | ) | [static, read] |
Return the buffer stream containing the stream s.
For internal use only.
Definition at line 71 of file stream_string.c.
References container_of.
Referenced by snprintf_stream_commit(), and sprintf_stream_commit().
1.6.3