home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume26 / unproto / part01 / stdarg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-07  |  1.4 KB  |  39 lines

  1.  /*
  2.   * @(#) stdarg.h 1.2 91/11/30 21:10:39
  3.   * 
  4.   * Sample stdarg.h file for use with the unproto filter.
  5.   * 
  6.   * This file serves two purposes.
  7.   * 
  8.   * 1 - As an include file for use with ANSI-style C source that implements
  9.   * variadic functions.
  10.   * 
  11.   * 2 - To configure the unproto filter itself. If the _VA_ALIST_ macro is
  12.   * defined, its value will appear in the place of the "..." in argument
  13.   * lists of variadic function *definitions* (not declarations).
  14.   * 
  15.   * Compilers that pass arguments via the stack can use the default code at the
  16.   * end of this file (this usually applies for the VAX, MC68k and 80*86
  17.   * architectures).
  18.   * 
  19.   * RISC-based systems often need special tricks. An example of the latter is
  20.   * given for the SPARC architecture. Read your /usr/include/varargs.h for
  21.   * more information.
  22.   * 
  23.   * You can use the varargs.c program provided with the unproto package to
  24.   * verify that the stdarg.h file has been set up correctly.
  25.   */
  26.  
  27. #ifdef sparc
  28. #  define _VA_ALIST_        "__builtin_va_alist"
  29.    typedef char *va_list;
  30. #  define va_start(ap, p)    (ap = (char *) &__builtin_va_alist)
  31. #  define va_arg(ap, type)    ((type *) __builtin_va_arg_incr((type *) ap))[0]
  32. #  define va_end(ap)
  33. #else /* vax, mc68k, 80*86 */
  34.    typedef char *va_list;
  35. #  define va_start(ap, p)    (ap = (char *) (&(p)+1))
  36. #  define va_arg(ap, type)    ((type *) (ap += sizeof(type)))[-1]
  37. #  define va_end(ap)
  38. #endif
  39.