Import (slightly modified) ru.koi8-r.win.kbd:1.1 from FreeBSD (fjoe):
[dragonfly.git] / contrib / cvs-1.12.11 / lib / printf-args.h
1 /* Decomposed printf argument list.
2    Copyright (C) 1999, 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 #ifdef HAVE_WCHAR_T
26 # include <stddef.h>
27 #endif
28
29 /* Get wint_t.  */
30 #ifdef HAVE_WINT_T
31 # include <wchar.h>
32 #endif
33
34 /* Get va_list.  */
35 #include <stdarg.h>
36
37
38 /* Argument types */
39 typedef 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 #ifdef HAVE_LONG_LONG
51   TYPE_LONGLONGINT,
52   TYPE_ULONGLONGINT,
53 #endif
54   TYPE_DOUBLE,
55 #ifdef HAVE_LONG_DOUBLE
56   TYPE_LONGDOUBLE,
57 #endif
58   TYPE_CHAR,
59 #ifdef HAVE_WINT_T
60   TYPE_WIDE_CHAR,
61 #endif
62   TYPE_STRING,
63 #ifdef HAVE_WCHAR_T
64   TYPE_WIDE_STRING,
65 #endif
66   TYPE_POINTER,
67   TYPE_COUNT_SCHAR_POINTER,
68   TYPE_COUNT_SHORT_POINTER,
69   TYPE_COUNT_INT_POINTER,
70   TYPE_COUNT_LONGINT_POINTER
71 #ifdef HAVE_LONG_LONG
72 , TYPE_COUNT_LONGLONGINT_POINTER
73 #endif
74 } arg_type;
75
76 /* Polymorphic argument */
77 typedef struct
78 {
79   arg_type type;
80   union
81   {
82     signed char                 a_schar;
83     unsigned char               a_uchar;
84     short                       a_short;
85     unsigned short              a_ushort;
86     int                         a_int;
87     unsigned int                a_uint;
88     long int                    a_longint;
89     unsigned long int           a_ulongint;
90 #ifdef HAVE_LONG_LONG
91     long long int               a_longlongint;
92     unsigned long long int      a_ulonglongint;
93 #endif
94     float                       a_float;
95     double                      a_double;
96 #ifdef HAVE_LONG_DOUBLE
97     long double                 a_longdouble;
98 #endif
99     int                         a_char;
100 #ifdef HAVE_WINT_T
101     wint_t                      a_wide_char;
102 #endif
103     const char*                 a_string;
104 #ifdef HAVE_WCHAR_T
105     const wchar_t*              a_wide_string;
106 #endif
107     void*                       a_pointer;
108     signed char *               a_count_schar_pointer;
109     short *                     a_count_short_pointer;
110     int *                       a_count_int_pointer;
111     long int *                  a_count_longint_pointer;
112 #ifdef HAVE_LONG_LONG
113     long long int *             a_count_longlongint_pointer;
114 #endif
115   }
116   a;
117 }
118 argument;
119
120 typedef struct
121 {
122   size_t count;
123   argument *arg;
124 }
125 arguments;
126
127
128 /* Fetch the arguments, putting them into a. */
129 #ifdef STATIC
130 STATIC
131 #else
132 extern
133 #endif
134 int printf_fetchargs (va_list args, arguments *a);
135
136 #endif /* _PRINTF_ARGS_H */