00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __wcecompat__STDARG_H__
00023 #define __wcecompat__STDARG_H__
00024
00025 #include "stddef.h"
00026
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030
00031 #if defined (_M_CEE)
00032 typedef struct { void* p[4]; } va_list;
00033 #else
00034 typedef char *va_list;
00035 #endif
00036
00037 #ifdef MIPS
00038
00039 #define va_start(ap,v) ap = (va_list)&v + sizeof(v)
00040 #define va_end(list) ( list = (va_list)0 )
00041 #define va_arg(list, mode) ((mode *)(list =\
00042 (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
00043 (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
00044
00045 #elif defined(PPC)
00046
00047
00048 #define _ALIGNIT(ap,t) ((((int)(ap))+(sizeof(t)<8?3:7)) & (sizeof(t)<8?~3:~7))
00049
00050 #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
00051 #define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
00052 #define va_arg(ap,t) ( *(t *)((ap = (char *) (_ALIGNIT(ap, t) + _INTSIZEOF(t))) - _INTSIZEOF(t)) )
00053 #define va_end(ap) ( ap = (va_list)0 )
00054
00055 #elif defined (_M_CEE)
00056
00057 extern void __cdecl __va_start(va_list*, ...);
00058 extern void* __cdecl __va_arg(va_list*, ...);
00059 extern void __cdecl __va_end(va_list*);
00060
00061 #define va_start(ap,v) (__va_start(&ap, &v, sizeof(v), __builtin_alignof(v), &v))
00062 #define va_arg(ap,t) (*((t*)__va_arg(&ap, sizeof(t), __builtin_alignof(t), (t*)0)))
00063 #define va_end(ap) (__va_end(&ap))
00064
00065 #else
00066
00067 #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
00068 #define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
00069 #define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
00070 #define va_end(ap) ( ap = (va_list)0 )
00071
00072 #endif
00073
00074 #ifdef __cplusplus
00075 }
00076 #endif
00077
00078 #endif