home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnuawk.zip / vms / varargs.h < prev    next >
C/C++ Source or Header  |  1991-05-17  |  1KB  |  39 lines

  1. /* "varargs.h" -- old style variable argument list manipulation (for VAX) */
  2. #ifndef __GNUC__
  3.  
  4.  /* Use the system's macros with the system's compiler. */
  5. #include <varargs.h>
  6.  
  7. #else    /*__GNUC__*/
  8.  
  9. # if defined(__VAX__) || defined(__vax__) || defined(VAX) || defined(vax)
  10.  /* These macros implement traditional (non-ANSI) varargs for GNU C on VAX */
  11.  
  12. #  if !defined(_VA_LIST) && !defined(_VA_LIST_)
  13. #   define _VA_LIST
  14. #   define _VA_LIST_
  15. typedef char *va_list;
  16. #  endif
  17.  
  18. #  define va_alist    _varargs
  19. #  define va_dcl    int va_alist;
  20. #  define va_start(AP)    AP = (va_list) &va_alist
  21. #  define va_end(AP)
  22.  
  23. #  define _va_rounded_size(TYPE)    \
  24.     (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  25.  
  26. #  define va_arg(AP,TYPE)        \
  27.     (AP += _va_rounded_size(TYPE),    \
  28.         *((TYPE *) (AP - _va_rounded_size(TYPE))))
  29.  
  30. #  if defined(__VMS__) || defined(__vms__) || defined(VMS) || defined(vms)
  31.  /* VAX C compatability macros */
  32. #   define va_count(CNT)  vaxc$va_count(&CNT)    /* rtl routine */
  33. #   define va_start_1(AP,OFFSET)  AP = (va_list) (&va_alist + (OFFSET))
  34. #  endif /* VMS */
  35.  
  36. # endif /* VAX */
  37.  
  38. #endif    /*__GNUC__*/
  39.