xref: /original-bsd/sys/pmax/include/varargs.h (revision babae2df)
1 /*-
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  * (c) UNIX System Laboratories, Inc.
5  * All or some portions of this file are derived from material licensed
6  * to the University of California by American Telephone and Telegraph
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8  * the permission of UNIX System Laboratories, Inc.
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)varargs.h	8.2 (Berkeley) 03/22/94
13  */
14 
15 #ifndef _VARARGS_H_
16 #define	_VARARGS_H_
17 
18 typedef char *va_list;
19 
20 #define	va_dcl	int va_alist;
21 
22 #define	va_start(ap) \
23 	ap = (char *)&va_alist
24 
25 #ifdef KERNEL
26 #define	va_arg(ap, type) \
27 	((type *)(ap += sizeof(type)))[-1]
28 #else
29 #define	va_arg(ap, type) \
30 	((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
31 		sizeof(type) > sizeof(int) ? \
32 		(-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
33 		(abort(), 0)))[-1]
34 #endif
35 
36 #define	va_end(ap)
37 
38 #endif /* !_VARARGS_H_ */
39