properly mark symbols in the public API to be exported. This allows us to use -fvisib...
[libfirm] / include / libfirm / irprintf.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    A little printf understanding some firm types.
23  * @author   Sebastian Hack
24  * @date     29.11.2004
25  * @version  $Id$
26  */
27 #ifndef FIRM_IR_IRPRINTF_H
28 #define FIRM_IR_IRPRINTF_H
29
30 #include <stddef.h>
31 #include <stdarg.h>
32 #include <stdio.h>
33 #include "begin.h"
34
35 /* forward definition */
36 struct obstack;
37
38 /**
39  * A string formatting routine for ir objects.
40  *
41  * @param fmt  The format string.
42  *
43  * This function rudimentary implements a kind of printf(3) for ir
44  * nodes. Following conversion specifiers. No length, special or field
45  * width specifiers are accepted.
46  * - @%% Print a '%' character.
47  * - @%> Print as many white spaces as given in the parameter.
48  * - @%c Print a character
49  * - @%s A string.
50  * - @%p A pointer.
51  * - @%d A decimal integer.
52  * - @%x A hexadecimal integer.
53  * - @%o An octal integer.
54  * - @%I An ident.
55  * - @%t A type name.
56  * - @%e An entity name.
57  * - @%E An entity ld name.
58  * - @%T A tarval.
59  * - @%n A full description of a node.
60  * - @%O The opcode name of an ir node.
61  * - @%N The node number of an ir node.
62  * - @%m The mode name of an ir mode.
63  * - @%B The block node number of the nodes block.
64  * - @%b A bitset.
65  * - @%= A pnc value
66  * - @%G A debug info (if available)
67  * - @%P A compound graph path
68  *
69  * Each of these can be prepend by a '+' which means, that the given
70  * pointer is a collection of items specified by the format. In this
71  * case you also have to pass an iterator interface to ir_printf()
72  * suitable for the instance of the collection. So, imagine you have a
73  * @c pset of ir_nodes and want to dump it, you write:
74  * @code
75  *   pset *nodes;
76  *   ...
77  *   ir_printf("Some nodes: %*n\n", it_pset, nodes);
78  * @endcode
79  * The @c it_pset is an iterator interface (of type
80  * @c iterator_t that allows the dumper to traverse the set.
81  */
82 FIRM_DLL void ir_printf(const char *fmt, ...);
83
84 /**
85  * @see irn_printf.
86  */
87 FIRM_DLL void ir_fprintf(FILE *f, const char *fmt, ...);
88
89 /**
90  * @see irn_printf.
91  */
92 FIRM_DLL void ir_snprintf(char *buf, size_t n, const char *fmt, ...);
93
94 /**
95  * @see irn_printf.
96  */
97 FIRM_DLL void ir_vprintf(const char *fmt, va_list args);
98
99 /**
100  * @see irn_printf.
101  */
102 FIRM_DLL void ir_vfprintf(FILE *f, const char *fmt, va_list args);
103
104 /**
105  * @see irn_printf.
106  */
107 FIRM_DLL void ir_vsnprintf(char *buf, size_t len, const char *fmt,
108                            va_list args);
109
110 /**
111  * @see irn_printf.
112  */
113 FIRM_DLL void ir_obst_vprintf(struct obstack *obst, const char *fmt,
114                               va_list args);
115
116 #include "end.h"
117
118 #endif