|
From: <sv...@va...> - 2009-05-16 02:03:42
|
Author: sewardj
Date: 2009-05-16 02:35:13 +0100 (Sat, 16 May 2009)
New Revision: 9844
Log:
Add new yet another (v)printf variant: VG_(vcbprintf), which is like
vprintf, but sends its output to a completely arbitrary callback
function on a character-by-character basis.
Modified:
branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c
branches/MESSAGING_TIDYUP/include/pub_tool_libcprint.h
Modified: branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c
===================================================================
--- branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c 2009-05-13 08:35:54 UTC (rev 9843)
+++ branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c 2009-05-16 01:35:13 UTC (rev 9844)
@@ -256,6 +256,17 @@
}
+/* --------- vcbprintf --------- */
+
+void VG_(vcbprintf)( void(*char_sink)(HChar, void* opaque),
+ void* opaque,
+ const HChar* format, va_list vargs )
+{
+ (void) VG_(debugLog_vprintf)
+ ( char_sink, opaque, format, vargs );
+}
+
+
/* ---------------------------------------------------------------------
percentify()
------------------------------------------------------------------ */
Modified: branches/MESSAGING_TIDYUP/include/pub_tool_libcprint.h
===================================================================
--- branches/MESSAGING_TIDYUP/include/pub_tool_libcprint.h 2009-05-13 08:35:54 UTC (rev 9843)
+++ branches/MESSAGING_TIDYUP/include/pub_tool_libcprint.h 2009-05-16 01:35:13 UTC (rev 9844)
@@ -73,6 +73,12 @@
const HChar *format, va_list vargs )
PRINTF_CHECK(3, 0);
+/* Yet another, totally general, version of vprintf, which hands all
+ output bytes to CHAR_SINK, passing it OPAQUE as the second arg. */
+extern void VG_(vcbprintf)( void(*char_sink)(HChar, void* opaque),
+ void* opaque,
+ const HChar* format, va_list vargs );
+
/* These are the same as the non "_xml" versions above, except the
output goes on the selected XML output channel instead of the
normal one.
@@ -85,7 +91,6 @@
extern UInt VG_(printf_xml_no_f_c) ( const HChar *format, ... );
-
// Percentify n/m with d decimal places. Includes the '%' symbol at the end.
// Right justifies in 'buf'.
extern void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[]);
|