home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c045 / 2.ddi / INCLUDE / STDARG.H$ / STDARG.bin
Encoding:
Text File  |  1992-01-01  |  1.3 KB  |  58 lines

  1. /***
  2. *stdarg.h - defines ANSI-style macros for variable argument functions
  3. *
  4. *    Copyright (c) 1985-1991, 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. #if defined(_DLL) && !defined(_MT)
  20. #error Cannot define _DLL without _MT
  21. #endif
  22.  
  23. #if (defined(_MT) || defined(_WINDLL))
  24. #define _FARARG_ __far
  25. #else
  26. #define _FARARG_
  27. #endif
  28.  
  29. #if (_MSC_VER <= 600)
  30. #define __far       _far
  31. #define __loadds    _loadds
  32. #endif
  33.  
  34. #ifndef _VA_LIST_DEFINED
  35. typedef char _FARARG_ *va_list;
  36. #define _VA_LIST_DEFINED
  37. #endif
  38.  
  39. /*
  40.  * define a macro to compute the size of a type, variable or expression,
  41.  * rounded up to the nearest multiple of sizeof(int). This number is its
  42.  * size as function argument (Intel architecture). Note that the macro
  43.  * depends on sizeof(int) being a power of 2!
  44.  */
  45.  
  46. #define _INTSIZEOF(n)     ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
  47.  
  48. #define va_start(ap,v) ap = (va_list)&v + _INTSIZEOF(v)
  49. #define va_arg(ap,t) ( *(t _FARARG_ *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
  50. #define va_end(ap) ap = (va_list)0
  51.  
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55.  
  56. #define _INC_STDARG
  57. #endif    /* _INC_STDARG */
  58.