Posted to tcl by patthoyts at Fri Oct 13 20:22:15 GMT 2006view pretty

namespace eval ::platform {
    proc platform {} {
        global tcl_platform
        set plat [lindex $tcl_platform(os) 0]
        set mach $tcl_platform(machine)
        switch -glob -- $mach {
            sun4* { set mach sparc }
            intel -
            i*86* { set mach x86 }
            "Power Macintosh" { set mach ppc }
        }
        switch -- $plat {
          AIX   { set mach ppc }
          HP-UX { set mach hppa }
        }
        if {[string equal $plat "Darwin"] \
                && [llength [info command ::tk]] != 0} {
            append mach -[::tk windowingsystem]
        }
        return "$plat-$mach"
    }
}