From: <arj...@us...> - 2009-01-03 11:05:04
|
Revision: 9249 http://plplot.svn.sourceforge.net/plplot/?rev=9249&view=rev Author: arjenmarkus Date: 2009-01-03 11:05:01 +0000 (Sat, 03 Jan 2009) Log Message: ----------- Added braces for all expressions and some rearrangements Modified Paths: -------------- trunk/examples/tcl/x15.tcl trunk/examples/tcl/x16.tcl Modified: trunk/examples/tcl/x15.tcl =================================================================== --- trunk/examples/tcl/x15.tcl 2009-01-03 11:02:30 UTC (rev 9248) +++ trunk/examples/tcl/x15.tcl 2009-01-03 11:05:01 UTC (rev 9249) @@ -13,11 +13,11 @@ # cmap1_init152 $w for {set i 0} {$i < $xpts} {incr i} { - set x [expr ($i - ($xpts/2)) / double($xpts/2)] + set x [expr {double($i - ($xpts/2)) / double($xpts/2)}] for {set j 0} {$j < $ypts} {incr j} { - set y [expr ($j - double($ypts/2)) / double($ypts/2) - 1.] + set y [expr {double($j - ($ypts/2)) / double($ypts/2) - 1.}] - z $i $j = [expr $x*$x - $y*$y + ($x - $y)/($x * $x + $y * $y + .1) ] + z $i $j = [expr {$x*$x - $y*$y + ($x - $y)/($x * $x + $y * $y + .1)} ] } } set zmin [z 0 0] @@ -31,7 +31,7 @@ plot151 $w $z $zmin $zmax plot152 $w $z $zmin $zmax plot153 $w - + } proc cmap1_init152 { w } { @@ -60,7 +60,7 @@ s 1 = 0.5 s 2 = 0.5 s 3 = 1.0 - + rev 0 = 0 rev 1 = 0 rev 2 = 0 @@ -78,8 +78,8 @@ # N.B. this flag set to use cmap0 set sh_cmap 0 - set shade_min [expr $zmin + ($zmax - $zmin)*.4 ] - set shade_max [expr $zmin + ($zmax - $zmin)*.6 ] + set shade_min [expr {$zmin + ($zmax - $zmin)*.4} ] + set shade_max [expr {$zmin + ($zmax - $zmin)*.6} ] set sh_color 7 $w cmd pladv 0 @@ -132,9 +132,9 @@ $w cmd plvpor .1 .9 .1 .9 $w cmd plwind -1.0 1.0 -1.0 1.0 for {set i 0} {$i < 10} {incr i} { - set shade_min [expr $zmin + ($zmax - $zmin)*$i/10.0 ] - set shade_max [expr $zmin + ($zmax - $zmin)*($i + 1)/10.0 ] - set sh_color [expr $i + 6] + set shade_min [expr {$zmin + ($zmax - $zmin)*$i/10.0} ] + set shade_max [expr {$zmin + ($zmax - $zmin)*($i + 1)/10.0} ] + set sh_color [expr {$i + 6}] $w cmd plpat [nlin $i] inc$i del$i $w cmd plshade z -1. 1. -1. 1. $shade_min $shade_max \ $sh_cmap $sh_color $sh_width \ @@ -150,9 +150,9 @@ proc plot153 { w } { - matrix xx0 f 5 = {-1.0, 1.0, 1.0, -1.0, -1.0} + matrix xx0 f 5 = {-1.0, 1.0, 1.0, -1.0, -1.0} matrix xx1 f 5 = {-1.0, 1.0, 1.0, -1.0, -1.0} - matrix yy0 f 5 = {1.0, 1.0, 0.0, 0.0, 1.0} + matrix yy0 f 5 = {1.0, 1.0, 0.0, 0.0, 1.0} matrix yy1 f 5 = {-1.0, -1.0, 0.0, 0.0, -1.0} matrix zz0 f 5 = {0.0, 0.0, 1.0, 1.0, 0.0} matrix zz1 f 5 = {0.0, 0.0, 1.0, 1.0, 0.0} @@ -163,7 +163,7 @@ $w cmd plw3d 1. 1. 1. -1.0 1.0 -1.0 1.0 0.0 1.5 30 -40 # Plot using identity transform - + $w cmd plcol0 1 $w cmd plbox3 "bntu" "X" 0.0 0 "bntu" "Y" 0.0 0 "bcdfntu" "Z" 0.5 0 $w cmd plcol0 2 Modified: trunk/examples/tcl/x16.tcl =================================================================== --- trunk/examples/tcl/x16.tcl 2009-01-03 11:02:30 UTC (rev 9248) +++ trunk/examples/tcl/x16.tcl 2009-01-03 11:05:01 UTC (rev 9249) @@ -25,12 +25,12 @@ # Set up data array for {set i 0} {$i < $nx} {incr i} { - set x [expr double($i - ($nx/2)) / double($nx/2)] + set x [expr {double($i - ($nx/2)) / double($nx/2)}] for {set j 0} {$j < $ny} {incr j} { - set y [expr double($j - $ny/2) / double($ny/2) - 1.] + set y [expr {double($j - $ny/2) / double($ny/2) - 1.}] - zz $i $j = [expr -sin(7.*$x) * cos(7.*$y) + $x*$x - $y*$y ] - ww $i $j = [expr -cos(7.*$x) * sin(7.*$y) + 2 * $x * $y ] + zz $i $j = [expr {-sin(7.*$x) * cos(7.*$y) + $x*$x - $y*$y} ] + ww $i $j = [expr {-cos(7.*$x) * sin(7.*$y) + 2 * $x * $y} ] } } @@ -44,11 +44,11 @@ } for {set i 0} {$i < $ns} {incr i} { - clevel $i = [expr $zmin + ($zmax - $zmin) * ($i + .5) / $ns.] + clevel $i = [expr {$zmin + ($zmax - $zmin) * ($i + .5) / double($ns)}] } - for {set i 0} {$i < [expr $ns+1]} {incr i} { - shedge $i = [expr $zmin + ($zmax - $zmin) * double($i) / double($ns)] + for {set i 0} {$i < $ns+1} {incr i} { + shedge $i = [expr {$zmin + ($zmax - $zmin) * double($i) / double($ns)}] } # Build the 1-d coord arrays. @@ -56,27 +56,27 @@ set distort .4 for {set i 0} {$i < $nx} {incr i} { - set xx [expr -1. + $i * ( 2. / ($nx-1.) )] - xg1 $i = [expr $xx + $distort * cos( .5 * $pi * $xx ) ] + set xx [expr {-1. + $i * ( 2. / ($nx-1.) )}] + xg1 $i = [expr {$xx + $distort * cos( .5 * $pi * $xx )} ] } for {set j 0} {$j < $ny} {incr j} { - set yy [expr -1. + $j * ( 2. / ($ny-1.) )] - yg1 $j = [expr $yy - $distort * cos( .5 * $pi * $yy ) ] + set yy [expr {-1. + $j * ( 2. / ($ny-1.) )}] + yg1 $j = [expr {$yy - $distort * cos( .5 * $pi * $yy )} ] } # Build the 2-d coord arrays. for {set i 0} {$i < $nx} {incr i} { - set xx [expr -1. + $i * ( 2. / ($nx-1.) )] + set xx [expr {-1. + $i * ( 2. / ($nx-1.) )}] for {set j 0} {$j < $ny} {incr j} { - set yy [expr -1. + $j * ( 2. / ($ny-1.) )] + set yy [expr {-1. + $j * ( 2. / ($ny-1.) )}] - set argx [expr .5 * $pi * $xx] - set argy [expr .5 * $pi * $yy] + set argx [expr {.5 * $pi * $xx}] + set argy [expr {.5 * $pi * $yy}] - xg2 $i $j = [expr $xx + $distort * cos($argx) * cos($argy) ] - yg2 $i $j = [expr $yy - $distort * cos($argx) * cos($argy) ] + xg2 $i $j = [expr {$xx + $distort * cos($argx) * cos($argy)} ] + yg2 $i $j = [expr {$yy - $distort * cos($argx) * cos($argy)} ] } } @@ -101,7 +101,7 @@ $w cmd pllab "distance" "altitude" "Bogon density" # Plot using 1d coordinate transform - + $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind -1.0 1.0 -1.0 1.0 @@ -167,14 +167,14 @@ matrix z f $nx $nylim for {set i 0} {$i < $nx} {incr i} { - set r [expr $i / ($nx - 1.)] + set r [expr {$i / ($nx - 1.)}] for {set j 0} {$j < $nylim} {incr j} { - set t [expr 2. * $pi * $j / ($ny - 1.)] + set t [expr {2. * $pi * $j / ($ny - 1.)}] - xg $i $j = [expr $r * cos($t)] - yg $i $j = [expr $r * sin($t)] + xg $i $j = [expr {$r * cos($t)}] + yg $i $j = [expr {$r * sin($t)}] - z $i $j = [expr exp(-$r*$r) * cos(5.*$t) * cos(5.*$pi*$r) ] + z $i $j = [expr {exp(-$r*$r) * cos(5.*$t) * cos(5.*$pi*$r)} ] } } @@ -190,7 +190,7 @@ } for {set i 0} {$i < [expr $ns+1]} {incr i} { - shedge $i = [expr $zmin + ($zmax - $zmin)/double($ns) * double($i)] + shedge $i = [expr {$zmin + ($zmax - $zmin)/double($ns) * double($i)}] } $w cmd pladv 0 @@ -207,9 +207,9 @@ matrix px f 100; matrix py f 100 for {set i 0} {$i < 100} {incr i} { - set t [expr 2. * $pi * $i / 99.] - px $i = [expr cos($t)] - py $i = [expr sin($t)] + set t [expr {2. * $pi * $i / 99.}] + px $i = [expr {cos($t)}] + py $i = [expr {sin($t)}] } # draw the perimeter. $w cmd plcol0 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |