X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firprintf.h;h=1b40e25ff59fa991c31d6c6a2bfbdfa1be9cbc7e;hb=23ea16875f38dc0c067cce24f64b5c70f3acc496;hp=7945546595499cbe2f4c86f844a3d11bf2cc9542;hpb=e086d97bdb7d5c48130ea6a2641f51408dd8accd;p=libfirm diff --git a/ir/ir/irprintf.h b/ir/ir/irprintf.h index 794554659..1b40e25ff 100644 --- a/ir/ir/irprintf.h +++ b/ir/ir/irprintf.h @@ -16,17 +16,23 @@ * @author Sebastian Hack * @date 29.11.2004 */ +#ifndef _FIRM_IR_IRPRINTF_H_ +#define _FIRM_IR_IRPRINTF_H_ -#ifndef _IRPRINTF_H -#define _IRPRINTF_H +#include "firm_config.h" #include +#include #include +/* forward definition */ +struct obstack; + /** * Something that can append strings and chars to something. */ typedef struct _appender_t { + void (*init)(void *object, size_t n); void (*append_char)(void *object, size_t n, char ch); void (*append_str)(void *object, size_t n, const char *str); } appender_t; @@ -43,22 +49,36 @@ typedef void (ir_printf_cb_t)(const appender_t *app, void *object, size_t limit, /** * A string formatting routine for ir objects. - * This function rudimentarily implements a kind of printf(3) for ir + * + * @param fmt The format string. + * + * This function rudimentary implements a kind of printf(3) for ir * nodes. Following conversion specifiers. No length, special or field * width specifiers are accepted. - * - @%p A pointer. + * - @%% Print a '%' character. + * - @%> Print as many white spaces as given in the parameter. + * - @%c Print a character * - @%s A string. + * - @%p A pointer. + * - @%d A decimal integer. + * - @%x A hexadecimal integer. + * - @%o An octal integer. * - @%I An ident. + * - @%t A type name. * - @%e An entity name. - * - @%E An entity ld_name. + * - @%E An entity ld name. + * - @%T A tarval. * - @%n A full description of a node. - * - @%o The opcode name of an ir node. - * - @%m The mode name of an ir mode. + * - @%O The opcode name of an ir node. * - @%N The node number of an ir node. - * - @%b The block node number of the nodes block. - * - @%t A tarval. + * - @%m The mode name of an ir mode. + * - @%B The block node number of the nodes block. + * - @%b A bitset. + * - @%= A pnc value + * - @%G A debug info (if available) + * - @%P A compound graph path * - * Each of these can be prepended by a '+' which means, that the given + * Each of these can be prepend by a '+' which means, that the given * pointer is a collection of items specified by the format. In this * case you also have to pass an iterator interface to ir_printf() * suitable for the instance of the collection. So, imagine you have a @@ -66,7 +86,7 @@ typedef void (ir_printf_cb_t)(const appender_t *app, void *object, size_t limit, * @code * pset *nodes; * ... - * ir_printf("Some nodes: %+n\n", it_pset, nodes); + * ir_printf("Some nodes: %*n\n", it_pset, nodes); * @endcode * The @c it_pset is an iterator interface (of type * @c iterator_t that allows the dumper to traverse the set. @@ -75,7 +95,7 @@ typedef void (ir_printf_cb_t)(const appender_t *app, void *object, size_t limit, * callback function which will be invoked on each element in the * collection. It gets the appender (the thing where the textual * representation of the element is written to) and its parameters - * passed by the dumping function. Suppose you have your own datatype + * passed by the dumping function. Suppose you have your own data type * @c xyz_t and want to dump a pset of it, you have: * @code * void xyz_dump(const appender_t *app, void *object, size_t limit, @@ -87,10 +107,8 @@ typedef void (ir_printf_cb_t)(const appender_t *app, void *object, size_t limit, * ... * pset *xyzs; * - * ir_printf("A set of xyz\'s: %+C\n", it_pset, xyzs, xyz_dump); + * ir_printf("A set of xyz\'s: %*C\n", it_pset, xyzs, xyz_dump); * @endcode - * - * @param fmt The format string. */ void ir_printf(const char *fmt, ...); @@ -104,5 +122,28 @@ void ir_fprintf(FILE *f, const char *fmt, ...); */ void ir_snprintf(char *buf, size_t n, const char *fmt, ...); +/** + * @see irn_printf. + */ +void ir_vprintf(const char *fmt, va_list args); + +/** + * @see irn_printf. + */ +void ir_vfprintf(FILE *f, const char *fmt, va_list args); + +/** + * @see irn_printf. + */ +void ir_vsnprintf(char *buf, size_t len, const char *fmt, va_list args); + +/** + * @see irn_printf. + */ +void ir_obst_vprintf(struct obstack *obst, const char *fmt, va_list args); + +#ifdef WITH_LIBCORE +#include +#endif /* WITH_LIBCORE */ -#endif +#endif /* _FIRM_IR_IRPRINTF_H_ */