7#ifndef CLIBS_PRINT_FUNCTIONS_H
8#define CLIBS_PRINT_FUNCTIONS_H
24#define TYPE_SEPARATOR ": "
29#define ITEM_PRINT_FUNCTION_NAME( type ) Print_##type
32#define DECLARE_PRINT_FUNC( name ) \
33 void ITEM_PRINT_FUNCTION_NAME( name )( const void *, size_t )
60#define DEFINE_PRINT_FUNC( type, format_str ) \
61 void ITEM_PRINT_FUNCTION_NAME( type )( const void *data, const size_t nbytes ) \
63 if ( nbytes != sizeof( type ) ) \
65 fwarnx( "invalid data" ); \
69 if ( PrintFunctions_DoPrintType ) \
72 printf( #type TYPE_SEPARATOR ); \
74 printf( format_str, *( ( type * ) data ) ); \
75 if ( PrintFunctions_DoPrintType ) \
Function and variable attributes.
#define LibraryDefined
Definition attributes.h:107
#define DECLARE_PRINT_FUNC(name)
Declares a PrintFunction
Definition item_print_functions.h:32
LibraryDefined bool PrintFunctions_DoPrintType
If true, the functions defined by DEFINE_PRINT_FUNC also print the type name.
Definition item_print_functions.h:20
void(* PrintFunction)(const void *, size_t)
Interface for functions that print data.
Definition item_print_functions.h:17