1/* Decomposed printf argument list. 2 Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with this program; if not, write to the Free Software Foundation, 16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 17 18#ifndef _PRINTF_ARGS_H 19#define _PRINTF_ARGS_H 20 21/* Get size_t. */ 22#include <stddef.h> 23 24/* Get wchar_t. */ 25#if HAVE_WCHAR_T 26# include <stddef.h> 27#endif 28 29/* Get wint_t. */ 30#if HAVE_WINT_T 31# include <wchar.h> 32#endif 33 34/* Get va_list. */ 35#include <stdarg.h> 36 37 38/* Argument types */ 39typedef enum 40{ 41 TYPE_NONE, 42 TYPE_SCHAR, 43 TYPE_UCHAR, 44 TYPE_SHORT, 45 TYPE_USHORT, 46 TYPE_INT, 47 TYPE_UINT, 48 TYPE_LONGINT, 49 TYPE_ULONGINT, 50#if HAVE_LONG_LONG_INT 51 TYPE_LONGLONGINT, 52 TYPE_ULONGLONGINT, 53#endif 54 TYPE_DOUBLE, 55 TYPE_LONGDOUBLE, 56 TYPE_CHAR, 57#if HAVE_WINT_T 58 TYPE_WIDE_CHAR, 59#endif 60 TYPE_STRING, 61#if HAVE_WCHAR_T 62 TYPE_WIDE_STRING, 63#endif 64 TYPE_POINTER, 65 TYPE_COUNT_SCHAR_POINTER, 66 TYPE_COUNT_SHORT_POINTER, 67 TYPE_COUNT_INT_POINTER, 68 TYPE_COUNT_LONGINT_POINTER 69#if HAVE_LONG_LONG_INT 70, TYPE_COUNT_LONGLONGINT_POINTER 71#endif 72} arg_type; 73 74/* Polymorphic argument */ 75typedef struct 76{ 77 arg_type type; 78 union 79 { 80 signed char a_schar; 81 unsigned char a_uchar; 82 short a_short; 83 unsigned short a_ushort; 84 int a_int; 85 unsigned int a_uint; 86 long int a_longint; 87 unsigned long int a_ulongint; 88#if HAVE_LONG_LONG_INT 89 long long int a_longlongint; 90 unsigned long long int a_ulonglongint; 91#endif 92 float a_float; 93 double a_double; 94 long double a_longdouble; 95 int a_char; 96#if HAVE_WINT_T 97 wint_t a_wide_char; 98#endif 99 const char* a_string; 100#if HAVE_WCHAR_T 101 const wchar_t* a_wide_string; 102#endif 103 void* a_pointer; 104 signed char * a_count_schar_pointer; 105 short * a_count_short_pointer; 106 int * a_count_int_pointer; 107 long int * a_count_longint_pointer; 108#if HAVE_LONG_LONG_INT 109 long long int * a_count_longlongint_pointer; 110#endif 111 } 112 a; 113} 114argument; 115 116typedef struct 117{ 118 size_t count; 119 argument *arg; 120} 121arguments; 122 123 124/* Fetch the arguments, putting them into a. */ 125#ifdef STATIC 126STATIC 127#else 128extern 129#endif 130int printf_fetchargs (va_list args, arguments *a); 131 132#endif /* _PRINTF_ARGS_H */ 133