summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tcl.h4
-rw-r--r--generic/tclDecls.h1
-rw-r--r--generic/tclMain.c41
-rw-r--r--generic/tclZipfs.c4
-rw-r--r--tests/compile.test6
-rwxr-xr-xunix/configure54
-rw-r--r--unix/tcl.m438
-rw-r--r--win/Makefile.in16
-rw-r--r--win/makefile.vc19
-rw-r--r--win/rules.vc17
10 files changed, 122 insertions, 78 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index 7832419..2a6d172 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -2401,7 +2401,9 @@ EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
const char *version, int exact);
EXTERN void Tcl_InitSubsystems(void);
EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
-#ifndef _WIN32
+#ifdef _WIN32
+EXTERN int TclZipfs_AppHook(int *argc, wchar_t ***argv);
+#else
EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
#endif
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index c993602..c833291 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -3959,7 +3959,6 @@ extern const TclStubs *tclStubsPtr;
# define Tcl_MainEx Tcl_MainExW
EXTERN void Tcl_MainExW(int argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
- EXTERN int TclZipfs_AppHook(int *argc, wchar_t ***argv);
#endif
#undef TCL_STORAGE_CLASS
diff --git a/generic/tclMain.c b/generic/tclMain.c
index b7d740a..05d3787 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"
/*
@@ -55,16 +45,15 @@
static inline Tcl_Obj *
NewNativeObj(
- TCHAR *string,
- int length)
+ TCHAR *string)
{
Tcl_DString ds;
#ifdef UNICODE
Tcl_DStringInit(&ds);
- Tcl_WCharToUtfDString(string, length, &ds);
+ Tcl_WCharToUtfDString(string, -1, &ds);
#else
- Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds);
+ Tcl_ExternalToUtfDString(NULL, (char *) string, -1, &ds);
#endif
return TclDStringToObj(&ds);
}
@@ -129,7 +118,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;
/*
@@ -274,7 +263,7 @@ Tcl_SourceRCFile(
Tcl_DStringFree(&temp);
}
}
-#endif /* !TCL_ASCII_MAIN */
+#endif /* !UNICODE */
/*----------------------------------------------------------------------
*
@@ -336,14 +325,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++;
}
@@ -351,7 +340,7 @@ Tcl_MainEx(
path = Tcl_GetStartupScript(&encodingName);
if (path == NULL) {
- appName = NewNativeObj(argv[0], -1);
+ appName = NewNativeObj(argv[0]);
} else {
appName = path;
}
@@ -363,7 +352,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);
@@ -630,7 +619,7 @@ Tcl_MainEx(
Tcl_Exit(exitCode);
}
-#ifndef TCL_ASCII_MAIN
+#if !defined(_WIN32) || defined(UNICODE)
/*
*---------------------------------------------------------------
@@ -721,7 +710,7 @@ TclFullFinalizationRequested(void)
return finalize;
#endif /* PURIFY */
}
-#endif /* !TCL_ASCII_MAIN */
+#endif /* UNICODE */
/*
*----------------------------------------------------------------------
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index d59d893..733b97b 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -4877,7 +4877,11 @@ TclZipfs_AppHook(
{
char *archive;
+#ifdef _WIN32
+ Tcl_FindExecutable(NULL);
+#else /* !_WIN32 */
Tcl_FindExecutable((*argvPtr)[0]);
+#endif /* _WIN32 */
archive = (char *) Tcl_GetNameOfExecutable();
TclZipfs_Init(NULL);
diff --git a/tests/compile.test b/tests/compile.test
index 4d57549..18e978f 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -494,10 +494,10 @@ test compile-13.2 {TclCompileScript: testing expected nested scripts compilation
ti eval {set result {}}
} -body {
# Test different compilation variants (instructions evalStk, invokeStk, etc),
- # with 2000 (1000 in debug) nested scripts (bodies). If you get SO/SF exceptions on some low-stack
+ # with 1500 (1000 in debug) nested scripts (bodies). If you get SO/SF exceptions on some low-stack
# boxes or systems, please don't decrease it (either provide a constraint)
ti eval {foreach cmd {eval "if 1" try catch} {
- set c [gencode [expr {![::tcl::pkgconfig get debug] ? 2000 : 1000}] $cmd]
+ set c [gencode [expr {![::tcl::pkgconfig get debug] ? 1500 : 1000}] $cmd]
if 1 $c
}}
ti eval {set result}
@@ -511,7 +511,7 @@ test compile-13.3 {TclCompileScript: testing check of max depth by nested script
# with 500 nested scripts (bodies). It must generate "too many nested compilations"
# error for any variant we're testing here:
ti eval {foreach cmd {eval "if 1" try catch} {
- set c [gencode [expr {![info exists ::tcl_platform(debug)] ? 2000 : 1000}] $cmd]
+ set c [gencode 500 $cmd]
lappend errors [catch $c e] $e
}}
#puts $errors
diff --git a/unix/configure b/unix/configure
index e0df311..e0e0b0e 100755
--- a/unix/configure
+++ b/unix/configure
@@ -7926,7 +7926,30 @@ $as_echo "#define HAVE_MTSAFE_GETHOSTBYADDR 1" >>confdefs.h
else
- ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r"
+
+ # Avoids picking hidden internal symbol from libc
+ ac_fn_c_check_decl "$LINENO" "gethostbyname_r" "ac_cv_have_decl_gethostbyname_r" "#include <netdb.h>
+"
+if test "x$ac_cv_have_decl_gethostbyname_r" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETHOSTBYNAME_R $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+
+ tcl_cv_api_gethostbyname_r=yes
+else
+ tcl_cv_api_gethostbyname_r=no
+fi
+
+
+
+ if test "$tcl_cv_api_gethostbyname_r" = yes; then
+ ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r"
if test "x$ac_cv_func_gethostbyname_r" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 6 args" >&5
@@ -8063,7 +8086,32 @@ $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h
fi
- ac_fn_c_check_func "$LINENO" "gethostbyaddr_r" "ac_cv_func_gethostbyaddr_r"
+ fi
+
+
+ # Avoids picking hidden internal symbol from libc
+ ac_fn_c_check_decl "$LINENO" "gethostbyaddr_r" "ac_cv_have_decl_gethostbyaddr_r" "#include <netdb.h>
+"
+if test "x$ac_cv_have_decl_gethostbyaddr_r" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETHOSTBYADDR_R $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+
+ tcl_cv_api_gethostbyaddr_r=yes
+else
+ tcl_cv_api_gethostbyaddr_r=no
+fi
+
+
+
+ if test "$tcl_cv_api_gethostbyaddr_r" = yes; then
+ ac_fn_c_check_func "$LINENO" "gethostbyaddr_r" "ac_cv_func_gethostbyaddr_r"
if test "x$ac_cv_func_gethostbyaddr_r" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr_r with 7 args" >&5
@@ -8165,6 +8213,8 @@ $as_echo "#define HAVE_GETHOSTBYADDR_R 1" >>confdefs.h
fi
+ fi
+
fi
#---------------------------------------------------------------------------
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 70303ce..93efb49 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -2518,7 +2518,20 @@ AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
#
#--------------------------------------------------------------------
-AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
+AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [
+ # Avoids picking hidden internal symbol from libc
+ SC_TCL_GETHOSTBYADDR_R_DECL
+
+ if test "$tcl_cv_api_gethostbyaddr_r" = yes; then
+ SC_TCL_GETHOSTBYADDR_R_TYPE
+ fi
+])
+
+AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_DECL], [AC_CHECK_DECLS(gethostbyaddr_r, [
+ tcl_cv_api_gethostbyaddr_r=yes],[tcl_cv_api_gethostbyaddr_r=no],[#include <netdb.h>])
+])
+
+AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_TYPE], [AC_CHECK_FUNC(gethostbyaddr_r, [
AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
AC_TRY_COMPILE([
#include <netdb.h>
@@ -2579,14 +2592,27 @@ AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
# Results:
#
# Might define the following vars:
-# HAVE_GETHOSTBYADDR_R
-# HAVE_GETHOSTBYADDR_R_3
-# HAVE_GETHOSTBYADDR_R_5
-# HAVE_GETHOSTBYADDR_R_6
+# HAVE_GETHOSTBYNAME_R
+# HAVE_GETHOSTBYNAME_R_3
+# HAVE_GETHOSTBYNAME_R_5
+# HAVE_GETHOSTBYNAME_R_6
#
#--------------------------------------------------------------------
-AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
+AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [
+ # Avoids picking hidden internal symbol from libc
+ SC_TCL_GETHOSTBYNAME_R_DECL
+
+ if test "$tcl_cv_api_gethostbyname_r" = yes; then
+ SC_TCL_GETHOSTBYNAME_R_TYPE
+ fi
+])
+
+AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_DECL], [AC_CHECK_DECLS(gethostbyname_r, [
+ tcl_cv_api_gethostbyname_r=yes],[tcl_cv_api_gethostbyname_r=no],[#include <netdb.h>])
+])
+
+AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_TYPE], [AC_CHECK_FUNC(gethostbyname_r, [
AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
AC_TRY_COMPILE([
#include <netdb.h>
diff --git a/win/Makefile.in b/win/Makefile.in
index e4866cd..30a9873 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
@@ -317,8 +317,8 @@ GENERIC_OBJS = \
tclLiteral.$(OBJEXT) \
tclListObj.$(OBJEXT) \
tclLoad.$(OBJEXT) \
+ tclMainW.$(OBJEXT) \
tclMain.$(OBJEXT) \
- tclMain2.$(OBJEXT) \
tclNamesp.$(OBJEXT) \
tclNotify.$(OBJEXT) \
tclOO.$(OBJEXT) \
@@ -555,7 +555,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)
@@ -621,7 +621,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)
@@ -635,11 +635,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 #430, ZipFS Support
tclZipfs.${OBJEXT}: $(GENERIC_DIR)/tclZipfs.c
diff --git a/win/makefile.vc b/win/makefile.vc
index 5711d23..6172dc5 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 \
@@ -647,7 +647,6 @@ $(OUT_DIR)\tcl.nmake:
CORE_MACHINE = $(MACHINE)
CORE_DEBUG = $(DEBUG)
CORE_USE_THREAD_ALLOC = $(USE_THREAD_ALLOC)
-CORE_USE_WIDECHAR_API = $(USE_WIDECHAR_API)
<<
#---------------------------------------------------------------------
@@ -733,12 +732,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
@@ -773,26 +772,18 @@ $(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$@ $?
### The following objects should be built using the stub interfaces
$(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 8d0793c..f8e7173 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -1326,23 +1326,6 @@ OPTDEFINES = $(OPTDEFINES) /DTCL_UTF_MAX=4
# _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