(__get_nprocs): Use /sys filesystem to determine which processors are online.
[glibc.git] / stdio-common / printf-parse.h
blobaa49c7a642272af38836d1358cd51cf307503594
1 /* Internal header for parsing printf format strings.
2 Copyright (C) 1995-1999, 2000, 2002, 2003 Free Software Foundation, Inc.
3 This file is part of th GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #include <printf.h>
21 #include <stdint.h>
22 #include <stddef.h>
25 struct printf_spec
27 /* Information parsed from the format spec. */
28 struct printf_info info;
30 /* Pointers into the format string for the end of this format
31 spec and the next (or to the end of the string if no more). */
32 const UCHAR_T *end_of_fmt, *next_fmt;
34 /* Position of arguments for precision and width, or -1 if `info' has
35 the constant value. */
36 int prec_arg, width_arg;
38 int data_arg; /* Position of data argument. */
39 int data_arg_type; /* Type of first argument. */
40 /* Number of arguments consumed by this format specifier. */
41 size_t ndata_args;
45 /* The various kinds off arguments that can be passed to printf. */
46 union printf_arg
48 wchar_t pa_wchar;
49 int pa_int;
50 long int pa_long_int;
51 long long int pa_long_long_int;
52 unsigned int pa_u_int;
53 unsigned long int pa_u_long_int;
54 unsigned long long int pa_u_long_long_int;
55 double pa_double;
56 long double pa_long_double;
57 const char *pa_string;
58 const wchar_t *pa_wstring;
59 void *pa_pointer;
63 #ifndef DONT_NEED_READ_INT
64 /* Read a simple integer from a string and update the string pointer.
65 It is assumed that the first character is a digit. */
66 static unsigned int
67 read_int (const UCHAR_T * *pstr)
69 unsigned int retval = **pstr - L_('0');
71 while (ISDIGIT (*++(*pstr)))
73 retval *= 10;
74 retval += **pstr - L_('0');
77 return retval;
79 #endif
82 /* These are defined in reg-printf.c. */
83 extern printf_arginfo_function **__printf_arginfo_table attribute_hidden;
84 extern printf_function **__printf_function_table attribute_hidden;
87 /* Find the next spec in FORMAT, or the end of the string. Returns
88 a pointer into FORMAT, to a '%' or a '\0'. */
89 extern const unsigned char *__find_specmb (const UCHAR_T *format,
90 mbstate_t *ps) attribute_hidden;
92 extern const unsigned int *__find_specwc (const UCHAR_T *format)
93 attribute_hidden;
96 /* FORMAT must point to a '%' at the beginning of a spec. Fills in *SPEC
97 with the parsed details. POSN is the number of arguments already
98 consumed. At most MAXTYPES - POSN types are filled in TYPES. Return
99 the number of args consumed by this spec; *MAX_REF_ARG is updated so it
100 remains the highest argument index used. */
101 extern size_t __parse_one_specmb (const unsigned char *format, size_t posn,
102 struct printf_spec *spec,
103 size_t *max_ref_arg, mbstate_t *ps)
104 attribute_hidden;
106 extern size_t __parse_one_specwc (const unsigned int *format, size_t posn,
107 struct printf_spec *spec,
108 size_t *max_ref_arg) attribute_hidden;