Skip to content

LoggerHelperMacros

Module: LIBDAISY / HUMAN_INTERFACE / LOGGING

Defines

Name
LOGGER_NEWLINE
LOGGER_BUFFER
PPCAT_NX(A, B)
PPCAT(A, B)
STRINGIZE_NX(A)
STRINGIZE(A)
FLT_FMT(_n)
FLT_VAR(_n, _x)
FLT_FMT3
FLT_VAR3(_x)

Macros Documentation

define LOGGER_NEWLINE

#define LOGGER_NEWLINE "\r\n"

Logger configuration custom newline character sequence

define LOGGER_BUFFER

#define LOGGER_BUFFER 128

size in bytes

define PPCAT_NX

#define PPCAT_NX(
    A,
    B
)
A##B

Helper macros for string concatenation and macro expansion non-expanding concatenation

define PPCAT

#define PPCAT(
    A,
    B
)
PPCAT_NX(A, B)

concatenate tokens

define STRINGIZE_NX

#define STRINGIZE_NX(
    A
)
#A

non-expanding stringize

define STRINGIZE

#define STRINGIZE(
    A
)
STRINGIZE_NX(A)

make a string

define FLT_FMT

#define FLT_FMT(
    _n
)
STRINGIZE(PPCAT(PPCAT(%c%d.%0, _n), d))

Floating point output formatting string. Include in your printf-style format string example: printf("float value = " FLT_FMT(3) " continue like that", FLT_VAR(3, x));

define FLT_VAR

#define FLT_VAR(
    _n,
    _x
)
    (_x < 0 ? '-' : ' '), (int)(abs(_x)), \
        (int)(((abs(_x)) - (int)(abs(_x))) * pow(10, (_n)))

Floating point output variable preprocessing Note: uses truncation instead of rounding -> the last digit may be off

define FLT_FMT3

#define FLT_FMT3 FLT_FMT(3)

Shorthand for 10^-3 fraction, output equivalent to %.3f

define FLT_VAR3

#define FLT_VAR3(
    _x
)
FLT_VAR(3, _x)

Shorthand for 10^-3 fraction


Updated on 2024-01-03 at 19:41:01 +0000