//| Copyright: (C) 2020-2024 Kevin Larke //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file. #include #include #include "rpt.h" #define RPT_BUF_N 64 char RPT_BUF[ RPT_BUF_N ]; void vrpt( printCallback_t printCbFunc, const char* fmt, va_list vl ) { if( printCbFunc != nullptr ) { vsnprintf(RPT_BUF,RPT_BUF_N,fmt,vl); RPT_BUF[RPT_BUF_N-1] = '\0'; printCbFunc(RPT_BUF); } } void rpt( printCallback_t printCbFunc, const char* fmt, ... ) { va_list vl; va_start(vl,fmt); vrpt(printCbFunc,fmt,vl); va_end(vl); } void rptHex( printCallback_t printCbFunc, const void* buf, unsigned bufByteN, const char* label, bool asciiFl ) { const unsigned char* data = static_cast(buf); const unsigned colN = 8; unsigned ci = 0; if( label != nullptr ) rpt(printCbFunc,"%s\n",label); for(unsigned i=0; i