/* vacall.h.  Generated automatically by configure.  */
#ifndef _VACALL_H
#define _VACALL_H

/*
 * Copyright 1995 Bruno Haible, <haible@ma2s2.mathematik.uni-karlsruhe.de>
 *
 * This is free software distributed under the GNU General Public Licence
 * described in the file COPYING. Contact the author if you don't have this
 * or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied,
 * on this software.
 */


/* These definitions are adjusted by `configure' automatically. */

/* CPU */
#ifndef __i386__
/* #undef __i386__ */
#endif
#ifndef __m68k__
#define __m68k__ 1
#endif
#ifndef __mips__
/* #undef __mips__ */
#endif
#ifndef __sparc__
/* #undef __sparc__ */
#endif
#ifndef __alpha__
/* #undef __alpha__ */
#endif
#ifndef __hppa__
/* #undef __hppa__ */
#endif
#ifndef __arm__
/* #undef __arm__ */
#endif
#ifndef __rs6000__
/* #undef __rs6000__ */
#endif
#ifndef __m88k__
/* #undef __m88k__ */
#endif
#ifndef __convex__
/* #undef __convex__ */
#endif

/* Calling convention */
/* Define if using pcc non-reentrant struct return convention */
#define __PCC_STRUCT_RETURN__ 1
/* Define if small structs are returned in registers */
/* #undef __SMALL_STRUCT_RETURN__ */

/* CL_CHAR_UNSIGNED */
#ifndef __CHAR_UNSIGNED__
/* #undef __CHAR_UNSIGNED__ */
#endif

/* End of definitions adjusted by `configure'. */


/* Max # words in argument-list and temporary structure storage.
 */
#ifndef __VA_ALIST_WORDS
#define __VA_ALIST_WORDS  256
#endif

/* The `signed' keyword.
 */
#if !defined(__STDC__) && !defined(__CHAR_UNSIGNED__) && !defined(signed)
#define signed
#endif

/* Determine the alignment of a type at compile time.
 */
#if defined(__GNUC__)
#define __VA_alignof __alignof__
#else
#if defined(__mips__) /* SGI compiler */
#define __VA_alignof __builtin_alignof
#else
#define __VA_offsetof(type,ident)  ((unsigned long)&(((type*)0)->ident))
#define __VA_alignof(type)  __VA_offsetof(struct { char __slot1; type __slot2; }, __slot2)
#endif
#endif

/* C builtin types.
 */
typedef long __vaword;

enum __VAtype
{
  __VAvoid,
  __VAchar,
  __VAschar,
  __VAuchar,
  __VAshort,
  __VAushort,
  __VAint,
  __VAuint,
  __VAlong,
  __VAulong,
  __VAfloat,
  __VAdouble,
  __VAvoidp,
  __VAstruct
};

enum __VA_alist_flags
{

  /* how to return structs */
  /* There are basically 3 ways to return structs:
   * a. The called function returns a pointer to static data. Not reentrant.
   * b. The caller passes the return structure address in a dedicated register
   *    or as a first (or last), invisible argument. The called function stores
   *    its result there.
   * c. Like b, and the called function also returns the return structure
   *    address in the return value register. (This is not very distinguishable
   *    from b.)
   * Independently of this,
   * r. small structures (<= 4 or <= 8 bytes) may be returned in the return
   *    value register(s), or
   * m. even small structures are passed in memory.
   */
  /* gcc-2.6.3 employs the following strategy:
   *   - If PCC_STATIC_STRUCT_RETURN is defined in the machine description
   *     it uses method a, else method c.
   *   - If flag_pcc_struct_return is set (either by -fpcc-struct-return or if
   *     DEFAULT_PCC_STRUCT_RETURN is defined to 1 in the machine description)
   *     it uses method m, else (either by -freg-struct-return or if
   *     DEFAULT_PCC_STRUCT_RETURN is defined to 0 in the machine description)
   *     method r.
   */
  __VA_PCC_STRUCT_RETURN	= 1<<0,	/* a: need to copy the struct */
  __VA_SMALL_STRUCT_RETURN	= 1<<1,	/* r: special case for small structs */
  __VA_GCC_STRUCT_RETURN	= 1<<2,	/* consider 8 byte structs as small */
#if defined(__sparc__)
  __VA_SUNCC_STRUCT_RETURN	= 1<<3,
#else
  __VA_SUNCC_STRUCT_RETURN	= 0,
#endif
#if defined(__i386__)
  __VA_NEXTGCC_STRUCT_RETURN	= 1<<3,
#endif
  /* the default way to return structs */
  /* This choice here is based on the assumption that the function you are
   * going to call has been compiled with the same compiler you are using to
   * include this file.
   * If you want to call functions with another struct returning convention,
   * just  #define __VA_STRUCT_RETURN ...
   * before or after #including <vacall.h>.
   */
#ifndef __VA_STRUCT_RETURN
  __VA_STRUCT_RETURN		=
#if defined(__PCC_STRUCT_RETURN__) /* defined through configure, see above */
				  __VA_PCC_STRUCT_RETURN |
#if defined(__sparc__) && defined(sun) && !(defined(__STDC__) || defined(__GNUC__)) /* sun cc */
  				  __VA_SUNCC_STRUCT_RETURN,
#else
  				  0,
#endif
#else
#if defined(__SMALL_STRUCT_RETURN__) /* defined through configure, see above */
				  __VA_SMALL_STRUCT_RETURN |
#endif
#if defined(__GNUC__)
				  __VA_GCC_STRUCT_RETURN |
#endif
#if defined(__i386__) && defined(NeXT) && defined(__GNUC__) /* NeXT gcc-2.5.8 */
				  __VA_NEXTGCC_STRUCT_RETURN |
#endif
  				  0,
#endif
#endif

  /* how to return floats */
#if defined(__m68k__) || defined(__sparc__)
  __VA_SUNCC_FLOAT_RETURN	= 1<<4,
#endif
  /* the default way to return floats */
  /* This choice here is based on the assumption that the function you are
   * going to call has been compiled with the same compiler you are using to
   * include this file.
   * If you want to call functions with another float returning convention,
   * just  #define __VA_FLOAT_RETURN ...
   * before or after #including <vacall.h>.
   */
#ifndef __VA_FLOAT_RETURN
#if (defined(__m68k__) || defined(__sparc__)) && !defined(__GNUC__) && defined(sun)  /* sun cc */
  __VA_FLOAT_RETURN		= __VA_SUNCC_FLOAT_RETURN,
#else
  __VA_FLOAT_RETURN		= 0,
#endif
#endif

  /* how to pass structs */
#if defined(__mips__)
  __VA_SGICC_STRUCT_ARGS	= 1<<5,
#endif
#if defined(__rs6000__)
  __VA_AIXCC_STRUCT_ARGS	= 1<<5,
#endif
  /* the default way to pass floats */
  /* This choice here is based on the assumption that the function you are
   * going to call has been compiled with the same compiler you are using to
   * include this file.
   * If you want to call functions with another float passing convention,
   * just  #define __VA_STRUCT_ARGS ...
   * before or after #including <vacall.h>.
   */
#ifndef __VA_STRUCT_ARGS
#if defined(__mips__) && !defined(__GNUC__) /* SGI mips cc */
  __VA_STRUCT_ARGS		= __VA_SGICC_STRUCT_ARGS,
#else
#if defined(__rs6000__) && !defined(__GNUC__) /* AIX cc, xlc */
  __VA_STRUCT_ARGS		= __VA_AIXCC_STRUCT_ARGS,
#else
  __VA_STRUCT_ARGS		= 0,
#endif
#endif
#endif

  /* how to pass floats */
  /* ANSI C compilers and GNU gcc pass floats as floats.
   * K&R C compilers pass floats as doubles.
   * (Except some compilers like SGI MIPS "cc" and "cc -cckr" if a prototype is
   * known for the called functions. But to compile a program with prototypes,
   * "cc -ansi" is better anyway.
   */
  __VA_ANSI_FLOAT_ARGS		= 0,    /* pass floats as floats */
  __VA_TRADITIONAL_FLOAT_ARGS	= 1<<6, /* pass floats as doubles */
  /* the default way to pass floats */
  /* This choice here is based on the assumption that the function you are
   * going to call has been compiled with the same compiler you are using to
   * include this file.
   * If you want to call functions with another float passing convention,
   * just  #define __VA_FLOAT_ARGS ...
   * before or after #including <vacall.h>.
   */
#ifndef __VA_FLOAT_ARGS
#if defined(__STDC__) || defined(__GNUC__) /* what about hppa "cc -Aa" ?? */
  __VA_FLOAT_ARGS		= __VA_ANSI_FLOAT_ARGS,
#else
  __VA_FLOAT_ARGS		= __VA_TRADITIONAL_FLOAT_ARGS,
#endif
#endif

  /* how to pass and return small integer arguments */
  __VA_ANSI_INTEGERS		= 0, /* no promotions */
  __VA_TRADITIONAL_INTEGERS	= 0, /* promote [u]char, [u]short to [u]int */
  /* Fortunately these two methods are compatible. Our macros work with both. */
  /* the default way to pass and return small integer arguments */
  /* This choice here is based on the assumption that the function you are
   * going to call has been compiled with the same compiler you are using to
   * include this file.
   * If you want to call functions with another float passing convention,
   * just  #define __VA_INTEGERS ...
   * before or after #including <vacall.h>.
   */
#ifndef __VA_INTEGERS
#if defined(__STDC__) || defined(__GNUC__)
  __VA_INTEGERS			= __VA_ANSI_INTEGERS,
#else
  __VA_INTEGERS			= __VA_TRADITIONAL_INTEGERS,
#endif
#endif

  /* These are for internal use only */
#if defined(__i386__) || defined(__m68k__) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__)
  __VA_REGISTER_STRUCT_RETURN	= 1<<8,
#endif
#if defined(__mips__)
  __VA_FLOAT_1			= 1<<9,
  __VA_FLOAT_2			= 1<<10,
#endif

  __VA_flag_for_broken_compilers_that_dont_like_trailing_commas
};

/*
 * Definition of the `va_alist' type.
 */
typedef struct
{
  /* some va_... macros need these flags */
  int            flags;
  /* current pointer into the argument array */
  unsigned long  aptr;
  /* structure return pointer, return type, return type size */
  void*          raddr;
  enum __VAtype  rtype;
  unsigned long  rsize;
  /* temporary storage for return value */
  union {
    char            _char;
    signed char     _schar;
    unsigned char   _uchar;
    short           _short;
    unsigned short  _ushort;
    int             _int;
    unsigned int    _uint;
    long            _long;
    unsigned long   _ulong;
    float           _float;
    double          _double;
    void*           _ptr;
    __vaword        _words[2];
  }              tmp;
#if defined(__i386__) || defined(__m68k__) || defined(__sparc__) || defined(__hppa__) || defined(__m88k__)
  void*          structraddr;
#endif
#if defined(__mips__) || defined(__alpha__) || defined(__hppa__)
  long           memargptr;
#endif
#if defined(__hppa__)
  long           farg_offset;
  long           darg_offset;
  float          farg[4];
  double         darg[2];
#endif
#if defined(__mips__)
  int            anum;
  float          farg[2];
  double         darg[2];
#endif
#if defined(__rs6000__)
  double*        memfargptr;
  double         farg[13];
#endif
} __va_alist;

typedef __va_alist* va_alist;


/*
 * Definition of the va_start_xxx macros.
 */
#define __VA_START_FLAGS  \
  __VA_STRUCT_RETURN | __VA_FLOAT_RETURN | __VA_STRUCT_ARGS | __VA_FLOAT_ARGS | __VA_INTEGERS
#define __va_start(LIST,RETTYPE)  \
  ((LIST)->flags = __VA_START_FLAGS,					\
   (LIST)->rtype = (RETTYPE)						\
  )
#define va_start_void(LIST)	__va_start(LIST,__VAvoid)
#define va_start_char(LIST)	__va_start(LIST,__VAchar)
#define va_start_schar(LIST)	__va_start(LIST,__VAschar)
#define va_start_uchar(LIST)	__va_start(LIST,__VAuchar)
#define va_start_short(LIST)	__va_start(LIST,__VAshort)
#define va_start_ushort(LIST)	__va_start(LIST,__VAushort)
#define va_start_int(LIST)	__va_start(LIST,__VAint)
#define va_start_uint(LIST)	__va_start(LIST,__VAuint)
#define va_start_long(LIST)	__va_start(LIST,__VAlong)
#define va_start_ulong(LIST)	__va_start(LIST,__VAulong)
#define va_start_float(LIST)	__va_start(LIST,__VAfloat)
#define va_start_double(LIST)	__va_start(LIST,__VAdouble)
#define va_start_ptr(LIST,TYPE)	__va_start(LIST,__VAvoidp)

/*
 * va_start_struct: Preparing structure return.
 */
#define va_start_struct(LIST,TYPE,TYPE_SPLITTABLE)  \
  _va_start_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE),TYPE_SPLITTABLE)
/* _va_start_struct() is like va_start_struct(), except that you pass
 * the type's size and alignment instead of the type itself.
 */
#define _va_start_struct(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE)  \
  (__va_start(LIST,__VAstruct),						\
   (LIST)->rsize = (TYPE_SIZE),						\
   ((LIST)->flags & (__VA_PCC_STRUCT_RETURN | __VA_SUNCC_STRUCT_RETURN)	\
    ? ((TYPE_SIZE) <= sizeof(__va_struct_buffer) || __va_error2(TYPE_SIZE), \
       (LIST)->raddr = &__va_struct_buffer,				\
       0								\
      )									\
    : (((LIST)->flags & __VA_SMALL_STRUCT_RETURN)			\
       && __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)	\
       ? ((LIST)->raddr = &(LIST)->tmp,					\
          __va_start_struct1(LIST)					\
         )								\
       : __va_start_struct2(LIST)					\
  ))  )
/* Determines whether a structure is returned in registers,
 * depending on its size and its word-splittable flag.
 */
#if defined(__i386__) || defined(__m68k__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__)
#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  \
  ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4		\
   || ((TYPE_SIZE) == 8 && (TYPE_SPLITTABLE)				\
       && ((LIST)->flags & __VA_GCC_STRUCT_RETURN)			\
  )   )
/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set
 * and the struct will actually be returned in registers.
 */
#define __va_start_struct1(LIST)  \
  ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, 0)
#endif
#if defined(__alpha__)
#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  \
  ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8	\
   || ((TYPE_SIZE) == 16 && (TYPE_SPLITTABLE)				\
       && ((LIST)->flags & __VA_GCC_STRUCT_RETURN)			\
  )   )
/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set
 * and the struct will actually be returned in registers.
 */
#define __va_start_struct1(LIST)  \
  ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, 0)
#endif
#if defined(__hppa__)
#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  \
  ((LIST)->flags & __VA_GCC_STRUCT_RETURN				\
   ? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4)		\
   : ((TYPE_SIZE) <= 8)							\
  )
/* Test both __AV_GCC_STRUCT_RETURN and __AV_SMALL_STRUCT_RETURN at run time. */
#define __va_start_struct1(LIST)  \
  0
#endif
#if defined(__mips__) || defined(__sparc__) || defined(__m88k__)
#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  \
  ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4)
/* Test __VA_SMALL_STRUCT_RETURN instead of __VA_REGISTER_STRUCT_RETURN. */
#if defined(__mips__)
#define __va_start_struct1(LIST)  \
  ((LIST)->anum++,							\
   0									\
  )
#else
#define __va_start_struct1(LIST)  \
  0
#endif
#endif
#if defined(__i386__)
/* Return structure pointer is passed in a special register or as first arg. */
#define __va_start_struct2(LIST)  \
  ((LIST)->flags & __VA_NEXTGCC_STRUCT_RETURN				\
   ? ((LIST)->raddr = (LIST)->structraddr, 0)	 /* special register */	\
   : ((LIST)->raddr = *(void* *)((LIST)->aptr),		/* first arg */	\
      (LIST)->aptr += sizeof(void*),					\
      0									\
  )  )
#endif
#if defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__)
/* Return structure pointer is passed as first arg. */
#define __va_start_struct2(LIST)  \
  ((LIST)->raddr = *(void* *)((LIST)->aptr),				\
   (LIST)->aptr += sizeof(void*),					\
   0									\
  )
#endif
#if defined(__mips__)
/* Return structure pointer is passed as first arg. */
#define __va_start_struct2(LIST)  \
  ((LIST)->raddr = *(void* *)((LIST)->aptr),				\
   (LIST)->aptr += sizeof(void*),					\
   (LIST)->anum++,							\
   0									\
  )
#endif
#if defined(__m68k__) || defined(__sparc__) || defined(__hppa__) || defined(__m88k__)
/* Return structure pointer is passed in a special register. */
#define __va_start_struct2(LIST)  \
  ((LIST)->raddr = (LIST)->structraddr, 0)
#endif


/*
 * Definition of the va_arg_xxx macros.
 */

/* Padding of non-struct arguments. */
#define __va_argsize(TYPE_SIZE)  \
  (((TYPE_SIZE) + sizeof(__vaword)-1) & -(long)sizeof(__vaword))
#if defined(__i386__) || defined(__m68k__) || defined(__mips__) || defined(__sparc__) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__)
/* args grow up */
/* small structures < 1 word are adjusted depending on compiler */
#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  ((LIST)->aptr += __va_argsize(TYPE_SIZE),				\
   (LIST)->aptr - __va_argsize(TYPE_SIZE)				\
  )
#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  ((LIST)->aptr += __va_argsize(TYPE_SIZE),				\
   (LIST)->aptr - ((TYPE_SIZE) < sizeof(__vaword)			\
		   ? (TYPE_SIZE)					\
		   : __va_argsize(TYPE_SIZE)				\
		  )							\
  )
#endif
#if defined(__hppa__)
/* args grow down */
#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  ((LIST)->aptr = (LIST)->aptr - __va_argsize(TYPE_SIZE),		\
   ((TYPE_SIZE) > 4 && ((LIST)->aptr &= -8)),				\
   (LIST)->aptr								\
  )
#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  ((LIST)->aptr = (LIST)->aptr - __va_argsize(TYPE_SIZE),		\
   ((TYPE_SIZE) > 4 && ((LIST)->aptr &= -8)),				\
   (LIST)->aptr + ((-(TYPE_SIZE)) & 3)					\
  )
#endif
#if defined(__i386__) || defined(__alpha__)
/* little endian -> small args < 1 word are adjusted to the left */
#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)
#endif
#if defined(__m68k__) || defined(__sparc__) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__)
/* big endian -> small args < 1 word are adjusted to the right */
#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)
#endif
#if defined(__mips__)
/* big endian -> small args < 1 word are adjusted to the right */
#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  ((LIST)->anum++, __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN))
#endif
#define __va_arg(LIST,TYPE)  \
  *(TYPE*)__va_arg_adjusted(LIST,sizeof(TYPE),__VA_alignof(TYPE))

/* Integer arguments. */
#define va_arg_char(LIST)	__va_arg(LIST,char)
#define va_arg_schar(LIST)	__va_arg(LIST,signed char)
#define va_arg_uchar(LIST)	__va_arg(LIST,unsigned char)
#define va_arg_short(LIST)	__va_arg(LIST,short)
#define va_arg_ushort(LIST)	__va_arg(LIST,unsigned short)
#define va_arg_int(LIST)	__va_arg(LIST,int)
#define va_arg_uint(LIST)	__va_arg(LIST,unsigned int)
#define va_arg_long(LIST)	__va_arg(LIST,long)
#define va_arg_ulong(LIST)	__va_arg(LIST,unsigned long)

/* Floating point arguments. */

#define va_arg_float(LIST)  \
  ((LIST)->flags & __VA_TRADITIONAL_FLOAT_ARGS				\
   ? (float)va_arg_double(LIST)						\
   : __va_arg_float(LIST)						\
  )

#if defined(__i386__) || defined(__m68k__) || defined(__sparc__) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__)
#define __va_align_double(LIST)
#endif
#if defined(__mips__) || defined(__m88k__)
/* __VA_alignof(double) > sizeof(__vaword) */
#define __va_align_double(LIST)  \
  (LIST)->aptr = ((LIST)->aptr + sizeof(double)-1) & -(long)sizeof(double),
#endif
#if defined(__hppa__)
#define __va_align_double(LIST)  \
  (LIST)->aptr = (LIST)->aptr & -(long)sizeof(double),
#endif

#if defined(__sparc__)
/* Beware against unaligned `double' accesses! */
#define va_arg_double(LIST)  \
  (__va_align_double(LIST)						\
   (LIST)->tmp._words[0] = ((__vaword*)((LIST)->aptr))[0],		\
   (LIST)->tmp._words[1] = ((__vaword*)((LIST)->aptr))[1],		\
   (LIST)->aptr += sizeof(double),					\
   (LIST)->tmp._double							\
  )
#endif
#if defined(__alpha__)
/* The first 6 floating point registers have been stored in another place. */
#define va_arg_double(LIST)  \
  (((LIST)->aptr += sizeof(double)) <= (LIST)->memargptr		\
   ? *(double*)((LIST)->aptr - sizeof(double) - 6*sizeof(double))	\
   : *(double*)((LIST)->aptr - sizeof(double))				\
  )
#define __va_arg_float(LIST)  \
  (((LIST)->aptr += sizeof(double)) <= (LIST)->memargptr		\
   ? /* The first 6 args have been put into memory by "stt" instructions */\
     /* (see vacall-alpha.s!). Therefore load them as doubles. */	\
     /* When viewed as floats, the value will be the correct one. */	\
     (float)*(double*)((LIST)->aptr - sizeof(double) - 6*sizeof(double)) \
   : /* These args have been put into memory by "sts" instructions, */	\
     /* therefore load them as floats. */				\
     *(float*)((LIST)->aptr - sizeof(double))				\
  )
#endif
#if defined(__hppa__)
/* The first 4 float registers and the first 2 double registers are stored
 * elsewhere.
 */
#if 1 /* gcc-2.5.2 passes these args in general registers! A bug, I think. */
#define __va_arg_float(LIST)  \
  (*(float*)((LIST)->aptr -= sizeof(float)))
#define va_arg_double(LIST)  \
  (__va_align_double(LIST)						\
   *(double*)((LIST)->aptr -= sizeof(double))				\
  )
#else /* this would be correct if the args were passed in float registers. */
#define __va_arg_float(LIST)  \
  (((LIST)->aptr -= sizeof(float)) >= (LIST)->memargptr			\
   ? /* The first 4 float args are stored separately. */		\
     *(float*)((LIST)->aptr + (LIST)->farg_offset)			\
   : *(float*)((LIST)->aptr)						\
  )
#define va_arg_double(LIST)  \
  (__va_align_double(LIST)						\
   (((LIST)->aptr -= sizeof(double)) >= (LIST)->memargptr		\
    ? /* The first 2 double args are stored separately. */		\
      *(double*)((LIST)->aptr + (LIST)->darg_offset)			\
    : *(double*)((LIST)->aptr)						\
  ))
#endif
#endif
#ifdef __mips__
/* The first 0,1,2 registers are stored elsewhere if they are floating-point
 * parameters.
 */
#define __va_arg_float(LIST)  \
  ((LIST)->aptr += sizeof(float),					\
   (LIST)->anum++,							\
   ((LIST)->anum == 1							\
    ? ((LIST)->flags |= __VA_FLOAT_1, (LIST)->farg[0])			\
    : ((LIST)->anum == 2 && ((LIST)->flags & __VA_FLOAT_1)		\
       ? (/* (LIST)->flags |= __VA_FLOAT_2, */ (LIST)->farg[1])		\
       : *(float*)((LIST)->aptr - sizeof(float))			\
  ))  )
#define va_arg_double(LIST)  \
  (__va_align_double(LIST)						\
   (LIST)->aptr += sizeof(double),					\
   (LIST)->anum++,							\
   ((LIST)->anum == 1							\
    ? ((LIST)->flags |= __VA_FLOAT_1, (LIST)->darg[0])			\
    : ((LIST)->anum == 2 && ((LIST)->flags & __VA_FLOAT_1)		\
       ? (/* (LIST)->flags |= __VA_FLOAT_2, */ (LIST)->darg[1])		\
       : *(double*)((LIST)->aptr - sizeof(double))			\
  ))  )
#endif
#ifdef __rs6000__
/* The first 13 floating-point args have been stored elsewhere. */
#define __va_arg_float(LIST)  \
  ((LIST)->aptr += sizeof(float),					\
   ((LIST)->memfargptr < &(LIST)->farg[13]				\
    ? (float) *((LIST)->memfargptr++)					\
    : *(float*)((LIST)->aptr - sizeof(float))				\
  ))
#define va_arg_double(LIST)  \
  (__va_align_double(LIST)						\
   (LIST)->aptr += sizeof(double),					\
   ((LIST)->memfargptr < &(LIST)->farg[13]				\
    ? *((LIST)->memfargptr++)						\
    : *(double*)((LIST)->aptr - sizeof(double))				\
  ))
#endif
#ifndef __va_arg_float
#define __va_arg_float(LIST)	__va_arg(LIST,float)
#endif
#ifndef va_arg_double
#define va_arg_double(LIST)  \
  (__va_align_double(LIST) __va_arg(LIST,double))
#endif

/* Pointer arguments. */
#define va_arg_ptr(LIST,TYPE)	__va_arg(LIST,TYPE)

/* Structure arguments. */
#define va_arg_struct(LIST,TYPE)  \
  *(TYPE*)__va_arg_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE))
/* _va_arg_struct() is like va_arg_struct(), except that you pass the type's
 * size and alignment instead of the type and get the value's address instead
 * of the value itself.
 */
#define _va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  (void*)__va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN)
#define __va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  (LIST)->aptr = ((LIST)->aptr + (TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN),
#if defined(__i386__) || defined(__m68k__) || defined(__alpha__) || defined(__arm__) || defined(__m88k__) || defined(__convex__)
#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN)				\
   __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN)				\
  )
#endif
#if defined(__mips__)
/* small structures < 1 word are adjusted depending on compiler */
#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN)				\
   ((LIST)->flags & __VA_SGICC_STRUCT_ARGS				\
    ? /* SGI MIPS cc passes small structures left-adjusted, although big-endian! */\
      __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)			\
    : /* SGI MIPS gcc passes small structures within the first four words left-	   \
       * adjusted, for compatibility with cc. But structures in memory are passed  \
       * right-adjusted!! See gcc-2.6.3/config/mips/mips.c:function_arg().	   \
       */									   \
      ((LIST)->aptr < (LIST)->memargptr					\
       ? __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)		\
       : __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)		\
  ))  )
#endif
#if defined(__rs6000__)
/* small structures < 1 word are adjusted depending on compiler */
#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN)				\
   ((LIST)->flags & __VA_AIXCC_STRUCT_ARGS				\
    ? /* AIX cc and xlc pass small structures left-adjusted, although big-endian! */\
      __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)			\
    : /* gcc passes small structures right-adjusted. */			\
      __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)			\
  ))
#endif
#if defined(__sparc__)
/* Structures are passed as pointers to caller-made local copies. */
#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  va_arg_ptr(LIST,void*)
#endif
#if defined(__hppa__)
/* Structures <= 8 bytes are passed as embedded copies on the arg stack.
 * Big structures are passed as pointers to caller-made local copies.
 */
#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN)  \
  ((TYPE_SIZE) > 8							\
   ? va_arg_ptr(LIST,void*)						\
   : /* FIXME: gcc-2.6.3 passes structures <= 4 bytes in memory left-adjusted! ?? */\
     (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)		\
  )
#endif


/*
 * Definition of the va_return_xxx macros.
 */
#define __va_return(LIST,RETTYPE)  \
  (((LIST)->rtype == (RETTYPE)) || __va_error1((LIST)->rtype,RETTYPE))
#define va_return_void(LIST)  \
  __va_return(LIST,__VAvoid)
#define va_return_char(LIST,VAL)  \
  (__va_return(LIST,__VAchar), (LIST)->tmp._char = (VAL))
#define va_return_schar(LIST,VAL)  \
  (__va_return(LIST,__VAschar), (LIST)->tmp._schar = (VAL))
#define va_return_uchar(LIST,VAL)  \
  (__va_return(LIST,__VAuchar), (LIST)->tmp._uchar = (VAL))
#define va_return_short(LIST,VAL)  \
  (__va_return(LIST,__VAshort), (LIST)->tmp._short = (VAL))
#define va_return_ushort(LIST,VAL)  \
  (__va_return(LIST,__VAushort), (LIST)->tmp._ushort = (VAL))
#define va_return_int(LIST,VAL)  \
  (__va_return(LIST,__VAint), (LIST)->tmp._int = (VAL))
#define va_return_uint(LIST,VAL)  \
  (__va_return(LIST,__VAuint), (LIST)->tmp._uint = (VAL))
#define va_return_long(LIST,VAL)  \
  (__va_return(LIST,__VAlong), (LIST)->tmp._long = (VAL))
#define va_return_ulong(LIST,VAL)  \
  (__va_return(LIST,__VAulong), (LIST)->tmp._ulong = (VAL))
#define va_return_float(LIST,VAL)  \
  (__va_return(LIST,__VAfloat), (LIST)->tmp._float = (VAL))
#define va_return_double(LIST,VAL)  \
  (__va_return(LIST,__VAdouble), (LIST)->tmp._double = (VAL))
#define va_return_ptr(LIST,TYPE,VAL)  \
  (__va_return(LIST,__VAvoidp), (LIST)->tmp._ptr = (void*)(TYPE)(VAL))
#define va_return_struct(LIST,TYPE,VAL)  \
  (__va_return(LIST,__VAstruct), *(TYPE*)((LIST)->raddr) = (VAL))
#define _va_return_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR)  \
  (__va_return(LIST,__VAstruct),					\
   __structcpy((void*)((LIST)->raddr),VAL_ADDR,TYPE_SIZE,TYPE_ALIGN)	\
  )


/* Determine whether a struct type is word-splittable, i.e. whether each of
 * its components fit into a register.
 * The entire computation is done at compile time.
 */
#define va_word_splittable_1(slot1)  \
  (__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword))
#define va_word_splittable_2(slot1,slot2)  \
  ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \
   && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \
  )
#define va_word_splittable_3(slot1,slot2,slot3)  \
  ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \
   && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \
   && (__va_offset3(slot1,slot2,slot3)/sizeof(__vaword) == (__va_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__vaword)) \
  )
#define va_word_splittable_4(slot1,slot2,slot3,slot4)  \
  ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \
   && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \
   && (__va_offset3(slot1,slot2,slot3)/sizeof(__vaword) == (__va_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__vaword)) \
   && (__va_offset4(slot1,slot2,slot3,slot4)/sizeof(__vaword) == (__va_offset4(slot1,slot2,slot3,slot4)+sizeof(slot4)-1)/sizeof(__vaword)) \
  )
#define __va_offset1(slot1)  \
  0
#define __va_offset2(slot1,slot2)  \
  ((__va_offset1(slot1)+sizeof(slot1)+__VA_alignof(slot2)-1) & -(long)__VA_alignof(slot2))
#define __va_offset3(slot1,slot2,slot3)  \
  ((__va_offset2(slot1,slot2)+sizeof(slot2)+__VA_alignof(slot3)-1) & -(long)__VA_alignof(slot3))
#define __va_offset4(slot1,slot2,slot3,slot4)  \
  ((__va_offset3(slot1,slot2,slot3)+sizeof(slot3)+__VA_alignof(slot4)-1) & -(long)__VA_alignof(slot4))


/*
 * Miscellaneous declarations.
 */
extern void vacall (); /* the return type is variable, not void! */
#if defined(__STDC__) || defined(__GNUC__)
extern void (* vacall_function) (va_alist);
extern int __va_error1 (enum __VAtype, enum __VAtype);
extern int __va_error2 (unsigned int);
extern void __structcpy (void* dest, void* src, unsigned long size, unsigned long alignment);
#else
extern void (* vacall_function) ();
extern int __va_error1 ();
extern int __va_error2 ();
extern void __structcpy ();
#endif
typedef union { __vaword room[__VA_ALIST_WORDS]; double align; } __va_struct_buffer_t;
extern __va_struct_buffer_t __va_struct_buffer;


#endif /* _VACALL_H */
