xref: /386bsd/usr/src/usr.bin/awk/vargs.h (revision a2142627)
1 
2 /********************************************
3 vargs.h
4 copyright 1992 Michael D. Brennan
5 
6 This is a source file for mawk, an implementation of
7 the AWK programming language.
8 
9 Mawk is distributed without warranty under the terms of
10 the GNU General Public License, version 2, 1991.
11 ********************************************/
12 
13 /*
14 $Log: vargs.h,v $
15  * Revision 1.1  1992/10/02  23:23:41  mike
16  * Initial revision
17  *
18 */
19 
20 /* provides common interface to <stdarg.h> or <varargs.h>
21    only used for error messages
22 */
23 
24 
25 #if   HAVE_STDARG_H == 0
26 #include <varargs.h>
27 
28 #ifndef  VA_ALIST
29 
30 #define  VA_ALIST(type, arg)  (va_alist) va_dcl { type arg ;
31 #define  VA_ALIST2(t1,a1,t2,a2) (va_alist) va_dcl { t1 a1 ; t2 a2 ;
32 
33 #endif
34 
35 #define  VA_START(p,type, last)  va_start(p) ;\
36                                  last = va_arg(p,type)
37 
38 
39 #define  VA_START2(p,t1,a1,t2,a2)  va_start(p) ;\
40                                   a1 = va_arg(p,t1);\
41                                   a2 = va_arg(p,t2)
42 
43 #else  /* HAVE_STDARG_H  */
44 #include <stdarg.h>
45 
46 #ifndef  VA_ALIST
47 #define  VA_ALIST(type, arg)  (type arg, ...) {
48 #define  VA_ALIST2(t1,a1,t2,a2)  (t1 a1,t2 a2,...) {
49 #endif
50 
51 #define  VA_START(p,type,last)   va_start(p,last)
52 
53 #define  VA_START2(p,t1,a1,t2,a2)  va_start(p,a2)
54 
55 #endif
56 
57