home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cplusplus-8 / gvarargs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-12  |  1.4 KB  |  69 lines

  1. #ifndef __GNUC__
  2. /* Use the system's macros with the system's compiler.  */
  3. #include <varargs.h>
  4. #else
  5. /* Record that varargs.h is defined; this turns off stdarg.h.  */
  6.  
  7. #ifndef _VARARGS_H
  8. #define _VARARGS_H
  9.  
  10. #ifdef __sparc__
  11. #include "va-sparc.h"
  12. #else
  13. #ifdef __spur__
  14. #include "va-spur.h"
  15. #else
  16. #ifdef __mips__
  17. #include "va-mips.h"
  18. #else
  19. #ifdef __i860__
  20. #include "va-i860.h"
  21. #else
  22. #ifdef __pyr__
  23. #include "va-pyr.h"
  24. #else
  25.  
  26. #ifdef __NeXT__
  27.  
  28. /* On Next, erase any vestiges of stdarg.h.  */
  29.  
  30. #undef va_alist
  31. #undef va_dcl
  32. #undef va_list
  33. #undef va_start
  34. #undef va_end
  35. #undef __va_rounded_size
  36. #undef va_arg
  37. #endif  /* __NeXT__ */
  38.  
  39. /* These macros implement traditional (non-ANSI) varargs
  40.    for GNU C.  */
  41.  
  42. #define va_alist  __builtin_va_alist
  43. #define va_dcl    int __builtin_va_alist;
  44. #define va_list   char *
  45.  
  46. #ifdef __sparc__
  47. #define va_start(AP)                         \
  48.  (__builtin_saveregs (),                    \
  49.   AP = ((void *) &__builtin_va_alist))
  50. #else
  51. #define va_start(AP)  AP=(char *) &__builtin_va_alist
  52. #endif
  53. #define va_end(AP)
  54.  
  55. #define __va_rounded_size(TYPE)  \
  56.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  57.  
  58. #define va_arg(AP, TYPE)                    \
  59.  (*((TYPE *) (AP += __va_rounded_size (TYPE),            \
  60.           AP - __va_rounded_size (TYPE))))
  61.  
  62. #endif /* not pyr */
  63. #endif /* not i860 */
  64. #endif /* not mips */
  65. #endif /* not spur */
  66. #endif /* not sparc */
  67. #endif /* not _VARARGS_H */
  68. #endif /* __GNUC__ */
  69.