home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / ginclude / va-pa.h < prev    next >
C/C++ Source or Header  |  1996-12-17  |  2KB  |  62 lines

  1.  
  2. /* Define __gnuc_va_list. */
  3.  
  4. #ifndef __GNUC_VA_LIST
  5. #define __GNUC_VA_LIST
  6.  
  7. #if defined(NeXT)
  8. #define _ANSI_STDARG_H_
  9. #endif
  10.  
  11. typedef double *__gnuc_va_list;
  12. #endif /* not __GNUC_VA_LIST */
  13.  
  14. #ifdef NeXT_PDO
  15. #define NULL_VALIST ((__gnuc_va_list)0)
  16. #endif
  17.  
  18. /* If this is for internal libc use, don't define anything but
  19.    __gnuc_va_list.  */
  20. #if defined (_STDARG_H) || defined (_VARARGS_H)
  21. #if __GNUC__ > 1
  22. #define __va_ellipsis ...
  23. #define __gnuc_va_start(AP) ((AP) = (va_list)__builtin_saveregs())
  24. #else
  25. #define va_alist __va_a__, __va_b__, __va_c__, __va_d__
  26. #define __va_ellipsis 
  27. #define __gnuc_va_start(AP)\
  28.   (AP) = (double *) &__va_a__, &__va_b__, &__va_c__, &__va_d__, \
  29.   (AP) = (double *)((char *)(AP) + 4)
  30. #endif /* __GNUC__ > 1 */
  31.  
  32. /* Call __builtin_next_arg even though we aren't using its value, so that
  33.    we can verify that LASTARG is correct.  */
  34. #ifdef _STDARG_H
  35. #define va_start(AP,LASTARG) \
  36.   (__builtin_next_arg (LASTARG), __gnuc_va_start (AP))
  37. #if defined(NeXT_PDO)
  38. #undef va_start
  39. #define va_start(AP,LASTARG) __gnuc_va_start (AP)
  40. #endif
  41. #else
  42. /* The ... causes current_function_varargs to be set in cc1.  */
  43. #define va_dcl long va_alist; __va_ellipsis
  44. #define va_start(AP) __gnuc_va_start (AP)
  45. #endif
  46.  
  47. #define va_arg(AP,TYPE)                        \
  48.   (sizeof(TYPE) > 8 ?                        \
  49.    ((AP = (__gnuc_va_list) ((char *)AP - sizeof (int))),    \
  50.     (*((TYPE *) (void *) (*((int *) (AP))))))            \
  51.    :((AP =                            \
  52.       (__gnuc_va_list) ((long)((char *)AP - sizeof (TYPE))    \
  53.             & (sizeof(TYPE) > 4 ? ~0x7 : ~0x3))),    \
  54.      (*((TYPE *) (void *) ((char *)AP + ((8 - sizeof(TYPE)) % 4))))))
  55.  
  56. #ifndef va_end
  57. void va_end (__gnuc_va_list);        /* Defined in libgcc.a */
  58. #endif
  59. #define va_end(AP)
  60.  
  61. #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
  62.