avcall.h.in
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:55k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. #ifndef _avcall_h /*-*- C -*-*/
  2. #define _avcall_h
  3. /**
  4.   Copyright 1993 Bill Triggs, <Bill.Triggs@inrialpes.fr>
  5.   Copyright 1995-2004 Bruno Haible, <bruno@clisp.org>
  6.   This is free software distributed under the GNU General Public
  7.   Licence described in the file COPYING. Contact the author if
  8.   you don't have this or can't live with it. There is ABSOLUTELY
  9.   NO WARRANTY, explicit or implied, on this software.
  10. **/
  11. /*----------------------------------------------------------------------
  12.   av_call() foreign function interface.
  13.   Varargs-style macros to build a C argument list incrementally
  14.   and call a function on it.
  15.  ----------------------------------------------------------------------*/
  16. /* These definitions are adjusted by `configure' automatically. */
  17. /* CPU */
  18. #ifndef __i386__
  19. #undef __i386__
  20. #endif
  21. #ifndef __m68k__
  22. #undef __m68k__
  23. #endif
  24. #ifndef __mips__
  25. #undef __mips__
  26. #endif
  27. #ifndef __mipsn32__
  28. #undef __mipsn32__
  29. #endif
  30. #ifndef __mips64__
  31. #undef __mips64__
  32. #endif
  33. #ifndef __sparc__
  34. #undef __sparc__
  35. #endif
  36. #ifndef __sparc64__
  37. #undef __sparc64__
  38. #endif
  39. #ifndef __alpha__
  40. #undef __alpha__
  41. #endif
  42. #ifndef __hppa__
  43. #undef __hppa__
  44. #endif
  45. #ifndef __arm__
  46. #undef __arm__
  47. #endif
  48. #ifndef __rs6000__
  49. #undef __rs6000__
  50. #endif
  51. #ifndef __s390__
  52. #undef __s390__
  53. #endif
  54. #ifndef __m88k__
  55. #undef __m88k__
  56. #endif
  57. #ifndef __convex__
  58. #undef __convex__
  59. #endif
  60. #ifndef __ia64__
  61. #undef __ia64__
  62. #endif
  63. #ifndef __x86_64__
  64. #undef __x86_64__
  65. #endif
  66. /* Calling convention */
  67. /* Define if using pcc non-reentrant struct return convention */
  68. #undef __PCC_STRUCT_RETURN__
  69. /* Define if small structs are returned in registers */
  70. #undef __SMALL_STRUCT_RETURN__
  71. /* Define if floating-point results are returned in the integer registers */
  72. #undef __IREG_FLOAT_RETURN__
  73. /* CL_LONGLONG */
  74. /* Define if your compiler supports the `long long' type. */
  75. #undef HAVE_LONGLONG
  76. /* End of definitions adjusted by `configure'. */
  77. /* Max # words in argument-list and temporary structure storage.
  78.  */
  79. #ifndef __AV_ALIST_WORDS
  80. #define __AV_ALIST_WORDS  256
  81. #endif
  82. /* Determine the alignment of a type at compile time.
  83.  */
  84. #if defined(__GNUC__)
  85. #define __AV_alignof __alignof__
  86. #else
  87. #if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) /* SGI compiler */
  88. #define __AV_alignof __builtin_alignof
  89. #else
  90. #define __AV_offsetof(type,ident)  ((unsigned long)&(((type*)0)->ident))
  91. #define __AV_alignof(type)  __AV_offsetof(struct { char __slot1; type __slot2; }, __slot2)
  92. #endif
  93. #endif
  94. /* C builtin types.
  95.  */
  96. #if defined(__mipsn32__)
  97. typedef long long __avword;
  98. #else
  99. typedef long __avword;
  100. #endif
  101. enum __AVtype
  102. {
  103.   __AVword,
  104.   __AVvoid,
  105.   __AVchar,
  106.   __AVschar,
  107.   __AVuchar,
  108.   __AVshort,
  109.   __AVushort,
  110.   __AVint,
  111.   __AVuint,
  112.   __AVlong,
  113.   __AVulong,
  114.   __AVlonglong,
  115.   __AVulonglong,
  116.   __AVfloat,
  117.   __AVdouble,
  118.   __AVvoidp,
  119.   __AVstruct
  120. };
  121. enum __AV_alist_flags
  122. {
  123.   /* how to return structs */
  124.   /* There are basically 3 ways to return structs:
  125.    * a. The called function returns a pointer to static data. Not reentrant.
  126.    * b. The caller passes the return structure address in a dedicated register
  127.    *    or as a first (or last), invisible argument. The called function stores
  128.    *    its result there.
  129.    * c. Like b, and the called function also returns the return structure
  130.    *    address in the return value register. (This is not very distinguishable
  131.    *    from b.)
  132.    * Independently of this,
  133.    * r. small structures (<= 4 or <= 8 bytes) may be returned in the return
  134.    *    value register(s), or
  135.    * m. even small structures are passed in memory.
  136.    */
  137.   /* gcc-2.6.3 employs the following strategy:
  138.    *   - If PCC_STATIC_STRUCT_RETURN is defined in the machine description
  139.    *     it uses method a, else method c.
  140.    *   - If flag_pcc_struct_return is set (either by -fpcc-struct-return or if
  141.    *     DEFAULT_PCC_STRUCT_RETURN is defined to 1 in the machine description)
  142.    *     it uses method m, else (either by -freg-struct-return or if
  143.    *     DEFAULT_PCC_STRUCT_RETURN is defined to 0 in the machine description)
  144.    *     method r.
  145.    */
  146.   __AV_PCC_STRUCT_RETURN = 1<<0, /* a: need to copy the struct */
  147.   __AV_SMALL_STRUCT_RETURN = 1<<1, /* r: special case for small structs */
  148.   __AV_GCC_STRUCT_RETURN = 1<<2, /* consider 8 byte structs as small */
  149. #if defined(__sparc__) && !defined(__sparc64__)
  150.   __AV_SUNCC_STRUCT_RETURN = 1<<3,
  151.   __AV_SUNPROCC_STRUCT_RETURN = 1<<4,
  152. #endif
  153. #if defined(__i386__)
  154.   __AV_NEXTGCC_STRUCT_RETURN = 1<<3,
  155.   __AV_MSVC_STRUCT_RETURN = 1<<4,
  156. #endif
  157. #if defined(__hppa__)
  158.   __AV_OLDGCC_STRUCT_RETURN = 1<<3,
  159. #endif
  160.   /* the default way to return structs */
  161.   /* This choice here is based on the assumption that the function you are
  162.    * going to call has been compiled with the same compiler you are using to
  163.    * include this file.
  164.    * If you want to call functions with another struct returning convention,
  165.    * just  #define __AV_STRUCT_RETURN ...
  166.    * before or after #including <avcall.h>.
  167.    */
  168. #ifndef __AV_STRUCT_RETURN
  169.   __AV_STRUCT_RETURN =
  170. #if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */
  171.   __AV_SUNPROCC_STRUCT_RETURN,
  172. #else
  173. #if defined(__PCC_STRUCT_RETURN__) /* defined through configure, see above */
  174.   __AV_PCC_STRUCT_RETURN |
  175. #if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && !(defined(__STDC__) || defined(__GNUC__)) /* sun cc */
  176.      __AV_SUNCC_STRUCT_RETURN,
  177. #else
  178.      0,
  179. #endif
  180. #else
  181. #if defined(__SMALL_STRUCT_RETURN__) || defined(__mipsn32__) || defined(__mips64__) /* defined through configure, see above */
  182.   __AV_SMALL_STRUCT_RETURN |
  183. #endif
  184. #if defined(__GNUC__)
  185.   __AV_GCC_STRUCT_RETURN |
  186. #endif
  187. #if defined(__i386__) && defined(NeXT) && defined(__GNUC__) /* NeXT gcc-2.5.8 */
  188.   __AV_NEXTGCC_STRUCT_RETURN |
  189. #endif
  190. #if defined(__i386__) && defined(_MSC_VER) /* MSVC 4.0 */
  191.   __AV_MSVC_STRUCT_RETURN |
  192. #endif
  193. #if defined(__hppa__) && defined(__GNUC__) && (__GNUC__ < 3) && (__GNUC_MINOR__ < 7)
  194.   __AV_OLDGCC_STRUCT_RETURN |
  195. #endif
  196.      0,
  197. #endif
  198. #endif
  199. #endif
  200.   /* how to return floats */
  201. #if defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__))
  202.   __AV_SUNCC_FLOAT_RETURN = 1<<5,
  203. #endif
  204. #if defined(__m68k__)
  205.   __AV_FREG_FLOAT_RETURN = 1<<6,
  206. #endif
  207.   /* the default way to return floats */
  208.   /* This choice here is based on the assumption that the function you are
  209.    * going to call has been compiled with the same compiler you are using to
  210.    * include this file.
  211.    * If you want to call functions with another float returning convention,
  212.    * just  #define __AV_FLOAT_RETURN ...
  213.    * before or after #including <avcall.h>.
  214.    */
  215. #ifndef __AV_FLOAT_RETURN
  216. #if (defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__))) && !defined(__GNUC__) && defined(sun) && !defined(__SUNPRO_C)  /* sun cc */
  217.   __AV_FLOAT_RETURN = __AV_SUNCC_FLOAT_RETURN,
  218. #elif (defined(__m68k__) && !defined(__IREG_FLOAT_RETURN__))
  219.   __AV_FLOAT_RETURN = __AV_FREG_FLOAT_RETURN,
  220. #else
  221.   __AV_FLOAT_RETURN = 0,
  222. #endif
  223. #endif
  224.   /* how to pass structs */
  225. #if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__)
  226.   __AV_SGICC_STRUCT_ARGS = 1<<7,
  227. #endif
  228. #if defined(__rs6000__)
  229.   __AV_AIXCC_STRUCT_ARGS = 1<<7,
  230. #endif
  231.   /* the default way to pass floats */
  232.   /* This choice here is based on the assumption that the function you are
  233.    * going to call has been compiled with the same compiler you are using to
  234.    * include this file.
  235.    * If you want to call functions with another float passing convention,
  236.    * just  #define __AV_STRUCT_ARGS ...
  237.    * before or after #including <avcall.h>.
  238.    */
  239. #ifndef __AV_STRUCT_ARGS
  240. #if (defined(__mips__) || defined(__mipsn32__) || defined(__mips64__)) && !defined(__GNUC__) /* SGI mips cc */
  241.   __AV_STRUCT_ARGS = __AV_SGICC_STRUCT_ARGS,
  242. #else
  243. #if defined(__rs6000__) && defined(_AIX) && !defined(__GNUC__) /* AIX cc, xlc */
  244.   __AV_STRUCT_ARGS = __AV_AIXCC_STRUCT_ARGS,
  245. #else
  246.   __AV_STRUCT_ARGS = 0,
  247. #endif
  248. #endif
  249. #endif
  250.   /* how to pass floats */
  251.   /* ANSI C compilers and GNU gcc pass floats as floats.
  252.    * K&R C compilers pass floats as doubles.
  253.    * (Except some compilers like SGI MIPS "cc" and "cc -cckr" if a prototype is
  254.    * known for the called functions. But to compile a program with prototypes,
  255.    * "cc -ansi" is better anyway.
  256.    */
  257.   __AV_ANSI_FLOAT_ARGS = 0,    /* pass floats as floats */
  258.   __AV_TRADITIONAL_FLOAT_ARGS = 1<<8, /* pass floats as doubles */
  259.   /* the default way to pass floats */
  260.   /* This choice here is based on the assumption that the function you are
  261.    * going to call has been compiled with the same compiler you are using to
  262.    * include this file.
  263.    * If you want to call functions with another float passing convention,
  264.    * just  #define __AV_FLOAT_ARGS ...
  265.    * before or after #including <avcall.h>.
  266.    */
  267. #ifndef __AV_FLOAT_ARGS
  268. #if defined(__STDC__) || defined(__GNUC__) /* what about hppa "cc -Aa" ?? */
  269.   __AV_FLOAT_ARGS = __AV_ANSI_FLOAT_ARGS,
  270. #else
  271.   __AV_FLOAT_ARGS = __AV_TRADITIONAL_FLOAT_ARGS,
  272. #endif
  273. #endif
  274.   /* how to pass and return small integer arguments */
  275.   __AV_ANSI_INTEGERS = 0, /* no promotions */
  276.   __AV_TRADITIONAL_INTEGERS = 0, /* promote [u]char, [u]short to [u]int */
  277.   /* Fortunately these two methods are compatible. Our macros work with both. */
  278.   /* the default way to pass and return small integer arguments */
  279.   /* This choice here is based on the assumption that the function you are
  280.    * going to call has been compiled with the same compiler you are using to
  281.    * include this file.
  282.    * If you want to call functions with another float passing convention,
  283.    * just  #define __AV_INTEGERS ...
  284.    * before or after #including <avcall.h>.
  285.    */
  286. #ifndef __AV_INTEGERS
  287. #if defined(__STDC__) || defined(__GNUC__)
  288.   __AV_INTEGERS = __AV_ANSI_INTEGERS,
  289. #else
  290.   __AV_INTEGERS = __AV_TRADITIONAL_INTEGERS,
  291. #endif
  292. #endif
  293.   /* stack cleanup policy */
  294.   __AV_CDECL_CLEANUP = 0, /* caller pops args after return */
  295.   __AV_STDCALL_CLEANUP = 0, /* callee pops args before return */
  296.      /* currently only supported on __i386__ */
  297. #ifndef __AV_CLEANUP
  298.   __AV_CLEANUP = __AV_CDECL_CLEANUP,
  299. #endif
  300.   /* These are for internal use only */
  301. #if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__)
  302.   __AV_REGISTER_STRUCT_RETURN = 1<<9,
  303. #endif
  304. #if defined(__mips__) && !defined(__mipsn32__)
  305.   __AV_FLOAT_1 = 1<<10,
  306.   __AV_FLOAT_2 = 1<<11,
  307. #endif
  308.   __AV_flag_for_broken_compilers_that_dont_like_trailing_commas
  309. };
  310. typedef struct
  311. {
  312.   /* function to be called */
  313.   __avword (*func)();
  314.   /* some av_... macros need these flags */
  315.   int flags;
  316.   /* return type, address for the result */
  317.   void* raddr;
  318.   enum __AVtype rtype;
  319.   unsigned long rsize;
  320.   /* current pointer into the args[] array */
  321.   __avword* aptr;
  322. #if defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || (defined(__rs6000__) && !defined(_AIX) && !(defined(__MACH__) && defined(__APPLE__))) || defined(__s390__)
  323.   /* limit pointer into the args[] array */
  324.   __avword* eptr;
  325. #endif
  326. #if defined(__i386__) && 0
  327.   /* Filler word, needed if the numbers of words up to now in this structure */
  328.   /* is odd (because on MSVC, alignof(double) = 8, normally = 4).            */
  329.   __avword filler1;
  330. #endif
  331. #if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__s390__)
  332.   /* temporary storage, used to split doubles into two words */
  333.   union {
  334.     double _double;
  335. #if defined(__sparc__) && !defined(__sparc64__) && defined(HAVE_LONGLONG)
  336.     long long _longlong;
  337. #endif
  338.     __avword words[2];
  339.   } tmp;
  340. #endif
  341. #if defined(__x86_64__)
  342.   /* store the integer arguments in an extra array */
  343.   __avword* iaptr;
  344.   __avword iargs[6];
  345. #endif
  346. #if defined(__mips__) && !defined(__mipsn32__)
  347.   /* store the floating-point arguments in an extra array */
  348.   int anum;
  349.   double floatarg[2];
  350. #endif
  351. #if defined(__mipsn32__) || defined(__mips64__)
  352.   /* store the floating-point arguments in an extra array */
  353.   int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */
  354.   unsigned int farg_mask; /* bitmask of those entries in farg[] which have a value */
  355.   unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */
  356.   float farg[8];
  357. #endif
  358. #if defined(__sparc64__)
  359.   /* store the floating-point arguments in an extra array */
  360.   int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */
  361.   unsigned int farg_mask; /* bitmask of those entries in farg[] which have a value */
  362.   unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */
  363. #endif
  364. #if defined(__ia64__) || defined(__x86_64__)
  365.   /* store the floating-point arguments in an extra array */
  366.   double* faptr;
  367.   double fargs[8];
  368. #endif
  369.   __avword args[__AV_ALIST_WORDS]; /* sizeof(double)-aligned */
  370. #if defined(__rs6000__)
  371.   /* store the floating-point arguments in an extra array */
  372.   double* faptr;
  373.   double fargs[13];
  374. #endif
  375. #if defined(__s390__)
  376.   /* store the floating-point arguments in an extra array */
  377.   int    fargwords;
  378.   float* faptr;
  379.   float  fargs[2];
  380.   int* fargsusedptr;
  381.   int fargsused[2];
  382.   double* daptr;
  383.   double dargs[2];
  384.   int* dargsusedptr;
  385.   int dargsused[2];
  386. #endif
  387. #if defined(AMIGA)
  388.   /* store the arguments passed in registers in an extra array */
  389.   __avword regargs[8+7];
  390. #endif
  391. } av_alist;
  392. /* The limit for the pointer into the args[] array. */
  393. #if defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || (defined(__rs6000__) && !defined(_AIX) && !(defined(__MACH__) && defined(__APPLE__))) || defined(__s390)
  394. #define __av_eptr(LIST) ((LIST).eptr)
  395. #else
  396. #define __av_eptr(LIST) (&(LIST).args[__AV_ALIST_WORDS])
  397. #endif
  398. /* Delayed overflow detection */
  399. #if defined(__hppa__)
  400. #define av_overflown(LIST) ((LIST).aptr < __av_eptr(LIST))
  401. #else
  402. #define av_overflown(LIST) ((LIST).aptr > __av_eptr(LIST))
  403. #endif
  404. /*
  405.  *  av_start_<type> macros which specify the return type
  406.  */
  407. #define __AV_START_FLAGS  
  408.   __AV_STRUCT_RETURN | __AV_FLOAT_RETURN | __AV_STRUCT_ARGS | __AV_FLOAT_ARGS | __AV_INTEGERS | __AV_CLEANUP
  409. #define __av_start(LIST,FUNC,RADDR,RETTYPE)
  410.   ((LIST).func = (__avword(*)())(FUNC),
  411.    (LIST).raddr = (void*)(RADDR),
  412.    (LIST).rtype = (RETTYPE),
  413.    __av_start1(LIST)
  414.    (LIST).flags = __AV_START_FLAGS)
  415. #if defined(__i386__) || defined(__m68k__) || defined(__alpha__) || defined(__arm__) || defined(__m88k__) || defined(__convex__)
  416. #define __av_start1(LIST)
  417.    (LIST).aptr = &(LIST).args[0],
  418. #endif
  419. #if defined(__mips__) && !defined(__mipsn32__)
  420. #define __av_start1(LIST)
  421.    (LIST).anum = 0,
  422.    (LIST).aptr = &(LIST).args[0],
  423. #endif
  424. #if defined(__mipsn32__) || defined(__mips64__)
  425. #define __av_start1(LIST)
  426.    (LIST).anum = 0,
  427.    (LIST).farg_mask = 0,
  428.    (LIST).darg_mask = 0,
  429.    (LIST).aptr = &(LIST).args[0],
  430. #endif
  431. #if defined(__sparc__) && !defined(__sparc64__)
  432. #define __av_start1(LIST)
  433.    (LIST).aptr = &(LIST).args[0],
  434.    (LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
  435. #endif
  436. #if defined(__sparc64__)
  437. #define __av_start1(LIST)
  438.    (LIST).anum = 0,
  439.    (LIST).farg_mask = 0,
  440.    (LIST).darg_mask = 0,
  441.    (LIST).aptr = &(LIST).args[0],
  442.    (LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
  443. #endif
  444. #if defined(__hppa__)
  445. #define __av_start1(LIST)
  446.    (LIST).aptr = &(LIST).args[__AV_ALIST_WORDS],
  447.    (LIST).eptr = &(LIST).args[0],
  448. #endif
  449. #if defined(__rs6000__)
  450. #if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__))
  451. #define __av_start1(LIST)
  452.    (LIST).aptr = &(LIST).args[0],
  453.    (LIST).faptr = &(LIST).fargs[0],
  454. #else
  455. #define __av_start1(LIST)
  456.    (LIST).aptr = &(LIST).args[0],
  457.    (LIST).faptr = &(LIST).fargs[0],                                     
  458.    (LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
  459. #endif
  460. #endif
  461. #if defined(__s390__)
  462. #define __av_start1(LIST)
  463.    (LIST).aptr = &(LIST).args[0],
  464.    (LIST).fargwords = 0,
  465.    (LIST).faptr = &(LIST).fargs[0],                                     
  466.    (LIST).daptr = &(LIST).dargs[0],                                     
  467.    (LIST).fargsusedptr = &(LIST).fargsused[0],                          
  468.    (LIST).dargsusedptr = &(LIST).dargsused[0],                          
  469.    (LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
  470. #endif
  471. #if defined(__ia64__)
  472. #define __av_start1(LIST)
  473.    (LIST).aptr = &(LIST).args[0],
  474.    (LIST).faptr = &(LIST).fargs[0],
  475. #endif
  476. #if defined(__x86_64__)
  477. #define __av_start1(LIST)
  478.    (LIST).aptr = &(LIST).args[0],
  479.    (LIST).iaptr = &(LIST).iargs[0],
  480.    (LIST).faptr = &(LIST).fargs[0],
  481. #endif
  482. #define av_start_void(LIST,FUNC) __av_start(LIST,FUNC,0,    __AVvoid)
  483. #define av_start_char(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVchar)
  484. #define av_start_schar(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVschar)
  485. #define av_start_uchar(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVuchar)
  486. #define av_start_short(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVshort)
  487. #define av_start_ushort(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVushort)
  488. #define av_start_int(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVint)
  489. #define av_start_uint(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVuint)
  490. #define av_start_long(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVlong)
  491. #define av_start_ulong(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVulong)
  492. #define av_start_longlong(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVlonglong)
  493. #define av_start_ulonglong(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVulonglong)
  494. #define av_start_float(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVfloat)
  495. #define av_start_double(LIST,FUNC,RADDR) __av_start(LIST,FUNC,RADDR,__AVdouble)
  496. #define av_start_ptr(LIST,FUNC,TYPE,RADDR) __av_start(LIST,FUNC,RADDR,__AVvoidp)
  497. #define av_start_struct(LIST,FUNC,TYPE,TYPE_SPLITTABLE,RADDR)
  498.   _av_start_struct(LIST,FUNC,sizeof(TYPE),TYPE_SPLITTABLE,RADDR)
  499. #define _av_start_struct(LIST,FUNC,TYPE_SIZE,TYPE_SPLITTABLE,RADDR)
  500.   (__av_start(LIST,FUNC,RADDR,__AVstruct),
  501.    (LIST).rsize = TYPE_SIZE,
  502.    __av_start_struct1(LIST,TYPE_SIZE,TYPE_SPLITTABLE),
  503.    0)
  504. #define __av_start_struct1(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  505.   ((LIST).flags & __AV_PCC_STRUCT_RETURN
  506.    ? /* pcc struct return convention:
  507.       * called function returns pointer to value, we'll copy its contents afterwards. 
  508.       */
  509.      0
  510.    : __av_start_struct2(LIST,TYPE_SIZE,TYPE_SPLITTABLE)
  511.   )
  512. #if (defined(__sparc__) && !defined(__sparc64__)) || defined(__m88k__)
  513. /* Return structure pointer is passed in a special register.
  514.  */
  515. #define __av_start_struct2(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  0
  516. #else
  517. #define __av_start_struct2(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  518.   (((LIST).flags & __AV_SMALL_STRUCT_RETURN)
  519.    && __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)
  520.    ? /* <= Word-sized structures are returned in a register. */
  521.      __av_start_struct3(LIST)
  522.    : __av_start_struct4(LIST,TYPE_SIZE)
  523.   )
  524. /* Determines whether a structure is returned in registers,
  525.  * depending on its size and its word-splittable flag.
  526.  */
  527. #if (defined(__i386__) && defined(_WIN32))
  528. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  529.   ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4
  530.    || ((TYPE_SIZE) == 8
  531.        && (((LIST).flags & __AV_MSVC_STRUCT_RETURN)
  532.            || ((TYPE_SPLITTABLE)
  533.                && ((LIST).flags & __AV_GCC_STRUCT_RETURN)
  534.   )   )   )   )
  535. /* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
  536.  * and the struct will actually be returned in registers.
  537.  */
  538. #define __av_start_struct3(LIST)  
  539.   ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
  540. #endif
  541. #if (defined(__i386__) && !defined(_WIN32)) || defined(__m68k__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__s390__)
  542. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  543.   ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4
  544.    || ((TYPE_SIZE) == 8 && (TYPE_SPLITTABLE)
  545.        && ((LIST).flags & __AV_GCC_STRUCT_RETURN)
  546.   )   )
  547. /* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
  548.  * and the struct will actually be returned in registers.
  549.  */
  550. #define __av_start_struct3(LIST)  
  551.   ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
  552. #endif
  553. #if defined(__alpha__)
  554. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  555.   ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8
  556.    || ((TYPE_SIZE) == 16 && (TYPE_SPLITTABLE)
  557.        && ((LIST).flags & __AV_GCC_STRUCT_RETURN)
  558.   )   )
  559. /* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
  560.  * and the struct will actually be returned in registers.
  561.  */
  562. #define __av_start_struct3(LIST)  
  563.   ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
  564. #endif
  565. #if defined(__hppa__)
  566. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  567.   ((LIST).flags & __AV_OLDGCC_STRUCT_RETURN
  568.    ? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4)
  569.    : ((TYPE_SIZE) <= 8)
  570.   )
  571. /* Test both __AV_OLDGCC_STRUCT_RETURN and __AV_SMALL_STRUCT_RETURN at run time. */
  572. #define __av_start_struct3(LIST)  
  573.   0
  574. #endif
  575. #if defined(__mips__) && !defined(__mipsn32__)
  576. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  577.   ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4)
  578. /* Test __AV_SMALL_STRUCT_RETURN instead of __AV_REGISTER_STRUCT_RETURN. */
  579. #define __av_start_struct3(LIST)  
  580.   0
  581. #endif
  582. #if defined(__mipsn32__) || defined(__mips64__)
  583. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  584.   ((LIST).flags & __AV_GCC_STRUCT_RETURN
  585.    ? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8) 
  586.    : ((TYPE_SIZE) <= 16)
  587.   )
  588. /* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
  589.  * and the struct will actually be returned in registers.
  590.  */
  591. #define __av_start_struct3(LIST)  
  592.   ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
  593. #endif
  594. #if defined(__sparc64__) || defined(__ia64__)
  595. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  596.   ((TYPE_SIZE) <= 32)
  597. /* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
  598.  * and the struct will actually be returned in registers.
  599.  */
  600. #define __av_start_struct3(LIST)  
  601.   ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
  602. #endif
  603. #if defined(__x86_64__)
  604. #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE)  
  605.   ((TYPE_SIZE) <= 16)
  606. /* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
  607.  * and the struct will actually be returned in registers.
  608.  */
  609. #define __av_start_struct3(LIST)  
  610.   ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
  611. #endif
  612. #if defined(__i386__)
  613. /* Return structure pointer is passed in a special register or as first arg. */
  614. #define __av_start_struct4(LIST,TYPE_SIZE)
  615.   ((LIST).flags & __AV_NEXTGCC_STRUCT_RETURN
  616.    ? 0  /* special register */
  617.    : (*(LIST).aptr++ = (__avword)((LIST).raddr), 0) /* first arg */
  618.   )
  619. #endif
  620. #if defined(__m68k__) || defined(__hppa__) || defined(__ia64__)
  621. /* Return structure pointer is passed in a special register.
  622.  */
  623. #define __av_start_struct4(LIST,TYPE_SIZE)  0
  624. #endif
  625. /* Return structure pointer is passed as first arg.
  626.  */
  627. #if defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__s390__)
  628. #define __av_start_struct4(LIST,TYPE_SIZE)
  629.    (*(LIST).aptr++ = (__avword)((LIST).raddr), 0)
  630. #endif
  631. #if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__)
  632. #define __av_start_struct4(LIST,TYPE_SIZE)
  633.    (*(LIST).aptr++ = (__avword)((LIST).raddr),
  634.     (LIST).anum++,
  635.     0
  636.    )
  637. #endif
  638. #if defined(__x86_64__)
  639. #define __av_start_struct4(LIST,TYPE_SIZE)
  640.    (*(LIST).iaptr++ = (__avword)((LIST).raddr), 0)
  641. #endif
  642. #endif
  643. /*
  644.  * av_<type> macros which specify the argument and its type
  645.  */
  646. /*
  647.  * scalar argument types
  648.  */
  649. #if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__)
  650. /* Floats and all integer types are passed as words,
  651.  * doubles as two words.
  652.  */
  653. #define __av_word(LIST,VAL)
  654.   (++(LIST).aptr > __av_eptr(LIST)
  655.    ? -1 : ((LIST).aptr[-1] = (__avword)(VAL), 0))
  656. #endif
  657. #if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__)
  658. /* Most things are passed as integers:
  659.  */
  660. #define __av_word(LIST,VAL)
  661.   (++(LIST).aptr > __av_eptr(LIST)
  662.    ? -1 : ((LIST).anum++, (LIST).aptr[-1] = (__avword)(VAL), 0))
  663. #endif
  664. #if defined(__hppa__)
  665. /* Floats and all integer types are passed as words,
  666.  * doubles as two words.
  667.  */
  668. #define __av_word(LIST,VAL)
  669.   (--(LIST).aptr < __av_eptr(LIST)
  670.    ? -1 : (*(LIST).aptr = (__avword)(VAL), 0))
  671. #endif
  672. #if defined(AMIGA)
  673. /* Some arguments are passed in registers. Query the macro AV_ARG_REGNUM.
  674.  * This should really be an argument to __av_word.
  675.  */
  676. #undef __av_word /**/
  677. #define __av_word(LIST,VAL)
  678.   ((AV_ARG_REGNUM) >= 0
  679.    ? ((AV_ARG_REGNUM) < 8+7
  680.       ? -1 : ((LIST).regargs[(AV_ARG_REGNUM)] = (__avword)(VAL), 0))
  681.    : (++(LIST).aptr > __av_eptr(LIST)
  682.       ? -1 : ((LIST).aptr[-1] = (__avword)(VAL), 0)))
  683. #endif
  684. /* integer argument types */
  685. #if defined(__x86_64__)
  686. /* The first 6 integer arguments are passed in registers. */
  687. #define av_long(LIST,VAL)
  688.   ((LIST).iaptr < &(LIST).iargs[6]
  689.    ? (*(LIST).iaptr++ = (long)(VAL), 0)
  690.    : __av_word(LIST,(long)(VAL)))
  691. #else
  692. #define av_long(LIST,VAL) __av_word(LIST,(long)(VAL))
  693. #endif
  694. #if defined(__x86_64__)
  695. /* The first 6 integer arguments are passed in registers. */
  696. #define av_ulong(LIST,VAL)
  697.   ((LIST).iaptr < &(LIST).iargs[6]
  698.    ? (*(LIST).iaptr++ = (unsigned long)(VAL), 0)
  699.    : __av_word(LIST,(unsigned long)(VAL)))
  700. #else
  701. #define av_ulong(LIST,VAL) __av_word(LIST,(unsigned long)(VAL))
  702. #endif
  703. #if defined(__x86_64__)
  704. /* The first 6 integer arguments are passed in registers. */
  705. #define av_ptr(LIST,TYPE,VAL)
  706.   ((LIST).iaptr < &(LIST).iargs[6]
  707.    ? (*(LIST).iaptr++ = (__avword)(TYPE)(VAL), 0)
  708.    : __av_word(LIST,(TYPE)(VAL)))
  709. #else
  710. #define av_ptr(LIST,TYPE,VAL) __av_word(LIST,(TYPE)(VAL))
  711. #endif
  712. #define av_char av_long
  713. #define av_schar av_long
  714. #define av_short av_long
  715. #define av_int av_long
  716. #define av_uchar av_ulong
  717. #define av_ushort av_ulong
  718. #define av_uint av_ulong
  719. #if defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__ia64__) || defined(__x86_64__)
  720. /* `long long' and `long' are identical. */
  721. #define av_longlong av_long
  722. #define av_ulonglong av_ulong
  723. #elif defined(__mipsn32__)
  724. /* `long long' fits in __avword. */
  725. #define av_longlong __av_word
  726. #define av_ulonglong(LIST,VAL) __av_word(LIST,(unsigned long long)(VAL))
  727. #elif defined(__i386__) || defined(__m68k__) || defined(__mips__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__) || defined(__s390__)
  728. /* `long long's are passed embedded on the arg stack. */
  729. #define av_longlong(LIST,VAL) __av_longlong(LIST,long long,VAL)
  730. #define av_ulonglong(LIST,VAL) __av_longlong(LIST,unsigned long long,VAL)
  731. #if defined(__i386__) || defined(__m68k__) || defined(__arm__) || (defined(__rs6000__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__convex__)
  732. /* `long long's are (at most) word-aligned. */
  733. #define __av_longlong(LIST,TYPE,VAL)
  734.   (((LIST).aptr += sizeof(TYPE)/sizeof(__avword)) > __av_eptr(LIST)
  735.    ? -1 : (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
  736. #endif
  737. #if defined(__mips__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || (defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__) || defined(__s390__)
  738. /* `long long's have alignment 8. */
  739. #if defined(__mips__)
  740. #define __av_longlong(LIST,TYPE,VAL)
  741.   (((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) 
  742.    ? -1 : ((LIST).anum++, ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
  743. #endif
  744. #if defined(__sparc__) && !defined(__sparc64__)
  745. /* Within the arg stack, the alignment is only 4, not 8. */
  746. /* This assumes sizeof(long long) == 2*sizeof(__avword). */
  747. #define __av_longlong(LIST,TYPE,VAL)
  748.   (((LIST).aptr += sizeof(TYPE)/sizeof(__avword)) > __av_eptr(LIST)
  749.    ? -1 :
  750.    ((LIST).tmp._longlong = (TYPE)(VAL),
  751.     (LIST).aptr[-2] = (LIST).tmp.words[0],
  752.     (LIST).aptr[-1] = (LIST).tmp.words[1],
  753.     0))
  754. #endif
  755. #if defined(__hppa__)
  756. #define __av_longlong(LIST,TYPE,VAL)
  757.   (((LIST).aptr = (__avword*)(((__avword)(LIST).aptr & -(long)__AV_alignof(TYPE)) - sizeof(TYPE))) < __av_eptr(LIST) 
  758.    ? -1 : (*(TYPE*)(LIST).aptr = (TYPE)(VAL), 0))
  759. #endif
  760. #if (defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__)
  761. #define __av_longlong(LIST,TYPE,VAL)
  762.   (((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) 
  763.    ? -1 : (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
  764. #endif
  765. #if defined(__s390__)
  766. #define __av_longlong(LIST,TYPE,VAL)
  767.   (((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) 
  768.    ? -1 :
  769.    (((LIST).aptr - (LIST).args - (LIST).fargwords == 4 ? ++(LIST).aptr,0 : 0), 
  770.     (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0)))
  771. #endif
  772. #endif
  773. #endif
  774. /* floating-point argument types */
  775. #define av_float(LIST,VAL)
  776.   ((LIST).flags & __AV_TRADITIONAL_FLOAT_ARGS
  777.    ? av_double(LIST,(float)(VAL))
  778.    : __av_float(LIST,VAL))
  779. #if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__arm__) || defined(__convex__)
  780. #define __av_float(LIST,VAL)
  781.   (++(LIST).aptr > __av_eptr(LIST)
  782.    ? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0))
  783. /* This assumes sizeof(double) == 2*sizeof(__avword). */
  784. #define av_double(LIST,VAL)
  785.    (((LIST).aptr += 2) > __av_eptr(LIST)
  786.     ? -1 :
  787.     ((LIST).tmp._double = (double)(VAL),
  788.      (LIST).aptr[-2] = (LIST).tmp.words[0],
  789.      (LIST).aptr[-1] = (LIST).tmp.words[1],
  790.      0))
  791. #endif
  792. #if defined(__mips__) && !defined(__mipsn32__)
  793. /* Up to 2 leading float or double non-varargs args can be passed in
  794.  * float registers, but we also push them into the corresponding int
  795.  * registers in case of varargs. For doubles we need to align the aptr
  796.  * to an even boundary.
  797.  */
  798. #define __av_float(LIST,VAL)
  799.   (++(LIST).aptr > __av_eptr(LIST)
  800.    ? -1 : ((++(LIST).anum == 1
  801.     ? ((LIST).flags |= __AV_FLOAT_1,
  802.        ((float*)(LIST).floatarg)[1] = ((float*)(LIST).aptr)[-1] = (float)(VAL))
  803.     : (LIST).anum == 2 && ((LIST).flags & __AV_FLOAT_1)
  804.     ? ((LIST).flags |= __AV_FLOAT_2,
  805.        ((float*)(LIST).floatarg)[3] = ((float*)(LIST).aptr)[-1] = (float)(VAL))
  806.     : (*(float*)&(LIST).aptr[-1] = (float)(VAL))),
  807.    0))
  808. #define av_double(LIST,VAL)
  809.   (((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+15)&-8))
  810.    > __av_eptr(LIST)
  811.    ? -1 : ((++(LIST).anum == 1
  812.     ? ((LIST).flags |= __AV_FLOAT_1,
  813.        (LIST).floatarg[0] = ((double*)(LIST).aptr)[-1] = (double)(VAL))
  814.     : (LIST).anum == 2 && ((LIST).flags & __AV_FLOAT_1)
  815.     ? ((LIST).flags |= __AV_FLOAT_2,
  816.        (LIST).floatarg[1] = ((double*)(LIST).aptr)[-1] = (double)(VAL))
  817.     : (((double*)(LIST).aptr)[-1] = (double)(VAL))),
  818.    0))
  819. #endif
  820. #if defined(__mipsn32__) || defined(__mips64__)
  821. /* Up to 8 leading float or double non-varargs args can be passed in
  822.  * float registers, but we also push them into the corresponding int
  823.  * registers in case of varargs.
  824.  */
  825. #define __av_float(LIST,VAL)
  826.   ((LIST).aptr >= __av_eptr(LIST)
  827.    ? -1 : (((LIST).anum < 8
  828.     ? ((LIST).farg_mask |= (1 << (LIST).anum),
  829.        (LIST).farg[(LIST).anum] = *(float*)(LIST).aptr = (float)(VAL)) 
  830.     : (*(float*)(LIST).aptr = (float)(VAL))),
  831.    (LIST).anum++,
  832.    (LIST).aptr++,
  833.    0))
  834. #define av_double(LIST,VAL)
  835.   ((LIST).aptr >= __av_eptr(LIST)
  836.    ? -1 : (((LIST).anum < 8 && ((LIST).darg_mask |= (1 << (LIST).anum))), 
  837.    *(double*)(LIST).aptr = (double)(VAL),
  838.    (LIST).anum++,
  839.    (LIST).aptr++,
  840.    0))
  841. #endif
  842. #if defined(__sparc64__)
  843. /* Up to 16 leading float or double non-varargs args can be passed in
  844.  * float registers, but we also push them into the corresponding int
  845.  * registers in case of varargs.
  846.  */
  847. #define __av_float(LIST,VAL)
  848.   ((LIST).aptr >= __av_eptr(LIST)
  849.    ? -1 : (((LIST).anum < 16 && ((LIST).farg_mask |= (1 << (LIST).anum))), 
  850.    (*(float*)(LIST).aptr = (float)(VAL)),
  851.    (LIST).anum++,
  852.    (LIST).aptr++,
  853.    0))
  854. #define av_double(LIST,VAL)
  855.   ((LIST).aptr >= __av_eptr(LIST)
  856.    ? -1 : (((LIST).anum < 16 && ((LIST).darg_mask |= (1 << (LIST).anum))), 
  857.    *(double*)(LIST).aptr = (double)(VAL),
  858.    (LIST).anum++,
  859.    (LIST).aptr++,
  860.    0))
  861. #endif
  862. #if defined(__alpha__)
  863. #define av_double(LIST,VAL)
  864.   (++(LIST).aptr > __av_eptr(LIST)
  865.    ? -1 : (((double*)(LIST).aptr)[-1] = (double)(VAL), 0))
  866. #define __av_float(LIST,VAL)
  867.   (++(LIST).aptr > __av_eptr(LIST)
  868.    ? -1
  869.    : (((LIST).aptr > &(LIST).args[6]
  870.        ? /* These args will be fetched from memory using "lds" instructions */ 
  871.  /* therefore store them as floats */
  872.  (*(float*)((LIST).aptr-1) = (float)(VAL))
  873.        : /* The first 6 args will be put into registers by "ldt" instructions */ 
  874.  /* (see avcall-alpha.c!). Therefore store them as doubles. */
  875.  /* When viewed as floats, the value will be the correct one. */
  876.  (*(double*)((LIST).aptr-1) = (double)(float)(VAL))
  877.      ), 0))
  878. #endif
  879. #if defined(__hppa__)
  880. #define __av_float(LIST,VAL)
  881.   (--(LIST).aptr < __av_eptr(LIST)
  882.    ? -1 : (*(float*)(LIST).aptr = (float)(VAL), 0))
  883. #define av_double(LIST,VAL)
  884.   (((LIST).aptr = (__avword*)(((long)(LIST).aptr-sizeof(double)) & -(long)sizeof(double))) 
  885.     < __av_eptr(LIST)
  886.     ? -1 : (*(double*)(LIST).aptr = (double)(VAL), 0))
  887. #endif
  888. #if defined(__rs6000__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))
  889. /* Up to 13 float or double non-varargs args can be passed in
  890.  * float registers, but we also push them into the corresponding int
  891.  * registers in case of varargs.
  892.  */
  893. #define __av_float(LIST,VAL)
  894.   (++(LIST).aptr > __av_eptr(LIST)
  895.    ? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL),
  896.    (LIST).faptr < &(LIST).fargs[13] &&
  897. (*(LIST).faptr++ = (double)(float)(VAL)),
  898.    0))
  899. #define av_double(LIST,VAL)
  900.    (((LIST).aptr += 2) > __av_eptr(LIST)
  901.     ? -1 :
  902.     ((LIST).tmp._double = (double)(VAL),
  903.      (LIST).aptr[-2] = (LIST).tmp.words[0],
  904.      (LIST).aptr[-1] = (LIST).tmp.words[1],
  905.      (LIST).faptr < &(LIST).fargs[13] &&
  906. (*(LIST).faptr++ = (LIST).tmp._double),
  907.      0))
  908. #endif
  909. #if defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))
  910. /* Up to 8 float or double non-varargs args can be passed in
  911.  * float registers, without occupying space in the general registers.
  912.  */
  913. #define __av_float(LIST,VAL)
  914.   ((LIST).faptr < &(LIST).fargs[8]
  915.    ? ((*(LIST).faptr++ = (double)(float)(VAL)), 0)
  916.    : (++(LIST).aptr > __av_eptr(LIST)
  917.       ? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0)))
  918. #define av_double(LIST,VAL)
  919.   ((LIST).faptr < &(LIST).fargs[8]
  920.    ? ((*(LIST).faptr++ = (double)(VAL)), 0)
  921.    : (((LIST).aptr += 2) > __av_eptr(LIST)
  922.       ? -1 :
  923.       ((LIST).tmp._double = (double)(VAL),
  924.        (LIST).aptr[-2] = (LIST).tmp.words[0],
  925.        (LIST).aptr[-1] = (LIST).tmp.words[1],
  926.        0)))
  927. #endif
  928. #if defined(__s390__)
  929. /* Up to 2 float or double non-varargs args can be passed in
  930.  * float registers, without occupying space in the general registers.
  931.  */
  932. #define __av_float(LIST,VAL)
  933.   ((LIST).faptr < &(LIST).fargs[2]
  934.    ? (LIST).daptr++, *(LIST).fargsusedptr++ = 1, *(LIST).dargsusedptr++ = 0, ((*(LIST).faptr++ = (float)(VAL)), 0)
  935.    : (++(LIST).aptr > __av_eptr(LIST)
  936.       ? -1 : ((LIST).fargwords++, ((float*)(LIST).aptr)[-1] = (float)(VAL), 0)))
  937. #define av_double(LIST,VAL)
  938.   ((LIST).daptr < &(LIST).dargs[2]
  939.    ? (LIST).faptr++, *(LIST).dargsusedptr++ = 1, *(LIST).fargsusedptr++ = 0, ((*(LIST).daptr++ = (double)(VAL)), 0)
  940.    : (((LIST).aptr += 2) > __av_eptr(LIST)
  941.       ? -1 :
  942.       ((LIST).fargwords+=2, (LIST).tmp._double = (double)(VAL),
  943.        (LIST).aptr[-2] = (LIST).tmp.words[0],
  944.        (LIST).aptr[-1] = (LIST).tmp.words[1],
  945.        0)))
  946. #endif
  947. #if defined(__m88k__)
  948. #define __av_float(LIST,VAL)
  949.   (++(LIST).aptr > __av_eptr(LIST)
  950.    ? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0))
  951. #define av_double(LIST,VAL)
  952.    (((LIST).aptr = (__avword*)(((long)(LIST).aptr+sizeof(double)+sizeof(double)-1) & -(long)sizeof(double))) 
  953.     > __av_eptr(LIST)
  954.     ? -1 : (((double*)(LIST).aptr)[-1] = (double)(VAL), 0))
  955. #endif
  956. #if defined(__ia64__)
  957. /* Up to 8 leading float or double non-varargs args can be passed in
  958.  * float registers, but we also push them into the corresponding int
  959.  * registers in case of varargs.
  960.  */
  961. #define __av_float(LIST,VAL)
  962.   ((LIST).aptr >= __av_eptr(LIST)
  963.    ? -1 : ((*(float*)(LIST).aptr = (float)(VAL)),
  964.    ((LIST).faptr < &(LIST).fargs[8] && (*(LIST).faptr = *(float*)(LIST).aptr, (LIST).faptr++)), 
  965.    (LIST).aptr++,
  966.    0))
  967. #define av_double(LIST,VAL)
  968.   ((LIST).aptr >= __av_eptr(LIST)
  969.    ? -1 : (*(double*)(LIST).aptr = (double)(VAL),
  970.    ((LIST).faptr < &(LIST).fargs[8] && (*(LIST).faptr = *(double*)(LIST).aptr, (LIST).faptr++)), 
  971.    (LIST).aptr++,
  972.    0))
  973. #endif
  974. #if defined(__x86_64__)
  975. /* Up to 8 leading float or double args can be passed in float registers.
  976.  */
  977. #define __av_float(LIST,VAL)
  978.   ((LIST).faptr < &(LIST).fargs[8]
  979.    ? (*(LIST).faptr = 0.0, *(float*)(LIST).faptr = (float)(VAL),
  980.       (LIST).faptr++,
  981.       0)
  982.    : ((LIST).aptr >= __av_eptr(LIST)
  983.       ? -1 : ((*(float*)(LIST).aptr = (float)(VAL)),
  984.       (LIST).aptr++,
  985.       0)))
  986. #define av_double(LIST,VAL)
  987.   ((LIST).faptr < &(LIST).fargs[8]
  988.    ? (*(LIST).faptr = (double)(VAL),
  989.       (LIST).faptr++,
  990.       0)
  991.    : ((LIST).aptr >= __av_eptr(LIST)
  992.       ? -1 : ((*(double*)(LIST).aptr = (double)(VAL)),
  993.       (LIST).aptr++,
  994.       0)))
  995. #endif
  996. /*
  997.  * structure argument types
  998.  */
  999. #define av_struct(LIST,TYPE,VAL)
  1000.   __av_struct(LIST,TYPE,sizeof(TYPE),__AV_alignof(TYPE),__av_struct_assign,VAL)
  1001. #define __av_struct_assign(TYPE,TYPE_SIZE,TYPE_ALIGN,PLACE,VAL)
  1002.   *(TYPE*)(PLACE) = (VAL)
  1003. /* _av_struct() is like av_struct(), except that you pass the type's size and alignment
  1004.  * and the value's address instead of the type and the value themselves.
  1005.  */
  1006. #define _av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR)
  1007.   __av_struct(LIST,unknown,TYPE_SIZE,TYPE_ALIGN,__av_struct_copy,VAL_ADDR)
  1008. #define __av_struct_copy(TYPE,TYPE_SIZE,TYPE_ALIGN,PLACE,VAL_ADDR)
  1009.   __structcpy(PLACE,VAL_ADDR,TYPE_SIZE,TYPE_ALIGN)
  1010. /* Structure argument alignment. */
  1011. #if defined(__i386__) && defined(_MSC_VER)
  1012. /* In MSVC, doubles inside structures have alignment 8, i.e.
  1013.  * __AV_alignof(double) = 8, but doubles (and also structures containing
  1014.  * doubles) are passed on the stack with alignment 4. Looks really weird.
  1015.  */
  1016. #define __av_struct_alignment(TYPE_ALIGN)  
  1017.   ((TYPE_ALIGN) <= 4 ? (TYPE_ALIGN) : 4)
  1018. #else
  1019. #define __av_struct_alignment(TYPE_ALIGN)  
  1020.   (TYPE_ALIGN)
  1021. #endif
  1022. #if defined(__i386__) || defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__alpha__) || (defined(__rs6000__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__) || defined(__ia64__) || defined(__s390__)
  1023. /* Structures are passed as fully aligned structures on the arg stack.
  1024.  * We align the aptr, store the structure, then fill to word alignment.
  1025.  * Single-small-integer structures are NOT promoted to integers and have
  1026.  * different alignment.
  1027.  */
  1028. /* little endian -> small structures < 1 word are adjusted to the left */
  1029. #if defined(__i386__) || defined(__alpha__) || defined(__x86_64__)
  1030. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1031.   (((LIST).aptr =
  1032.     (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN)))
  1033.    > __av_eptr(LIST)
  1034.    ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1035.    (LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),
  1036.    0))
  1037. #endif
  1038. #if defined(__ia64__)
  1039. /* Types larger than a word have 2-word alignment. */
  1040. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1041.   ((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN)), 
  1042.    ((TYPE_SIZE) > sizeof(__avword) && (((LIST).aptr - &(LIST).args[0]) & 1) ? ++(LIST).aptr : 0), 
  1043.    ((LIST).aptr > __av_eptr(LIST)
  1044.     ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1045.     (LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),
  1046.     0)))
  1047. #endif
  1048. /* small structures < 1 word are adjusted depending on compiler */
  1049. #if defined(__mips__) && !defined(__mipsn32__)
  1050. #define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) 
  1051.   (((LIST).aptr =
  1052.     (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))
  1053.    > __av_eptr(LIST)
  1054.    ? -1 : (++(LIST).anum,
  1055.    ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1056.    (LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),
  1057.    0))
  1058. #define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) 
  1059.   (((LIST).aptr =
  1060.     (__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))
  1061.  +sizeof(__avword)-1) & -(long)sizeof(__avword)))
  1062.    > __av_eptr(LIST)
  1063.    ? -1 : (++(LIST).anum,
  1064.    ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1065.    0))
  1066. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1067.   ((LIST).flags & __AV_SGICC_STRUCT_ARGS
  1068.    ? /* SGI MIPS cc passes small structures left-adjusted, although big-endian! */
  1069.      __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) 
  1070.    : /* SGI MIPS gcc passes small structures within the first four words left-   
  1071.       * adjusted, for compatibility with cc. But structures in memory are passed  
  1072.       * right-adjusted!! See gcc-2.6.3/config/mips/mips.c:function_arg().   
  1073.       */   
  1074.      ((LIST).aptr < &(LIST).args[4]
  1075.       ? __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1076.       : __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)))
  1077. #endif
  1078. #if defined(__mipsn32__) || defined(__mips64__)
  1079. /* When a structure is passed (partially) in registers, it is passed in the
  1080.  * integer registers, except that doubles within the structure are passed in
  1081.  * the floating point registers. Instead of distinguishing these cases, we
  1082.  * always pass the structure in both the integer and the floating point
  1083.  * registers.
  1084.  */
  1085. #define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) 
  1086.   (((LIST).aptr =
  1087.     (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))
  1088.    > __av_eptr(LIST)
  1089.    ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1090.    (LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),
  1091.    ((LIST).anum < 8 && ((LIST).darg_mask |= (-1 << (LIST).anum))), 
  1092.    (LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(long)sizeof(__avword))/sizeof(__avword),
  1093.    (LIST).darg_mask &= (1 << ((LIST).anum < 8 ? (LIST).anum : 8)) - 1, 
  1094.    0))
  1095. #define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) 
  1096.   (((LIST).aptr =
  1097.     (__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))
  1098.  +sizeof(__avword)-1) & -(long)sizeof(__avword)))
  1099.    > __av_eptr(LIST)
  1100.    ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1101.    ((LIST).anum < 8 && ((LIST).darg_mask |= (-1 << (LIST).anum))), 
  1102.    (LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(long)sizeof(__avword))/sizeof(__avword),
  1103.    (LIST).darg_mask &= (1 << ((LIST).anum < 8 ? (LIST).anum : 8)) - 1, 
  1104.    0))
  1105. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1106.   ((LIST).flags & __AV_SGICC_STRUCT_ARGS
  1107.    ? /* SGI MIPS cc passes small structures left-adjusted, although big-endian! */
  1108.      __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) 
  1109.    : /* SGI MIPS gcc passes small structures right-adjusted. */
  1110.      __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL))
  1111. #endif
  1112. #if defined(__rs6000__)
  1113. #define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1114.   (((LIST).aptr =
  1115.     (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))
  1116.    > __av_eptr(LIST)
  1117.    ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1118.    (LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),
  1119.    0))
  1120. #define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1121.   (((LIST).aptr =
  1122.     (__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))
  1123.  +sizeof(__avword)-1) & -(long)sizeof(__avword)))
  1124.    > __av_eptr(LIST)
  1125.    ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1126.    0))
  1127. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1128.   ((LIST).flags & __AV_AIXCC_STRUCT_ARGS
  1129.    ? /* AIX cc and xlc pass small structures left-adjusted, although big-endian! */
  1130.      __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) 
  1131.    : /* gcc passes small structures right-adjusted. */
  1132.      __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL))
  1133. #endif
  1134. #if defined(__s390__)
  1135. #define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1136.   (((LIST).aptr =
  1137.     (__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))
  1138.  +sizeof(__avword)-1) & -(long)sizeof(__avword)))
  1139.    > __av_eptr(LIST)
  1140.    ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1141.    0))
  1142. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1143. ((TYPE_SIZE) != 1 && (TYPE_SIZE) != 2 && (TYPE_SIZE) != 4 && (TYPE_SIZE) != 8 
  1144.  ? (++(LIST).aptr
  1145.     > ((LIST).eptr = (__avword*)((long)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))
  1146.     ? -1 :
  1147.     (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL),
  1148.      (LIST).aptr[-1] = (__avword)(LIST).eptr,
  1149.      0))
  1150.  : (((TYPE_SIZE) == 8 && (LIST).aptr - (LIST).args - (LIST).fargwords == 4 ? ++(LIST).aptr,0 : 0), 
  1151.     __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)))
  1152. #endif
  1153. /* big endian -> small structures < 1 word are adjusted to the right */
  1154. #if defined(__m88k__)
  1155. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1156.   (((LIST).aptr =
  1157.     (__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))
  1158.  +sizeof(__avword)-1) & -(long)sizeof(__avword)))
  1159.    > __av_eptr(LIST)
  1160.    ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1161.    0))
  1162. #endif
  1163. #endif
  1164. #if defined(__m68k__) || defined(__arm__) || defined(__convex__)
  1165. /* Structures are passed as embedded copies on the arg stack.
  1166.  */
  1167. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1168.   (((LIST).aptr = (__avword*)(((long)(LIST).aptr+(TYPE_SIZE)+sizeof(__avword)-1) & -(long)sizeof(__avword))) 
  1169.     > __av_eptr(LIST)
  1170.     ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1171.     0))
  1172. #endif
  1173. #if (defined(__sparc__) && !defined(__sparc64__)) || (defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__))))
  1174. /* Structures are passed as pointers to caller-made local copies. We
  1175.  * grab space for the copies from the end of the argument list space
  1176.  * and always use maximal (double) alignment.
  1177.  */
  1178. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1179.    (++(LIST).aptr
  1180.     > ((LIST).eptr = (__avword*)((long)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))
  1181.     ? -1 :
  1182.     (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL),
  1183.      (LIST).aptr[-1] = (__avword)(LIST).eptr,
  1184.      0))
  1185. #endif
  1186. #if defined(__sparc64__)
  1187. /* Structures <= 16 bytes are passed as embedded copies on the arg stack,
  1188.  * left-adjusted (although big-endian!).
  1189.  * When a structure is passed (partially) in registers, it is passed in the
  1190.  * integer registers, except that floats and doubles within the structure
  1191.  * are passed in the floating point registers. Instead of distinguishing
  1192.  * these cases, we always pass the structure in both the integer and the
  1193.  * floating point registers.
  1194.  * Big structures are passed as pointers to caller-made local copies.
  1195.  * FIXME: Shouldn't (LIST).anum be incremented in sync with (LIST).aptr ?
  1196.  */
  1197. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1198.   ((TYPE_SIZE) > 16
  1199.    ? (++(LIST).aptr
  1200.       > ((LIST).eptr = (__avword*)((long)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))
  1201.       ? -1 :
  1202.       (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL),
  1203.        (LIST).aptr[-1] = (__avword)(LIST).eptr,
  1204.        0))
  1205.    : (((LIST).aptr =
  1206.        (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))
  1207.       > __av_eptr(LIST)
  1208.       ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),
  1209.       (LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),
  1210.       ((LIST).anum < 16
  1211. && ((LIST).farg_mask |= (-1 << (LIST).anum),
  1212.     (LIST).darg_mask |= (-1 << (LIST).anum))),
  1213.       (LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(long)sizeof(__avword))/sizeof(__avword),
  1214.       (LIST).farg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, 
  1215.       (LIST).darg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, 
  1216.       0)))
  1217. #endif
  1218. #if defined(__hppa__)
  1219. /* Structures <= 8 bytes are passed as embedded copies on the arg stack.
  1220.  * Big structures are passed as pointers to caller-made local copies.
  1221.  */
  1222. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1223.   ((TYPE_SIZE) > 8
  1224.    ? (--(LIST).aptr
  1225.       < ((LIST).eptr = (__avword*)((long)(LIST).eptr + (((TYPE_SIZE) + 7) & -8))) 
  1226.       ? -1
  1227.       : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((long)(LIST).eptr - (((TYPE_SIZE) + 7) & -8)), VAL), 
  1228.  *(LIST).aptr = (__avword)((long)(LIST).eptr - (((TYPE_SIZE) + 7) & -8)), 
  1229.  0))
  1230.    : ((TYPE_SIZE) > 4
  1231.       ? (((LIST).aptr = (__avword*)((((long)(LIST).aptr & -8) - (long)(TYPE_SIZE)) & -8)) 
  1232.   < &(LIST).args[0]
  1233.   ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).aptr,VAL), 0))
  1234.       : /* FIXME: gcc-2.6.3 passes structures <= 4 bytes in memory left-adjusted! ?? */
  1235.         (((LIST).aptr = (__avword*)(((long)(LIST).aptr & -4) - (long)(TYPE_SIZE))) 
  1236.   < &(LIST).args[0]
  1237.   ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).aptr,VAL),
  1238.   (LIST).aptr = (__avword*)((long)(LIST).aptr & -4),
  1239.   0))))
  1240. #endif
  1241. #if defined(__x86_64__)
  1242. /* Structures <= 16 bytes can be passed in integer or floating-point registers
  1243.    if there is enough room for the whole number of words needed by the structure
  1244.    in the corresponding iargs/fargs block. We can't distinguish the two cases
  1245.    and support only passing in integer registers. Other structures are passed
  1246.    on the arg stack. */
  1247. #define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
  1248.   ((LIST).iaptr + ((TYPE_SIZE) + sizeof(__avword)-1) / sizeof(__avword) <= &(LIST).iargs[6] 
  1249.    ? (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).iaptr,VAL),
  1250.       (LIST).iaptr += ((TYPE_SIZE) + sizeof(__avword)-1) / sizeof(__avword),
  1251.       0)
  1252.    : ((LIST).aptr = (__avword*)((__avword)(LIST).aptr + (((TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN))), 
  1253.       ((LIST).aptr > __av_eptr(LIST)
  1254.        ? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr - (((TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN))),VAL),
  1255.        0))))
  1256. #endif
  1257. /*
  1258.  * calling the function
  1259.  */
  1260. #define av_call(LIST) __builtin_avcall(&(LIST))
  1261. /* Determine whether a struct type is word-splittable, i.e. whether each of
  1262.  * its components fit into a register.
  1263.  * The entire computation is done at compile time.
  1264.  */
  1265. #define av_word_splittable_1(slot1)  
  1266.   (__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword))
  1267. #define av_word_splittable_2(slot1,slot2)  
  1268.   ((__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword)) 
  1269.    && (__av_offset2(slot1,slot2)/sizeof(__avword) == (__av_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__avword)) 
  1270.   )
  1271. #define av_word_splittable_3(slot1,slot2,slot3)  
  1272.   ((__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword)) 
  1273.    && (__av_offset2(slot1,slot2)/sizeof(__avword) == (__av_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__avword)) 
  1274.    && (__av_offset3(slot1,slot2,slot3)/sizeof(__avword) == (__av_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__avword)) 
  1275.   )
  1276. #define av_word_splittable_4(slot1,slot2,slot3,slot4)  
  1277.   ((__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword)) 
  1278.    && (__av_offset2(slot1,slot2)/sizeof(__avword) == (__av_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__avword)) 
  1279.    && (__av_offset3(slot1,slot2,slot3)/sizeof(__avword) == (__av_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__avword)) 
  1280.    && (__av_offset4(slot1,slot2,slot3,slot4)/sizeof(__avword) == (__av_offset4(slot1,slot2,slot3,slot4)+sizeof(slot4)-1)/sizeof(__avword)) 
  1281.   )
  1282. #define __av_offset1(slot1)  
  1283.   0
  1284. #define __av_offset2(slot1,slot2)  
  1285.   ((__av_offset1(slot1)+sizeof(slot1)+__AV_alignof(slot2)-1) & -(long)__AV_alignof(slot2))
  1286. #define __av_offset3(slot1,slot2,slot3)  
  1287.   ((__av_offset2(slot1,slot2)+sizeof(slot2)+__AV_alignof(slot3)-1) & -(long)__AV_alignof(slot3))
  1288. #define __av_offset4(slot1,slot2,slot3,slot4)  
  1289.   ((__av_offset3(slot1,slot2,slot3)+sizeof(slot3)+__AV_alignof(slot4)-1) & -(long)__AV_alignof(slot4))
  1290. /*
  1291.  * Miscellaneous declarations.
  1292.  */
  1293. #if defined(__STDC__) || defined(__GNUC__) || defined(__cplusplus)
  1294. extern int __builtin_avcall (av_alist* l);
  1295. extern void __structcpy (void* dest, void* src, unsigned long size, unsigned long alignment);
  1296. #else
  1297. extern int __builtin_avcall ();
  1298. extern void __structcpy ();
  1299. #endif
  1300. #endif /*_avcall_h */