diff options
Diffstat (limited to 'gl/printf-args.h')
-rw-r--r-- | gl/printf-args.h | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/gl/printf-args.h b/gl/printf-args.h index 5759da0e..67cb990c 100644 --- a/gl/printf-args.h +++ b/gl/printf-args.h | |||
@@ -1,9 +1,9 @@ | |||
1 | /* Decomposed printf argument list. | 1 | /* Decomposed printf argument list. |
2 | Copyright (C) 1999, 2002-2003, 2006 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 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 | 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) | 6 | the Free Software Foundation; either version 3, or (at your option) |
7 | any later version. | 7 | any later version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, | 9 | This program is distributed in the hope that it will be useful, |
@@ -18,16 +18,26 @@ | |||
18 | #ifndef _PRINTF_ARGS_H | 18 | #ifndef _PRINTF_ARGS_H |
19 | #define _PRINTF_ARGS_H | 19 | #define _PRINTF_ARGS_H |
20 | 20 | ||
21 | /* This file can be parametrized with the following macros: | ||
22 | ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. | ||
23 | PRINTF_FETCHARGS Name of the function to be declared. | ||
24 | STATIC Set to 'static' to declare the function static. */ | ||
25 | |||
26 | /* Default parameters. */ | ||
27 | #ifndef PRINTF_FETCHARGS | ||
28 | # define PRINTF_FETCHARGS printf_fetchargs | ||
29 | #endif | ||
30 | |||
21 | /* Get size_t. */ | 31 | /* Get size_t. */ |
22 | #include <stddef.h> | 32 | #include <stddef.h> |
23 | 33 | ||
24 | /* Get wchar_t. */ | 34 | /* Get wchar_t. */ |
25 | #ifdef HAVE_WCHAR_T | 35 | #if HAVE_WCHAR_T |
26 | # include <stddef.h> | 36 | # include <stddef.h> |
27 | #endif | 37 | #endif |
28 | 38 | ||
29 | /* Get wint_t. */ | 39 | /* Get wint_t. */ |
30 | #ifdef HAVE_WINT_T | 40 | #if HAVE_WINT_T |
31 | # include <wchar.h> | 41 | # include <wchar.h> |
32 | #endif | 42 | #endif |
33 | 43 | ||
@@ -47,20 +57,18 @@ typedef enum | |||
47 | TYPE_UINT, | 57 | TYPE_UINT, |
48 | TYPE_LONGINT, | 58 | TYPE_LONGINT, |
49 | TYPE_ULONGINT, | 59 | TYPE_ULONGINT, |
50 | #ifdef HAVE_LONG_LONG_INT | 60 | #if HAVE_LONG_LONG_INT |
51 | TYPE_LONGLONGINT, | 61 | TYPE_LONGLONGINT, |
52 | TYPE_ULONGLONGINT, | 62 | TYPE_ULONGLONGINT, |
53 | #endif | 63 | #endif |
54 | TYPE_DOUBLE, | 64 | TYPE_DOUBLE, |
55 | #ifdef HAVE_LONG_DOUBLE | ||
56 | TYPE_LONGDOUBLE, | 65 | TYPE_LONGDOUBLE, |
57 | #endif | ||
58 | TYPE_CHAR, | 66 | TYPE_CHAR, |
59 | #ifdef HAVE_WINT_T | 67 | #if HAVE_WINT_T |
60 | TYPE_WIDE_CHAR, | 68 | TYPE_WIDE_CHAR, |
61 | #endif | 69 | #endif |
62 | TYPE_STRING, | 70 | TYPE_STRING, |
63 | #ifdef HAVE_WCHAR_T | 71 | #if HAVE_WCHAR_T |
64 | TYPE_WIDE_STRING, | 72 | TYPE_WIDE_STRING, |
65 | #endif | 73 | #endif |
66 | TYPE_POINTER, | 74 | TYPE_POINTER, |
@@ -68,9 +76,15 @@ typedef enum | |||
68 | TYPE_COUNT_SHORT_POINTER, | 76 | TYPE_COUNT_SHORT_POINTER, |
69 | TYPE_COUNT_INT_POINTER, | 77 | TYPE_COUNT_INT_POINTER, |
70 | TYPE_COUNT_LONGINT_POINTER | 78 | TYPE_COUNT_LONGINT_POINTER |
71 | #ifdef HAVE_LONG_LONG_INT | 79 | #if HAVE_LONG_LONG_INT |
72 | , TYPE_COUNT_LONGLONGINT_POINTER | 80 | , TYPE_COUNT_LONGLONGINT_POINTER |
73 | #endif | 81 | #endif |
82 | #if ENABLE_UNISTDIO | ||
83 | /* The unistdio extensions. */ | ||
84 | , TYPE_U8_STRING | ||
85 | , TYPE_U16_STRING | ||
86 | , TYPE_U32_STRING | ||
87 | #endif | ||
74 | } arg_type; | 88 | } arg_type; |
75 | 89 | ||
76 | /* Polymorphic argument */ | 90 | /* Polymorphic argument */ |
@@ -87,21 +101,19 @@ typedef struct | |||
87 | unsigned int a_uint; | 101 | unsigned int a_uint; |
88 | long int a_longint; | 102 | long int a_longint; |
89 | unsigned long int a_ulongint; | 103 | unsigned long int a_ulongint; |
90 | #ifdef HAVE_LONG_LONG_INT | 104 | #if HAVE_LONG_LONG_INT |
91 | long long int a_longlongint; | 105 | long long int a_longlongint; |
92 | unsigned long long int a_ulonglongint; | 106 | unsigned long long int a_ulonglongint; |
93 | #endif | 107 | #endif |
94 | float a_float; | 108 | float a_float; |
95 | double a_double; | 109 | double a_double; |
96 | #ifdef HAVE_LONG_DOUBLE | ||
97 | long double a_longdouble; | 110 | long double a_longdouble; |
98 | #endif | ||
99 | int a_char; | 111 | int a_char; |
100 | #ifdef HAVE_WINT_T | 112 | #if HAVE_WINT_T |
101 | wint_t a_wide_char; | 113 | wint_t a_wide_char; |
102 | #endif | 114 | #endif |
103 | const char* a_string; | 115 | const char* a_string; |
104 | #ifdef HAVE_WCHAR_T | 116 | #if HAVE_WCHAR_T |
105 | const wchar_t* a_wide_string; | 117 | const wchar_t* a_wide_string; |
106 | #endif | 118 | #endif |
107 | void* a_pointer; | 119 | void* a_pointer; |
@@ -109,9 +121,15 @@ typedef struct | |||
109 | short * a_count_short_pointer; | 121 | short * a_count_short_pointer; |
110 | int * a_count_int_pointer; | 122 | int * a_count_int_pointer; |
111 | long int * a_count_longint_pointer; | 123 | long int * a_count_longint_pointer; |
112 | #ifdef HAVE_LONG_LONG_INT | 124 | #if HAVE_LONG_LONG_INT |
113 | long long int * a_count_longlongint_pointer; | 125 | long long int * a_count_longlongint_pointer; |
114 | #endif | 126 | #endif |
127 | #if ENABLE_UNISTDIO | ||
128 | /* The unistdio extensions. */ | ||
129 | const uint8_t * a_u8_string; | ||
130 | const uint16_t * a_u16_string; | ||
131 | const uint32_t * a_u32_string; | ||
132 | #endif | ||
115 | } | 133 | } |
116 | a; | 134 | a; |
117 | } | 135 | } |
@@ -131,6 +149,6 @@ STATIC | |||
131 | #else | 149 | #else |
132 | extern | 150 | extern |
133 | #endif | 151 | #endif |
134 | int printf_fetchargs (va_list args, arguments *a); | 152 | int PRINTF_FETCHARGS (va_list args, arguments *a); |
135 | 153 | ||
136 | #endif /* _PRINTF_ARGS_H */ | 154 | #endif /* _PRINTF_ARGS_H */ |