|
From: <and...@us...> - 2009-01-07 16:11:06
|
Revision: 9273
http://plplot.svn.sourceforge.net/plplot/?rev=9273&view=rev
Author: andrewross
Date: 2009-01-07 16:10:59 +0000 (Wed, 07 Jan 2009)
Log Message:
-----------
Update example 14 to consistently get and set the familying properties
for the second stream in all languages.
Modified Paths:
--------------
trunk/examples/ada/x14a.adb.cmake
trunk/examples/ada/xthick14a.adb.cmake
trunk/examples/c/x14c.c
trunk/examples/c++/x14.cc
trunk/examples/f77/x14f.fm4
trunk/examples/f95/x14f.f90
trunk/examples/java/x14.java
trunk/examples/ocaml/x14.ml
trunk/examples/perl/x14.pl
trunk/examples/python/xw14.py
trunk/examples/tcl/x14.tcl
Modified: trunk/examples/ada/x14a.adb.cmake
===================================================================
--- trunk/examples/ada/x14a.adb.cmake 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/ada/x14a.adb.cmake 2009-01-07 16:10:59 UTC (rev 9273)
@@ -69,6 +69,8 @@
mark0 : Integer_Array_1D(1 .. 1) := (Others => 0);
space1 : Integer_Array_1D(1 .. 1) := (Others => 1500);
mark1 : Integer_Array_1D(1 .. 1) := (Others => 1500);
+ fam : Boolean;
+ num, bmax : Integer;
procedure plot1 is
xmin, xmax, ymin, ymax : Long_Float;
@@ -295,6 +297,7 @@
plparseopts(PL_PARSE_FULL);
driver := To_Unbounded_String(plgdev);
+ plgfam(fam, num, bmax);
Put_Line("Demo of multiple output streams via the " & plgdev & " driver.");
Put_Line("Running with the second stream as slave to the first.");
@@ -313,6 +316,8 @@
-- Turn off pause to make this a slave (must follow master)
plsetopt("geometry", geometry_slave);
plspause(False);
+ plgfam(fam, num, bmax);
+ plsetopt("fflen","2");
plsdev(To_String(driver));
plinit;
Modified: trunk/examples/ada/xthick14a.adb.cmake
===================================================================
--- trunk/examples/ada/xthick14a.adb.cmake 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/ada/xthick14a.adb.cmake 2009-01-07 16:10:59 UTC (rev 9273)
@@ -2,8 +2,8 @@
-- Demo of multiple stream/window capability (requires Tk or Tcl-DP).
--- Maurice LeBrun
--- IFS, University of Texas at Austin
+-- Maurice LeBrun
+-- IFS, University of Texas at Austin
-- Copyright (C) 2008 Jerry Bauck
@@ -43,7 +43,7 @@
PLplot_Auxiliary,
PLplot;
--- COMMENT THIS LINE IF YOUR COMPILER DOES NOT INCLUDE THESE
+-- COMMENT THIS LINE IF YOUR COMPILER DOES NOT INCLUDE THESE
-- DEFINITIONS, FOR EXAMPLE, IF IT IS NOT ADA 2005 WITH ANNEX G.3 COMPLIANCE.
--with Ada.Numerics.Long_Real_Arrays; use Ada.Numerics.Long_Real_Arrays;
@Ada_Is_2007_With_and_Use_Numerics@
@@ -52,13 +52,13 @@
-- Plots several simple functions from other example programs.
--
-- This version sends the output of the first 4 plots (one page) to two
--- independent streams.
+-- independent streams.
------------------------------------------------------------------------------
procedure xthick14a is
- -- Select either TK or DP driver and use a small window
- -- Using DP results in a crash at the end due to some odd cleanup problems
- -- The geometry strings MUST be in writable memory
+ -- Select either TK or DP driver and use a small window
+ -- Using DP results in a crash at the end due to some odd cleanup problems
+ -- The geometry strings MUST be in writable memory
geometry_master : String := "500x410+100+200";
geometry_slave : String := "500x410+650+200";
driver : Unbounded_String;
@@ -69,6 +69,8 @@
mark0 : Integer_Array_1D(1 .. 1) := (Others => 0);
space1 : Integer_Array_1D(1 .. 1) := (Others => 1500);
mark1 : Integer_Array_1D(1 .. 1) := (Others => 1500);
+ fam : Boolean;
+ num, bmax : Integer;
procedure plot1 is
xmin, xmax, ymin, ymax : Long_Float;
@@ -89,26 +91,26 @@
ys(i) := y(i * 10 + 3);
end loop;
- -- Set up the viewport and window using PLENV. The range in X is
- -- 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are
- -- scaled separately (just := 0), and we just draw a labelled
- -- box (axis := 0).
+ -- Set up the viewport and window using PLENV. The range in X is
+ -- 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are
+ -- scaled separately (just := 0), and we just draw a labelled
+ -- box (axis := 0).
Set_Pen_Color(Red);
Set_Environment(xmin, xmax, ymin, ymax, Not_Justified, Linear_Box_Plus);
Set_Pen_Color(Wheat);
Write_Labels("(x)", "(y)", "#frPLplot Example 1 - y=x#u2");
- -- Plot the data points
+ -- Plot the data points
Set_Pen_Color(Blue);
Draw_Points(xs, ys, 9);
- -- Draw the line through the data
+ -- Draw the line through the data
Set_Pen_Color(Aquamarine);
Draw_Curve(x, y);
Flush_Output_Stream;
end plot1;
- -- ================================================================
+ -- ================================================================
procedure plot2 is
@@ -116,13 +118,13 @@
begin
-- Set up the viewport and window using PLENV. The range in X is -2.0 to
-- 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately
- -- (just = 0), and we draw a box with axes (axis = 1).
+ -- (just = 0), and we draw a box with axes (axis = 1).
Set_Pen_Color(Red);
Set_Environment(-2.0, 10.0, -0.4, 1.2, Not_Justified, Linear_Zero_Axes);
Set_Pen_Color(Yellow);
Write_Labels("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function");
- -- Fill up the arrays
+ -- Fill up the arrays
for i in x'range loop
x(i) := (Long_Float(i) - 19.0) / 6.0;
y(i) := 1.0;
@@ -131,33 +133,33 @@
end if;
end loop;
- -- Draw the line
+ -- Draw the line
Set_Pen_Color(Green);
Draw_Curve(x, y);
Flush_Output_Stream;
end plot2;
- -- ================================================================
+ -- ================================================================
procedure plot3 is
x, y : Real_Vector(0 .. 100);
begin
-- For the final graph we wish to override the default tick intervals, and
- -- so do not use PLENV
+ -- so do not use PLENV
Advance_To_Subpage(Next_Subpage);
-- Use standard viewport, and define X range from 0 to 360 degrees, Y range
- -- from -1.2 to 1.2.
+ -- from -1.2 to 1.2.
Set_Viewport_Standard;
Set_Viewport_World(0.0, 360.0, -1.2, 1.2);
- -- Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y.
+ -- Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y.
Set_Pen_Color(Red);
Box_Around_Viewport("bcnst", 60.0, 2, "bcnstv", 0.2, 2);
- -- Superimpose a dashed line grid, with 1.5 mm marks and spaces.
+ -- Superimpose a dashed line grid, with 1.5 mm marks and spaces.
Set_Line_Style(mark1, space1);
Set_Pen_Color(Yellow);
Box_Around_Viewport("g", 30.0, 0, "g", 0.2, 0);
@@ -176,7 +178,7 @@
Flush_Output_Stream;
end plot3;
- -- ================================================================
+ -- ================================================================
procedure plot4 is
@@ -189,7 +191,7 @@
y0(i) := sin(dtr * Long_Float(i));
end loop;
- -- Set up viewport and window, but do not draw box
+ -- Set up viewport and window, but do not draw box
Set_Environment(-1.3, 1.3, -1.3, 1.3, Justified, No_Box);
for i in 1 .. 10 loop
for j in x'range loop
@@ -197,7 +199,7 @@
y(j) := 0.1 * Long_Float(i) * y0(j);
end loop;
- -- Draw circles for polar grid
+ -- Draw circles for polar grid
Draw_Curve(x, y);
end loop;
@@ -207,11 +209,11 @@
dx := cos(dtr * theta);
dy := sin(dtr * theta);
- -- Draw radial spokes for polar grid
+ -- Draw radial spokes for polar grid
Draw_Line(0.0, 0.0, dx, dy);
- -- Write labels for angle
- -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg.
+ -- Write labels for angle
+ -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg.
if dx >= -0.00001 then
Write_Text_World(dx, dy, dx, dy, -0.15, Trim(Integer'image(Integer(theta)), Left));
else
@@ -219,7 +221,7 @@
end if;
end loop;
- -- Draw the graph
+ -- Draw the graph
for i in x'range loop
r := sin(dtr * Long_Float(5 * i));
x(i) := x0(i) * r;
@@ -233,10 +235,10 @@
Flush_Output_Stream;
end plot4;
- -- ================================================================
+ -- ================================================================
- -- Demonstration of contour plotting
+ -- Demonstration of contour plotting
procedure plot5 is
XPTS : constant Integer := 35;
YPTS : constant Integer := 46;
@@ -248,20 +250,20 @@
mark : Integer_Array_1D(1 .. 1) := (Others => 1500);
space : Integer_Array_1D(1 .. 1) := (Others => 1500);
z, w : Real_Matrix(0 .. XPTS -1, 0 .. YPTS - 1);
- clevel : Real_Vector(0 .. 10) :=
+ clevel : Real_Vector(0 .. 10) :=
(-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0);
procedure mypltr -- This spec is necessary to accommodate pragma Convention(C...).
- (x, y : Long_Float;
- tx, ty : out Long_Float;
+ (x, y : Long_Float;
+ tx, ty : out Long_Float;
pltr_data : PLpointer);
pragma Convention(Convention => C, Entity => mypltr);
procedure mypltr
- (x, y : Long_Float;
- tx, ty : out Long_Float;
+ (x, y : Long_Float;
+ tx, ty : out Long_Float;
pltr_data : PLpointer)
- is
+ is
begin
tx := tr(0) * x + tr(1) * y + tr(2);
ty := tr(3) * x + tr(4) * y + tr(5);
@@ -290,34 +292,37 @@
begin
- -- plplot initialization
- -- Parse and process command line arguments
+ -- plplot initialization
+ -- Parse and process command line arguments
Parse_Command_Line_Arguments(Parse_Full);
driver := To_Unbounded_String(Get_Device_Name);
+ Get_File_Family_Parameters(fam, num, bmax);
Put_Line("Demo of multiple output streams via the " & Get_Device_Name & " driver.");
Put_Line("Running with the second stream as slave to the first.");
New_Line;
- -- Set up first stream
+ -- Set up first stream
Set_Command_Line_Option("geometry", geometry_master);
Set_Device_Name(To_String(driver));
Set_Number_Of_Subpages(2, 2);
Initialize_PLplot;
- -- Start next stream
+ -- Start next stream
Set_Stream_Number(1);
- -- Turn off pause to make this a slave (must follow master)
+ -- Turn off pause to make this a slave (must follow master)
Set_Command_Line_Option("geometry", geometry_slave);
Set_Pause(False);
Set_Device_Name(To_String(driver));
+ Get_File_Family_Parameters(fam, num, bmax);
+ Set_Command_Line_Option("fflen","2");
Initialize_PLplot;
- -- Set up the data & plot
- -- Original case
+ -- Set up the data & plot
+ -- Original case
Set_Stream_Number(0);
xscale := 6.0;
@@ -326,19 +331,19 @@
yoff := 0.0;
plot1;
- -- Set up the data & plot
+ -- Set up the data & plot
xscale := 1.0;
yscale := 1.0e+6;
plot1;
- -- Set up the data & plot
+ -- Set up the data & plot
xscale := 1.0;
yscale := 1.0e-6;
digmax := 2;
Set_Floating_Point_Display_Y(digmax, 0);
plot1;
- -- Set up the data & plot
+ -- Set up the data & plot
xscale := 1.0;
yscale := 0.0014;
yoff := 0.0185;
@@ -346,26 +351,26 @@
Set_Floating_Point_Display_Y(digmax, 0);
plot1;
- -- To slave
- -- The Eject_Current_Page ensures the eop indicator gets lit.
+ -- To slave
+ -- The Eject_Current_Page ensures the eop indicator gets lit.
Set_Stream_Number(1);
plot4;
Eject_Current_Page;
- -- Back to master
+ -- Back to master
Set_Stream_Number(0);
plot2;
plot3;
- -- To slave
+ -- To slave
Set_Stream_Number(1);
plot5;
Eject_Current_Page;
- -- Back to master to wait for user to advance
+ -- Back to master to wait for user to advance
Set_Stream_Number(0);
Eject_Current_Page;
- -- Call End_PLplot to finish off.
+ -- Call End_PLplot to finish off.
End_PLplot;
end xthick14a;
Modified: trunk/examples/c/x14c.c
===================================================================
--- trunk/examples/c/x14c.c 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/c/x14c.c 2009-01-07 16:10:59 UTC (rev 9273)
@@ -92,6 +92,9 @@
plspause(0);
plsdev(driver);
plsfam(fam,num,bmax);
+ /* Currently number of digits in format number can only be
+ * set via the command line option */
+ plsetopt("fflen","2");
plinit();
/* Set up the data & plot */
Modified: trunk/examples/c++/x14.cc
===================================================================
--- trunk/examples/c++/x14.cc 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/c++/x14.cc 2009-01-07 16:10:59 UTC (rev 9273)
@@ -93,6 +93,9 @@
// The geometry strings MUST be in writable memory
char driver[80];
+
+ PLINT fam, num, bmax;
+
const char geometry_master[] = "500x410+100+200";
const char geometry_slave[] = "500x410+650+200";
@@ -104,6 +107,7 @@
pls1->parseopts( &argc, argv, PL_PARSE_FULL );
pls1->gdev(driver);
+ pls1->gfam(fam,num,bmax);
cout << "Demo of multiple output streams via the " <<
driver << " driver." << endl;
@@ -125,6 +129,10 @@
pls2->SetOpt("geometry", geometry_slave);
pls2->spause(false);
pls2->sdev(driver);
+ pls2->sfam(fam,num,bmax);
+ // Currently number of digits in format number can only be
+ // set via the command line option
+ pls2->SetOpt("fflen","2");
pls2->init();
// Set up the data & plot
Modified: trunk/examples/f77/x14f.fm4
===================================================================
--- trunk/examples/f77/x14f.fm4 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/f77/x14f.fm4 2009-01-07 16:10:59 UTC (rev 9273)
@@ -35,6 +35,8 @@
character*15 geometry_master
character*15 geometry_slave
+ integer fam, num, bmax
+
real*8 x(101), y(101)
real*8 xs(6), ys(6)
real*8 xscale, yscale, xoff, yoff
@@ -61,6 +63,7 @@
call plparseopts(PL_PARSE_FULL)
call plgdev(driver)
+ call plgfam(fam,num,bmax)
write(*,'(3A)') 'Demo of multiple output streams via the ',
& driver(:lnblnk(driver)), ' driver.'
@@ -85,6 +88,8 @@
call plsetopt( 'geometry', geometry_slave)
call plspause(0)
call plsdev(driver)
+ call plsfam(fam,num,bmax)
+ call plsetopt('fflen','2')
call plinit()
C Set up the data & plot
Modified: trunk/examples/f95/x14f.f90
===================================================================
--- trunk/examples/f95/x14f.f90 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/f95/x14f.f90 2009-01-07 16:10:59 UTC (rev 9273)
@@ -36,6 +36,8 @@
character*15 geometry_master
character*15 geometry_slave
+ integer fam, num, bmax
+
real(kind=plflt) x(101), y(101)
real(kind=plflt) xs(6), ys(6)
real(kind=plflt) xscale, yscale, xoff, yoff
@@ -58,6 +60,7 @@
call plparseopts(PL_PARSE_FULL)
call plgdev(driver)
+ call plgfam(fam,num,bmax)
write(*,'(3A)') 'Demo of multiple output streams via the ', &
trim(driver), ' driver.'
@@ -82,6 +85,8 @@
call plsetopt( 'geometry', geometry_slave)
call plspause(.false.)
call plsdev(driver)
+ call plsfam(fam,num,bmax)
+ call plsetopt('fflen','2')
call plinit()
! Set up the data & plot
Modified: trunk/examples/java/x14.java
===================================================================
--- trunk/examples/java/x14.java 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/java/x14.java 2009-01-07 16:10:59 UTC (rev 9273)
@@ -51,6 +51,10 @@
String geometry_master = "500x410+100+200";
String geometry_slave = "500x410+650+200";
+ int fam[] = new int[1];
+ int num[] = new int[1];
+ int bmax[] = new int[1];
+
// Parse and process command line arguments.
pls1.parseopts( args, PLStream.PL_PARSE_FULL|PLStream.PL_PARSE_NOPROGRAM );
@@ -58,6 +62,7 @@
StringBuffer driver = new StringBuffer(80);
pls1.gdev(driver);
+ pls1.gfam(fam,num,bmax);
String sdriver = new String(driver);
System.out.println("Demo of multiple output streams via the " + sdriver + " driver.");
System.out.println("Running with the second stream as slave to the first.");
@@ -78,6 +83,8 @@
pls2.setopt("geometry", geometry_slave);
pls2.spause(false);
pls2.sdev(sdriver);
+ pls2.sfam(fam[0],num[0],bmax[0]);
+ pls2.setopt("fflen","2");
pls2.init();
//Set up the data & plot
Modified: trunk/examples/ocaml/x14.ml
===================================================================
--- trunk/examples/ocaml/x14.ml 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/ocaml/x14.ml 2009-01-07 16:10:59 UTC (rev 9273)
@@ -228,6 +228,7 @@
ignore (plparseopts Sys.argv [PL_PARSE_FULL]);
let driver = plgdev () in
+ let fam, num, bmax = plgfam () in
printf "Demo of multiple output streams via the %s driver.\n" driver;
printf "Running with the second stream as slave to the first.\n";
@@ -247,6 +248,8 @@
plsetopt "geometry" geometry_slave;
plspause false;
plsdev driver;
+ plsfam fam num bmax;
+ plsetopt "fflen" "2";
plinit ();
(* Set up the data & plot *)
Modified: trunk/examples/perl/x14.pl
===================================================================
--- trunk/examples/perl/x14.pl 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/perl/x14.pl 2009-01-07 16:10:59 UTC (rev 9273)
@@ -57,6 +57,7 @@
plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM);
my $driver = plgdev ();
+ my ($fam, $num, $bmax) = plgfam ();
print ("Demo of multiple output streams via the $driver driver.\n"
. "Running with the second stream as slave to the first.\n"
@@ -79,6 +80,8 @@
plsetopt ("geometry", $geometry_slave);
plspause (0);
plsdev ($driver);
+ plsfam ($fam, $num, $bmax);
+ plsetopt ("fflen","2");
plinit ();
# Set up the data & plot
Modified: trunk/examples/python/xw14.py
===================================================================
--- trunk/examples/python/xw14.py 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/python/xw14.py 2009-01-07 16:10:59 UTC (rev 9273)
@@ -42,6 +42,8 @@
geometry_master = "500x410+100+200"
geometry_slave = "500x410+650+200"
driver = plgdev()
+ (fam, num, bmax) = plgfam()
+
print "Demo of multiple output streams via the %s driver." % driver
print "Running with the second stream as slave to the first."
print ""
@@ -60,6 +62,8 @@
plsetopt("geometry", geometry_slave)
plspause(0)
plsdev(driver)
+ plsfam(fam, num, bmax)
+ plsetopt("fflen","2")
plinit()
# Set up the data & plot
Modified: trunk/examples/tcl/x14.tcl
===================================================================
--- trunk/examples/tcl/x14.tcl 2009-01-07 15:14:56 UTC (rev 9272)
+++ trunk/examples/tcl/x14.tcl 2009-01-07 16:10:59 UTC (rev 9273)
@@ -8,6 +8,7 @@
set geometry_slave "500x410+650+200"
$w cmd plgdev driver
+ $w cmd plgfam fam num bmax
puts "Demo of multiple output streams via the $driver driver."
puts "Running with the second stream as slave to the first."
puts ""
@@ -27,7 +28,11 @@
$w cmd plsetopt "geometry" $geometry_slave
$w cmd plspause 0
- if {$driver != ""} {$w cmd plsdev $driver}
+ if {$driver != ""} {
+ $w cmd plsdev $driver
+ }
+ $w cmd plsfam $fam $num $bmax
+ $w cmd plsetopt "fflen" "2"
$w cmd plinit
# Set up the data & plot
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|