From: Michael Beck Date: Mon, 29 Nov 2004 14:15:25 +0000 (+0000) Subject: Improved doxygen docu X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=2a1ac3ef0662b13991af866cfe4bf806d59d62b9;p=libfirm Improved doxygen docu Added Ident and Entity dumpers [r4496] --- diff --git a/ir/ir/irprintf.c b/ir/ir/irprintf.c index 7bbf9cbe7..c7df31081 100644 --- a/ir/ir/irprintf.c +++ b/ir/ir/irprintf.c @@ -1,5 +1,18 @@ +/* + * Project: libFIRM + * File name: ir/ir/irprintf.c + * Purpose: A little printf helper unterstanding firm types + * Author: Sebastian Hack + * Created: 29.11.2004 + * CVS-ID: $Id$ + * Copyright: (c) 1998-2004 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ + /** - * A little printf helper funterstanding firm types. + * @file irprinf.c + * + * A little printf helper unterstanding firm types. * @author Sebastian Hack * @date 29.11.2004 */ @@ -8,15 +21,19 @@ #include #include -#include "irmode.h" -#include "irnode.h" +#include "ident.h" +#include "irmode_t.h" +#include "irnode_t.h" +#include "entity_t.h" #include "tv.h" #include "irprintf.h" #include "pset.h" #include "iterator.h" - +/** + * append a char to a string buffer + */ static void str_append_char(void *object, size_t n, char ch) { char buf[2]; @@ -27,26 +44,41 @@ static void str_append_char(void *object, size_t n, char ch) strncat(object, buf, n); } +/** + * append a string to a string buffer + */ static void str_append_str(void *object, size_t n, const char *str) { strncat(object, str, n); } +/** + * append a char to a file + */ static void file_append_char(void *object, size_t n, char ch) { fputc(ch, object); } +/** + * append a string to a file + */ static void file_append_str(void *object, size_t n, const char *str) { fputs(str, object); } +/** + * the file appender + */ static const appender_t file_appender = { file_append_char, file_append_str }; +/** + * the string buffer appender + */ static const appender_t str_appender = { str_append_char, str_append_str @@ -100,6 +132,18 @@ static void ir_common_vprintf(const appender_t *app, void *object, DUMP_STR(va_arg(args, const char *)); break; + case 'I': + DUMP_STR(get_id_str(va_arg(args, ident *))); + break; + + case 'e': + DUMP_STR(get_entity_name(va_arg(args, entity *))); + break; + + case 'E': + DUMP_STR(get_entity_ldname(va_arg(args, entity *))); + break; + case 'p': snprintf(buf, sizeof(buf), "%p", va_arg(args, void *)); break; diff --git a/ir/ir/irprintf.h b/ir/ir/irprintf.h index 8dbaa2b74..1e1a2f6af 100644 --- a/ir/ir/irprintf.h +++ b/ir/ir/irprintf.h @@ -1,4 +1,17 @@ +/* + * Project: libFIRM + * File name: ir/ir/irprintf.h + * Purpose: A little printf understanding some firm types. + * Author: Sebastian Hack + * Created: 29.11.2004 + * CVS-ID: $Id$ + * Copyright: (c) 1998-2004 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ + /** + * @file irprintf.h + * * A little printf understanding some firm types. * @author Sebastian Hack * @date 29.11.2004 @@ -19,47 +32,51 @@ typedef struct _appender_t { /** * A callback function type to add something to an appender. - * @param app The 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. + * @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 nodes. + * A string formatting routine for ir objects. * This function rudimentarily implements a kind of printf(3) for ir * nodes. Following conversion specifiers. No length, special or field * width specifiers are accepted. - * - %p A pointer. - * - %s A string. - * - %n A full description of a node. - * - %o The opcode name of an ir node. - * - %m The mode name of an ir mode. - * - %N The node number of an ir node. - * - %b The block node number of the nodes block. - * - %t A tarval. + * - @%p A pointer. + * - @%s A string. + * - @%I An ident. + * - @%e An entity name. + * - @%E An entity ld_name. + * - @%n A full description of a node. + * - @%o The opcode name of an ir node. + * - @%m The mode name of an ir mode. + * - @%N The node number of an ir node. + * - @%b The block node number of the nodes block. + * - @%t A tarval. * * Each of these can be prepended 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 + * case you also have to pass an iterator interface to ir_printf() * suitable for the instance of the collection. So, imagine you have a - * pset of ir_nodes and want to dump it, you write: - * + * @c pset of ir_nodes and want to dump it, you write: + * @code * pset *nodes; * ... * ir_printf("Some nodes: %+n\n", it_pset, nodes); - * - * The it_pset is an iterator interface (of type - * iterator_t that allows the dumper to traverse the set. + * @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 datatype - * xyz_t and want to dump a pset of it, you have: - * + * @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) * { @@ -70,7 +87,7 @@ 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); - * + * @endcode * * @param fmt The format string. */