X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Flibcore%2Flc_printf.h;h=c6e79099d4ddb622530cec16ddf852cb5acd0aff;hb=d2b8adc12afc99ec5f04d530638803356f8be9f6;hp=621f2ba5cc51ff636cdd194102aec9eaed7c12d8;hpb=de1b0c8d4f653f534a38740ad7f6803d82f2762e;p=libfirm diff --git a/ir/libcore/lc_printf.h b/ir/libcore/lc_printf.h index 621f2ba5c..c6e79099d 100644 --- a/ir/libcore/lc_printf.h +++ b/ir/libcore/lc_printf.h @@ -1,64 +1,45 @@ /* - libcore: library for basic data structures and algorithms. - Copyright (C) 2005 IPD Goos, Universit"at Karlsruhe, Germany - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - + * This file is part of libFirm. + * Copyright (C) 2012 IPD Goos, Universit"at Karlsruhe, Germany + */ /** * Flexible printf(). * @author Sebastian Hack * @date 3.1.2005 */ - -#ifndef _LIBCORE_XPRINTF_H -#define _LIBCORE_XPRINTF_H - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef _LIBCORE_LC_PRINTF_H +#define _LIBCORE_LC_PRINTF_H #include #include #include +#include #include -#include -#include - -typedef struct _lc_arg_occ_t { - int width; /**< The width, or 0 if not given. */ - int precision; /**< The precision, or 0 if not given */ - - const char *modifier; /**< A string of of modifiers preceding the - conversion specifier. Attention: This string is not - zero terminated. Use @c modifier_length to get the - number of valid chars in it. */ - size_t modifier_length; /**< The number of valid chars in @c modifier. */ - char conversion; /**< The conversion specifier. */ - int lc_arg_type; /**< The type of the argument as determined by the - @c get_lc_arg_type member function of the handler. */ - - unsigned flag_hash : 1; /**< @c # flag was seen. */ - unsigned flag_zero : 1; /**< @c 0 flag was seen. */ - unsigned flag_minus : 1; /**< @c - flag was seen. */ - unsigned flag_plus : 1; /**< @c + flag was seen. */ - unsigned flag_space : 1; /**< A space flag was seen. */ +#include "lc_appendable.h" + +typedef struct lc_arg_occ_t { + int width; /**< The width, or 0 if not given. */ + int precision; /**< The precision, or 0 if not given */ + + const char *modifier; /**< A string of of modifiers preceding the + conversion specifier. Attention: This string + is not zero terminated. Use + @c modifier_length to get the number of + valid chars in it. */ + size_t modifier_length; /**< The number of valid chars in @c modifier. */ + char conversion; /**< The conversion specifier. */ + int lc_arg_type; /**< The type of the argument as determined by + the @c get_lc_arg_type member function of + the handler. */ + + unsigned flag_hash : 1; /**< @c # flag was seen. */ + unsigned flag_zero : 1; /**< @c 0 flag was seen. */ + unsigned flag_minus : 1; /**< @c - flag was seen. */ + unsigned flag_plus : 1; /**< @c + flag was seen. */ + unsigned flag_space : 1; /**< A space flag was seen. */ } lc_arg_occ_t; /** @@ -67,24 +48,24 @@ typedef struct _lc_arg_occ_t { * @c ARG_TYPE macro is the name of the union member preceded by $c v_ */ typedef union { -#define LC_ARG_TYPE(type,name) type v_ ## name; +#define LC_ARG_TYPE(type,name,va_type) type v_ ## name; #include "lc_printf_arg_types.def" #undef LC_ARG_TYPE } lc_arg_value_t; enum { -#define LC_ARG_TYPE(type,name) lc_arg_type_ ## name, +#define LC_ARG_TYPE(type,name,va_type) lc_arg_type_ ## name, #include "lc_printf_arg_types.def" #undef LC_ARG_TYPE lc_arg_type_last }; -typedef struct _lc_arg_handler { +typedef struct lc_arg_handler { int (*get_lc_arg_type)(const lc_arg_occ_t *occ); int (*emit)(lc_appendable_t *app, const lc_arg_occ_t *occ, const lc_arg_value_t *arg); } lc_arg_handler_t; -typedef struct _lc_arg_env_t lc_arg_env_t; +typedef struct lc_arg_env_t lc_arg_env_t; lc_arg_env_t *lc_arg_new_env(void); void lc_arg_free_env(lc_arg_env_t *env); @@ -122,9 +103,4 @@ int lc_vsnprintf(char *buf, size_t len, const char *fmt, va_list args); int lc_vfprintf(FILE *f, const char *fmt, va_list args); int lc_voprintf(struct obstack *obst, const char *fmt, va_list args); -#ifdef __cplusplus -} #endif - - -#endif /* _LIBCORE_XPRINTF_H */