Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

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