home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK4 / INCLUDE / STDARG.H$ / STDARG
Encoding:
Text File  |  1991-11-06  |  1.2 KB  |  53 lines

  1. /***
  2. *stdarg.h - defines ANSI-style macros for variable argument functions
  3. *
  4. *    Copyright (c) 1985-1992, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file defines ANSI-style macros for accessing arguments
  8. *    of functions which take a variable number of arguments.
  9. *    [ANSI]
  10. *
  11. ****/
  12.  
  13. #ifndef _INC_STDARG
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19. #ifdef _WINDLL
  20. #define _FARARG_ __far
  21. #else
  22. #define _FARARG_
  23. #endif
  24.  
  25. #if (_MSC_VER <= 600)
  26. #define __far       _far
  27. #endif
  28.  
  29. #ifndef _VA_LIST_DEFINED
  30. typedef char _FARARG_ *va_list;
  31. #define _VA_LIST_DEFINED
  32. #endif
  33.  
  34. /*
  35.  * define a macro to compute the size of a type, variable or expression,
  36.  * rounded up to the nearest multiple of sizeof(int). This number is its
  37.  * size as function argument (Intel architecture). Note that the macro
  38.  * depends on sizeof(int) being a power of 2!
  39.  */
  40.  
  41. #define _INTSIZEOF(n)     ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
  42.  
  43. #define va_start(ap,v) ap = (va_list)&v + _INTSIZEOF(v)
  44. #define va_arg(ap,t) ( *(t _FARARG_ *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
  45. #define va_end(ap) ap = (va_list)0
  46.  
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50.  
  51. #define _INC_STDARG
  52. #endif    /* _INC_STDARG */
  53.