|
|
1.1 root 1: /***
2: *varargs.h - XENIX style macros for variable argument functions
3: *
4: * Copyright (c) 1985-1990, 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:
13: #ifndef _INC_VARARGS
14:
15: #ifdef __cplusplus
16: extern "C" {
17: #endif
18:
19: #ifdef __STDC__
20: #error varargs.h incompatible with ANSI (use stdarg.h)
21: #endif
22:
23: #ifndef _VA_LIST_DEFINED
24: typedef char *va_list;
25: #define _VA_LIST_DEFINED
26: #endif
27:
28: /*
29: * define a macro to compute the size of a type, variable or expression,
30: * rounded up to the nearest multiple of sizeof(int). This number is its
31: * size as function argument (Intel architecture). Note that the macro
32: * depends on sizeof(int) being a power of 2!
33: */
34:
35: #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
36:
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 *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
40: #define va_end(ap) ap = (va_list)0
41:
42: #ifdef __cplusplus
43: }
44: #endif
45:
46: #define _INC_VARARGS
47: #endif /* _INC_VARARGS */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.