Posted to tcl by patthoyts at Wed Nov 01 15:16:36 GMT 2006view raw
- namespace eval ::platform {
- proc generic {} {
- global tcl_platform
- set plat [string tolower [lindex $tcl_platform(os) 0]]
- set cpu $tcl_platform(machine)
- switch -glob -- $cpu {
- sun4* {
- set cpu sparc
- }
- intel -
- i*86* {
- set cpu ix86
- }
- x86_64 {
- if {$tcl_platform(wordSize) == 4} {
- # See Example <1> at the top of this file.
- set cpu ix86
- }
- }
- "Power*" {
- set cpu powerpc
- }
- "arm*" {
- set cpu arm
- }
- }
- switch -- $plat {
- windows {
- set plat win32
- }
- sunos {
- set plat solaris
- if {$tcl_platform(wordSize) == 8} {
- append cpu 64
- }
- }
- darwin {
- set plat macosx
- }
- aix {
- set cpu powerpc
- if {$tcl_platform(wordSize) == 8} {
- append cpu 64
- }
- }
- hp-ux {
- set plat hpux
- if {$cpu ne "ia64"} {
- set cpu parisc
- if {$tcl_platform(wordSize) == 8} {
- append cpu 64
- }
- }
- }
- osf1 {
- set plat tru64
- }
- }
- return "${cpu}-${plat}"
- }
- }