From: <arj...@us...> - 2013-11-18 20:17:45
|
Revision: 12712 http://sourceforge.net/p/plplot/code/12712 Author: arjenmarkus Date: 2013-11-18 20:17:42 +0000 (Mon, 18 Nov 2013) Log Message: ----------- Use [info nameofexecutable] to identify whether the Tcl/Tk interpreter program is "plserver" or one of the standard shells. Include tclsh in the mix and use a switch statement. Modified Paths: -------------- trunk/examples/tk/tkdemos.tcl Modified: trunk/examples/tk/tkdemos.tcl =================================================================== --- trunk/examples/tk/tkdemos.tcl 2013-11-18 19:31:25 UTC (rev 12711) +++ trunk/examples/tk/tkdemos.tcl 2013-11-18 20:17:42 UTC (rev 12712) @@ -43,28 +43,36 @@ set utf8_examples {4 18 24 26 33} # In order to distinguish whether this is a plserver or wish -# environment we assume that $argv0 has the string "plserver" or -# "wish" in it. Some contrived examples can be figured out where this +# environment we assume that [info nameofexecutable] has the string "plserver", +# "wish" or "tclsh" in it. Some contrived examples can be figured out where this # assumption is not correct, and for those cases we simply emit an # error message and return. But normally this assumption is correct, # and it is certainly correct for our tests. -if { [string first "plserver" $argv0] >= 0 } { - # use 'plserver' method - plstdwin . - plxframe .plw - set plwin .plw.plwin -} elseif { [string first "wish" $argv0] >= 0 } { - # use 'wish" method - plframe .plw - set plwin .plw -} else { - puts stderr "Error: argv0 = \"$argv0\"\ndoes not contain either the substrings \"plserver\" or \"wish\"" - puts stderr "Therefore cannot decide how to proceed with tkdemos.tcl so giving up" - return +switch -glob -- [info nameofexecutable] { + "*plserver*" { + # use 'plserver' method + plstdwin . + plxframe .plw + set plwin .plw.plwin + } + "*wish*" - + "*tclsh*" { + # use 'wish" method + plframe .plw + set plwin .plw + } + default { + puts stderr "Error: argv0 = \"$argv0\"\ndoes not contain either the substrings \"plserver\" or \"wish\"" + puts stderr "Therefore cannot decide how to proceed with tkdemos.tcl so giving up" + return + } } +puts "append ..." pack append . .plw {left expand fill} for {set i 0} {$i <= 33} {incr i} { + + puts "$i ..." if {$i != 32} { set demo x[format "%02d" $i] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |