gsasl  1.10.0
About: GNU SASL is an implementation of the Simple Authentication and Security Layer (SASL). Development version.
  Fossies Dox: gsasl-1.10.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

printf-args.h
Go to the documentation of this file.
1 /* Decomposed printf argument list.
2  Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2021 Free Software
3  Foundation, Inc.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 3, or (at your option)
8  any later version.
9 
10  This program 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
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, see <https://www.gnu.org/licenses/>. */
17 
18 #ifndef _PRINTF_ARGS_H
19 #define _PRINTF_ARGS_H
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 
31 /* Get size_t. */
32 #include <stddef.h>
33 
34 /* Get wchar_t. */
35 #if HAVE_WCHAR_T
36 # include <stddef.h>
37 #endif
38 
39 /* Get wint_t. */
40 #if HAVE_WINT_T
41 # include <wchar.h>
42 #endif
43 
44 /* Get va_list. */
45 #include <stdarg.h>
46 
47 
48 /* Argument types */
49 typedef enum
50 {
65 #if HAVE_WINT_T
66  TYPE_WIDE_CHAR,
67 #endif
69 #if HAVE_WCHAR_T
70  TYPE_WIDE_STRING,
71 #endif
78 #if ENABLE_UNISTDIO
79  /* The unistdio extensions. */
80 , TYPE_U8_STRING
81 , TYPE_U16_STRING
82 , TYPE_U32_STRING
83 #endif
85 
86 /* Polymorphic argument */
87 typedef struct
88 {
90  union
91  {
92  signed char a_schar;
93  unsigned char a_uchar;
94  short a_short;
95  unsigned short a_ushort;
96  int a_int;
97  unsigned int a_uint;
98  long int a_longint;
99  unsigned long int a_ulongint;
100  long long int a_longlongint;
101  unsigned long long int a_ulonglongint;
102  float a_float;
103  double a_double;
104  long double a_longdouble;
105  int a_char;
106 #if HAVE_WINT_T
107  wint_t a_wide_char;
108 #endif
109  const char* a_string;
110 #if HAVE_WCHAR_T
111  const wchar_t* a_wide_string;
112 #endif
113  void* a_pointer;
114  signed char * a_count_schar_pointer;
119 #if ENABLE_UNISTDIO
120  /* The unistdio extensions. */
121  const uint8_t * a_u8_string;
122  const uint16_t * a_u16_string;
123  const uint32_t * a_u32_string;
124 #endif
125  }
126  a;
127 }
128 argument;
129 
130 /* Number of directly allocated arguments (no malloc() needed). */
131 #define N_DIRECT_ALLOC_ARGUMENTS 7
132 
133 typedef struct
134 {
135  size_t count;
138 }
139 arguments;
140 
141 
142 /* Fetch the arguments, putting them into a. */
143 #ifdef STATIC
144 STATIC
145 #else
146 extern
147 #endif
148 int PRINTF_FETCHARGS (va_list args, arguments *a);
149 
150 #endif /* _PRINTF_ARGS_H */
#define N_DIRECT_ALLOC_ARGUMENTS
Definition: printf-args.h:131
arg_type
Definition: printf-args.h:50
@ TYPE_DOUBLE
Definition: printf-args.h:62
@ TYPE_NONE
Definition: printf-args.h:51
@ TYPE_SHORT
Definition: printf-args.h:54
@ TYPE_CHAR
Definition: printf-args.h:64
@ TYPE_ULONGLONGINT
Definition: printf-args.h:61
@ TYPE_USHORT
Definition: printf-args.h:55
@ TYPE_INT
Definition: printf-args.h:56
@ TYPE_LONGINT
Definition: printf-args.h:58
@ TYPE_COUNT_SCHAR_POINTER
Definition: printf-args.h:73
@ TYPE_POINTER
Definition: printf-args.h:72
@ TYPE_COUNT_LONGLONGINT_POINTER
Definition: printf-args.h:77
@ TYPE_SCHAR
Definition: printf-args.h:52
@ TYPE_LONGDOUBLE
Definition: printf-args.h:63
@ TYPE_COUNT_SHORT_POINTER
Definition: printf-args.h:74
@ TYPE_LONGLONGINT
Definition: printf-args.h:60
@ TYPE_COUNT_LONGINT_POINTER
Definition: printf-args.h:76
@ TYPE_COUNT_INT_POINTER
Definition: printf-args.h:75
@ TYPE_UINT
Definition: printf-args.h:57
@ TYPE_ULONGINT
Definition: printf-args.h:59
@ TYPE_STRING
Definition: printf-args.h:68
@ TYPE_UCHAR
Definition: printf-args.h:53
#define PRINTF_FETCHARGS
Definition: printf-args.h:28
#define uint32_t
Definition: stdint.in.h:168
#define uint16_t
Definition: stdint.in.h:161
#define uint8_t
Definition: stdint.in.h:154
#define wint_t
Definition: wchar.in.h:106
int a_char
Definition: printf-args.h:105
long long int a_longlongint
Definition: printf-args.h:100
signed char * a_count_schar_pointer
Definition: printf-args.h:114
long long int * a_count_longlongint_pointer
Definition: printf-args.h:118
unsigned int a_uint
Definition: printf-args.h:97
long int * a_count_longint_pointer
Definition: printf-args.h:117
int a_int
Definition: printf-args.h:96
arg_type type
Definition: printf-args.h:89
signed char a_schar
Definition: printf-args.h:92
unsigned long int a_ulongint
Definition: printf-args.h:99
long double a_longdouble
Definition: printf-args.h:104
short a_short
Definition: printf-args.h:94
float a_float
Definition: printf-args.h:102
double a_double
Definition: printf-args.h:103
unsigned short a_ushort
Definition: printf-args.h:95
unsigned long long int a_ulonglongint
Definition: printf-args.h:101
unsigned char a_uchar
Definition: printf-args.h:93
union argument::@3 a
const char * a_string
Definition: printf-args.h:109
long int a_longint
Definition: printf-args.h:98
void * a_pointer
Definition: printf-args.h:113
short * a_count_short_pointer
Definition: printf-args.h:115
int * a_count_int_pointer
Definition: printf-args.h:116
argument * arg
Definition: printf-args.h:136
size_t count
Definition: printf-args.h:135