New developer version 0.6.8; added select () function; added demonstrating example...
[ZeXOS.git] / kernel / include / stdarg.h
blob2a8e428730268284b8b4fa457138397649b01e87
1 /*
2 * ZeX/OS
3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
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 of the License, or
8 * (at your option) any later version.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __TL_STDARG_H
21 #define __TL_STDARG_H
23 #include <_va_list.h>
25 /* width of stack == width of int */
26 #define STACKITEM int
28 /* round up width of objects pushed on stack. The expression before the
29 & ensures that we get 0 for objects of size 0. */
30 #define VA_SIZE(TYPE) \
31 ((sizeof(TYPE) + sizeof(STACKITEM) - 1) \
32 & ~(sizeof(STACKITEM) - 1))
34 /* &(LASTARG) points to the LEFTMOST argument of the function call
35 (before the ...) */
36 #define va_start(AP, LASTARG) \
37 (AP=((va_list)&(LASTARG) + VA_SIZE(LASTARG)))
39 #define va_end(AP) /* nothing */
41 #define va_arg(AP, TYPE) \
42 (AP += VA_SIZE(TYPE), *((TYPE *)(AP - VA_SIZE(TYPE))))
44 #endif