diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-09-29 12:02:22 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-09-29 12:02:22 (GMT) |
| commit | f96662305e702a2c78089497268cff80903028e2 (patch) | |
| tree | 0678341be2d455b1e33e3e1f29b6d92fc7d99efd | |
| parent | 052144cb1fd693cf17ac2ebdf15272268d16a57d (diff) | |
| parent | e0087267dfcc2f5340cb0ca19d97f65ae198beb0 (diff) | |
| download | tcl-f96662305e702a2c78089497268cff80903028e2.zip tcl-f96662305e702a2c78089497268cff80903028e2.tar.gz tcl-f96662305e702a2c78089497268cff80903028e2.tar.bz2 | |
Don't build most of the files with -DUNICODE -D_UNICODE any more, only the ones that need to.
Since all calls to the Win32 API already use the *W() forms directly, this actually doesn't make a difference.
| -rw-r--r-- | generic/tclMain.c | 53 | ||||
| -rw-r--r-- | win/Makefile.in | 16 | ||||
| -rw-r--r-- | win/makefile.vc | 22 | ||||
| -rw-r--r-- | win/rules.vc | 17 |
4 files changed, 33 insertions, 75 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c index 927de7e..08c1fe0 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -17,21 +17,11 @@ */ /* - * On Windows, this file needs to be compiled twice, once with TCL_ASCII_MAIN - * defined. This way both Tcl_Main and Tcl_MainExW can be implemented, sharing - * the same source code. + * On Windows, this file needs to be compiled twice, once with UNICODE and + * _UNICODE defined. This way both Tcl_Main and Tcl_MainExW can be + * implemented, sharing the same source code. */ -#if defined(TCL_ASCII_MAIN) -# ifdef UNICODE -# undef UNICODE -# undef _UNICODE -# else -# define UNICODE -# define _UNICODE -# endif -#endif - #include "tclInt.h" /* @@ -53,26 +43,19 @@ # define _tcscmp strcmp #endif -/* - * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise - * NewNativeObj is needed (which provides proper conversion from native - * encoding to UTF-8). - */ - -#ifdef UNICODE -# define NewNativeObj Tcl_NewUnicodeObj -#else /* !UNICODE */ static inline Tcl_Obj * NewNativeObj( - char *string, - int length) + TCHAR *string) { Tcl_DString ds; - Tcl_ExternalToUtfDString(NULL, string, length, &ds); +#ifdef UNICODE + Tcl_WinTCharToUtf(string, -1, &ds); +#else + Tcl_ExternalToUtfDString(NULL, (char *) string, -1, &ds); +#endif return TclDStringToObj(&ds); } -#endif /* !UNICODE */ /* * Declarations for various library functions and variables (don't want to @@ -134,7 +117,7 @@ static void Prompt(Tcl_Interp *interp, InteractiveState *isPtr); static void StdinProc(ClientData clientData, int mask); static void FreeMainInterp(ClientData clientData); -#ifndef TCL_ASCII_MAIN +#if !defined(_WIN32) || defined(UNICODE) static Tcl_ThreadDataKey dataKey; /* @@ -279,7 +262,7 @@ Tcl_SourceRCFile( Tcl_DStringFree(&temp); } } -#endif /* !TCL_ASCII_MAIN */ +#endif /* !UNICODE */ /*---------------------------------------------------------------------- * @@ -341,14 +324,14 @@ Tcl_MainEx( if ((argc > 3) && (0 == _tcscmp(TEXT("-encoding"), argv[1])) && ('-' != argv[3][0])) { - Tcl_Obj *value = NewNativeObj(argv[2], -1); - Tcl_SetStartupScript(NewNativeObj(argv[3], -1), + Tcl_Obj *value = NewNativeObj(argv[2]); + Tcl_SetStartupScript(NewNativeObj(argv[3]), Tcl_GetString(value)); Tcl_DecrRefCount(value); argc -= 3; argv += 3; } else if ((argc > 1) && ('-' != argv[1][0])) { - Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL); + Tcl_SetStartupScript(NewNativeObj(argv[1]), NULL); argc--; argv++; } @@ -356,7 +339,7 @@ Tcl_MainEx( path = Tcl_GetStartupScript(&encodingName); if (path == NULL) { - appName = NewNativeObj(argv[0], -1); + appName = NewNativeObj(argv[0]); } else { appName = path; } @@ -368,7 +351,7 @@ Tcl_MainEx( argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { - Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(*argv++, -1)); + Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(*argv++)); } Tcl_SetVar2Ex(interp, "argv", NULL, argvPtr, TCL_GLOBAL_ONLY); @@ -650,7 +633,7 @@ Tcl_Main( } #endif /* TCL_MAJOR_VERSION == 8 && !UNICODE */ -#ifndef TCL_ASCII_MAIN +#if !defined(_WIN32) || defined(UNICODE) /* *--------------------------------------------------------------- @@ -741,7 +724,7 @@ TclFullFinalizationRequested(void) return finalize; #endif /* PURIFY */ } -#endif /* !TCL_ASCII_MAIN */ +#endif /* UNICODE */ /* *---------------------------------------------------------------------- diff --git a/win/Makefile.in b/win/Makefile.in index 988a1af..4b2aed2 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -82,7 +82,7 @@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE -D_ATL_XP_TARGETING +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING # To compile without backward compatibility and deprecated code uncomment the # following @@ -270,8 +270,8 @@ GENERIC_OBJS = \ tclLiteral.$(OBJEXT) \ tclListObj.$(OBJEXT) \ tclLoad.$(OBJEXT) \ + tclMainW.$(OBJEXT) \ tclMain.$(OBJEXT) \ - tclMain2.$(OBJEXT) \ tclNamesp.$(OBJEXT) \ tclNotify.$(OBJEXT) \ tclOO.$(OBJEXT) \ @@ -473,7 +473,7 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) @VC_MANIFEST_EMBED_EXE@ cat32.$(OBJEXT): cat.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) + $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE @DEPARG@ $(CC_OBJNAME) $(CAT32): cat32.$(OBJEXT) $(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE) @@ -534,7 +534,7 @@ ${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE} # Special case object targets tclTestMain.${OBJEXT}: tclAppInit.c - $(CC) -c $(CC_SWITCHES) -DTCL_TEST -DBUILD_tcl $(EXTFLAGS) $(CC_OBJNAME) $(WIN_DIR)/tclAppInit.c + $(CC) -c $(CC_SWITCHES) -DTCL_TEST -DUNICODE -D_UNICODE $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) tclWinInit.${OBJEXT}: tclWinInit.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) @@ -548,11 +548,11 @@ tclWinReg.${OBJEXT}: tclWinReg.c tclWinDde.${OBJEXT}: tclWinDde.c $(CC) -c $(CC_SWITCHES) $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) -testMain.${OBJEXT}: tclAppInit.c - $(CC) -c $(CC_SWITCHES) -DTCL_TEST @DEPARG@ $(CC_OBJNAME) +tclAppInit.${OBJEXT}: tclAppInit.c + $(CC) -c $(CC_SWITCHES) $(EXTFLAGS) -DUNICODE -D_UNICODE @DEPARG@ $(CC_OBJNAME) -tclMain2.${OBJEXT}: tclMain.c - $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) +tclMainW.${OBJEXT}: tclMain.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DUNICODE -D_UNICODE @DEPARG@ $(CC_OBJNAME) # TIP #59, embedding of configuration information into the binary library. # diff --git a/win/makefile.vc b/win/makefile.vc index cbd2a41..21e4270 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -260,8 +260,8 @@ COREOBJS = \ $(TMP_DIR)\tclListObj.obj \
$(TMP_DIR)\tclLiteral.obj \
$(TMP_DIR)\tclLoad.obj \
+ $(TMP_DIR)\tclMainW.obj \
$(TMP_DIR)\tclMain.obj \
- $(TMP_DIR)\tclMain2.obj \
$(TMP_DIR)\tclNamesp.obj \
$(TMP_DIR)\tclNotify.obj \
$(TMP_DIR)\tclOO.obj \
@@ -547,7 +547,8 @@ clean-pkgs: )
$(CAT32): $(WIN_DIR)\cat.c
- $(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE -Fo$(TMP_DIR)\ $?
+ $(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE \
+ /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $?
$(CONEXECMD) -stack:16384 $(TMP_DIR)\cat.obj
$(_VC_MANIFEST_EMBED_EXE)
@@ -646,7 +647,6 @@ CORE_MACHINE = $(MACHINE) CORE_DEBUG = $(DEBUG)
CORE_TCL_THREADS = $(TCL_THREADS)
CORE_USE_THREAD_ALLOC = $(USE_THREAD_ALLOC)
-CORE_USE_WIDECHAR_API = $(USE_WIDECHAR_API)
<<
#---------------------------------------------------------------------
@@ -733,12 +733,12 @@ gendate: #---------------------------------------------------------------------
$(TMP_DIR)\testMain.obj: $(WIN_DIR)\tclAppInit.c
- $(cc32) $(appcflags) /DTCL_TEST \
+ $(cc32) $(appcflags) /DTCL_TEST /DUNICODE /D_UNICODE \
/DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
-Fo$@ $?
-$(TMP_DIR)\tclMain2.obj: $(GENERICDIR)\tclMain.c
- $(cc32) $(pkgcflags) /DTCL_ASCII_MAIN \
+$(TMP_DIR)\tclMainW.obj: $(GENERICDIR)\tclMain.c
+ $(cc32) $(pkgcflags) /DUNICODE /D_UNICODE \
-Fo$@ $?
$(TMP_DIR)\tclTest.obj: $(GENERICDIR)\tclTest.c
@@ -768,7 +768,7 @@ $(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c -Fo$@ $?
$(TMP_DIR)\tclAppInit.obj: $(WIN_DIR)\tclAppInit.c
- $(cc32) $(appcflags) \
+ $(cc32) $(appcflags) /DUNICODE /D_UNICODE \
/DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
-Fo$@ $?
@@ -776,19 +776,11 @@ $(TMP_DIR)\tclAppInit.obj: $(WIN_DIR)\tclAppInit.c ### *ALL* extensions need to built with /DTCL_THREADS=1
$(TMP_DIR)\tclWinReg.obj: $(WIN_DIR)\tclWinReg.c
-!if $(STATIC_BUILD)
- $(cc32) $(appcflags) /DSTATIC_BUILD -Fo$@ $?
-!else
$(cc32) $(appcflags) /DUSE_TCL_STUBS -Fo$@ $?
-!endif
$(TMP_DIR)\tclWinDde.obj: $(WIN_DIR)\tclWinDde.c
-!if $(STATIC_BUILD)
- $(cc32) $(appcflags) /DSTATIC_BUILD -Fo$@ $?
-!else
$(cc32) $(appcflags) /DUSE_TCL_STUBS -Fo$@ $?
-!endif
### The following objects are part of the stub library and should not
diff --git a/win/rules.vc b/win/rules.vc index 454887c..325357c 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1332,23 +1332,6 @@ OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T # _ATL_XP_TARGETING - Newer SDK's need this to build for XP
COMPILERFLAGS = /D_ATL_XP_TARGETING
-# Following is primarily for the benefit of extensions. Tcl 8.5 builds
-# Tcl without /DUNICODE, while 8.6 builds with it defined. When building
-# an extension, it is advisable (but not mandated) to use the same Windows
-# API as the Tcl build. This is accordingly defaulted below. A particular
-# extension can override this by pre-definining USE_WIDECHAR_API.
-!ifndef USE_WIDECHAR_API
-!if $(TCL_VERSION) > 85
-USE_WIDECHAR_API = 1
-!else
-USE_WIDECHAR_API = 0
-!endif
-!endif
-
-!if $(USE_WIDECHAR_API)
-COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE
-!endif
-
# Like the TEA system only set this non empty for non-Tk extensions
# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME
# so we pass both
|
