1platform(n) Tcl Bundled Packages platform(n)
2
3
4
5______________________________________________________________________________
6
8 platform - System identification support code and utilities
9
11 package require platform ?1.0.10?
12
13 platform::generic
14 platform::identify
15 platform::patterns identifier
16______________________________________________________________________________
17
19 The platform package provides several utility commands useful for the
20 identification of the architecture of a machine running Tcl.
21
22 Whilst Tcl provides the tcl_platform array for identifying the current
23 architecture (in particular, the platform and machine elements) this is
24 not always sufficient. This is because (on Unix machines) tcl_platform
25 reflects the values returned by the uname command and these are not
26 standardized across platforms and architectures. In addition, on at
27 least one platform (AIX) the tcl_platform(machine) contains the CPU
28 serial number.
29
30 Consequently, individual applications need to manipulate the values in
31 tcl_platform (along with the output of system specific utilities) -
32 which is both inconvenient for developers, and introduces the potential
33 for inconsistencies in identifying architectures and in naming conven‐
34 tions.
35
36 The platform package prevents such fragmentation - i.e., it establishes
37 a standard naming convention for architectures running Tcl and makes it
38 more convenient for developers to identify the current architecture a
39 Tcl program is running on.
40
42 platform::identify
43 This command returns an identifier describing the platform the
44 Tcl core is running on. The returned identifier has the general
45 format OS-CPU. The OS part of the identifier may contain details
46 like kernel version, libc version, etc., and this information
47 may contain dashes as well. The CPU part will not contain
48 dashes, making the preceding dash the last dash in the result.
49
50 platform::generic
51 This command returns a simplified identifier describing the
52 platform the Tcl core is running on. In contrast to plat‐
53 form::identify it leaves out details like kernel version, libc
54 version, etc. The returned identifier has the general format OS-
55 CPU.
56
57 platform::patterns identifier
58 This command takes an identifier as returned by platform::iden‐
59 tify and returns a list of identifiers describing compatible
60 architectures.
61
63 This can be used to allow an application to be shipped with multiple
64 builds of a shared library, so that the same package works on many ver‐
65 sions of an operating system. For example:
66
67 package require platform
68 # Assume that app script is .../theapp/bin/theapp.tcl
69 set binDir [file dirname [file normalize [info script]]]
70 set libDir [file join $binDir .. lib]
71 set platLibDir [file join $libDir [platform::identify]]
72 load [file join $platLibDir support[info sharedlibextension]]
73
75 operating system, cpu architecture, platform, architecture
76
77
78
79platform 1.0.4 platform(n)