1 /* varargs.h for SPUR */
3 /* NB. This is NOT the definition needed for the new ANSI proposed
7 struct __va_struct
{ char __regs
[20]; };
9 #define va_alist __va_regs, __va_stack
11 /* In GCC version 2, we want an ellipsis at the end of the declaration
12 of the argument list. GCC version 1 can't parse it. */
15 #define __va_ellipsis ...
20 /* The ... causes current_function_varargs to be set in cc1. */
21 #define va_dcl struct __va_struct __va_regs; int __va_stack;
29 #define va_start(pvar) \
30 ((pvar).__pnt = 0, (pvar).__regs = __va_regs.__regs, \
31 (pvar).__stack = (char *) &__va_stack)
34 #define va_arg(pvar,type) \
35 ({ type __va_result; \
36 if ((pvar).__pnt >= 20) { \
37 __va_result = *( (type *) ((pvar).__stack + (pvar).__pnt - 20)); \
38 (pvar).__pnt += (sizeof(type) + 7) & ~7; \
40 else if ((pvar).__pnt + sizeof(type) > 20) { \
41 __va_result = * (type *) (pvar).__stack; \
42 (pvar).__pnt = 20 + ( (sizeof(type) + 7) & ~7); \
44 else if (sizeof(type) == 8) { \
45 union {double d; int i[2];} __u; \
46 __u.i[0] = *(int *) ((pvar).__regs + (pvar).__pnt); \
47 __u.i[1] = *(int *) ((pvar).__regs + (pvar).__pnt + 4); \
48 __va_result = * (type *) &__u; \
52 __va_result = * (type *) ((pvar).__regs + (pvar).__pnt); \
53 (pvar).__pnt += (sizeof(type) + 3) & ~3; \