1 /* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
29 #define __need_wchar_t
35 int prec
; /* Precision. */
36 int width
; /* Width. */
37 wchar_t spec
; /* Format letter. */
38 unsigned int is_long_double
:1;/* L flag. */
39 unsigned int is_short
:1; /* h flag. */
40 unsigned int is_long
:1; /* l flag. */
41 unsigned int alt
:1; /* # flag. */
42 unsigned int space
:1; /* Space flag. */
43 unsigned int left
:1; /* - flag. */
44 unsigned int showsign
:1; /* + flag. */
45 unsigned int group
:1; /* ' flag. */
46 unsigned int extra
:1; /* For special use. */
47 char pad
; /* Padding character. */
51 /* Type of a printf specifier-handler function.
52 STREAM is the FILE on which to write output.
53 INFO gives information about the format specification.
54 ARGS is a vector of pointers to the argument data;
55 the number of pointers will be the number returned
56 by the associated arginfo function for the same INFO.
58 The function should return the number of characters written,
61 typedef int printf_function
__P ((FILE *__stream
,
62 __const
struct printf_info
*__info
,
63 __const
void *__const
*__args
));
65 /* Type of a printf specifier-arginfo function.
66 INFO gives information about the format specification.
67 N, ARGTYPES, and return value are as for printf_parse_format. */
69 typedef int printf_arginfo_function
__P ((__const
struct printf_info
* __info
,
74 /* Register FUNC to be called to format SPEC specifiers; ARGINFO must be
75 specified to determine how many arguments a SPEC conversion requires and
76 what their types are, even if your program never calls
77 `parse_printf_format'. */
79 extern int register_printf_function
__P ((int __spec
, printf_function __func
,
80 printf_arginfo_function __arginfo
));
83 /* Parse FMT, and fill in N elements of ARGTYPES with the
84 types needed for the conversions FMT specifies. Returns
85 the number of arguments required by FMT.
87 The ARGINFO function registered with a user-defined format is passed a
88 `struct printf_info' describing the format spec being parsed. A width
89 or precision of INT_MIN means a `*' was used to indicate that the
90 width/precision will come from an arg. The function should fill in the
91 array it is passed with the types of the arguments it wants, and return
92 the number of arguments it wants. */
94 extern size_t parse_printf_format
__P ((__const
char *__fmt
,
99 /* Codes returned by `parse_printf_format' for basic types.
101 These values cover all the standard format specifications.
102 Users can add new values after PA_LAST for their own types. */
107 PA_CHAR
, /* int, cast to char */
108 PA_STRING
, /* const char *, a '\0'-terminated string */
109 PA_POINTER
, /* void * */
110 PA_FLOAT
, /* float */
111 PA_DOUBLE
, /* double */
115 /* Flag bits that can be set in a type returned by `parse_printf_format'. */
116 #define PA_FLAG_MASK 0xff00
117 #define PA_FLAG_LONG_LONG (1 << 8)
118 #define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
119 #define PA_FLAG_LONG (1 << 9)
120 #define PA_FLAG_SHORT (1 << 10)
121 #define PA_FLAG_PTR (1 << 11)
126 #endif /* printf.h */