X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fprintf-args.h;h=e03eb6e78aee67a6edbf60e5568ccce65182cd36;hb=1bb384c44db25aef8f8b455cef22af32d8401abc;hp=74a18d9bf342426fac0d39e7d45ce94d1516d6a6;hpb=ac5d57a6683bc6f146b28d2c84e1fdbf80877e06;p=gnulib.git diff --git a/lib/printf-args.h b/lib/printf-args.h index 74a18d9bf..e03eb6e78 100644 --- a/lib/printf-args.h +++ b/lib/printf-args.h @@ -1,5 +1,6 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2006-2007, 2011 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +19,16 @@ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H +/* This file can be parametrized with the following macros: + ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. + PRINTF_FETCHARGS Name of the function to be declared. + STATIC Set to 'static' to declare the function static. */ + +/* Default parameters. */ +#ifndef PRINTF_FETCHARGS +# define PRINTF_FETCHARGS printf_fetchargs +#endif + /* Get size_t. */ #include @@ -52,9 +63,7 @@ typedef enum TYPE_ULONGLONGINT, #endif TYPE_DOUBLE, -#if HAVE_LONG_DOUBLE TYPE_LONGDOUBLE, -#endif TYPE_CHAR, #if HAVE_WINT_T TYPE_WIDE_CHAR, @@ -71,6 +80,12 @@ typedef enum #if HAVE_LONG_LONG_INT , TYPE_COUNT_LONGLONGINT_POINTER #endif +#if ENABLE_UNISTDIO + /* The unistdio extensions. */ +, TYPE_U8_STRING +, TYPE_U16_STRING +, TYPE_U32_STRING +#endif } arg_type; /* Polymorphic argument */ @@ -79,48 +94,56 @@ typedef struct arg_type type; union { - signed char a_schar; - unsigned char a_uchar; - short a_short; - unsigned short a_ushort; - int a_int; - unsigned int a_uint; - long int a_longint; - unsigned long int a_ulongint; + signed char a_schar; + unsigned char a_uchar; + short a_short; + unsigned short a_ushort; + int a_int; + unsigned int a_uint; + long int a_longint; + unsigned long int a_ulongint; #if HAVE_LONG_LONG_INT - long long int a_longlongint; - unsigned long long int a_ulonglongint; -#endif - float a_float; - double a_double; -#if HAVE_LONG_DOUBLE - long double a_longdouble; + long long int a_longlongint; + unsigned long long int a_ulonglongint; #endif - int a_char; + float a_float; + double a_double; + long double a_longdouble; + int a_char; #if HAVE_WINT_T - wint_t a_wide_char; + wint_t a_wide_char; #endif - const char* a_string; + const char* a_string; #if HAVE_WCHAR_T - const wchar_t* a_wide_string; + const wchar_t* a_wide_string; #endif - void* a_pointer; - signed char * a_count_schar_pointer; - short * a_count_short_pointer; - int * a_count_int_pointer; - long int * a_count_longint_pointer; + void* a_pointer; + signed char * a_count_schar_pointer; + short * a_count_short_pointer; + int * a_count_int_pointer; + long int * a_count_longint_pointer; #if HAVE_LONG_LONG_INT - long long int * a_count_longlongint_pointer; + long long int * a_count_longlongint_pointer; +#endif +#if ENABLE_UNISTDIO + /* The unistdio extensions. */ + const uint8_t * a_u8_string; + const uint16_t * a_u16_string; + const uint32_t * a_u32_string; #endif } a; } argument; +/* Number of directly allocated arguments (no malloc() needed). */ +#define N_DIRECT_ALLOC_ARGUMENTS 7 + typedef struct { size_t count; argument *arg; + argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS]; } arguments; @@ -131,6 +154,6 @@ STATIC #else extern #endif -int printf_fetchargs (va_list args, arguments *a); +int PRINTF_FETCHARGS (va_list args, arguments *a); #endif /* _PRINTF_ARGS_H */