PATCH 3 msvcrt.diff minor fixes to msvcrt
- include/msvcrt/limits.h very much synced with MSVC, needed by MFC
- include/msvcrt/math.h I'm not sure who submitted a broken empty math.h header. Just to show that no one is doing serious winlib work lately, or they are not reporting about it. This header is the one I have for use with STLPort, it will Just #include the standard lib one. If it is not acceptable than at least completely remove the one in now.
- include/msvcrt/mbctype.h Some missing constants for the _setmbcp, used by MFC
- include/msvcrt/wchar.h Some code was copy pasted from <sys/stat.h> and was protected by an #ifndef. The <sys/stat.h> added some newer definitions that where not added to wchar. This patch removes the old definitions and instead #includes <sys/stat.h>. It is the same way in ms-headers. In fact I had some code that presupposed stat.h included by wchar that would hence not compile under the old version.
? include/msvcrt/exception ? include/msvcrt/float.h ? include/msvcrt/new ? include/msvcrt/stdarg.h ? include/msvcrt/typeinfo
Index: include/msvcrt/limits.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/limits.h,v retrieving revision 1.1 diff -u -r1.1 limits.h --- include/msvcrt/limits.h 2 Sep 2003 00:58:21 -0000 1.1 +++ include/msvcrt/limits.h 10 Mar 2004 08:36:47 -0000 @@ -1,10 +1,32 @@ #ifndef __WINE_LIMITS_H #define __WINE_LIMITS_H
-#define INT_MAX 2147483647 -#define INT_MIN (-2147483648) -#define SHRT_MAX 32767 -#define SHRT_MIN (-32768) +/*chars and mb's*/ +#define CHAR_BIT 8 +#define CHAR_MIN (-128) +#define CHAR_MAX 127 +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MIN 0 +#define UCHAR_MAX 0xff +#define MB_LEN_MAX 2 + +/*shorts ints longs*/ +#define SHRT_MIN 0x8000 +#define SHRT_MAX 0x0fff + +#define USHRT_MAX 0xffff +#define INT_MIN (-2147483647 - 1) +#define INT_MAX 2147483647 +#define UINT_MAX 0xffffffff +#define LONG_MIN (-2147483647L - 1) +#define LONG_MAX 2147483647L +#define ULONG_MAX 0xffffffffUL + +/* __int64 */ +#define _I64_MIN (-9223372036854775807i64 - 1) +#define _I64_MAX 9223372036854775807i64 +#define _UI64_MAX 0xffffffffffffffffui64
#ifdef __cplusplus extern "C" { Index: include/msvcrt/math.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/math.h,v retrieving revision 1.1 diff -u -r1.1 math.h --- include/msvcrt/math.h 2 Sep 2003 00:58:21 -0000 1.1 +++ include/msvcrt/math.h 10 Mar 2004 08:36:47 -0000 @@ -1,12 +1,14 @@ -#ifndef __WINE_MATH_H -#define __WINE_MATH_H
-#ifdef __cplusplus -extern "C" { -#endif +#include <../include/math.h>
-#ifdef __cplusplus -} -#endif - -#endif /* __WINE_MATH_H */ Index: include/msvcrt/mbctype.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/mbctype.h,v retrieving revision 1.4 diff -u -r1.4 mbctype.h --- include/msvcrt/mbctype.h 18 Jul 2003 22:57:15 -0000 1.4 +++ include/msvcrt/mbctype.h 10 Mar 2004 08:36:47 -0000 @@ -30,6 +30,12 @@ unsigned char* __p__mbctype(void); #define _mbctype (__p__mbctype())
+/* _setmbcp parameter defines */ +#define _MB_CP_SBCS 0 +#define _MB_CP_OEM -2 +#define _MB_CP_ANSI -3 +#define _MB_CP_LOCALE -4 + int _getmbcp(void); int _ismbbalnum(unsigned int); int _ismbbalpha(unsigned int); Index: include/msvcrt/wchar.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/wchar.h,v retrieving revision 1.5 diff -u -r1.5 wchar.h --- include/msvcrt/wchar.h 18 Jul 2003 22:57:15 -0000 1.5 +++ include/msvcrt/wchar.h 10 Mar 2004 08:36:48 -0000 @@ -151,35 +151,7 @@ #endif /* MSVCRT_WFINDDATA_T_DEFINED */
#ifndef MSVCRT_STAT_DEFINED -#define MSVCRT_STAT_DEFINED - -struct _stat { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - MSVCRT(_off_t) st_size; - MSVCRT(time_t) st_atime; - MSVCRT(time_t) st_mtime; - MSVCRT(time_t) st_ctime; -}; - -struct _stati64 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - MSVCRT(time_t) st_atime; - MSVCRT(time_t) st_mtime; - MSVCRT(time_t) st_ctime; -}; +#include <sys/stat.h> #endif /* MSVCRT_STAT_DEFINED */
/* ASCII char classification table - binary compatible */
Boaz Harrosh boaz@electrozaur.com writes:
+#define _I64_MIN (-9223372036854775807i64 - 1) +#define _I64_MAX 9223372036854775807i64 +#define _UI64_MAX 0xffffffffffffffffui64
The i64 suffix is not portable.
--- include/msvcrt/math.h 2 Sep 2003 00:58:21 -0000 1.1 +++ include/msvcrt/math.h 10 Mar 2004 08:36:47 -0000 @@ -1,12 +1,14 @@ -#ifndef __WINE_MATH_H -#define __WINE_MATH_H
-#ifdef __cplusplus -extern "C" { -#endif +#include <../include/math.h>
This is wrong, we need a proper math.h.
On Thursday 11 March 2004 20:44, Alexandre Julliard wrote:
--- include/msvcrt/math.h 2 Sep 2003 00:58:21 -0000 1.1 +++ include/msvcrt/math.h 10 Mar 2004 08:36:47 -0000 @@ -1,12 +1,14 @@ -#ifndef __WINE_MATH_H -#define __WINE_MATH_H
-#ifdef __cplusplus -extern "C" { -#endif +#include <../include/math.h>
This is wrong, we need a proper math.h.
As part of my efforts to get msvcrt compiled on MinGW I created a math.h and float.h based on MinGW headers. Since you're asking for a math.h and since my patch is going to be large enough already I thought I'd post them here. They are not complete but have enough to compile msvcrt itself.
-Hans
Changelog: The beginnings of math.h and float.h.
Alexandre Julliard wrote:
The i64 suffix is not portable.
oops the wrong file. I do need it with "LL" (real 64bit constant). If you want it protected by an ifdef. Is there an long long ifdef done by configure? .. OK I'll look for it and send a fix.
This is wrong, we need a proper math.h.
Do you want msvcrt to export math so we do not need -lm on link? Should I send in GCC's math.h adopted for wine and the additions to the msvcrt.spec file? In any way please remove the empty math.h . It is braking any winelib that uses math (and msvcrt).