summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-06-06 14:49:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-06-06 14:49:53 (GMT)
commit392486c0fc59117de0084c05adc0a3b7e5c22125 (patch)
tree934555da212f3a176ecef4c63cbd3cf59f65859d
parenteb41635caa3911f42cd3be3ed014fc094e50b614 (diff)
parent342d27d13f57e57c4e1bc71b6dd00ef6244d8af1 (diff)
downloadtcl-392486c0fc59117de0084c05adc0a3b7e5c22125.zip
tcl-392486c0fc59117de0084c05adc0a3b7e5c22125.tar.gz
tcl-392486c0fc59117de0084c05adc0a3b7e5c22125.tar.bz2
merge trunk
-rw-r--r--ChangeLog12
-rw-r--r--generic/tclZlib.c11
-rw-r--r--unix/tclUnixInit.c71
3 files changed, 91 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 46c1b78f..3f089d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-06-06 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclZlib.c (TclZlibInit): Declare that Tcl is publishing the
+ zlib package (version 2.0) as part of its bootstrap process. This will
+ have an impact on tclkit (which includes zlib 1.1) but otherwise be
+ very low impact.
+
+2012-06-06 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tclUnixInit.c: On Cygwin, use win32 API in stead of uname()
+ to determine the tcl_platform variables.
+
2012-05-31 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tclZlib.c: [Bug 3530536]: zlib-7.4 fails on IRIX64
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 63d2aca..585b500 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -20,6 +20,15 @@
#include "tclIO.h"
/*
+ * The version of the zlib "package" that this implements. Note that this
+ * thoroughly supersedes the versions included with tclkit, which are "1.1",
+ * so this is at least "2.0" (there's no general *commitment* to have the same
+ * interface, even if that is mostly true).
+ */
+
+#define TCL_ZLIB_VERSION "2.0"
+
+/*
* Magic flags used with wbits fields to indicate that we're handling the gzip
* format or automatic detection of format. Putting it here is slightly less
* gross!
@@ -3584,7 +3593,7 @@ TclZlibInit(
*/
Tcl_CreateObjCommand(interp, "zlib", ZlibCmd, 0, 0);
- return TCL_OK;
+ return Tcl_PkgProvide(interp, "zlib", TCL_ZLIB_VERSION);
}
/*
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index bc1b0e7..f07b123 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -31,6 +31,51 @@
# include <dlfcn.h>
# endif
#endif
+
+#ifdef __CYGWIN__
+DLLIMPORT extern __stdcall unsigned char GetVersionExA(void *);
+DLLIMPORT extern __stdcall void GetSystemInfo(void *);
+
+#define NUMPLATFORMS 4
+static const char *const platforms[NUMPLATFORMS] = {
+ "Win32s", "Windows 95", "Windows NT", "Windows CE"
+};
+
+#define NUMPROCESSORS 11
+static const char *const processors[NUMPROCESSORS] = {
+ "intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil",
+ "amd64", "ia32_on_win64"
+};
+
+typedef struct _SYSTEM_INFO {
+ union {
+ DWORD dwOemId;
+ struct {
+ int wProcessorArchitecture;
+ int wReserved;
+ };
+ };
+ DWORD dwPageSize;
+ void *lpMinimumApplicationAddress;
+ void *lpMaximumApplicationAddress;
+ void *dwActiveProcessorMask;
+ DWORD dwNumberOfProcessors;
+ DWORD dwProcessorType;
+ DWORD dwAllocationGranularity;
+ int wProcessorLevel;
+ int wProcessorRevision;
+} SYSTEM_INFO;
+
+typedef struct _OSVERSIONINFOA {
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformId;
+ char szCSDVersion[128];
+} OSVERSIONINFOA;
+#endif
+
#ifdef HAVE_COREFOUNDATION
#include <CoreFoundation/CoreFoundation.h>
#endif
@@ -700,7 +745,11 @@ void
TclpSetVariables(
Tcl_Interp *interp)
{
-#ifndef NO_UNAME
+#ifdef __CYGWIN__
+ SYSTEM_INFO sysInfo;
+ OSVERSIONINFOA osInfo;
+ char buffer[TCL_INTEGER_SPACE * 2];
+#elif !defined(NO_UNAME)
struct utsname name;
#endif
int unameOK;
@@ -809,7 +858,25 @@ TclpSetVariables(
#endif
unameOK = 0;
-#ifndef NO_UNAME
+#ifdef __CYGWIN__
+ unameOK = 1;
+ osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
+ GetVersionExA(&osInfo);
+ GetSystemInfo(&sysInfo);
+
+ if (osInfo.dwPlatformId < NUMPLATFORMS) {
+ Tcl_SetVar2(interp, "tcl_platform", "os",
+ platforms[osInfo.dwPlatformId], TCL_GLOBAL_ONLY);
+ }
+ sprintf(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion);
+ Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY);
+ if (sysInfo.wProcessorArchitecture < NUMPROCESSORS) {
+ Tcl_SetVar2(interp, "tcl_platform", "machine",
+ processors[sysInfo.wProcessorArchitecture],
+ TCL_GLOBAL_ONLY);
+ }
+
+#elif !defined NO_UNAME
if (uname(&name) >= 0) {
const char *native;