home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cc-61.0.1 / cc / gstdarg.h < prev    next >
C/C++ Source or Header  |  1991-05-03  |  1KB  |  43 lines

  1. /* stdarg.h for GNU.
  2.    Note that the type used in va_arg is supposed to match the
  3.    actual type **after default promotions**.
  4.    Thus, va_arg (..., short) is not valid.  */
  5.  
  6. #ifndef _STDARG_H
  7. #define _STDARG_H
  8.  
  9. #ifdef __m88k__
  10. #include "va-m88k.h"
  11. #else
  12.  
  13. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
  14. #ifndef _VA_LIST_
  15. #define _VA_LIST_
  16. typedef char *va_list;
  17. #endif /* _VA_LIST_ */
  18.  
  19. /* Amount of space required in an argument list for an arg of type TYPE.
  20.    TYPE may alternatively be an expression whose type is used.  */
  21.  
  22. #define __va_rounded_size(TYPE)  \
  23.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  24.  
  25. #ifndef __sparc__
  26. #define va_start(AP, LASTARG)                         \
  27.  (AP = ((char *) __builtin_next_arg ()))
  28. #else
  29. #define va_start(AP, LASTARG)                         \
  30.  (__builtin_saveregs (),                        \
  31.   AP = ((char *) __builtin_next_arg ()))
  32. #endif
  33.  
  34. void va_end (va_list);        /* Defined in gnulib */
  35. #define va_end(AP)
  36.  
  37. #define va_arg(AP, TYPE)                        \
  38.  (AP += __va_rounded_size (TYPE),                    \
  39.   *((TYPE *) (AP - __va_rounded_size (TYPE))))
  40.  
  41. #endif /* Not m88k */
  42. #endif /* _STDARG_H */
  43.