home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / borhead.zip / VARARGS.H < prev   
C/C++ Source or Header  |  1994-11-09  |  911b  |  38 lines

  1. /*  varargs.h
  2.  
  3.     Definitions for accessing parameters in functions that accept
  4.     a variable number of arguments.  These macros are compatible
  5.     with UNIX System V.  Use stdarg.h for ANSI C compatibility.
  6.  
  7. */
  8.  
  9. /*
  10.  *      C/C++ Run Time Library - Version 1.5
  11.  *
  12.  *      Copyright (c) 1991, 1994 by Borland International
  13.  *      All Rights Reserved.
  14.  *
  15.  */
  16.  
  17. #ifndef __VARARGS_H
  18. #define __VARARGS_H
  19.  
  20. #ifdef __STDARG_H
  21. #error Can't include both STDARG.H and VARARGS.H
  22. #endif
  23.  
  24. #if !defined(___DEFS_H)
  25. #include <_defs.h>
  26. #endif
  27.  
  28. typedef void _FAR *va_list;
  29.  
  30. #define __size(x) ((sizeof(x)+sizeof(int)-1) & ~(sizeof(int)-1))
  31.  
  32. #define va_dcl va_list va_alist;
  33. #define va_start(ap) ap = (va_list)&va_alist
  34. #define va_arg(ap, type) (*(type _FAR *)(((*(char _FAR * _FAR *)&(ap))+=__size(type))-(__size(type))))
  35. #define va_end(ap)   ap = ((void _FAR *)0)
  36.  
  37. #endif  /* __VARARGS_H */
  38.