blob: 8922a6a05e55d6f378b478a92ea2e2dab4fe1016 [file] [log] [blame]
njn36a20fa2005-06-03 03:08:39 +00001
2/*--------------------------------------------------------------------*/
3/*--- Printing libc stuff. pub_tool_libcprint.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
10 Copyright (C) 2000-2005 Julian Seward
11 jseward@acm.org
12
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
31#ifndef __PUB_TOOL_LIBCPRINT_H
32#define __PUB_TOOL_LIBCPRINT_H
33
34/* ---------------------------------------------------------------------
35 Basic printing
36 ------------------------------------------------------------------ */
37
38/* Note that they all output to the file descriptor given by the
39 * --log-fd/--log-file/--log-socket argument, which defaults to 2 (stderr).
40 * Hence no need for VG_(fprintf)().
41 */
42extern UInt VG_(printf) ( const HChar *format, ... );
43extern UInt VG_(vprintf) ( const HChar *format, va_list vargs );
44/* too noisy ... __attribute__ ((format (printf, 1, 2))) ; */
45extern UInt VG_(sprintf) ( Char* buf, const HChar* format, ... );
46extern UInt VG_(vsprintf)( Char* buf, const HChar* format, va_list vargs );
47
njn7a5915e2005-07-17 16:12:59 +000048// Percentify n/m with d decimal places. Includes the '%' symbol at the end.
njn856c54e2005-06-26 18:43:40 +000049extern void VG_(percentify)(UInt n, UInt m, UInt d, Int n_buf, char buf[]);
50
njn36a20fa2005-06-03 03:08:39 +000051/* ---------------------------------------------------------------------
52 Messages for the user
53 ------------------------------------------------------------------ */
54
njn3e114522005-06-11 03:31:09 +000055/* No, really. I _am_ that strange. */
56#define OINK(nnn) VG_(message)(Vg_DebugMsg, "OINK %d",nnn)
57
njn36a20fa2005-06-03 03:08:39 +000058/* Print a message prefixed by "??<pid>?? "; '?' depends on the VgMsgKind.
59 Should be used for all user output. */
60
61typedef
62 enum { Vg_UserMsg, /* '?' == '=' */
63 Vg_DebugMsg, /* '?' == '-' */
64 Vg_DebugExtraMsg, /* '?' == '+' */
65 Vg_ClientMsg /* '?' == '*' */
66 }
67 VgMsgKind;
68
69/* Send a single-part message. Appends a newline. */
70extern UInt VG_(message) ( VgMsgKind kind, const HChar* format, ... );
71extern UInt VG_(vmessage) ( VgMsgKind kind, const HChar* format, va_list vargs );
72
73#endif // __PUB_TOOL_LIBCPRINT_H
74
75/*--------------------------------------------------------------------*/
76/*--- end ---*/
77/*--------------------------------------------------------------------*/