- byteOrder - is the most significant, or least significant, byte first
- machine - some info specific to the kind of hardware
- os - a string identifying the operating system
- osVersion - the version of the os
- pathSeparator — character used to split variables like env(PATH) into a proper Tcl list (from 8.6)
- platform - which of the major types of computers is this
- pointerSize - bytes taken up by a void pointer (from 8.5)
- user - user's login id
- wordSize - number of bytes for a machine-word
- threaded - tcl configured with --enable-threads
- debug - a windows tcl configured with --enable-debug
LV In Tcl 8.5, a new platform package makes available new commands such as platform::generic and platform::identify .
LV How much of this information is generated dynamically, and how much of it really is generated statically at compile time?
- byteOrder, wordSize, and pointerSize are dynamically generated.
- The statement which adds the threaded element is statically compiled into the system.
- The platform entry is generated statically.
- The os, and osVersion entries appear to be generated dynamically.
- The machine entry is generated dynamically.
- The user entry is generated dynamically (based on USER and LOGNAME environment variables)
- The debug entry is statically added.
Please add the output of
parray tcl_platformhere for your platform if it is not represented.MSDN has documentation for the Microsoft Windows platforms [1]What order should these be in? Alpha by platform? -- CLNI've put the Linux entries together, annotated with processor, kernel, and distribution info. -- DJHAIX 4.3:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = 003C87964C00 tcl_platform(os) = AIX tcl_platform(osVersion) = 4.3 tcl_platform(platform) = unixAIX 5.1 on PPC:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = 0042065B4C00 tcl_platform(os) = AIX tcl_platform(osVersion) = 5.1 tcl_platform(platform) = unix tcl_platform(wordSize) = 4AIX 6.1 on pSeries:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = 000BF680D600 tcl_platform(os) = AIX tcl_platform(osVersion) = 6.1 tcl_platform(platform) = unix tcl_platform(wordSize) = 4CYGWIN_NT-5.1 (tclsh8.5.exe, Cygwin on Windows XP Professional):
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 5.1 tcl_platform(platform) = unixThe last field changed from "windows" to "unix" in 2012-02.HP-UX 10.20:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = 9000/715 tcl_platform(os) = HP-UX tcl_platform(osVersion) = B.10.20 tcl_platform(platform) = unixHP-UX 11:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = 9000/782 tcl_platform(os) = HP-UX tcl_platform(osVersion) = B.11.00 tcl_platform(platform) = unixHP-UX 11.11:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = 9000/800 tcl_platform(os) = HP-UX tcl_platform(osVersion) = B.11.11 tcl_platform(platform) = unix tcl_platform(wordSize) = 4HP-UX 11.23 Itanium :
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = ia64 tcl_platform(os) = HP-UX tcl_platform(osVersion) = B.11.23 tcl_platform(platform) = unix tcl_platform(wordSize) = 4HP-UX 11.31 parisc :
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = 9000/800 tcl_platform(os) = HP-UX tcl_platform(osVersion) = B.11.31 tcl_platform(platform) = unix tcl_platform(wordSize) = 4IRIX 6.5:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = IP32 tcl_platform(os) = IRIX tcl_platform(osVersion) = 6.5 tcl_platform(platform) = unixLinux Alpha kernel 2.2, distrib Redhat 6.2:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = alpha tcl_platform(os) = Linux tcl_platform(osVersion) = 2.2.19 tcl_platform(platform) = unixLinux StrongARM kernel 2.4, distrib Debian 2.2
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = armv4l tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.0-test1-ac7-rmk1-crl2 tcl_platform(platform) = unix tcl_platform(wordSize) = 4Linux PowerPC kernel 2.4, distrib Debian 'woody':
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = ppc tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.16 tcl_platform(platform) = unixLinux s/390x kernel 2.6, distrib SuSE Enterprise Server 10 SP 1:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = s390x tcl_platform(os) = Linux tcl_platform(osVersion) = 2.6.16.46-0.12-default tcl_platform(platform) = unix tcl_platform(wordSize) = 4Linux SH4 kernel 2.4, distrib Debian unstable/testing:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = sh4 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.18-sh tcl_platform(platform) = unix tcl_platform(wordSize) = 4Linux x86 kernel 2.4, distrib RedHat Enterprise Linux 3:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = ia64 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.21-47.EL tcl_platform(platform) = unix tcl_platform(wordSize) = 8Linux x86 kernel 2.2, distrib Redhat 6.2:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.2.19 tcl_platform(platform) = unixLinux x86 kernel 2.4, distrib Debian:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.7-win4lin tcl_platform(platform) = unixLinux x86 kernel 2.4 distrib Mandrake (8.1)
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.8-26mdk tcl_platform(platform) = unixLinux x86, kernel 2.4.22, distrib Slackware
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.22 tcl_platform(platform) = unix tcl_platform(wordSize) = 4Linux x86, kernel 2.6.8, distrib Debian, Sarge (on PC with 1GHz AMD Athlon)
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.6.8-2-386 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Linux x86, kernel 2.6.8, distrib Debian, Sarge (on PC with a classic Pentium 120)
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i586 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.6.8-2-386 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Linux x86_64, kernel 2.6.8, distrib SUSE 9.2
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = x86_64 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.6.8-24.14-default tcl_platform(platform) = unix tcl_platform(wordSize) = 8Linux x86, kernel 2.6.21.5, distrib Slackware 12.0
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.6.21.5 tcl_platform(platform) = unix tcl_platform(tip,268) = 1 tcl_platform(tip,280) = 1 tcl_platform(wordSize) = 4Mac OS 8:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = ppc tcl_platform(os) = MacOS tcl_platform(osVersion) = 8.6 tcl_platform(platform) = macintoshMac OS 9:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = ppc tcl_platform(os) = MacOS tcl_platform(osVersion) = 9.0 tcl_platform(platform) = macintoshMac OS X:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 1.3.7 tcl_platform(platform) = unixMac OS X, officially version 10.2.3, "Jaguar":
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 6.3 tcl_platform(platform) = unixMac OS X, 10.3.9, "Panther"
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 7.9.0 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Mac OS X, 10.4.1, "Tiger"
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 8.1.0 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Mac OS X, 10.4.3, "Tiger"
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 8.3.0 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Mac OS X, 10.4.6
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 8.6.0 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Mac OS X, 10.4.8 (PowerPC)
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 8.8.0 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Mac OS X, 10.4.8 (Intel)
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = Darwin tcl_platform(osVersion) = 8.8.1 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Mac OS X, 10.4.10 (Intel)
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = Darwin tcl_platform(osVersion) = 8.10.1 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(tip,268) = 1 tcl_platform(tip,280) = 1 tcl_platform(wordSize) = 4Mac OS X, 10.5.1 "Leopard" (PowerPC)
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = Power Macintosh tcl_platform(os) = Darwin tcl_platform(osVersion) = 9.1.0 tcl_platform(platform) = unix tcl_platform(wordSize) = 8Mac OS X, 10.5.1 "Leopard" (Intel) - ActiveTcl 8.5.0
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = Darwin tcl_platform(osVersion) = 9.1.0 tcl_platform(platform) = unix tcl_platform(pointerSize) = 4 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4MacOS X 10.6.2 "Snow Leopard" (Intel) - ActiveTcl 8.6
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = Darwin tcl_platform(osVersion) = 10.2.0 tcl_platform(platform) = unix tcl_platform(pointerSize) = 4 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4MacOS X 10.7.1 "Lion" (Intel) - ActiveTcl 8.5.10
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = x86_64 tcl_platform(os) = Darwin tcl_platform(osVersion) = 11.1.0 tcl_platform(platform) = unix tcl_platform(pointerSize) = 8 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 8DragonFlyBSD 1.0A-RELEASE
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = DragonFly tcl_platform(osVersion) = 1.0A-RELEASE tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4FreeBSD 4.7-STABLE x86:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = FreeBSD tcl_platform(osVersion) = 4.7-STABLE tcl_platform(platform) = unix tcl_platform(wordSize) = 4FreeBSD 4.8-STABLE x86:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = FreeBSD tcl_platform(osVersion) = 4.8-STABLE tcl_platform(platform) = unix tcl_platform(wordSize) = 4NetBSD 1.6(I) x86:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = NetBSD tcl_platform(osVersion) = 1.6I tcl_platform(platform) = unixNetBSD 2.0.2 x86:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = NetBSD tcl_platform(osVersion) = 2.0.2 tcl_platform(platform) = unix tcl_platform(wordSize) = 4OpenBSD 3.0 x86:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = OpenBSD tcl_platform(osVersion) = 3.0 tcl_platform(platform) = unix tcl_platform(wordSize) = 4SunOS 4:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4m tcl_platform(os) = SunOS tcl_platform(osVersion) = 4.1.3_U1 tcl_platform(platform) = unixSPARC Solaris 2.6:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.6 tcl_platform(platform) = unixSparc Solaris 2.7:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.7 tcl_platform(platform) = unix tcl_platform(threaded) = 1Sparc Solaris 8:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.8 tcl_platform(platform) = unixIntel Solaris 8:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i86pc tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.8 tcl_platform(platform) = unix tcl_platform(wordSize) = 4Sparc Solaris 9 with threads enabled:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.9 tcl_platform(platform) = unix tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Sparc Solaris 9 with threads and 64 bit enabled:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.9 tcl_platform(platform) = unix tcl_platform(pointerSize) = 8 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 8Sparc Solaris 9, without threads or 64 bit enabled, Tcl 8.5.4:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.9 tcl_platform(platform) = unix tcl_platform(pointerSize) = 4 tcl_platform(wordSize) = 4Sparc Solaris 10:
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = sun4u tcl_platform(os) = SunOS tcl_platform(osVersion) = 5.10 tcl_platform(platform) = unix tcl_platform(wordSize) = 4S/390 Linux
tcl_platform(byteOrder) = bigEndian tcl_platform(machine) = s390 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.4.21-20.EL tcl_platform(platform) = unix tcl_platform(wordSize) = 4Tru64 UNIX:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = alpha tcl_platform(os) = OSF1 tcl_platform(osVersion) = X5.1 tcl_platform(platform) = unixWindows 3.1:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Win32s tcl_platform(osVersion) = 1.30 tcl_platform(platform) = windowsWin95:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows 95 tcl_platform(osVersion) = 4.0 tcl_platform(platform) = windows tcl_platform(wordSize) = 4Win98:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows 95 tcl_platform(osVersion) = 4.10 tcl_platform(platform) = windowsWinNT:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 4.0 tcl_platform(platform) = windowsWin2000:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 5.0 tcl_platform(platform) = windows tcl_platform(wordSize) = 4Windows XP Home:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 5.1 tcl_platform(platform) = windows tcl_platform(wordSize) = 4Windows XP Professional:
tcl_platform(byteOrder) = littleEndian tcl_platform(debug) = 1 tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 5.1 tcl_platform(platform) = windowsWindows XP Professional/Firefox 1.04 with Tcl/Tk Tclet Plugin (with [tk windowingsystem] = "win32"):
tcl_platform(byteOrder) = littleEndian tcl_platform(platform) = windows tcl_platform(wordSize) = 4Windows Vista:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 6.0 tcl_platform(platform) = windows tcl_platform(wordSize) = 4Windows 2003 x64 (64-bit) running 32-bit Tcl:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 5.2 tcl_platform(platform) = windows tcl_platform(wordSize) = 4Windows 2003 x64 (64-bit) running 64-bit Tcl:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = amd64 tcl_platform(os) = Windows NT tcl_platform(osVersion) = 5.2 tcl_platform(platform) = windows tcl_platform(wordSize) = 4Windows 7 32-bit
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 6.1 tcl_platform(pointerSize) = 4 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Windows 7 Home Premium 64-bit
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = intel tcl_platform(os) = Windows NT tcl_platform(osVersion) = 6.1 tcl_platform(platform) = windows tcl_platform(pointerSize) = 4 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Note: there is no way to obtain the bitsize of the OS, an important variable, e.g. when you're going to exec programs that exist in specific 32- and 64-bit versions. A quick and reliable method in distinguishing is by using the windows wmi framework as follows (but you could also use the twapi package):
lindex [exec wmic computersystem get systemtype] 1Responses: X86-based or x64-basedThis was tested with following systems with 64-bit CPUs: Win XP 32-bit, Win7 32-bit and Win7 64-bit.Windows 7 Home Premium 64-bit running 64-bit Tcl
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = amd64 tcl_platform(os) = Windows NT tcl_platform(osVersion) = 6.1 tcl_platform(platform) = windows tcl_platform(pointerSize) = 8 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Windows 2008 Server R2 64-bit
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = amd64 tcl_platform(os) = Windows NT tcl_platform(osVersion) = 6.1 tcl_platform(pathSeparator) = ; tcl_platform(platform) = windows tcl_platform(pointerSize) = 8 tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4Windows/CE:
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = arm tcl_platform(os) = Windows CE tcl_platform(osVersion) = 3.0 tcl_platform(platform) = windowsWindows Mobile 2003SE (eTcl):
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = arm tcl_platform(os) = Windows CE tcl_platform(osVersion) = 4.21 tcl_platform(platform) = windows tcl_platform(threaded) = 1 tcl_platform(wordSize) = 4OS/400 V5R1M0:
tcl_platform(byteOrder) = bigEndian tcl_platform(host_platform) = unix tcl_platform(machine) = PowerPC tcl_platform(os) = OS/400 tcl_platform(osVersion) = V5R1M0 tcl_platform(platform) = javaQNX 6.3.0
tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = x86pc tcl_platform(os) = QNX tcl_platform(osVersion) = 6.3.0 tcl_platform(platform) = unix
Usage tip: it's probably a mistake to "switch $::tcl_platform(os) ..." If you're having to distinguish different flavors of Unix or Windows from each other, you're likely better off determining the availability of the functionality you truly want, rather than trying to infer it from OS variation. In the Microsoft world, for example, service packs give different NT installations features that align them with 95, 98, ... Think of how autoconf performs run-time tests, rather than switching on uname.For Tk since 8.4.2 there is also [tk windowingsystem], which tells you whether your Tk port is "win32", "x11", "aqua" or (MacOS) "classic". For UI issues that's better than asking for $tcl_platform(platform) and/or $tcl_platform(os), especially on MacOS X, where you have "aqua" as well as "x11" on the very same platform.
Note, the debug variable apparently is only available on Windows platforms when the Tcl library itself was compiled with the --enable-symbols flag.
There's a separate page called Generating a generic platform name, for discussion on how to massage the above information into a name which can be used as dirname to disambiguate shared libraries, etc.
Also potentially useful is the getWindowsAPIVendor proc which, on Windows, provides info regarding whether your underlying platform is Microsoft Windows, Wine or ReactOS.
[daneyul] - 2010-03-18 15:37:42Last I checked, Windows 7 is no longer pre-release. Any one have any info on the codes returned by Win 7 32, 64, for the different versions (Home Premium, Ultimate, Pro) for those who don't have Win 7 systems at hand?
