[stdlib.h]

- Improve definition of __mb_cur_max and related
- properly handle _M_CEE_PURE

svn path=/trunk/; revision=48157
This commit is contained in:
Timo Kreuzer 2010-07-21 02:55:59 +00:00
parent 398f20dacd
commit 147a7b6fc9

View file

@ -92,22 +92,15 @@ extern "C" {
#ifndef MB_CUR_MAX #ifndef MB_CUR_MAX
#define MB_CUR_MAX ___mb_cur_max_func() #define MB_CUR_MAX ___mb_cur_max_func()
#ifndef __mb_cur_max #ifdef _M_CEE_PURE
#ifdef _MSVCRT_ _CRTIMP int* __cdecl __p___mb_cur_max();
extern int __mb_cur_max; #define __mb_cur_max (*__p___mb_cur_max())
#else #else /* !_M_CEE_PURE */
#define __mb_cur_max (*_imp____mb_cur_max) _CRTIMP extern int __mb_cur_max;
extern int *_imp____mb_cur_max; #endif /* !_M_CEE_PURE */
#endif _CRTIMP int __cdecl ___mb_cur_max_func(void);
#endif _CRTIMP int __cdecl ___mb_cur_max_l_func(_locale_t);
#ifdef _MSVCRT_ #endif /* !MB_CUR_MAX */
extern int __mbcur_max;
#define ___mb_cur_max_func() (__mb_cur_max)
#else
extern int* _imp____mbcur_max;
#define ___mb_cur_max_func() (*_imp____mb_cur_max)
#endif
#endif
#define __max(a,b) (((a) > (b)) ? (a) : (b)) #define __max(a,b) (((a) > (b)) ? (a) : (b))
#define __min(a,b) (((a) < (b)) ? (a) : (b)) #define __min(a,b) (((a) < (b)) ? (a) : (b))
@ -152,7 +145,7 @@ extern "C" {
_CRTIMP extern char *_sys_errlist[]; _CRTIMP extern char *_sys_errlist[];
_CRTIMP extern int _sys_nerr; _CRTIMP extern int _sys_nerr;
//#if !defined(__x86_64) #if defined(_DLL) && defined(_M_IX86)
_CRTIMP int *__cdecl __p___argc(void); _CRTIMP int *__cdecl __p___argc(void);
_CRTIMP char ***__cdecl __p___argv(void); _CRTIMP char ***__cdecl __p___argv(void);
_CRTIMP wchar_t ***__cdecl __p___wargv(void); _CRTIMP wchar_t ***__cdecl __p___wargv(void);
@ -160,133 +153,74 @@ extern "C" {
_CRTIMP wchar_t ***__cdecl __p__wenviron(void); _CRTIMP wchar_t ***__cdecl __p__wenviron(void);
_CRTIMP char **__cdecl __p__pgmptr(void); _CRTIMP char **__cdecl __p__pgmptr(void);
_CRTIMP wchar_t **__cdecl __p__wpgmptr(void); _CRTIMP wchar_t **__cdecl __p__wpgmptr(void);
//#endif
#ifndef __argc
#ifdef _MSVCRT_
extern int __argc;
#else
#define __argc (*_imp____argc)
extern int *_imp____argc;
#endif
#endif
#ifndef __argv
#ifdef _MSVCRT_
extern char **__argv;
#else
#define __argv (*_imp____argv)
extern char ***_imp____argv;
#endif
#endif
#ifndef __wargv
#ifdef _MSVCRT_
extern wchar_t **__wargv;
#else
#define __wargv (*_imp____wargv)
extern wchar_t ***_imp____wargv;
#endif
#endif #endif
#ifdef _POSIX_ // FIXME: move inside _M_CEE_PURE section
extern char **environ; _CRTIMP int *__cdecl __p___argc();
#else _CRTIMP char ***__cdecl __p___argv();
#ifndef _environ _CRTIMP wchar_t ***__cdecl __p___wargv();
#ifdef _MSVCRT_ _CRTIMP char ***__cdecl __p__environ();
extern char **_environ; _CRTIMP wchar_t ***__cdecl __p__wenviron();
#else _CRTIMP char **__cdecl __p__pgmptr();
#define _environ (*_imp___environ) _CRTIMP wchar_t **__cdecl __p__wpgmptr();
extern char ***_imp___environ;
#endif
#endif
#ifndef _wenviron #ifdef _M_CEE_PURE
#ifdef _MSVCRT_ #define __argv (*__p___argv())
extern wchar_t **_wenviron; #define __argc (*__p___argc())
#else #define __wargv (*__p___wargv())
#define _wenviron (*_imp___wenviron) #define _environ (*__p__environ())
extern wchar_t ***_imp___wenviron; #define _wenviron (*__p__wenviron())
#endif #define _pgmptr (*__p__pgmptr())
#endif #define _wpgmptr (*__p__wpgmptr())
#endif #else /* !_M_CEE_PURE */
#ifndef _pgmptr _CRTIMP extern int __argc;
#ifdef _MSVCRT_ _CRTIMP extern char **__argv;
extern char *_pgmptr; _CRTIMP extern wchar_t **__wargv;
#else _CRTIMP extern char **_environ;
#define _pgmptr (*_imp___pgmptr) _CRTIMP extern wchar_t **_wenviron;
extern char **_imp___pgmptr; _CRTIMP extern char *_pgmptr;
#endif _CRTIMP extern wchar_t *_wpgmptr;
#endif #endif /* !_M_CEE_PURE */
#ifndef _wpgmptr _CRTIMP errno_t __cdecl _get_environ(char***);
#ifdef _MSVCRT_ _CRTIMP errno_t __cdecl _get_wenviron(wchar_t***);
extern wchar_t *_wpgmptr; _CRTIMP errno_t __cdecl _get_pgmptr(char **_Value);
_CRTIMP errno_t __cdecl _get_wpgmptr(wchar_t **_Value);
#ifdef _M_CEE_PURE
_CRTIMP int* __cdecl __p__fmode();
#define _fmode (*__p__fmode())
#else #else
#define _wpgmptr (*_imp___wpgmptr) _CRTIMP extern int _fmode;
extern wchar_t **_imp___wpgmptr; #endif /* !_M_CEE_PURE */
#endif
#endif
errno_t __cdecl _get_pgmptr(char **_Value);
errno_t __cdecl _get_wpgmptr(wchar_t **_Value);
#ifndef _fmode
#ifdef _MSVCRT_
extern int _fmode;
#else
#define _fmode (*_imp___fmode)
extern int *_imp___fmode;
#endif
#endif
_CRTIMP errno_t __cdecl _set_fmode(int _Mode); _CRTIMP errno_t __cdecl _set_fmode(int _Mode);
_CRTIMP errno_t __cdecl _get_fmode(int *_PMode); _CRTIMP errno_t __cdecl _get_fmode(int *_PMode);
#ifndef _osplatform #ifdef _M_CEE_PURE
#ifdef _MSVCRT_ _CRTIMP unsigned int* __cdecl __p__osplatform();
extern unsigned int _osplatform; _CRTIMP unsigned int* __cdecl __p__osver();
#else _CRTIMP unsigned int* __cdecl __p__winver();
#define _osplatform (*_imp___osplatform) _CRTIMP unsigned int* __cdecl __p__winmajor();
extern unsigned int *_imp___osplatform; _CRTIMP unsigned int* __cdecl __p__winminor();
#endif #define _osplatform (*__p__osplatform())
#endif #define _osver (*__p__osver())
#define _winver (*__p__winver())
#ifndef _osver #define _winmajor (*__p__winmajor())
#ifdef _MSVCRT_ #define _winminor (*__p__winminor())
extern unsigned int _osver; #else /* !_M_CEE_PURE */
#else _CRTIMP extern unsigned int _osplatform;
#define _osver (*_imp___osver) _CRTIMP extern unsigned int _osver;
extern unsigned int *_imp___osver; _CRTIMP extern unsigned int _winver;
#endif _CRTIMP extern unsigned int _winmajor;
#endif _CRTIMP extern unsigned int _winminor;
#endif /* !_M_CEE_PURE */
#ifndef _winver
#ifdef _MSVCRT_
extern unsigned int _winver;
#else
#define _winver (*_imp___winver)
extern unsigned int *_imp___winver;
#endif
#endif
#ifndef _winmajor
#ifdef _MSVCRT_
extern unsigned int _winmajor;
#else
#define _winmajor (*_imp___winmajor)
extern unsigned int *_imp___winmajor;
#endif
#endif
#ifndef _winminor
#ifdef _MSVCRT_
extern unsigned int _winminor;
#else
#define _winminor (*_imp___winminor)
extern unsigned int *_imp___winminor;
#endif
#endif
errno_t __cdecl _get_osplatform(unsigned int *_Value); errno_t __cdecl _get_osplatform(unsigned int *_Value);
errno_t __cdecl _get_osver(unsigned int *_Value); errno_t __cdecl _get_osver(unsigned int *_Value);
errno_t __cdecl _get_winver(unsigned int *_Value); errno_t __cdecl _get_winver(unsigned int *_Value);
errno_t __cdecl _get_winmajor(unsigned int *_Value); errno_t __cdecl _get_winmajor(unsigned int *_Value);
errno_t __cdecl _get_winminor(unsigned int *_Value); errno_t __cdecl _get_winminor(unsigned int *_Value);
#ifndef _countof #ifndef _countof
#ifndef __cplusplus #ifndef __cplusplus
#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))