void _debug_vprintf(const char *format, va_list ap) { #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) /* EngDebugPrint does not handle float point arguments, so we need to use * our own vsnprintf implementation. It is also very slow, so buffer until * we find a newline. */ static char buf[512] = {'\0'}; size_t len = strlen(buf); int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap); if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) { _EngDebugPrint("%s", buf); buf[0] = '\0'; } #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) /* EngDebugPrint does not handle float point arguments, so we need to use * our own vsnprintf implementation. It is also very slow, so buffer until * we find a newline. */ static char buf[512 + 1] = {'\0'}; size_t len = strlen(buf); int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap); if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) { OutputDebugStringA(buf); buf[0] = '\0'; } #elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) /* TODO */ #else /* !PIPE_SUBSYSTEM_WINDOWS */ vfprintf(stderr, format, ap); #endif }
void _debug_vprintf(const char *format, va_list ap) { static char buf[4096] = {'\0'}; #if defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_EMBEDDED) /* We buffer until we find a newline. */ size_t len = strlen(buf); int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap); if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) { os_log_message(buf); buf[0] = '\0'; } #else util_vsnprintf(buf, sizeof(buf), format, ap); os_log_message(buf); #endif }
void dbg_verify_failed(const char *format, ...) { int s; char buffer[1024*4]; va_list ap; if (!g_expr) g_expr="(none)"; s=my_snprintf(buffer, sizeof(buffer), "ASSERT FAILED in file %s, line %d:\n\t\"%s\"\n", g_file, g_line, g_expr); if (format) { va_start(ap, format); util_vsnprintf(buffer+s, sizeof(buffer)-s, format, ap); va_end(ap); } g_hand(g_level, buffer); /* [i_a] ALWAYS offer the user-def'able abort * handler (unittests depend on this) */ if (ham_test_abort) { ham_test_abort(); } else { #ifndef HAM_OS_WINCE abort(); #else ExitProcess(-1); #endif } }
static INLINE void trace_dump_writef(const char *format, ...) { static char buf[1024]; unsigned len; va_list ap; va_start(ap, format); len = util_vsnprintf(buf, sizeof(buf), format, ap); va_end(ap); trace_dump_write(buf, len); }
static INLINE void util_stream_writef(FILE *stream, const char *format, ...) { static char buf[1024]; unsigned len; va_list ap; va_start(ap, format); len = util_vsnprintf(buf, sizeof(buf), format, ap); va_end(ap); fwrite(buf, len, 1, stream); }
void _debug_vprintf(const char *format, va_list ap) { /* We buffer until we find a newline. */ static char buf[4096] = {'\0'}; size_t len = strlen(buf); int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap); if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) { os_log_message(buf); buf[0] = '\0'; } }
void dbg_log(const char *format, ...) { int s=0; char buffer[1024*4]; va_list ap; va_start(ap, format); #if HAM_DEBUG s=my_snprintf (buffer, sizeof(buffer), "%s[%d]: ", g_file, g_line); util_vsnprintf(buffer+s, sizeof(buffer)-s, format, ap); #else if (g_function) s=my_snprintf(buffer, sizeof(buffer), "%s: ", g_function); util_vsnprintf (buffer+s, sizeof(buffer)-s, format, ap); #endif va_end(ap); g_hand(g_level, buffer); }
static int my_snprintf(char *str, size_t size, const char *format, ...) { int s; va_list ap; va_start(ap, format); s=util_vsnprintf(str, size, format, ap); va_end(ap); return (s); }
static void util_report_result_helper(int status, const char *name, ...) { char buf[256]; va_list ap; va_start(ap, name); util_vsnprintf(buf, sizeof(buf), name, ap); va_end(ap); printf("Test(%s) = %s\n", buf, status == SKIP ? "skip" : status == PASS ? "pass" : "fail"); }
void i915_program_error(struct i915_fp_compile *p, const char *msg, ...) { va_list args; char buffer[1024]; debug_printf("i915_program_error: "); va_start( args, msg ); util_vsnprintf( buffer, sizeof(buffer), msg, args ); va_end( args ); debug_printf("%s", buffer); debug_printf("\n"); p->error = 1; }
static void str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...) { struct str_dump_ctx *sctx = (struct str_dump_ctx *)ctx; if(sctx->left > 1) { int written; va_list ap; va_start(ap, format); written = util_vsnprintf(sctx->ptr, sctx->left, format, ap); va_end(ap); /* Some complicated logic needed to handle the return value of * vsnprintf: */ if (written > 0) { written = MIN2(sctx->left, written); sctx->ptr += written; sctx->left -= written; } } }