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; it cannot be used to detect whether truncation occurred.

Declaration at line 131 of file c-api.h, definition at line 72 of file trace-c-api.cpp.

72micro_os_plus_trace_printf (const char* format, ...)
73{
74 std::va_list arguments;
75 va_start (arguments, format);
76
77 int ret
79
80 va_end (arguments);
81 return ret;
82}

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 unsigned 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 c-api.h, definition at line 97 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 c-api.h, definition at line 91 of file trace-c-api.cpp.

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; the return value cannot be used to detect whether truncation occurred. Typically called by micro_os_plus_trace_printf.

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

85micro_os_plus_trace_vprintf (const char* format, va_list arguments)
86{
88}

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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.