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

  1. namespace eval ::platform {
  2. proc platform {} {
  3. global tcl_platform
  4. set plat [lindex $tcl_platform(os) 0]
  5. set mach $tcl_platform(machine)
  6. switch -glob -- $mach {
  7. sun4* { set mach sparc }
  8. intel -
  9. i*86* { set mach x86 }
  10. "Power Macintosh" { set mach ppc }
  11. }
  12. switch -- $plat {
  13. AIX { set mach ppc }
  14. HP-UX { set mach hppa }
  15. }
  16. if {[string equal $plat "Darwin"] \
  17. && [llength [info command ::tk]] != 0} {
  18. append mach -[::tk windowingsystem]
  19. }
  20. return "$plat-$mach"
  21. }
  22. }