Skip to main content

Main functions

Primary C functions for outputting trace messages. More...

Functions Index

intmicro_os_plus_trace_printf (const char *format,...)

Write a formatted string to the trace output channel. More...

intmicro_os_plus_trace_putchar (int c)

Write the single character to the trace output channel. More...

intmicro_os_plus_trace_puts (const char *s)

Write the string and a line terminator to the trace output channel. More...

intmicro_os_plus_trace_vprintf (const char *format, va_list arguments)

Write a formatted variable arguments list to the trace output channel. More...

Description

Primary C functions for outputting trace messages.

These functions constitute the primary methods for outputting trace messages in C projects.

Functions

micro_os_plus_trace_printf()

int micro_os_plus_trace_printf (const char * format, ...)

Write a formatted string to the trace output channel.

Parameters
format

A null terminated string with the format.

...

Additional arguments matching the format specifiers.

Returns

The number of bytes written, or -1 if an error occurred.

Formatting is performed into a fixed-size stack buffer of MICRO_OS_PLUS_DIAG_TRACE_PRINTF_BUFFER_ARRAY_SIZE_INTEGER bytes (default: 200). If the formatted output exceeds this limit, it is silently truncated before being passed to micro_os_plus_trace_write. The return value reflects the number of bytes actually written, not the number that the format string would have produced.

Declaration at line 132 of file trace-c-api.h, definition at line 66 of file trace-c-api.cpp.

66micro_os_plus_trace_printf (const char* format, ...)
67{
68 std::va_list arguments;
69 va_start (arguments, format);
70
71#pragma GCC diagnostic push
72#if defined(__clang__)
73#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
74#endif
75 int ret = tracer<implementation>::vprintf (format, arguments);
76#pragma GCC diagnostic pop
77
78 va_end (arguments);
79 return ret;
80}

Reference micro_os_plus::trace::detail::tracer< T >::vprintf.

micro_os_plus_trace_putchar()

int micro_os_plus_trace_putchar (int c)

Write the single character to the trace output channel.

Parameters
c

A single byte character, passed as an int.

Returns

The written character as an int, or EOF (-1) if an error occurred.

Converts c to char and passes it as a one-byte buffer to micro_os_plus_trace_write. On success, returns the original value of c; on failure, returns EOF.

Declaration at line 186 of file trace-c-api.h, definition at line 105 of file trace-c-api.cpp.

Reference micro_os_plus::trace::detail::tracer< T >::putchar.

micro_os_plus_trace_puts()

int micro_os_plus_trace_puts (const char * s)

Write the string and a line terminator to the trace output channel.

Parameters
s

A null terminated string.

Returns

The total number of bytes written (string + newline), or EOF (-1) if an error occurred.

Writes the characters of s followed by a single newline character ('\n'). Unlike the standard C puts(), this function returns the total byte count written, not merely a non-negative indicator. If writing the newline fails after the string has been written successfully, EOF is returned.

Declaration at line 170 of file trace-c-api.h, definition at line 94 of file trace-c-api.cpp.

95{
96#pragma GCC diagnostic push
97#if defined(__clang__)
98#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
99#endif
101#pragma GCC diagnostic pop
102}

Reference micro_os_plus::trace::detail::tracer< T >::puts.

micro_os_plus_trace_vprintf()

int micro_os_plus_trace_vprintf (const char * format, va_list arguments)

Write a formatted variable arguments list to the trace output channel.

Parameters
format

A null terminated string with the format.

arguments

A variable arguments list.

Returns

The number of bytes written, or -1 if an error occurred.

Equivalent to micro_os_plus_trace_printf, but accepts a va_list instead of a variadic argument list. Subject to the same fixed-size stack buffer constraint and truncation behaviour. Typically called by micro_os_plus_trace_printf.

Declaration at line 151 of file trace-c-api.h, definition at line 83 of file trace-c-api.cpp.

83micro_os_plus_trace_vprintf (const char* format, va_list arguments)
84{
85#pragma GCC diagnostic push
86#if defined(__clang__)
87#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
88#endif
89 return tracer<implementation>::vprintf (format, arguments);
90#pragma GCC diagnostic pop
91}

Reference micro_os_plus::trace::detail::tracer< T >::vprintf.


Generated via doxygen2docusaurus 2.2.1 by Doxygen 1.17.0.