plibsys 0.0.5
pstdarg.h
Go to the documentation of this file.
1/*
2 * The MIT License
3 *
4 * Copyright (C) 2017 Jean-Damien Durand <jeandamiendurand@free.fr>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * 'Software'), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
64#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
65# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
66#endif
67
68#ifndef PLIBSYS_HEADER_PSTDARG_H
69#define PLIBSYS_HEADER_PSTDARG_H
70
71#include <pmacros.h>
72#include <ptypes.h>
73
74#include <stdio.h>
75#include <stdarg.h>
76#ifndef PLIBSYS_VA_COPY
77# include <string.h>
78#endif
79
84#define p_va_list va_list
85
93#define p_va_start(ap, last) va_start(ap, last)
94
104#define p_va_arg(ap, type) (type) va_arg(ap, type)
105
112#define p_va_end(ap) va_end(ap)
113
123#ifdef PLIBSYS_VA_COPY
124# define p_va_copy(dst, src) PLIBSYS_VA_COPY(dst, src)
125#else
126# define p_va_copy(dst, src) ((void) memcpy (&(dst), &(src), sizeof (va_list)))
127#endif
128
136#define pint8_va_arg(ap) ((pint8) p_va_arg(ap, pint))
137
145#define puint8_va_arg(ap) ((puint8) p_va_arg(ap, puint))
146
154#define pint16_va_arg(ap) ((pint16) p_va_arg(ap, pint))
155
163#define puint16_va_arg(ap) ((puint16) p_va_arg(ap, puint))
164
172#define pint32_va_arg(ap) ((pint32) p_va_arg(ap, pint))
173
181#define puint32_va_arg(ap) ((puint32) p_va_arg(ap, puint))
182
190#define pint64_va_arg(ap) (p_va_arg(ap, pint64))
191
199#define puint64_va_arg(ap) (p_va_arg(ap, puint64))
200
208#define ppointer_va_arg(ap) (p_va_arg(ap, ppointer))
209
217#define pconstpointer_va_arg(ap) (p_va_arg(ap, pconstpointer))
218
226#define pboolean_va_arg(ap) ((pboolean) p_va_arg(ap, pint))
227
235#define pchar_va_arg(ap) ((pchar) p_va_arg(ap, pint))
236
244#define pshort_va_arg(ap) ((pshort) p_va_arg(ap, pint))
245
253#define pint_va_arg(ap) (p_va_arg(ap, pint))
254
262#define plong_va_arg(ap) (p_va_arg(ap, plong))
263
271#define puchar_va_arg(ap) ((puchar) p_va_arg(ap, puint))
272
280#define pushort_va_arg(ap) ((pushort) p_va_arg(ap, puint))
281
289#define puint_va_arg(ap) (p_va_arg(ap, puint))
290
298#define pulong_va_arg(ap) (p_va_arg(ap, pulong))
299
307#define pfloat_va_arg(ap) ((pfloat) p_va_arg(ap, pdouble))
308
316#define pdouble_va_arg(ap) (p_va_arg(ap, pdouble))
317
318#endif /* PLIBSYS_HEADER_PSTDARG_H */
Miscellaneous macros.
Types definitions.