Overview
| Artifact ID: | 1f88a2cb3cf50139dd742bec1d69d30dfe62c37f |
|---|---|
| Ticket: | 442178ffffffffffffffffffffffffffffffffff
Cygwin TCHAR in tclPlatDecls.h fix |
| User & Date: | mdejong on 2001-07-18 15:22:13 |
Changes
- icomment:
Logged In: YES user_id=90858 Ok, I took another look at things and I think one of these two options is the ticket. The first option is to pull <windows.h> into tclPlatDecls.h. This moves the currently unused TCHAR defines in the CHECK_UNICODE_DEFINES block. Index: generic/tclPlatDecls.h =================================================================== RCS file: /cvsroot/tcl/tcl/generic/tclPlatDecls.h,v retrieving revision 1.6 diff -u -r1.6 tclPlatDecls.h --- generic/tclPlatDecls.h2000/08/20 03:51:231.6 +++ generic/tclPlatDecls.h2001/07/18 08:04:32 @@ -13,13 +13,29 @@ #define _TCLPLATDECLS /* - * Pull in the definition of TCHAR. Hopefully the compile flags - * of the core are matching against your project build for these - * public functions. BE AWARE. + * Define TCHAR by pulling in <windows.h>. If the + * core uses unicode but an extension does not, a compile + * time error should be generated. BE AWARE. */ -#if defined(__WIN32__) && !defined(_INC_TCHAR) -#include <tchar.h> -#endif +#ifdef __WIN32__ + +#ifdef CHECK_UNICODE_CALLS + +#define _UNICODE +#define UNICODE + +#define __TCHAR_DEFINED +typedef float *_TCHAR; + +#define _TCHAR_DEFINED +typedef float *TCHAR; + +#endif /* CHECK_UNICODE_CALLS */ + +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# undef WIN32_LEAN_AND_MEAN +#endif /* __WIN32__ */ /* !BEGIN!: Do not edit below this line. */ Index: win/tclWinPort.h =================================================================== RCS file: /cvsroot/tcl/tcl/win/tclWinPort.h,v retrieving revision 1.16 diff -u -r1.16 tclWinPort.h --- win/tclWinPort.h2001/07/17 18:33:241.16 +++ win/tclWinPort.h2001/07/18 08:04:32 @@ -20,19 +20,6 @@ # include "tclInt.h" #endif -#ifdef CHECK_UNICODE_CALLS - -#define _UNICODE -#define UNICODE - -#define __TCHAR_DEFINED -typedef float *_TCHAR; - -#define _TCHAR_DEFINED -typedef float *TCHAR; - -#endif - /* *--------------------------------------------------------------------------- * The following sets of #includes and #ifdefs are required to get Tcl to @@ -66,10 +53,6 @@ #include <time.h> #include <winsock.h> -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#undef WIN32_LEAN_AND_MEAN - #ifdef BUILD_tcl # undef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLEXPORT The second option would be to leave the #include <windows.h> in tclWinPort.h and just #define TCHAR for ourselves in tclPlatDecls.h. Index: generic/tclPlatDecls.h =================================================================== RCS file: /cvsroot/tcl/tcl/generic/tclPlatDecls.h,v retrieving revision 1.6 diff -u -r1.6 tclPlatDecls.h --- generic/tclPlatDecls.h2000/08/20 03:51:231.6 +++ generic/tclPlatDecls.h2001/07/18 07:50:42 @@ -13,13 +13,17 @@ #define _TCLPLATDECLS /* - * Pull in the definition of TCHAR. Hopefully the compile flags - * of the core are matching against your project build for these - * public functions. BE AWARE. + * Define TCHAR without pulling in <windows.h>. If the + * core uses unicode but an extension does not, a compile + * time error should be generated. BE AWARE. */ -#if defined(__WIN32__) && !defined(_INC_TCHAR) -#include <tchar.h> -#endif +#ifdef __WIN32__ +#ifdef UNICODE +#define TCHAR wchar_t +#else +#define TCHAR char +#endif /* UNICODE */ +#endif /* __WIN32__ */ /* !BEGIN!: Do not edit below this line. */ @@ -96,6 +100,10 @@ #ifdef __cplusplus } #endif + +#ifdef __WIN32__ +#undef TCHAR +#endif /* __WIN32__ */ #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) Comments? Does one seem better than the other?
- login: "mdejong"
- mimetype: "text/plain"
- username: "mdejong"