X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=include%2Flibfirm%2Firprintf.h;h=676018a1cb9e16ba280f8856634cba0c82cd2c97;hb=86bf49fa21cc460fcb4e5962308dcb6eac08e293;hp=7103587ee746cdc3aa9d03925249cca1d0d92237;hpb=972eca70744a2c9a0e0d472db4f62250cdeee01c;p=libfirm diff --git a/include/libfirm/irprintf.h b/include/libfirm/irprintf.h index 7103587ee..676018a1c 100644 --- a/include/libfirm/irprintf.h +++ b/include/libfirm/irprintf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -22,7 +22,6 @@ * @brief A little printf understanding some firm types. * @author Sebastian Hack * @date 29.11.2004 - * @version $Id$ */ #ifndef FIRM_IR_IRPRINTF_H #define FIRM_IR_IRPRINTF_H @@ -30,46 +29,18 @@ #include #include #include +#include "begin.h" /* 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; - -/** - * A callback function type to add something to an appender. - * - * @param app The appender. - * @param object The object for the appender. - * @param limit The limit for the appender. - * @param arg The thing to append. - */ -typedef void (ir_printf_cb_t)(const appender_t *app, void *object, size_t limit, const void *arg); - /** * A string formatting routine for ir objects. * * @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. - * - @%% 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. + * nodes and adds the following additional conversion specifiers. * - @%t A type name. * - @%e An entity name. * - @%E An entity ld name. @@ -79,73 +50,50 @@ typedef void (ir_printf_cb_t)(const appender_t *app, void *object, size_t limit, * - @%N The node number of an ir node. * - @%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 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 - * @c pset of ir_nodes and want to dump it, you write: - * @code - * 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. - * - * As special case when working with collections, you can also give a - * 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 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, - * const void *arg) - * { - * const xyz_t *xyz = arg; - * app->append_str(object, limit, xyz->name); - * } - * ... - * pset *xyzs; + * - @%P A compound graph path. + * - @%I An ident. + * - @%D Print as many white spaces as given in the parameter. + * - @%G A debug info (if available) from the given ir node. + * - @%B A bitset. + * - @%F A Firm object (automatically detected). * - * ir_printf("A set of xyz\'s: %*C\n", it_pset, xyzs, xyz_dump); - * @endcode + * Note that some of the standard format capabilities are not available + * due to this new conversion specifiers, use lc_printf() if needed. */ -void ir_printf(const char *fmt, ...); +FIRM_API void ir_printf(const char *fmt, ...); /** - * @see irn_printf. + * @see ir_printf. */ -void ir_fprintf(FILE *f, const char *fmt, ...); +FIRM_API void ir_fprintf(FILE *f, const char *fmt, ...); /** - * @see irn_printf. + * @see ir_printf. */ -void ir_snprintf(char *buf, size_t n, const char *fmt, ...); +FIRM_API void ir_snprintf(char *buf, size_t n, const char *fmt, ...); /** - * @see irn_printf. + * @see ir_printf. */ -void ir_vprintf(const char *fmt, va_list args); +FIRM_API void ir_vprintf(const char *fmt, va_list args); /** - * @see irn_printf. + * @see ir_printf. */ -void ir_vfprintf(FILE *f, const char *fmt, va_list args); +FIRM_API void ir_vfprintf(FILE *f, const char *fmt, va_list args); /** - * @see irn_printf. + * @see ir_printf. */ -void ir_vsnprintf(char *buf, size_t len, const char *fmt, va_list args); +FIRM_API void ir_vsnprintf(char *buf, size_t len, const char *fmt, + va_list args); /** - * @see irn_printf. + * @see ir_printf. */ -void ir_obst_vprintf(struct obstack *obst, const char *fmt, va_list args); +FIRM_API void ir_obst_vprintf(struct obstack *obst, const char *fmt, + va_list args); + +#include "end.h" #endif