|
From: <arj...@us...> - 2011-02-22 07:31:40
|
Revision: 11574
http://plplot.svn.sourceforge.net/plplot/?rev=11574&view=rev
Author: arjenmarkus
Date: 2011-02-22 07:31:33 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
Adjusted the second set of Tcl examples to use the new PLPLOT namespace for predefined constants
Modified Paths:
--------------
trunk/examples/tcl/x22.tcl
trunk/examples/tcl/x23.tcl
trunk/examples/tcl/x26.tcl
trunk/examples/tcl/x27.tcl
trunk/examples/tcl/x28.tcl
trunk/examples/tcl/x29.tcl
trunk/examples/tcl/x31.tcl
Modified: trunk/examples/tcl/x22.tcl
===================================================================
--- trunk/examples/tcl/x22.tcl 2011-02-21 17:20:25 UTC (rev 11573)
+++ trunk/examples/tcl/x22.tcl 2011-02-22 07:31:33 UTC (rev 11574)
@@ -33,10 +33,10 @@
set dx 1.0
set dy 1.0
- set xmin [expr (-$nx/2*$dx)]
- set xmax [expr ($nx/2*$dx)]
- set ymin [expr (-$ny/2*$dy)]
- set ymax [expr ($ny/2*$dy)]
+ set xmin [expr {-$nx/2*$dx}]
+ set xmax [expr {$nx/2*$dx}]
+ set ymin [expr {-$ny/2*$dy}]
+ set ymax [expr {$ny/2*$dy}]
matrix xg f $nx $ny
matrix yg f $nx $ny
@@ -45,13 +45,13 @@
# Create data - circulation around the origin.
for {set i 0} {$i < $nx} {incr i} {
- set x [expr (($i-$nx/2+0.5)*$dx) ]
+ set x [expr {($i-$nx/2+0.5)*$dx} ]
for {set j 0} {$j < $ny} {incr j} {
- set y [expr (($j-$ny/2+0.5)*$dy)]
+ set y [expr {($j-$ny/2+0.5)*$dy}]
xg $i $j = $x
yg $i $j = $y
u $i $j = $y
- v $i $j = [expr (-1.0*$x)]
+ v $i $j = [expr {-1.0*$x}]
}
}
@@ -67,18 +67,16 @@
# Vector plot of flow through a constricted pipe
proc constriction {w} {
- set pi 3.14159265358979323846
-
set nx 20
set ny 20
set dx 1.0
set dy 1.0
- set xmin [expr (-$nx/2*$dx)]
- set xmax [expr ($nx/2*$dx)]
- set ymin [expr (-$ny/2*$dy)]
- set ymax [expr ($ny/2*$dy)]
+ set xmin [expr {-$nx/2*$dx}]
+ set xmax [expr {$nx/2*$dx}]
+ set ymin [expr {-$ny/2*$dy}]
+ set ymax [expr {$ny/2*$dy}]
matrix xg f $nx $ny
matrix yg f $nx $ny
@@ -88,16 +86,16 @@
set Q 2.0
# Create data - circulation around the origin.
for {set i 0} {$i < $nx} {incr i} {
- set x [expr (($i-$nx/2+0.5)*$dx) ]
+ set x [expr {($i-$nx/2+0.5)*$dx} ]
for {set j 0} {$j < $ny} {incr j} {
- set y [expr (($j-$ny/2+0.5)*$dy)]
+ set y [expr {($j-$ny/2+0.5)*$dy}]
xg $i $j = $x
yg $i $j = $y
- set b [expr ($ymax/4.0*(3.0-cos($pi*$x/$xmax)))]
+ set b [expr {$ymax/4.0*(3.0-cos($::PLPLOT::PL_PI*$x/$xmax))}]
if {abs($y) < $b} {
- set dbdx [expr ($ymax/4.0*sin($pi*$x/$xmax)*$y/$b)]
- u $i $j = [expr ($Q*$ymax/$b)]
- v $i $j = [expr ($Q*$ymax/$b*$dbdx)]
+ set dbdx [expr {$ymax/4.0*sin($::PLPLOT::PL_PI*$x/$xmax)*$y/$b}]
+ u $i $j = [expr {$Q*$ymax/$b}]
+ v $i $j = [expr {$Q*$ymax/$b*$dbdx}]
} else {
u $i $j = 0.0
v $i $j = 0.0
@@ -117,8 +115,6 @@
# Vector plot of the gradient of a shielded potential (see example 9)
proc potential {w} {
- set pi 3.14159265358979323846
-
set nr 20
set ntheta 20
set nper 100
@@ -137,24 +133,24 @@
set rmax $nr
- set eps [expr 2.]
+ set eps 2.
- set q1 [expr 1.]
- set d1 [expr $rmax/4.]
+ set q1 1.
+ set d1 [expr {$rmax/4.}]
- set q1i [expr - $q1*$rmax/$d1]
- set d1i [expr pow($rmax,2)/$d1]
+ set q1i [expr {- $q1*$rmax/$d1}]
+ set d1i [expr {pow($rmax,2)/$d1}]
- set q2 [expr -1.]
- set d2 [expr $rmax/4.]
+ set q2 -1.
+ set d2 [expr {$rmax/4.}]
- set q2i [expr - $q2*$rmax/$d2]
- set d2i [expr pow($rmax,2)/$d2]
-
+ set q2i [expr {- $q2*$rmax/$d2}]
+ set d2i [expr {pow($rmax,2)/$d2}]
+
for {set i 0} {$i < $nr} {incr i} {
- set r [expr 0.5 + $i]
+ set r [expr {0.5 + $i}]
for {set j 0} {$j < $ntheta} {incr j} {
- set theta [expr {(2. * $pi / ($ntheta - 1.))*(0.5 + $j)}]
+ set theta [expr {(2. * $::PLPLOT::PL_PI / ($ntheta - 1.))*(0.5 + $j)}]
set x [expr {$r * cos($theta)}]
set y [expr {$r * sin($theta)}]
xg $i $j = $x
@@ -166,9 +162,9 @@
pow($eps,2))}]
set div2i [expr {sqrt(pow($x-$d2i,2) + pow($y+$d2i,2) + pow($eps,2))}]
z $i $j = [expr {$q1/$div1 + $q1i/$div1i + $q2/$div2 + $q2i/$div2i}]
- u $i $j = [expr {-$q1*($x-$d1)/pow($div1,3) - $q1i*($x-$d1i)/pow($div1i,3) -
+ u $i $j = [expr {-$q1*($x-$d1)/pow($div1,3) - $q1i*($x-$d1i)/pow($div1i,3) -
$q2*($x-$d2)/pow($div2,3) - $q2i*($x-$d2i)/pow($div2i,3)}]
- v $i $j = [expr {-$q1*($y-$d1)/pow($div1,3) - $q1i*($y-$d1i)/pow($div1i,3) -
+ v $i $j = [expr {-$q1*($y-$d1)/pow($div1,3) - $q1i*($y-$d1i)/pow($div1i,3) -
$q2*($y+$d2)/pow($div2,3) - $q2i*($y+$d2i)/pow($div2i,3)}]
}
}
@@ -194,7 +190,7 @@
$w cmd plenv $xmin $xmax $ymin $ymax 0 0
$w cmd pllab "(x)" "(y)" "#frPLplot Example 22 - potential gradient vector plot"
# Plot contours of the potential
- set dz [expr (($zmax-$zmin)/$nlevel)]
+ set dz [expr {($zmax-$zmin)/$nlevel}]
matrix clevel f $nlevel
for {set i 0} {$i < $nlevel} {incr i} {
clevel $i = [expr {$zmin + ($i + 0.5)*$dz}]
@@ -213,11 +209,11 @@
# Plot the perimeter of the cylinder
matrix px f $nper
matrix py f $nper
- set dtheta [expr (2.0*$pi/($nper-1.0))]
+ set dtheta [expr {2.0*$::PLPLOT::PL_PI/($nper-1.0)}]
for {set i 0} {$i < $nper} {incr i} {
- set theta [expr $dtheta*$i]
- px $i = [expr ($rmax*cos($theta))]
- py $i = [expr ($rmax*sin($theta))]
+ set theta [expr {$dtheta*$i}]
+ px $i = [expr {$rmax*cos($theta)}]
+ py $i = [expr {$rmax*sin($theta)}]
}
$w cmd plline $nper px py
Modified: trunk/examples/tcl/x23.tcl
===================================================================
--- trunk/examples/tcl/x23.tcl 2011-02-21 17:20:25 UTC (rev 11573)
+++ trunk/examples/tcl/x23.tcl 2011-02-22 07:31:33 UTC (rev 11574)
@@ -28,175 +28,175 @@
proc x23 {{w loopback}} {
- set Greek0 "#gA"
+ set Greek0 "#gA"
set Greek1 "#gB"
set Greek2 "#gG"
set Greek3 "#gD"
set Greek4 "#gE"
set Greek5 "#gZ"
- set Greek6 "#gY"
- set Greek7 "#gH"
+ set Greek6 "#gY"
+ set Greek7 "#gH"
set Greek8 "#gI"
- set Greek9 "#gK"
- set Greek10 "#gL"
- set Greek11 "#gM"
- set Greek12 "#gN"
- set Greek13 "#gC"
- set Greek14 "#gO"
- set Greek15 "#gP"
- set Greek16 "#gR"
- set Greek17 "#gS"
- set Greek18 "#gT"
- set Greek19 "#gU"
- set Greek20 "#gF"
- set Greek21 "#gX"
- set Greek22 "#gQ"
- set Greek23 "#gW"
- set Greek24 "#ga"
- set Greek25 "#gb"
- set Greek26 "#gg"
- set Greek27 "#gd"
- set Greek28 "#ge"
- set Greek29 "#gz"
- set Greek30 "#gy"
- set Greek31 "#gh"
- set Greek32 "#gi"
- set Greek33 "#gk"
- set Greek34 "#gl"
- set Greek35 "#gm"
- set Greek36 "#gn"
- set Greek37 "#gc"
- set Greek38 "#go"
- set Greek39 "#gp"
- set Greek40 "#gr"
- set Greek41 "#gs"
- set Greek42 "#gt"
- set Greek43 "#gu"
- set Greek44 "#gf"
- set Greek45 "#gx"
- set Greek46 "#gq"
- set Greek47 "#gw"
-
+ set Greek9 "#gK"
+ set Greek10 "#gL"
+ set Greek11 "#gM"
+ set Greek12 "#gN"
+ set Greek13 "#gC"
+ set Greek14 "#gO"
+ set Greek15 "#gP"
+ set Greek16 "#gR"
+ set Greek17 "#gS"
+ set Greek18 "#gT"
+ set Greek19 "#gU"
+ set Greek20 "#gF"
+ set Greek21 "#gX"
+ set Greek22 "#gQ"
+ set Greek23 "#gW"
+ set Greek24 "#ga"
+ set Greek25 "#gb"
+ set Greek26 "#gg"
+ set Greek27 "#gd"
+ set Greek28 "#ge"
+ set Greek29 "#gz"
+ set Greek30 "#gy"
+ set Greek31 "#gh"
+ set Greek32 "#gi"
+ set Greek33 "#gk"
+ set Greek34 "#gl"
+ set Greek35 "#gm"
+ set Greek36 "#gn"
+ set Greek37 "#gc"
+ set Greek38 "#go"
+ set Greek39 "#gp"
+ set Greek40 "#gr"
+ set Greek41 "#gs"
+ set Greek42 "#gt"
+ set Greek43 "#gu"
+ set Greek44 "#gf"
+ set Greek45 "#gx"
+ set Greek46 "#gq"
+ set Greek47 "#gw"
+
matrix Type1 i 166 = {
- 0x0020, 0x0021, 0x0023, 0x0025, 0x0026,
- 0x0028, 0x0029, 0x002b, 0x002c, 0x002e,
- 0x002f, 0x0030, 0x0031, 0x0032, 0x0033,
- 0x0034, 0x0035, 0x0036, 0x0037, 0x0038,
- 0x0039, 0x003a, 0x003b, 0x003c, 0x003d,
- 0x003e, 0x003f, 0x005b, 0x005d, 0x005f,
- 0x007b, 0x007c, 0x007d, 0x00a9, 0x00ac,
- 0x00ae, 0x00b0, 0x00b1, 0x00d7, 0x00f7,
- 0x0192, 0x0391, 0x0392, 0x0393, 0x0394,
- 0x0395, 0x0396, 0x0397, 0x0398, 0x0399,
- 0x039a, 0x039b, 0x039c, 0x039d, 0x039e,
- 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4,
- 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9,
- 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5,
- 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba,
- 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
- 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4,
- 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9,
- 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022,
- 0x2026, 0x2032, 0x2033, 0x203e, 0x2044,
- 0x2111, 0x2118, 0x211c, 0x2122, 0x2126,
- 0x2135, 0x2190, 0x2191, 0x2192, 0x2193,
- 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2,
- 0x21d3, 0x21d4, 0x2200, 0x2202, 0x2203,
- 0x2205, 0x2206, 0x2207, 0x2208, 0x2209,
- 0x220b, 0x220f, 0x2211, 0x2212, 0x2215,
- 0x2217, 0x221a, 0x221d, 0x221e, 0x2220,
- 0x2227, 0x2228, 0x2229, 0x222a, 0x222b,
- 0x2234, 0x223c, 0x2245, 0x2248, 0x2260,
- 0x2261, 0x2264, 0x2265, 0x2282, 0x2283,
- 0x2284, 0x2286, 0x2287, 0x2295, 0x2297,
- 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329,
- 0x232a, 0x25ca, 0x2660, 0x2663, 0x2665,
+ 0x0020, 0x0021, 0x0023, 0x0025, 0x0026,
+ 0x0028, 0x0029, 0x002b, 0x002c, 0x002e,
+ 0x002f, 0x0030, 0x0031, 0x0032, 0x0033,
+ 0x0034, 0x0035, 0x0036, 0x0037, 0x0038,
+ 0x0039, 0x003a, 0x003b, 0x003c, 0x003d,
+ 0x003e, 0x003f, 0x005b, 0x005d, 0x005f,
+ 0x007b, 0x007c, 0x007d, 0x00a9, 0x00ac,
+ 0x00ae, 0x00b0, 0x00b1, 0x00d7, 0x00f7,
+ 0x0192, 0x0391, 0x0392, 0x0393, 0x0394,
+ 0x0395, 0x0396, 0x0397, 0x0398, 0x0399,
+ 0x039a, 0x039b, 0x039c, 0x039d, 0x039e,
+ 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4,
+ 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9,
+ 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5,
+ 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba,
+ 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
+ 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4,
+ 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9,
+ 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022,
+ 0x2026, 0x2032, 0x2033, 0x203e, 0x2044,
+ 0x2111, 0x2118, 0x211c, 0x2122, 0x2126,
+ 0x2135, 0x2190, 0x2191, 0x2192, 0x2193,
+ 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2,
+ 0x21d3, 0x21d4, 0x2200, 0x2202, 0x2203,
+ 0x2205, 0x2206, 0x2207, 0x2208, 0x2209,
+ 0x220b, 0x220f, 0x2211, 0x2212, 0x2215,
+ 0x2217, 0x221a, 0x221d, 0x221e, 0x2220,
+ 0x2227, 0x2228, 0x2229, 0x222a, 0x222b,
+ 0x2234, 0x223c, 0x2245, 0x2248, 0x2260,
+ 0x2261, 0x2264, 0x2265, 0x2282, 0x2283,
+ 0x2284, 0x2286, 0x2287, 0x2295, 0x2297,
+ 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329,
+ 0x232a, 0x25ca, 0x2660, 0x2663, 0x2665,
0x2666
}
- set title0 "#<0x10>PLplot Example 23 - Greek Letters"
- set title1 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)"
- set title2 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)"
- set title3 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)"
- set title4 "#<0x10>PLplot Example 23 - Number Forms Unicode Block"
- set title5 "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)"
- set title6 "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)"
- set title7 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)"
- set title8 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)"
- set title9 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)"
- set title10 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)"
-
+ set title0 "#<0x10>PLplot Example 23 - Greek Letters"
+ set title1 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)"
+ set title2 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)"
+ set title3 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)"
+ set title4 "#<0x10>PLplot Example 23 - Number Forms Unicode Block"
+ set title5 "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)"
+ set title6 "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)"
+ set title7 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)"
+ set title8 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)"
+ set title9 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)"
+ set title10 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)"
+
matrix lo i 11 = {
- 0x0,
- 0x0,
- 0x40,
- 0x80,
- 0x2153,
- 0x2190,
- 0x21d0,
- 0x2200,
- 0x2240,
- 0x2280,
- 0x22c0
+ 0x0,
+ 0x0,
+ 0x40,
+ 0x80,
+ 0x2153,
+ 0x2190,
+ 0x21d0,
+ 0x2200,
+ 0x2240,
+ 0x2280,
+ 0x22c0
}
matrix hi i 11 = {
- 0x30,
- 0x40,
- 0x80,
- 0xA6,
- 0x2184,
- 0x21d0,
- 0x2200,
- 0x2240,
- 0x2280,
- 0x22c0,
- 0x2300
+ 0x30,
+ 0x40,
+ 0x80,
+ 0xA6,
+ 0x2184,
+ 0x21d0,
+ 0x2200,
+ 0x2240,
+ 0x2280,
+ 0x22c0,
+ 0x2300
}
matrix nxcells i 11 = {
- 12,
- 8,
- 8,
- 8,
+ 12,
8,
- 8,
- 8,
- 8,
- 8,
- 8,
- 8
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8
}
-
+
matrix nycells i 11 = {
- 8,
- 8,
- 8,
- 8,
- 8,
- 8,
- 8,
- 8,
- 8,
- 8,
- 8
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8,
+ 8
}
# non-zero values Must be consistent with nxcells and nycells.
matrix offset i 11 = {
- 0,
- 0,
- 64,
- 128,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
+ 0,
+ 0,
+ 64,
+ 128,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
}
# 30 possible FCI values.
@@ -232,20 +232,20 @@
0x80000123,
0x80000124,
}
-
- set family(0) "sans-serif"
- set family(1) "serif"
- set family(2) "monospace"
- set family(3) "script"
- set family(4) "symbol"
-
- set style(0) "upright"
- set style(1) "italic"
- set style(2) "oblique"
-
- set weight(0) "medium"
- set weight(1) "bold"
-
+
+ set family(0) "sans-serif"
+ set family(1) "serif"
+ set family(2) "monospace"
+ set family(3) "script"
+ set family(4) "symbol"
+
+ set style(0) "upright"
+ set style(1) "italic"
+ set style(2) "oblique"
+
+ set weight(0) "medium"
+ set weight(1) "bold"
+
for {set page 0} {$page<11} {incr page} {
$w cmd pladv 0
@@ -279,7 +279,7 @@
if {$page == 0} {
set cmdString [format "#%s" [set Greek$slice]]
} elseif {$page <= 3} {
- set cmdString [format "##\[0x%.4x\]" [ Type1 [expr [offset $page]+$slice] ] ]
+ set cmdString [format "##\[0x%.4x\]" [ Type1 [expr {[offset $page]+$slice}] ] ]
} else {
set cmdString [format "##\[0x%.4x\]" [expr {[lo $page]+$slice}]]
}
@@ -338,7 +338,7 @@
"Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog" \
$family($family_index) \
$style($style_index) \
- $weight($weight_index) \
+ $weight($weight_index) \
]
} elseif {$page == 13} {
set string [format \
Modified: trunk/examples/tcl/x26.tcl
===================================================================
--- trunk/examples/tcl/x26.tcl 2011-02-21 17:20:25 UTC (rev 11573)
+++ trunk/examples/tcl/x26.tcl 2011-02-22 07:31:33 UTC (rev 11574)
@@ -130,8 +130,6 @@
proc plot261 { w type x_label y_label alty_label legend_text title_label line_label } {
- set PI [expr {4.0*atan(1.0)}]
-
matrix freql f 101
matrix ampl f 101
matrix phase f 101
@@ -145,7 +143,7 @@
freql $i = [expr {-2.0 + $i / 20.0}]
set freq [expr {pow(10.0,[freql $i])}]
ampl $i = [expr {20.0 * log10(1.0 / sqrt(1.0 + pow($freq/$f0,2)))}]
- phase $i = [expr {-(180.0 / $PI) * atan($freq / $f0)}]
+ phase $i = [expr {-(180.0 / $::PLPLOT::PL_PI) * atan($freq / $f0)}]
}
$w cmd plvpor 0.15 0.85 0.1 0.9
$w cmd plwind -2.0 3.0 -80.0 0.0
Modified: trunk/examples/tcl/x27.tcl
===================================================================
--- trunk/examples/tcl/x27.tcl 2011-02-21 17:20:25 UTC (rev 11573)
+++ trunk/examples/tcl/x27.tcl 2011-02-22 07:31:33 UTC (rev 11574)
@@ -93,7 +93,7 @@
set windings [expr {int($param4)}]
set steps [expr {$NPNT/$windings}]
- set dphi [expr {8.0*acos(-1.0)/double($steps)}]
+ set dphi [expr {8.0*$::PLPLOT::PL_PI/double($steps)}]
# This initialisation is safe!
set xmin 0.0
Modified: trunk/examples/tcl/x28.tcl
===================================================================
--- trunk/examples/tcl/x28.tcl 2011-02-21 17:20:25 UTC (rev 11573)
+++ trunk/examples/tcl/x28.tcl 2011-02-22 07:31:33 UTC (rev 11574)
@@ -35,9 +35,7 @@
set NROTATION 8
set NSHEAR 8
- set pi 3.14159265358979323846
-
- set DRAW_LINEXY 3
+ set pi $::PLPLOT::PL_PI
set xmin 0.
set xmax 1.0
@@ -63,7 +61,7 @@
set dzsrot [expr {$zsrange / ( $NROTATION - 1 )}]
set dzsshear [expr {$zsrange / ( $NSHEAR - 1 )}]
- # p1string must be exactly one character + the null termination
+ # p1string must be exactly one character + the null termination
# character.
set p1string "O"
set pstring "The future of our civilization depends on software freedom."
@@ -87,12 +85,12 @@
}
# Page 1: Demonstrate inclination and shear capability pattern.
-
+
$w cmd pladv 0
$w cmd plvpor -0.15 1.15 -0.05 1.05
$w cmd plwind -1.2 1.2 -0.8 1.5
$w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.
-
+
$w cmd plcol0 2
$w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
"b" "" [expr {$ymax-$ymin}] 0 \
@@ -117,7 +115,7 @@
0.0 " revolution"
}
- # x = xmax.
+ # x = xmax.
$w cmd plschr 0. 1.0
for {set i 0} {$i < $NREVOLUTION} {incr i} {
set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}]
@@ -136,7 +134,7 @@
0.0 " revolution"
}
- # y = ymax.
+ # y = ymax.
$w cmd plschr 0., 1.0
for {set i 0} {$i < $NREVOLUTION} {incr i} {
set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}]
@@ -154,21 +152,21 @@
$x_shear $y_shear $z_shear \
0.0 " revolution"
}
- # Draw minimal 3D grid to finish defining the 3D box.
- $w cmd plmesh x y z $XPTS $YPTS $DRAW_LINEXY
-
- # Page 2: Demonstrate rotation of string around its axis.
+ # Draw minimal 3D grid to finish defining the 3D box.
+ $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]
+
+ # Page 2: Demonstrate rotation of string around its axis.
$w cmd pladv 0
$w cmd plvpor -0.15 1.15 -0.05 1.05
$w cmd plwind -1.2 1.2 -0.8 1.5
$w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.
-
+
$w cmd plcol0 2
$w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
"b" "" [expr {$ymax-$ymin}] 0 \
"bcd" "" [expr {$zmax-$zmin}] 0
- # y = ymax.
+ # y = ymax.
$w cmd plschr 0. 1.0
set x_inclination 1.
set y_inclination 0.
@@ -188,7 +186,7 @@
0.5 "rotation for y = y#dmax#u"
}
- # x = xmax.
+ # x = xmax.
$w cmd plschr 0. 1.0
set x_inclination 0.
set y_inclination -1.
@@ -208,7 +206,7 @@
0.5 "rotation for x = x#dmax#u"
}
- # z = zmin.
+ # z = zmin.
$w cmd plschr 0. 1.0
set x_inclination 1.
set y_inclination 0.
@@ -227,25 +225,25 @@
$x_shear $y_shear $z_shear \
0.5 "rotation for z = z#dmin#u"
}
- # Draw minimal 3D grid to finish defining the 3D box.
- $w cmd plmesh x y z $XPTS $YPTS $DRAW_LINEXY
+ # Draw minimal 3D grid to finish defining the 3D box.
+ $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]
- # Page 3: Demonstrate shear of string along its axis.
- # Work around xcairo and pngcairo (but not pscairo) problems for
+ # Page 3: Demonstrate shear of string along its axis.
+ # Work around xcairo and pngcairo (but not pscairo) problems for
# shear vector too close to axis of string. (N.B. no workaround
- # would be domega = 0.)
+ # would be domega = 0.)
set domega 0.05
$w cmd pladv 0
$w cmd plvpor -0.15 1.15 -0.05 1.05
$w cmd plwind -1.2 1.2 -0.8 1.5
$w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.
-
+
$w cmd plcol0 2
$w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
"b" "" [expr {$ymax-$ymin}] 0 \
"bcd" "" [expr {$zmax-$zmin}] 0
- # y = ymax.
+ # y = ymax.
$w cmd plschr 0. 1.0
set x_inclination 1.
set y_inclination 0.
@@ -265,7 +263,7 @@
0.5 "shear for y = y#dmax#u"
}
- # x = xmax.
+ # x = xmax.
$w cmd plschr 0. 1.0
set x_inclination 0.
set y_inclination -1.
@@ -285,7 +283,7 @@
0.5 "shear for x = x#dmax#u"
}
- # z = zmin.
+ # z = zmin.
$w cmd plschr 0. 1.0
set x_inclination 1.
set y_inclination 0.
@@ -304,28 +302,28 @@
$x_shear $y_shear $z_shear \
0.5 "shear for z = z#dmin#u"
}
- # Draw minimal 3D grid to finish defining the 3D box.
- $w cmd plmesh x y z $XPTS $YPTS $DRAW_LINEXY
-
- # Page 4: Demonstrate drawing a string on a 3D path.
+ # Draw minimal 3D grid to finish defining the 3D box.
+ $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]
+
+ # Page 4: Demonstrate drawing a string on a 3D path.
$w cmd pladv 0
$w cmd plvpor -0.15 1.15 -0.05 1.05
$w cmd plwind -1.2 1.2 -0.8 1.5
$w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 40. -30.
-
+
$w cmd plcol0 2
$w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
"b" "" [expr {$ymax-$ymin}] 0 \
"bcd" "" [expr {$zmax-$zmin}] 0
-
+
$w cmd plschr 0. 1.2
# domega controls the spacing between the various characters of the
# string and also the maximum value of omega for the given number
- # of characters in *pstring.
+ # of characters in *pstring.
set pslen [string length $pstring]
set domega [expr {2.*$pi/$pslen}]
set omega 0.
- # 3D function is a helix of the given radius and pitch
+ # 3D function is a helix of the given radius and pitch
set radius 0.5
set pitch [expr {1./(2.*$pi)}]
for {set i 0} {$i < $pslen} {incr i} {
@@ -334,14 +332,14 @@
set xpos [expr {$xmid + $radius*$sin_omega}]
set ypos [expr {$ymid - $radius*$cos_omega}]
set zpos [expr {$zmin + $pitch*$omega}]
- # In general, the inclination is proportional to the derivative of
- # the position wrt theta.
+ # In general, the inclination is proportional to the derivative of
+ # the position wrt theta.
set x_inclination [expr {$radius*$cos_omega}]
set y_inclination [expr {$radius*$sin_omega}]
set z_inclination [expr {$pitch}]
# The shear vector should be perpendicular to the 3D line with Z
# component maximized, but for low pitch a good approximation is
- # a constant vector that is parallel to the Z axis.
+ # a constant vector that is parallel to the Z axis.
set x_shear 0.
set y_shear 0.
set z_shear 1.
@@ -352,15 +350,15 @@
0.5 [string range $pstring $i $i]
set omega [expr {$omega + $domega}]
}
- # Draw minimal 3D grid to finish defining the 3D box.
- $w cmd plmesh x y z $XPTS $YPTS $DRAW_LINEXY
+ # Draw minimal 3D grid to finish defining the 3D box.
+ $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]
- # Page 5: Demonstrate plmtex3 axis labelling capability
+ # Page 5: Demonstrate plmtex3 axis labelling capability
$w cmd pladv 0
$w cmd plvpor -0.15 1.15 -0.05 1.05
$w cmd plwind -1.2 1.2 -0.8 1.5
$w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45.
-
+
$w cmd plcol0 2
$w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \
"b" "" [expr {$ymax-$ymin}] 0 \
@@ -379,7 +377,7 @@
$w cmd plmtex3 "zp" 3.0 0.5 0.5 "primary Z-axis label"
$w cmd plmtex3 "zs" -2.5 0.5 0.5 "Arbitrarily displaced"
$w cmd plmtex3 "zs" -1.0 0.5 0.5 "secondary Z-axis label"
- # Draw minimal 3D grid to finish defining the 3D box.
- $w cmd plmesh x y z $XPTS $YPTS $DRAW_LINEXY
-
+ # Draw minimal 3D grid to finish defining the 3D box.
+ $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}]
+
}
Modified: trunk/examples/tcl/x29.tcl
===================================================================
--- trunk/examples/tcl/x29.tcl 2011-02-21 17:20:25 UTC (rev 11573)
+++ trunk/examples/tcl/x29.tcl 2011-02-22 07:31:33 UTC (rev 11574)
@@ -24,14 +24,14 @@
# Draws several plots which demonstrate the use of date / time formats for
# the axis labels.
-# Time formatting is done using the system strftime routine. See the
+# Time formatting is done using the system strftime routine. See the
# documentation of this for full details of the available formats.
#
# 1) Plotting temperature over a day (using hours / minutes)
-# 2) Plotting
+# 2) Plotting
#
-# Note: Times are stored as seconds since the epoch (usually 1st Jan 1970).
-#
+# Note: Times are stored as seconds since the epoch (usually 1st Jan 1970).
+#
proc x29 {{w loopback}} {
@@ -50,27 +50,25 @@
# Plot a model diurnal cycle of temperature
proc x29_plot1 {{w loopback}} {
- set pi 3.14159265358979323846
-
# Data points every 10 minutes for 1 day
set npts 73
-
+
matrix x f $npts
matrix y f $npts
matrix xerr1 f $npts
matrix xerr2 f $npts
matrix yerr1 f $npts
matrix yerr2 f $npts
-
+
set xmin 0
# Number of seconds in a day
- set xmax [expr {60.0*60.0*24.0}]
+ set xmax [expr {60.0*60.0*24.0}]
set ymin 10.0
set ymax 20.0
-
+
for {set i 0} {$i<$npts} {incr i} {
set xx [expr {$xmax*double($i)/double($npts)}]
- set yy [expr {15.0 - 5.0*cos( 2*$pi*double($i)/double($npts))}]
+ set yy [expr {15.0 - 5.0*cos( 2*$::PLPLOT::PL_PI*double($i)/double($npts))}]
x $i = $xx
y $i = $yy
xerr1 $i = [expr {$xx - 60.0*5.0}]
@@ -78,7 +76,7 @@
yerr1 $i = [expr {$yy - 0.1}]
yerr2 $i = [expr {$yy + 0.1}]
}
-
+
$w cmd pladv 0
$w cmd plsmaj 0.0 0.5
@@ -96,7 +94,7 @@
$w cmd plcol0 3
$w cmd pllab "Time (hours:mins)" "Temperature (degC)" \
"@frPLplot Example 29 - Daily temperature"
-
+
$w cmd plcol0 4
$w cmd plline $npts x y
@@ -110,25 +108,25 @@
}
# Plot the number of hours of daylight as a function of day for a year
-proc x29_plot2 {{w loopback}} {
-
- set pi 3.14159265358979323846
+proc x29_plot2 {{w loopback}} {
+ set pi $::PLPLOT::PL_PI
+
# Latitude for London
set lat 51.5
-
+
set npts 365
-
+
matrix x f $npts
matrix y f $npts
-
+
set xmin 0
set xmax [expr {$npts*60.0*60.0*24.0}]
set ymin 0
set ymax 24
-
- # Formula for hours of daylight from
- # "A Model Comparison for Daylength as a Function of Latitude and
+
+ # Formula for hours of daylight from
+ # "A Model Comparison for Daylength as a Function of Latitude and
# Day of the Year", 1995, Ecological Modelling, 80, pp 87-95.
for {set j 0} {$j < $npts} {incr j} {
x $j = [expr {$j*60.0*60.0*24.0}]
@@ -139,7 +137,7 @@
(cos($lat*$pi/180.0)*cos($p)) )}]
y $j = $d
}
-
+
$w cmd plcol0 1
# Set time format to be abbreviated month name followed by day of month
$w cmd pltimefmt "%b %d"
@@ -150,7 +148,7 @@
$w cmd plcol0 3
$w cmd pllab "Date" "Hours of daylight" \
"@frPLplot Example 29 - Hours of daylight at 51.5N"
-
+
$w cmd plcol0 4
$w cmd plline $npts x y
@@ -160,16 +158,14 @@
proc x29_plot3 {{w loopback}} {
- set pi 3.14159265358979323846
-
# Calculate seconds since the Unix epoch for 2005-12-01 UTC.
- # On newer versions of tcl should use the -format "%Y-%m-%d"
- # option rather than free-form scanning, but this doesn't
+ # On newer versions of tcl should use the -format "%Y-%m-%d"
+ # option rather than free-form scanning, but this doesn't
# seem to work on tcl8.4
# Also -timezone :UTC should be used instead of -gmt
set tstart [clock scan "2005-12-01" \
-gmt true ]
-
+
set npts 62
matrix x f $npts
@@ -179,11 +175,11 @@
set xmax [expr {$xmin + $npts*60.0*60.0*24.0}]
set ymin 0.0
set ymax 5.0
-
+
for {set i 0} {$i<$npts} {incr i} {
x $i = [expr {$xmin + $i*60.0*60.0*24.0}]
set imin [expr {$i < $npts-$i ? $i : $npts-$i}]
- y $i = [expr {1.0 + sin( 2*$pi*double($i)/7.0 ) + \
+ y $i = [expr {1.0 + sin( 2*$::PLPLOT::PL_PI*double($i)/7.0 ) + \
exp( double($imin) / 31.0) }]
}
$w cmd pladv 0
@@ -197,25 +193,25 @@
$w cmd pltimefmt "%Y-%m-%d"
# Draw a box with ticks spaced every 14 days in X and 1 hour in Y.
$w cmd plbox "bcnstd" [expr {14*24.0*60.0*60.0}] 14 "bcnstv" 1 4
-
+
$w cmd plcol0 3
$w cmd pllab "Date" "Hours of television watched" \
"@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006"
-
+
$w cmd plcol0 4
$w cmd plssym 0.0 0.5
$w cmd plpoin $npts x y 2
- $w cmd plline $npts x y
+ $w cmd plline $npts x y
}
proc x29_plot4 {{w loopback}} {
# TAI-UTC (seconds) as a function of time.
# Use Besselian epochs as the continuous time interval just to prove
# this does not introduce any issues.
-
+
# Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch
- # B = 1900. + (JD -2415020.31352)/365.242198781
+ # B = 1900. + (JD -2415020.31352)/365.242198781
# ==> (as calculated with aid of "bc -l" command)
# B = (MJD + 678940.364163900)/365.242198781
# ==>
@@ -327,6 +323,6 @@
$w cmd plline $npts x y
}
-
+
}
Modified: trunk/examples/tcl/x31.tcl
===================================================================
--- trunk/examples/tcl/x31.tcl 2011-02-21 17:20:25 UTC (rev 11573)
+++ trunk/examples/tcl/x31.tcl 2011-02-22 07:31:33 UTC (rev 11574)
@@ -4,9 +4,6 @@
proc x31 {{w loopback}} {
- # this constant should be defined centrally.
- set PL_NOTSET -42
-
# Test setting / getting familying parameters before plinit.
# Save values set by plparseopts to be restored later.
@@ -25,7 +22,7 @@
}
# Restore values set initially by plparseopts.
$w cmd plsfam $fam0 $num0 $bmax0
-
+
# Test setting / getting page parameters before plinit.
# Save values set by plparseopts to be restored later.
$w cmd plgpage xp0 yp0 xleng0 yleng0 xoff0 yoff0
@@ -57,7 +54,7 @@
# Test if device initialization screwed around with the preset
# compression parameter.
- $w cmd plgcompression compression2
+ $w cmd plgcompression compression2
puts [ format "Output various PLplot parameters" ]
puts [ format "compression parameter = %d" $compression2 ]
if {$compression2 != $compression1} {
@@ -75,7 +72,7 @@
$w cmd plscmap1 r1 g1 b1 2
$w cmd plscmap1a r1 g1 b1 a1 2
- $w cmd plglevel level2
+ $w cmd plglevel level2
puts [ format "level parameter = %d" $level2 ]
if {$level2 != 1} {
puts stderr "plglevel test failed."
@@ -90,8 +87,8 @@
puts stderr "plgvpd test failed"
set status 1
}
- set xmid [ expr 0.5*($xmin+$xmax) ]
- set ymid [ expr 0.5*($ymin+$ymax) ]
+ set xmid [ expr {0.5*($xmin+$xmax)} ]
+ set ymid [ expr {0.5*($ymin+$ymax)} ]
$w cmd plwind 0.2 0.3 0.4 0.5
$w cmd plgvpw xmin xmax ymin ymax
@@ -110,7 +107,7 @@
}
# Retrieve and print the name of the output file (if any)
- $w cmd plgfnam fnam
+ $w cmd plgfnam fnam
if {$fnam == ""} {
puts [ format "No output file name is set" ]
} {else} {
@@ -119,7 +116,7 @@
puts stderr [ format "Output file name is %s" $fnam ]
# Set and get the number of digits used to display axis labels
- # Note digits is currently ignored in pls[xyz]ax and
+ # Note digits is currently ignored in pls[xyz]ax and
# therefore it does not make sense to test the returned value.
$w cmd plsxax 3 0
$w cmd plgxax digmax digits
@@ -137,14 +134,14 @@
set status 1
}
$w cmd plszax 5 0
- $w cmd plgzax digmax digits
+ $w cmd plgzax digmax digits
puts [ format "z axis parameters: digmax, digits = %d %d" $digmax $digits ]
if {$digmax != 5} {
puts stderr "plgzax test failed"
set status 1
}
- $w cmd plsdidev 0.05 $PL_NOTSET 0.1 0.2
+ $w cmd plsdidev 0.05 [expr {$::PLPLOT::PL_NOTSET}] 0.1 0.2
$w cmd plgdidev mar aspect jx jy
puts [ format "device-space window parameters: mar, aspect, jx, jy = %f %f %f %f" $mar $aspect $jx $jy ]
if {$mar != 0.05 || $jx != 0.1 || $jy != 0.2} {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|