Dr Andrew Scott G7VAV

My photo
 
April 2024
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12


printf.h
001: /* Copyright (C) 1991-1993,1995-2001,2006,2009
002:         Free Software Foundation, Inc.
003:    This file is part of the GNU C Library.
004: 
005:    The GNU C Library is free software; you can redistribute it and/or
006:    modify it under the terms of the GNU Lesser General Public
007:    License as published by the Free Software Foundation; either
008:    version 2.1 of the License, or (at your option) any later version.
009: 
010:    The GNU C Library is distributed in the hope that it will be useful,
011:    but WITHOUT ANY WARRANTY; without even the implied warranty of
012:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:    Lesser General Public License for more details.
014: 
015:    You should have received a copy of the GNU Lesser General Public
016:    License along with the GNU C Library; if not, write to the Free
017:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
018:    02111-1307 USA.  */
019: 
020: #ifndef _PRINTF_H
021: 
022: #define _PRINTF_H       1
023: #include <features.h>
024: 
025: __BEGIN_DECLS
026: 
027: #define __need_FILE
028: #include <stdio.h>
029: #define __need_size_t
030: #define __need_wchar_t
031: #include <stddef.h>
032: #include <stdarg.h>
033: 
034: 
035: struct printf_info
036: {
037:   int prec;                     /* Precision.  */
038:   int width;                    /* Width.  */
039:   wchar_t spec;                 /* Format letter.  */
040:   unsigned int is_long_double:1;/* L flag.  */
041:   unsigned int is_short:1;      /* h flag.  */
042:   unsigned int is_long:1;       /* l flag.  */
043:   unsigned int alt:1;           /* # flag.  */
044:   unsigned int space:1;         /* Space flag.  */
045:   unsigned int left:1;          /* - flag.  */
046:   unsigned int showsign:1;      /* + flag.  */
047:   unsigned int group:1;         /* ' flag.  */
048:   unsigned int extra:1;         /* For special use.  */
049:   unsigned int is_char:1;       /* hh flag.  */
050:   unsigned int wide:1;          /* Nonzero for wide character streams.  */
051:   unsigned int i18n:1;          /* I flag.  */
052:   unsigned int __pad:4;         /* Unused so far.  */
053:   unsigned short int user;      /* Bits for user-installed modifiers.  */
054:   wchar_t pad;                  /* Padding character.  */
055: };
056: 
057: 
058: /* Type of a printf specifier-handler function.
059:    STREAM is the FILE on which to write output.
060:    INFO gives information about the format specification.
061:    ARGS is a vector of pointers to the argument data;
062:    the number of pointers will be the number returned
063:    by the associated arginfo function for the same INFO.
064: 
065:    The function should return the number of characters written,
066:    or -1 for errors.  */
067: 
068: typedef int printf_function (FILE *__stream,
069:                              __const struct printf_info *__info,
070:                              __const void *__const *__args);
071: 
072: /* Type of a printf specifier-arginfo function.
073:    INFO gives information about the format specification.
074:    N, ARGTYPES, *SIZE has to contain the size of the parameter for
075:    user-defined types, and return value are as for parse_printf_format
076:    except that -1 should be returned if the handler cannot handle
077:    this case.  This allows to partially overwrite the functionality
078:    of existing format specifiers.  */
079: 
080: typedef int printf_arginfo_size_function (__const struct printf_info *__info,
081:                                           size_t __n, int *__argtypes,
082:                                           int *__size);
083: 
084: /* Old version of 'printf_arginfo_function' without a SIZE parameter.  */
085: 
086: typedef int printf_arginfo_function (__const struct printf_info *__info,
087:                                      size_t __n, int *__argtypes);
088: 
089: /* Type of a function to get a value of a user-defined from the
090:    variable argument list.  */
091: typedef void printf_va_arg_function (void *__mem, va_list *__ap);
092: 
093: 
094: /* Register FUNC to be called to format SPEC specifiers; ARGINFO must be
095:    specified to determine how many arguments a SPEC conversion requires and
096:    what their types are.  */
097: 
098: extern int register_printf_specifier (int __spec, printf_function __func,
099:                                       printf_arginfo_size_function __arginfo)
100:   __THROW;
101: 
102: 
103: /* Obsolete interface similar to register_printf_specifier.  It can only
104:    handle basic data types because the ARGINFO callback does not return
105:    information on the size of the user-defined type.  */
106: 
107: extern int register_printf_function (int __spec, printf_function __func,
108:                                      printf_arginfo_function __arginfo)
109:   __THROW __attribute_deprecated__;
110: 
111: 
112: /* Register a new modifier character sequence.  If the call succeeds
113:    it returns a positive value representing the bit set in the USER
114:    field in 'struct printf_info'.  */
115: 
116: extern int register_printf_modifier (__const wchar_t *__str) __wur __THROW;
117: 
118: 
119: /* Register variable argument handler for user type.  The return value
120:    is to be used in ARGINFO functions to signal the use of the
121:    type.  */
122: extern int register_printf_type (printf_va_arg_function __fct) __wur __THROW;
123: 
124: 
125: /* Parse FMT, and fill in N elements of ARGTYPES with the
126:    types needed for the conversions FMT specifies.  Returns
127:    the number of arguments required by FMT.
128: 
129:    The ARGINFO function registered with a user-defined format is passed a
130:    `struct printf_info' describing the format spec being parsed.  A width
131:    or precision of INT_MIN means a `*' was used to indicate that the
132:    width/precision will come from an arg.  The function should fill in the
133:    array it is passed with the types of the arguments it wants, and return
134:    the number of arguments it wants.  */
135: 
136: extern size_t parse_printf_format (__const char *__restrict __fmt, size_t __n,
137:                                    int *__restrict __argtypes) __THROW;
138: 
139: 
140: /* Codes returned by `parse_printf_format' for basic types.
141: 
142:    These values cover all the standard format specifications.
143:    Users can reserve new values after PA_LAST for their own types
144:    using 'register_printf_type'.  */
145: 
146: enum
147: {                               /* C type: */
148:   PA_INT,                       /* int */
149:   PA_CHAR,                      /* int, cast to char */
150:   PA_WCHAR,                     /* wide char */
151:   PA_STRING,                    /* const char *, a '\0'-terminated string */
152:   PA_WSTRING,                   /* const wchar_t *, wide character string */
153:   PA_POINTER,                   /* void * */
154:   PA_FLOAT,                     /* float */
155:   PA_DOUBLE,                    /* double */
156:   PA_LAST
157: };
158: 
159: /* Flag bits that can be set in a type returned by `parse_printf_format'.  */
160: #define PA_FLAG_MASK            0xff00
161: #define PA_FLAG_LONG_LONG       (1 << 8)
162: #define PA_FLAG_LONG_DOUBLE     PA_FLAG_LONG_LONG
163: #define PA_FLAG_LONG            (1 << 9)
164: #define PA_FLAG_SHORT           (1 << 10)
165: #define PA_FLAG_PTR             (1 << 11)
166: 
167: 
168: 
169: /* Function which can be registered as `printf'-handlers.  */
170: 
171: /* Print floating point value using using abbreviations for the orders
172:    of magnitude used for numbers ('k' for kilo, 'm' for mega etc).  If
173:    the format specifier is a uppercase character powers of 1000 are
174:    used.  Otherwise powers of 1024.  */
175: extern int printf_size (FILE *__restrict __fp,
176:                         __const struct printf_info *__info,
177:                         __const void *__const *__restrict __args) __THROW;
178: 
179: /* This is the appropriate argument information function for `printf_size'.  */
180: extern int printf_size_info (__const struct printf_info *__restrict
181:                              __info, size_t __n, int *__restrict __argtypes)
182:      __THROW;
183: 
184: #ifdef __LDBL_COMPAT
185: # include <bits/printf-ldbl.h>
186: #endif
187: 
188: __END_DECLS
189: 
190: #endif /* printf.h  */
191: 


for client 3.149.255.162
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/