libexplain
1.4.D001
|
00001 /* 00002 * libexplain - Explain errno values returned by libc functions 00003 * Copyright (C) 2010, 2013 Peter Miller 00004 * Written by Peter Miller <pmiller@opensource.org.au> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as 00008 * published by the Free Software Foundation; either version 3 of the 00009 * License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #ifndef LIBEXPLAIN_PRINTF_FORMAT_H 00021 #define LIBEXPLAIN_PRINTF_FORMAT_H 00022 00023 #include <libexplain/ac/stddef.h> 00024 00025 #define FLAG_ZERO (1 << 0) 00026 #define FLAG_SPACE (1 << 1) 00027 #define FLAG_HASH (1 << 2) 00028 #define FLAG_PLUS (1 << 3) 00029 #define FLAG_MINUS (1 << 4) 00030 #define FLAG_THOUSANDS (1 << 5) 00031 #define FLAG_I18N (1 << 6) 00032 00033 typedef struct explain_printf_format_t explain_printf_format_t; 00034 struct explain_printf_format_t 00035 { 00036 int index; 00037 unsigned int flags; 00038 int width; 00039 int precision; 00040 unsigned char modifier; 00041 unsigned char specifier; 00042 }; 00043 00044 typedef struct explain_printf_format_list_t explain_printf_format_list_t; 00045 struct explain_printf_format_list_t 00046 { 00047 size_t length; 00048 size_t maximum; 00049 explain_printf_format_t *list; 00050 }; 00051 00059 void explain_printf_format_list_constructor(explain_printf_format_list_t *lp); 00060 00069 void explain_printf_format_list_destructor(explain_printf_format_list_t *lp); 00070 00078 void explain_printf_format_list_clear(explain_printf_format_list_t *lp); 00079 00091 int explain_printf_format_list_append(explain_printf_format_list_t *lp, 00092 const explain_printf_format_t *datum); 00093 00103 void explain_printf_format_list_sort(explain_printf_format_list_t *lp); 00104 00119 size_t explain_printf_format(const char *text, 00120 explain_printf_format_list_t *result); 00121 00122 #include <libexplain/string_buffer.h> 00123 #include <libexplain/ac/stdarg.h> 00124 00138 void explain_printf_format_representation(explain_string_buffer_t *sb, 00139 const char *format, va_list ap); 00140 00141 #endif /* LIBEXPLAIN_PRINTF_FORMAT_H */ 00142 /* vim: set ts=8 sw=4 et : */