]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/include/pub_tool_libcprint.h
c205515950cf27ebbc5107e2439079c11b49708e
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / include / pub_tool_libcprint.h
1
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-2010 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
40    (stderr).  Hence no need for VG_(fprintf)().
41 */
42 extern UInt VG_(printf)   ( const HChar *format, ... )
43                           PRINTF_CHECK(1, 2);
44
45 extern UInt VG_(vprintf)  ( const HChar *format, va_list vargs )
46                           PRINTF_CHECK(1, 0);
47
48 extern UInt VG_(sprintf)  ( Char* buf, const HChar* format, ... )
49                           PRINTF_CHECK(2, 3);
50
51 extern UInt VG_(vsprintf) ( Char* buf, const HChar* format, va_list vargs )
52                           PRINTF_CHECK(2, 0);
53
54 extern UInt VG_(snprintf) ( Char* buf, Int size, 
55                                        const HChar *format, ... )
56                           PRINTF_CHECK(3, 4);
57
58 extern UInt VG_(vsnprintf)( Char* buf, Int size, 
59                                        const HChar *format, va_list vargs )
60                           PRINTF_CHECK(3, 0);
61
62 /* Yet another, totally general, version of vprintf, which hands all
63    output bytes to CHAR_SINK, passing it OPAQUE as the second arg. */
64 extern void VG_(vcbprintf)( void(*char_sink)(HChar, void* opaque),
65                             void* opaque,
66                             const HChar* format, va_list vargs );
67
68 /* These are the same as the non "_xml" versions above, except the
69    output goes on the selected XML output channel instead of the
70    normal one.
71 */
72 extern UInt VG_(printf_xml)  ( const HChar *format, ... )
73                              PRINTF_CHECK(1, 2);
74
75 extern UInt VG_(vprintf_xml) ( const HChar *format, va_list vargs )
76                              PRINTF_CHECK(1, 0);
77
78 extern UInt VG_(printf_xml_no_f_c) ( const HChar *format, ... );
79
80 // Percentify n/m with d decimal places.  Includes the '%' symbol at the end.
81 // Right justifies in 'buf'.
82 extern void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[]);
83
84
85 /* ---------------------------------------------------------------------
86    Messages for the user
87    ------------------------------------------------------------------ */
88
89 /* No, really.  I _am_ that strange. */
90 #define OINK(nnn) VG_(message)(Vg_DebugMsg, "OINK %d\n",nnn)
91
92 /* Print a message prefixed by "??<pid>?? "; '?' depends on the VgMsgKind.
93    Should be used for all user output. */
94
95 typedef
96    enum { Vg_UserMsg,         /* '?' == '=' */
97           Vg_DebugMsg,        /* '?' == '-' */
98           Vg_DebugExtraMsg,   /* '?' == '+' */
99           Vg_ClientMsg        /* '?' == '*' */
100    }
101    VgMsgKind;
102
103 /* Send a single-part message.  The format specification may contain
104    any ISO C format specifier or %t.  No attempt is made to let the
105    compiler verify consistency of the format string and the argument
106    list. */
107 extern UInt VG_(message_no_f_c)( VgMsgKind kind, const HChar* format, ... );
108 /* Send a single-part message.  The format specification may contain
109    any ISO C format specifier. The gcc compiler will verify
110    consistency of the format string and the argument list. */
111 extern UInt VG_(message)( VgMsgKind kind, const HChar* format, ... )
112   PRINTF_CHECK(2, 3);
113
114 extern UInt VG_(vmessage)( VgMsgKind kind, const HChar* format, va_list vargs )
115   PRINTF_CHECK(2, 0);
116
117 // Short-cuts for VG_(message)().
118 extern UInt VG_(umsg)( const HChar* format, ... ) PRINTF_CHECK(1, 2);
119 extern UInt VG_(dmsg)( const HChar* format, ... ) PRINTF_CHECK(1, 2);
120 extern UInt VG_(emsg)( const HChar* format, ... ) PRINTF_CHECK(1, 2);
121
122 /* Flush any output cached by previous calls to VG_(message) et al. */
123 extern void VG_(message_flush) ( void );
124
125 #endif   // __PUB_TOOL_LIBCPRINT_H
126
127 /*--------------------------------------------------------------------*/
128 /*--- end                                                          ---*/
129 /*--------------------------------------------------------------------*/