|
|
1.1 root 1: /***
2: *stdarg.h - defines ANSI-style macros for variable argument functions
3: *
1.1.1.3 root 4: * Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
1.1 root 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:
20:
21: #ifndef _VA_LIST_DEFINED
1.1.1.3 root 22: #if defined(_ALPHA_)
23: typedef struct {
24: char *a0; /* pointer to first homed integer argument */
25: int offset; /* byte offset of next parameter */
26: } va_list;
27: #else
1.1 root 28: typedef char * va_list;
1.1.1.3 root 29: #endif
1.1 root 30: #define _VA_LIST_DEFINED
31: #endif
32:
1.1.1.3 root 33:
34: #ifdef _M_IX86
1.1.1.2 root 35:
1.1 root 36: #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
37:
38: #define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
39: #define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
40: #define va_end(ap) ( ap = (va_list)0 )
41:
1.1.1.2 root 42: #endif
43:
1.1.1.3 root 44: #if defined(_M_MRX000) || defined(_MIPS_)
1.1.1.2 root 45:
46: #define va_start(ap,v) ap = (va_list)&v + sizeof(v)
47: #define va_end(list)
48: #define va_arg(list, mode) ((mode *)(list =\
49: (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
50: (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
51:
52: /* +++++++++++++++++++++++++++++++++++++++++++
53: Because of parameter passing conventions in C:
54: use mode=int for char, and short types
55: use mode=double for float types
56: use a pointer for array types
57: +++++++++++++++++++++++++++++++++++++++++++ */
58:
59:
60: #endif
1.1.1.3 root 61:
1.1.1.4 ! root 62: #if defined(_ALPHA_)
1.1.1.3 root 63:
64: /*
65: * The Alpha compiler supports two builtin functions that are used to
66: * implement stdarg/varargs. The __builtin_va_start function is used
67: * by va_start to initialize the data structure that locates the next
68: * argument. The __builtin_isfloat function is used by va_arg to pick
69: * which part of the home area a given register argument is stored in.
70: * The home area is where up to six integer and/or six floating point
71: * register arguments are stored down (so they can also be referenced
72: * by a pointer like any arguments passed on the stack).
73: */
74:
75: #ifdef _CFRONT
76: extern __builtin_va_start(va_list, ...);
77: #define __builtin_isfloat(a) __builtin_alignof(a)
1.1.1.4 ! root 78: #elif defined(__cplusplus)
! 79: extern __builtin_va_start(va_list, ...);
1.1.1.2 root 80: #endif
81:
1.1.1.3 root 82: #define va_start(list, v) __builtin_va_start(list, v, 1)
83: #define va_end(list)
84: #define va_arg(list, mode) \
85: ( *( ((list).offset += ((int)sizeof(mode) + 7) & -8) , \
86: (mode *)((list).a0 + (list).offset - \
87: ((__builtin_isfloat(mode) && (list).offset <= (6 * 8)) ? \
88: (6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8) \
89: ) \
90: ) \
91: )
92:
1.1.1.4 ! root 93: #endif /* _ALPHA_ */
1.1.1.2 root 94:
95:
1.1 root 96: #ifdef __cplusplus
97: }
98: #endif
99:
100: #define _INC_STDARG
101: #endif /* _INC_STDARG */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.