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