home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / mntinc16 / stdarg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-29  |  1.0 KB  |  44 lines

  1. /*
  2.  * STDARG.H
  3.  */
  4.  
  5. #ifndef _STDARG_H
  6. #ifndef va_start    /* in case of varargs being included */
  7. #define    _STDARG_H
  8.  
  9. #ifndef _COMPILER_H
  10. #include <compiler.h>
  11. #endif
  12.  
  13. typedef    __VA_LIST__ va_list;
  14.  
  15. #ifndef __GNUC__
  16.  
  17. #define va_start(list,param)  list = ((va_list) &(param)) \
  18.                    + ((sizeof(param) + 1) & ~1)
  19. #define va_arg(list,type)     ((type *)(list += ((sizeof(type) + 1) & ~1)))[-1]
  20. #define va_end(list)
  21.  
  22. #else
  23.  
  24. /* Amount of space required in an argument list for an arg of type TYPE.
  25.    TYPE may alternatively be an expression whose type is used.  */
  26.  
  27. #define __va_rounded_size(TYPE)  \
  28.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  29.  
  30. #define va_start(AP, LASTARG)                         \
  31.  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
  32.  
  33. void va_end (va_list);        /* Defined in gnulib -- not needed */
  34. #define va_end(AP)
  35.  
  36. #define va_arg(AP, TYPE)                        \
  37.  (AP += __va_rounded_size (TYPE),                    \
  38.   ((TYPE *) AP)[-1])
  39.  
  40. #endif /* __GNUC__ */
  41.  
  42. #endif /* va_start */
  43. #endif /* _STDARG_H */
  44.