From: <jb...@us...> - 2010-01-05 07:30:46
|
Revision: 10736 http://plplot.svn.sourceforge.net/plplot/?rev=10736&view=rev Author: jbauck Date: 2010-01-05 07:30:39 +0000 (Tue, 05 Jan 2010) Log Message: ----------- Incorporate plgradient into the Ada bindings and Ada examples 25 and 30. Modified Paths: -------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake trunk/examples/ada/x25a.adb.cmake trunk/examples/ada/x30a.adb.cmake trunk/examples/ada/xthick25a.adb.cmake trunk/examples/ada/xthick30a.adb.cmake Modified: trunk/bindings/ada/plplot.adb.cmake =================================================================== --- trunk/bindings/ada/plplot.adb.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/bindings/ada/plplot.adb.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -1641,6 +1641,14 @@ end Use_Graphics_Mode; + -- Draw gradient in polygon. + -- plgradient + procedure Fill_Polygon_Gradient(x, y : Real_Vector; Angle : Long_Float) is + begin + plgradient(x'Length, x, y, Angle); + end Fill_Polygon_Gradient; + + -- Grid irregularly sampled data. -- plgriddata procedure Grid_Data Modified: trunk/bindings/ada/plplot.ads.cmake =================================================================== --- trunk/bindings/ada/plplot.ads.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/bindings/ada/plplot.ads.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -1017,6 +1017,11 @@ procedure Use_Graphics_Mode; + -- Draw gradient in polygon. + -- plgradient + procedure Fill_Polygon_Gradient(x, y : Real_Vector; Angle : Long_Float); + + -- Grid irregularly sampled data. -- plgriddata procedure Grid_Data Modified: trunk/bindings/ada/plplot_thin.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_thin.ads.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/bindings/ada/plplot_thin.ads.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -846,8 +846,15 @@ pragma Import(C, plgra, "c_plgra"); + -- Draw gradient in polygon. + + procedure + plgradient(n : PLINT; x : PL_Float_Array; y : PL_Float_Array; angle : PLFLT); + pragma Import(C, plgradient, "c_plgradient"); + + -- grid irregularly sampled data - -- Note that since z_Gridded is passed as an array of pointers, this is + -- Ada Note: Since z_Gridded is passed as an array of pointers, this is -- effectively the same as pass-by-reference so "in out" is not required for -- the formal argument zg in plgriddata. Modified: trunk/bindings/ada/plplot_traditional.adb.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.adb.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/bindings/ada/plplot_traditional.adb.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -1592,6 +1592,13 @@ end plgra; + -- Draw gradient in polygon. + procedure plgradient(x, y : Real_Vector; Angle : Long_Float) is + begin + plgradient(x'Length, x, y, Angle); + end plgradient; + + -- Grid irregularly sampled data. procedure plgriddata (x, y, z : Real_Vector; -- ungridded x- and y-points; z is height Modified: trunk/bindings/ada/plplot_traditional.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.ads.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/bindings/ada/plplot_traditional.ads.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -965,6 +965,10 @@ procedure plgra; + -- Draw gradient in polygon. + procedure plgradient(x, y : Real_Vector; Angle : Long_Float); + + -- Grid irregularly sampled data. procedure plgriddata (x, y, z : Real_Vector; -- ungridded x- and y-points; z is height Modified: trunk/examples/ada/x25a.adb.cmake =================================================================== --- trunk/examples/ada/x25a.adb.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/examples/ada/x25a.adb.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -2,7 +2,7 @@ -- Filling and clipping polygons. --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. @@ -52,76 +52,82 @@ xextreme(7, 0) := -80.0; xextreme(7, 1) := 80.0; yextreme(7, 0) := -80.0; yextreme(7, 1) := 80.0; xextreme(8, 0) := 20.0; xextreme(8, 1) := 120.0; yextreme(8, 0) := -120.0; yextreme(8, 1) := 120.0; - for j in 0 .. 3 loop - if j = 0 then - -- Polygon 1: a diamond - x0(0) := 0.0; y0(0) := -100.0; - x0(1) := -100.0; y0(1) := 0.0; - x0(2) := 0.0; y0(2) := 100.0; - x0(3) := 100.0; y0(3) := 0.0; - npts := 4; - end if; - if j = 1 then - -- Polygon 1: a diamond - reverse direction - x0(3) := 0.0; y0(3) := -100.0; - x0(2) := -100.0; y0(2) := 0.0; - x0(1) := 0.0; y0(1) := 100.0; - x0(0) := 100.0; y0(0) := 0.0; - npts := 4; - end if; - if j = 2 then - -- Polygon 2: a square with punctures - x0(0) := -100.0; y0(0) := -100.0; - x0(1) := -100.0; y0(1) := -80.0; - x0(2) := 80.0; y0(2) := 0.0; - x0(3) := -100.0; y0(3) := 80.0; - x0(4) := -100.0; y0(4) := 100.0; - x0(5) := -80.0; y0(5) := 100.0; - x0(6) := 0.0; y0(6) := 80.0; - x0(7) := 80.0; y0(7) := 100.0; - x0(8) := 100.0; y0(8) := 100.0; - x0(9) := 100.0; y0(9) := -100.0; - npts := 10; - end if; - if j = 3 then - -- Polygon 2: a square with punctures - reversed direction - x0(9) := -100.0; y0(9) := -100.0; - x0(8) := -100.0; y0(8) := -80.0; - x0(7) := 80.0; y0(7) := 0.0; - x0(6) := -100.0; y0(6) := 80.0; - x0(5) := -100.0; y0(5) := 100.0; - x0(4) := -80.0; y0(4) := 100.0; - x0(3) := 0.0; y0(3) := 80.0; - x0(2) := 80.0; y0(2) := 100.0; - x0(1) := 100.0; y0(1) := 100.0; - x0(0) := 100.0; y0(0) := -100.0; - npts := 10; - end if; + for k in 0 .. 1 loop + for j in 0 .. 3 loop + if j = 0 then + -- Polygon 1: a diamond + x0(0) := 0.0; y0(0) := -100.0; + x0(1) := -100.0; y0(1) := 0.0; + x0(2) := 0.0; y0(2) := 100.0; + x0(3) := 100.0; y0(3) := 0.0; + npts := 4; + end if; + if j = 1 then + -- Polygon 1: a diamond - reverse direction + x0(3) := 0.0; y0(3) := -100.0; + x0(2) := -100.0; y0(2) := 0.0; + x0(1) := 0.0; y0(1) := 100.0; + x0(0) := 100.0; y0(0) := 0.0; + npts := 4; + end if; + if j = 2 then + -- Polygon 2: a square with punctures + x0(0) := -100.0; y0(0) := -100.0; + x0(1) := -100.0; y0(1) := -80.0; + x0(2) := 80.0; y0(2) := 0.0; + x0(3) := -100.0; y0(3) := 80.0; + x0(4) := -100.0; y0(4) := 100.0; + x0(5) := -80.0; y0(5) := 100.0; + x0(6) := 0.0; y0(6) := 80.0; + x0(7) := 80.0; y0(7) := 100.0; + x0(8) := 100.0; y0(8) := 100.0; + x0(9) := 100.0; y0(9) := -100.0; + npts := 10; + end if; + if j = 3 then + -- Polygon 2: a square with punctures - reversed direction + x0(9) := -100.0; y0(9) := -100.0; + x0(8) := -100.0; y0(8) := -80.0; + x0(7) := 80.0; y0(7) := 0.0; + x0(6) := -100.0; y0(6) := 80.0; + x0(5) := -100.0; y0(5) := 100.0; + x0(4) := -80.0; y0(4) := 100.0; + x0(3) := 0.0; y0(3) := 80.0; + x0(2) := 80.0; y0(2) := 100.0; + x0(1) := 100.0; y0(1) := 100.0; + x0(0) := 100.0; y0(0) := -100.0; + npts := 10; + end if; - for i in xextreme'range(1) loop - pladv(0); - plvsta; - plwind(xextreme(i, 0), xextreme(i, 1), yextreme(i, 0), yextreme(i, 1)); + for i in xextreme'range(1) loop + pladv(0); + plvsta; + plwind(xextreme(i, 0), xextreme(i, 1), yextreme(i, 0), yextreme(i, 1)); - declare - x0_Stop_Sucking, y0_Stop_Sucking : Real_Vector(0 .. npts - 1); - begin - x0_Stop_Sucking := x0(0 .. npts - 1); - y0_Stop_Sucking := y0(0 .. npts - 1); - - plcol0(2); - plbox("bc", 1.0, 0, "bcnv", 10.0, 0); - plcol0(1); - plpsty(0); - plfill(x0_Stop_Sucking, y0_Stop_Sucking); - plcol0(2); - pllsty(1); - plline(x0_Stop_Sucking, y0_Stop_Sucking); - end; - end loop; + declare + x0_Stop_Sucking, y0_Stop_Sucking : Real_Vector(0 .. npts - 1); + begin + x0_Stop_Sucking := x0(0 .. npts - 1); + y0_Stop_Sucking := y0(0 .. npts - 1); + + plcol0(2); + plbox("bc", 1.0, 0, "bcnv", 10.0, 0); + plcol0(1); + plpsty(0); + -- Solid fill or gradient fill + if k = 0 then + plfill(x0_Stop_Sucking, y0_Stop_Sucking); + else + plgradient(x0_Stop_Sucking, y0_Stop_Sucking, 45.0); + end if; + plcol0(2); + pllsty(1); + plline(x0_Stop_Sucking, y0_Stop_Sucking); + end; + end loop; -- i + end loop; -- j + end loop; --k - end loop; - -- Don't forget to call plend to finish off! plend; end x25a; Modified: trunk/examples/ada/x30a.adb.cmake =================================================================== --- trunk/examples/ada/x30a.adb.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/examples/ada/x30a.adb.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -2,7 +2,7 @@ -- Alpha color values demonstration --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. @@ -52,8 +52,7 @@ icol, r, g, b : Integer; a : Long_Float; - clevel : Real_Vector(0 .. 100); - z : Real_Matrix(0 .. 1, 0 .. 1); + begin plparseopts(PL_PARSE_FULL); plinit; @@ -127,30 +126,23 @@ end loop; end loop; - -- The overlaid box is drawn using plshades with a color map that is - -- the same color but has a linearly varying transparency. - -- Create the color map with 128 colors and use plscmap1la to initialize - -- the color values with a linear varying transparency (or alpha). + -- the color values with a linearly varying transparency (or alpha). plscmap1n(128); plscmap1la(RGB, pos, rcoord, gcoord, bcoord, acoord, Reverse_Hue_None); - -- Create a 2 x 2 array that contains the z values (0.0 to 1.0) that will - -- used for the shade plot. plshades will use linear interpolation to - -- calculate the z values of all the intermediate points in this array. - z(0, 0) := 0.0; - z(1, 0) := 0.0; - z(0, 1) := 1.0; - z(1, 1) := 1.0; + -- Use that cmap1 to create a transparent red gradient for the whole window. + px(0) := 0.0; + px(1) := 1.0; + px(2) := 1.0; + px(3) := 0.0; - -- Set the color levels array. These levels are also between 0.0 and 1.0 - for i in clevel'range loop - clevel(i) := 0.01 * Long_Float(i); - end loop; + py(0) := 0.0; + py(1) := 0.0; + py(2) := 1.0; + py(3) := 1.0; - -- Draw the shade plot with zmin := 0.0, zmax := 1.0 and x and y coordinate - -- ranges such that it fills the entire plotting area. - plshades(z, Null, 0.0, 1.0, 0.0, 1.0, clevel, 0, 0, 2, plfill'access, True, NULL, System.Null_Address); - + plgradient(px, py, 90.0); + plend; end x30a; Modified: trunk/examples/ada/xthick25a.adb.cmake =================================================================== --- trunk/examples/ada/xthick25a.adb.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/examples/ada/xthick25a.adb.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -2,7 +2,7 @@ -- Filling and clipping polygons. --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. @@ -52,76 +52,82 @@ xextreme(7, 0) := -80.0; xextreme(7, 1) := 80.0; yextreme(7, 0) := -80.0; yextreme(7, 1) := 80.0; xextreme(8, 0) := 20.0; xextreme(8, 1) := 120.0; yextreme(8, 0) := -120.0; yextreme(8, 1) := 120.0; - for j in 0 .. 3 loop - if j = 0 then - -- Polygon 1: a diamond - x0(0) := 0.0; y0(0) := -100.0; - x0(1) := -100.0; y0(1) := 0.0; - x0(2) := 0.0; y0(2) := 100.0; - x0(3) := 100.0; y0(3) := 0.0; - npts := 4; - end if; - if j = 1 then - -- Polygon 1: a diamond - reverse direction - x0(3) := 0.0; y0(3) := -100.0; - x0(2) := -100.0; y0(2) := 0.0; - x0(1) := 0.0; y0(1) := 100.0; - x0(0) := 100.0; y0(0) := 0.0; - npts := 4; - end if; - if j = 2 then - -- Polygon 2: a square with punctures - x0(0) := -100.0; y0(0) := -100.0; - x0(1) := -100.0; y0(1) := -80.0; - x0(2) := 80.0; y0(2) := 0.0; - x0(3) := -100.0; y0(3) := 80.0; - x0(4) := -100.0; y0(4) := 100.0; - x0(5) := -80.0; y0(5) := 100.0; - x0(6) := 0.0; y0(6) := 80.0; - x0(7) := 80.0; y0(7) := 100.0; - x0(8) := 100.0; y0(8) := 100.0; - x0(9) := 100.0; y0(9) := -100.0; - npts := 10; - end if; - if j = 3 then - -- Polygon 2: a square with punctures - reversed direction - x0(9) := -100.0; y0(9) := -100.0; - x0(8) := -100.0; y0(8) := -80.0; - x0(7) := 80.0; y0(7) := 0.0; - x0(6) := -100.0; y0(6) := 80.0; - x0(5) := -100.0; y0(5) := 100.0; - x0(4) := -80.0; y0(4) := 100.0; - x0(3) := 0.0; y0(3) := 80.0; - x0(2) := 80.0; y0(2) := 100.0; - x0(1) := 100.0; y0(1) := 100.0; - x0(0) := 100.0; y0(0) := -100.0; - npts := 10; - end if; + for k in 0 .. 1 loop + for j in 0 .. 3 loop + if j = 0 then + -- Polygon 1: a diamond + x0(0) := 0.0; y0(0) := -100.0; + x0(1) := -100.0; y0(1) := 0.0; + x0(2) := 0.0; y0(2) := 100.0; + x0(3) := 100.0; y0(3) := 0.0; + npts := 4; + end if; + if j = 1 then + -- Polygon 1: a diamond - reverse direction + x0(3) := 0.0; y0(3) := -100.0; + x0(2) := -100.0; y0(2) := 0.0; + x0(1) := 0.0; y0(1) := 100.0; + x0(0) := 100.0; y0(0) := 0.0; + npts := 4; + end if; + if j = 2 then + -- Polygon 2: a square with punctures + x0(0) := -100.0; y0(0) := -100.0; + x0(1) := -100.0; y0(1) := -80.0; + x0(2) := 80.0; y0(2) := 0.0; + x0(3) := -100.0; y0(3) := 80.0; + x0(4) := -100.0; y0(4) := 100.0; + x0(5) := -80.0; y0(5) := 100.0; + x0(6) := 0.0; y0(6) := 80.0; + x0(7) := 80.0; y0(7) := 100.0; + x0(8) := 100.0; y0(8) := 100.0; + x0(9) := 100.0; y0(9) := -100.0; + npts := 10; + end if; + if j = 3 then + -- Polygon 2: a square with punctures - reversed direction + x0(9) := -100.0; y0(9) := -100.0; + x0(8) := -100.0; y0(8) := -80.0; + x0(7) := 80.0; y0(7) := 0.0; + x0(6) := -100.0; y0(6) := 80.0; + x0(5) := -100.0; y0(5) := 100.0; + x0(4) := -80.0; y0(4) := 100.0; + x0(3) := 0.0; y0(3) := 80.0; + x0(2) := 80.0; y0(2) := 100.0; + x0(1) := 100.0; y0(1) := 100.0; + x0(0) := 100.0; y0(0) := -100.0; + npts := 10; + end if; - for i in xextreme'range(1) loop - Advance_To_Subpage(Next_Subpage); - Set_Viewport_Standard; - Set_Viewport_World(xextreme(i, 0), xextreme(i, 1), yextreme(i, 0), yextreme(i, 1)); + for i in xextreme'range(1) loop + Advance_To_Subpage(Next_Subpage); + Set_Viewport_Standard; + Set_Viewport_World(xextreme(i, 0), xextreme(i, 1), yextreme(i, 0), yextreme(i, 1)); - declare - x0_Stop_Sucking, y0_Stop_Sucking : Real_Vector(0 .. npts - 1); - begin - x0_Stop_Sucking := x0(0 .. npts - 1); - y0_Stop_Sucking := y0(0 .. npts - 1); - - Set_Pen_Color(Yellow); - Box_Around_Viewport("bc", 1.0, 0, "bcnv", 10.0, 0); - Set_Pen_Color(Red); - Select_Fill_Pattern(0); - Fill_Polygon(x0_Stop_Sucking, y0_Stop_Sucking); - Set_Pen_Color(Yellow); - Select_Line_Style(1); - Draw_Curve(x0_Stop_Sucking, y0_Stop_Sucking); - end; - end loop; + declare + x0_Stop_Sucking, y0_Stop_Sucking : Real_Vector(0 .. npts - 1); + begin + x0_Stop_Sucking := x0(0 .. npts - 1); + y0_Stop_Sucking := y0(0 .. npts - 1); + + Set_Pen_Color(Yellow); + Box_Around_Viewport("bc", 1.0, 0, "bcnv", 10.0, 0); + Set_Pen_Color(Red); + Select_Fill_Pattern(0); + -- Solid fill or gradient fill + if k = 0 then + Fill_Polygon(x0_Stop_Sucking, y0_Stop_Sucking); + else + Fill_Polygon_Gradient(x0_Stop_Sucking, y0_Stop_Sucking, 45.0); + end if; + Set_Pen_Color(Yellow); + Select_Line_Style(1); + Draw_Curve(x0_Stop_Sucking, y0_Stop_Sucking); + end; + end loop; -- i + end loop; -- j + end loop; -- k - end loop; - -- Don't forget to call End_PLplot to finish off! End_PLplot; end xthick25a; Modified: trunk/examples/ada/xthick30a.adb.cmake =================================================================== --- trunk/examples/ada/xthick30a.adb.cmake 2010-01-04 06:39:22 UTC (rev 10735) +++ trunk/examples/ada/xthick30a.adb.cmake 2010-01-05 07:30:39 UTC (rev 10736) @@ -2,7 +2,7 @@ -- Alpha color values demonstration --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. @@ -52,8 +52,7 @@ icol, r, g, b : Integer; a : Long_Float; - clevel : Real_Vector(0 .. 100); - z : Real_Matrix(0 .. 1, 0 .. 1); + begin Parse_Command_Line_Arguments(Parse_Full); Initialize_PLplot; @@ -127,30 +126,23 @@ end loop; end loop; - -- The overlaid box is drawn using Shade_Regions with a color map that is - -- the same color but has a linearly varying transparency. - -- Create the color map with 128 colors and use Set_Color_Map_1_RGBla to initialize - -- the color values with a linear varying transparency (or alpha). + -- the color values with a linearly varying transparency (or alpha). Set_Number_Of_Colors_In_Color_Map_1(128); Set_Color_Map_1_Piecewise_And_Alpha(RGB, pos, rcoord, gcoord, bcoord, acoord, Reverse_Hue_None); - -- Create a 2 x 2 array that contains the z values (0.0 to 1.0) that will - -- used for the shade plot. Shade_Regions will use linear interpolation to - -- calculate the z values of all the intermediate points in this array. - z(0, 0) := 0.0; - z(1, 0) := 0.0; - z(0, 1) := 1.0; - z(1, 1) := 1.0; + -- Use that cmap1 to create a transparent red gradient for the whole window. + px(0) := 0.0; + px(1) := 1.0; + px(2) := 1.0; + px(3) := 0.0; - -- Set the color levels array. These levels are also between 0.0 and 1.0 - for i in clevel'range loop - clevel(i) := 0.01 * Long_Float(i); - end loop; + py(0) := 0.0; + py(1) := 0.0; + py(2) := 1.0; + py(3) := 1.0; - -- Draw the shade plot with zmin := 0.0, zmax := 1.0 and x and y coordinate - -- ranges such that it fills the entire plotting area. - Shade_Regions(z, Null, 0.0, 1.0, 0.0, 1.0, clevel, 0, 0, 2, Fill_Polygon'access, True, NULL, System.Null_Address); + Fill_Polygon_Gradient(px, py, 90.0); End_PLplot; end xthick30a; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-01-06 20:21:41
|
Revision: 10737 http://plplot.svn.sourceforge.net/plplot/?rev=10737&view=rev Author: andrewross Date: 2010-01-06 20:21:34 +0000 (Wed, 06 Jan 2010) Log Message: ----------- Fix up pl_create_tempfile to properly delete temporary files once they are closed on UNIX-like systems. The call to unlink had been commented out during testing and not restored. Also add it a proper test for unlink in case there is a platform out there with mkstemp, but not unlink. Modified Paths: -------------- trunk/cmake/modules/plplot.cmake trunk/config.h.cmake trunk/src/plstdio.c Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2010-01-05 07:30:39 UTC (rev 10736) +++ trunk/cmake/modules/plplot.cmake 2010-01-06 20:21:34 UTC (rev 10737) @@ -243,6 +243,7 @@ check_function_exists(popen HAVE_POPEN) check_function_exists(usleep PL_HAVE_USLEEP) check_function_exists(mkstemp PL_HAVE_MKSTEMP) +check_function_exists(mkstemp PL_HAVE_UNLINK) # Check for FP functions, including underscored version which # are sometimes all that is available on windows Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2010-01-05 07:30:39 UTC (rev 10736) +++ trunk/config.h.cmake 2010-01-06 20:21:34 UTC (rev 10737) @@ -153,6 +153,9 @@ /* Define to 1 if you have the <termios.h> header file. */ #cmakedefine HAVE_TERMIOS_H 1 +/* Define to 1 if the function unlink is available */ +#cmakedefine PL_HAVE_UNLINK 1 + /* Define to 1 if you have the `vfork' function. */ #cmakedefine HAVE_VFORK 1 Modified: trunk/src/plstdio.c =================================================================== --- trunk/src/plstdio.c 2010-01-05 07:30:39 UTC (rev 10736) +++ trunk/src/plstdio.c 2010-01-06 20:21:34 UTC (rev 10737) @@ -221,8 +221,10 @@ } /* If we are not returning the file name then unlink the file so it is * automatically deleted. */ - //if ( fname == NULL ) - // unlink( template ); +#ifdef PL_HAVE_UNLINK + if ( fname == NULL ) + unlink( template ); +#endif #else #if !defined ( _S_IREAD ) #define _S_IREAD 256 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-01-08 01:14:10
|
Revision: 10744 http://plplot.svn.sourceforge.net/plplot/?rev=10744&view=rev Author: airwin Date: 2010-01-08 01:14:04 +0000 (Fri, 08 Jan 2010) Log Message: ----------- uncrustify 0.55 styling changes. Modified Paths: -------------- trunk/drivers/aqt.c trunk/drivers/wingcc.c trunk/examples/c++/x01cc.cc trunk/examples/d/x04d.d trunk/lib/qsastime/bhunt_search_test.c trunk/lib/qsastime/qsastime.c trunk/src/plot3d.c trunk/src/plvpor.c Modified: trunk/drivers/aqt.c =================================================================== --- trunk/drivers/aqt.c 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/drivers/aqt.c 2010-01-08 01:14:04 UTC (rev 10744) @@ -284,8 +284,8 @@ if ( !didTests ) { - hasShear = [adapter respondsToSelector:@selector( addLabel:atPoint:angle:shearAngle:align:)]; - hasAlpha = [adapter respondsToSelector:@selector( setColorRed:green:blue:alpha:)]; + hasShear = [adapter respondsToSelector:@selector( addLabel:atPoint:angle:shearAngle:align: )]; + hasAlpha = [adapter respondsToSelector:@selector( setColorRed:green:blue:alpha: )]; didTests = true; } } Modified: trunk/drivers/wingcc.c =================================================================== --- trunk/drivers/wingcc.c 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/drivers/wingcc.c 2010-01-08 01:14:04 UTC (rev 10744) @@ -169,10 +169,10 @@ #define Debug2 if ( pls->debug ) printf #define Debug3 if ( pls->debug ) printf #else - #define Verbose(... ) do { if ( pls->verbose ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) - #define Debug(... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) - #define Debug2(... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) - #define Debug3(... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) + #define Verbose( ... ) do { if ( pls->verbose ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) + #define Debug( ... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) + #define Debug2( ... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) + #define Debug3( ... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) #endif #define ReportWinError() do { \ Modified: trunk/examples/c++/x01cc.cc =================================================================== --- trunk/examples/c++/x01cc.cc 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/examples/c++/x01cc.cc 2010-01-08 01:14:04 UTC (rev 10744) @@ -47,7 +47,7 @@ Matrix( int _nx, int _ny ) : nx( _nx ), ny( _ny ) { v = new PLFLT[nx * ny]; } ~Matrix() { delete[] v; } - PLFLT& operator()( int i, int j ) + PLFLT & operator()( int i, int j ) { // Should do bounds checking, pass for now. return v[ j * ny + i ]; @@ -89,7 +89,7 @@ else _ny = ny; } - PLFLT& operator()( int i, int j ) + PLFLT & operator()( int i, int j ) { if ( wrapy ) j %= ny; return m( i, j ); @@ -121,7 +121,7 @@ return m( ix, iy ); } - PLFLT& operator()( int ix, int iy ) + PLFLT & operator()( int ix, int iy ) { if ( wrapy ) iy %= ny; return m( ix, iy ); Modified: trunk/examples/d/x04d.d =================================================================== --- trunk/examples/d/x04d.d 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/examples/d/x04d.d 2010-01-08 01:14:04 UTC (rev 10744) @@ -44,7 +44,7 @@ /* Set up data for log plot */ f0 = 1.0; - for ( size_t i = 0; i <= 100; i++ ) + for ( size_t i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = pow( 10.0, freql[i] ); Modified: trunk/lib/qsastime/bhunt_search_test.c =================================================================== --- trunk/lib/qsastime/bhunt_search_test.c 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/lib/qsastime/bhunt_search_test.c 2010-01-08 01:14:04 UTC (rev 10744) @@ -78,7 +78,7 @@ test = offset + (double) j / (double) multiplier; if ( !ifhunt ) index = -40; - bhunt_search( &test, table, ntable, sizeof ( double ), &index, ( int( * ) ( const void *, const void * ))gedouble ); + bhunt_search( &test, table, ntable, sizeof ( double ), &index, ( int ( * )( const void *, const void * ))gedouble ); if ( index < -1 || index > ntable - 1 ) { printf( "ERROR: test = %20.16f lead to an invalid index of %i\n", test, index ); Modified: trunk/lib/qsastime/qsastime.c =================================================================== --- trunk/lib/qsastime/qsastime.c 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/lib/qsastime/qsastime.c 2010-01-08 01:14:04 UTC (rev 10744) @@ -1008,7 +1008,7 @@ *MJD = *MJD_TAI; normalize_MJD( MJD ); /* Search for index such that TAI_UTC_lookup_table[*index] <= MJD(TAI) < TAI_UTC_lookup_table[*index+1] */ - bhunt_search( MJD, TAI_UTC_lookup_table, number_of_entries_in_tai_utc_table, sizeof ( TAI_UTC ), index, ( int( * ) ( const void *, const void * ))geMJDtime_TAI ); + bhunt_search( MJD, TAI_UTC_lookup_table, number_of_entries_in_tai_utc_table, sizeof ( TAI_UTC ), index, ( int ( * )( const void *, const void * ))geMJDtime_TAI ); if ( debug == 2 ) fprintf( stderr, "*index = %d\n", *index ); if ( *index == -1 ) Modified: trunk/src/plot3d.c =================================================================== --- trunk/src/plot3d.c 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/src/plot3d.c 2010-01-08 01:14:04 UTC (rev 10744) @@ -1495,14 +1495,14 @@ switch ( flag ) { - case - 3: + case -3: y0 += dy; flag = -flag; break; - case - 2: + case -2: y0 += dy; break; - case - 1: + case -1: y0 += dy; flag = -flag; break; Modified: trunk/src/plvpor.c =================================================================== --- trunk/src/plvpor.c 2010-01-08 01:09:18 UTC (rev 10743) +++ trunk/src/plvpor.c 2010-01-08 01:14:04 UTC (rev 10744) @@ -192,9 +192,9 @@ switch ( axis ) { - case - 2: + case -2: break; - case - 1: + case -1: plbox( "bc", (PLFLT) 0.0, 0, "bc", (PLFLT) 0.0, 0 ); break; case 0: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-01-20 02:21:27
|
Revision: 10758 http://plplot.svn.sourceforge.net/plplot/?rev=10758&view=rev Author: hbabcock Date: 2010-01-20 02:21:19 +0000 (Wed, 20 Jan 2010) Log Message: ----------- Initial commit of a very basic (but working) Windows Cairo driver. Move the cairo devices to the 100+ range so that they can be sequentially numbered and not overlap with the Qt devices. Changes have not been styled. Modified Paths: -------------- trunk/cmake/modules/cairo.cmake trunk/cmake/modules/drivers-init.cmake trunk/drivers/cairo.c trunk/drivers/cairo.rc.in trunk/examples/plplot_configure.cmake_installed_examples.in trunk/include/drivers.h trunk/include/plDevs.h.cmake trunk/include/plcore.h trunk/plplot_test/plplot-test.sh.cmake Modified: trunk/cmake/modules/cairo.cmake =================================================================== --- trunk/cmake/modules/cairo.cmake 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/cmake/modules/cairo.cmake 2010-01-20 02:21:19 UTC (rev 10758) @@ -29,6 +29,7 @@ # PLD_pscairo - ON means the pscairo device is enabled. # PLD_svgcairo - ON means the svgcairo device is enabled. # PLD_xcairo - ON means the xcairo device is enabled. +# PLD_wincairo - ON means the wincairo device is enabled. # cairo_COMPILE_FLAGS - Blank-delimited COMPILE_FLAGS required to # compile cairo device drivers. # cairo_LINK_FLAGS - list of full path names of libraries and @@ -55,6 +56,7 @@ OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo +OR PLD_wincairo ) if(NOT PKG_CONFIG_EXECUTABLE) message(STATUS @@ -67,6 +69,7 @@ set(PLD_svgcairo OFF CACHE BOOL "Enable svgcairo device" FORCE) set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE) set(PLD_extcairo OFF CACHE BOOL "Enable extcairo device" FORCE) + set(PLD_wincairo OFF CACHE BOOL "Enable wincairo device" FORCE) endif(NOT PKG_CONFIG_EXECUTABLE) endif( PLD_memcairo @@ -76,6 +79,7 @@ OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo +OR PLD_wincairo ) if( @@ -86,6 +90,7 @@ OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo +OR PLD_wincairo ) pkg_check_pkgconfig( pangocairo @@ -145,6 +150,7 @@ set(PLD_svgcairo OFF CACHE BOOL "Enable svgcairo device" FORCE) set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE) set(PLD_extcairo OFF CACHE BOOL "Enable extcairo device" FORCE) + set(PLD_wincairo OFF CACHE BOOL "Enable wincairo device" FORCE) endif(linkflags) endif( PLD_memcairo @@ -154,6 +160,7 @@ OR PLD_svgcairo OR PLD_xcairo OR PLD_extcairo +OR PLD_wincairo ) if(NOT PLD_xcairo) @@ -163,3 +170,10 @@ if(NOT PLD_extcairo) set(extcairo_true "#") endif(NOT PLD_extcairo) + +if(NOT WIN32) + message(STATUS + "WARNING: Not a Windows Computer. Setting wincairo driver to OFF." + ) + set(PLD_wincairo OFF CACHE BOOL "Enable wincairo device" FORCE) +endif(NOT WIN32) Modified: trunk/cmake/modules/drivers-init.cmake =================================================================== --- trunk/cmake/modules/drivers-init.cmake 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/cmake/modules/drivers-init.cmake 2010-01-20 02:21:19 UTC (rev 10758) @@ -136,6 +136,7 @@ "pscairo:cairo:ON:F:OFF" "svgcairo:cairo:ON:F:ON" "xcairo:cairo:ON:I:OFF" + "wincairo:cairo:ON:I:OFF" # new example 16 shows severe valgrind issues with this device. "cgm:cgm:OFF:F:OFF" # This unmaintained device driver builds but does not actually work Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/drivers/cairo.c 2010-01-20 02:21:19 UTC (rev 10758) @@ -57,8 +57,10 @@ #if defined ( PLD_svgcairo ) #include <cairo-svg.h> #endif +#if defined ( PLD_wincairo ) +#include <windows.h> +#endif - /*--------------------------------------------------------------------- * Constants & global (to this file) variables * ---------------------------------------------------------------------*/ @@ -113,30 +115,40 @@ unsigned char *cairo_format_memory; char bigendian; #endif +#if defined ( PLD_wincairo ) + WNDCLASSEX wndclass; + HWND hwnd; + MSG msg; + HDC hdc; + HDC SCRN_hdc; +#endif } PLCairo; PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_cairo = #if defined ( PLD_xcairo ) - "xcairo:Cairo X Windows Driver:1:cairo:59:xcairo\n" + "xcairo:Cairo X Windows Driver:1:cairo:100:xcairo\n" #endif #if defined ( PLD_pdfcairo ) - "pdfcairo:Cairo PDF Driver:0:cairo:60:pdfcairo\n" + "pdfcairo:Cairo PDF Driver:0:cairo:101:pdfcairo\n" #endif #if defined ( PLD_pscairo ) - "pscairo:Cairo PS Driver:0:cairo:61:pscairo\n" + "pscairo:Cairo PS Driver:0:cairo:102:pscairo\n" #endif #if defined ( PLD_svgcairo ) - "svgcairo:Cairo SVG Driver:0:cairo:62:svgcairo\n" + "svgcairo:Cairo SVG Driver:0:cairo:103:svgcairo\n" #endif #if defined ( PLD_pngcairo ) - "pngcairo:Cairo PNG Driver:0:cairo:63:pngcairo\n" + "pngcairo:Cairo PNG Driver:0:cairo:104:pngcairo\n" #endif #if defined ( PLD_memcairo ) - "memcairo:Cairo Memory Driver:0:cairo:64:memcairo\n" + "memcairo:Cairo Memory Driver:0:cairo:105:memcairo\n" #endif #if defined ( PLD_extcairo ) - "extcairo:Cairo External Context Driver:0:cairo:65:extcairo\n" + "extcairo:Cairo External Context Driver:0:cairo:106:extcairo\n" #endif +#if defined ( PLD_wincairo ) + "wincairo:Cairo Microscoft Windows Driver:0:cairo:107:wincairo\n" +#endif ; /* @@ -2553,3 +2565,314 @@ } #endif + + +/*--------------------------------------------------------------------- + * --------------------------------------------------------------------- + * + * That which is specific to the cairo microsoft windows driver. + * + * Much of the Windows specific code here was lifted from the wingcc + * driver. + * + * --------------------------------------------------------------------- + * ---------------------------------------------------------------------*/ + +#if defined ( PLD_wincairo ) + +static char* szWndClass = "PLplot WinCairo"; + +void plD_dispatch_init_wincairo( PLDispatchTable *pdt ); +void plD_init_wincairo( PLStream * ); +//void plD_bop_extcairo( PLStream * ); +void plD_eop_wincairo( PLStream * ); +//void plD_esc_extcairo( PLStream *, PLINT, void * ); +void plD_tidy_wincairo( PLStream * ); + +/*--------------------------------------------------------------------------*\ + * This is the window function for the plot window. Whenever a message is + * dispatched using DispatchMessage (or sent with SendMessage) this function + * gets called with the contents of the message. + \*--------------------------------------------------------------------------*/ + +LRESULT CALLBACK PlplotCairoWndProc( HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) +{ + PLStream *pls = NULL; + PLCairo *dev = NULL; + +/* + * The window carries a 32bit user defined pointer which points to the + * plplot stream (pls). This is used for tracking the window. + * Unfortunately, this is "attached" to the window AFTER it is created + * so we can not initialise PLStream or wingcc_Dev "blindly" because + * they may not yet have been initialised. + * WM_CREATE is called before we get to initialise those variables, so + * we wont try to set them. + */ + + if ( nMsg == WM_CREATE ) + { + return ( 0 ); + } + else + { + pls = (PLStream *) GetWindowLong( hwnd, GWL_USERDATA ); /* Try to get the address to pls for this window */ + if ( pls ) /* If we got it, then we will initialise this windows plplot private data area */ + { + dev = (PLCairo *) pls->dev; + } + } + +/* + * Process the windows messages + * + * Everything except WM_CREATE is done here and it is generally hoped that + * pls and dev are defined already by this stage. + * That will be true MOST of the time. Some times WM_PAINT will be called + * before we get to initialise the user data area of the window with the + * pointer to the windows plplot stream + */ + + switch ( nMsg ) + { + case WM_DESTROY: + // if ( dev ) + // Debug( "WM_DESTROY\t" ); + PostQuitMessage( 0 ); + return ( 0 ); + break; + + case WM_PAINT: + return ( 1 ); + break; + + case WM_SIZE: + return ( 0 ); + break; + + case WM_ENTERSIZEMOVE: + return ( 0 ); + break; + + case WM_EXITSIZEMOVE: + return ( 0 ); + break; + + case WM_ERASEBKGND: + return ( 0 ); + break; + + case WM_COMMAND: + return ( 0 ); + break; + } + + /* If we don't handle a message completely we hand it to the system + * provided default window function. */ + return DefWindowProc( hwnd, nMsg, wParam, lParam ); +} + +/*--------------------------------------------------------------------- + * dispatch_init_init() + * + * Initialize device dispatch table + * ----------------------------------------------------------------------*/ + +/* extcairo */ +void plD_dispatch_init_wincairo( PLDispatchTable *pdt ) +{ +#ifndef ENABLE_DYNDRIVERS + pdt->pl_MenuStr = "Cairo Microsoft Windows driver"; + pdt->pl_DevName = "wincairo"; +#endif + pdt->pl_type = plDevType_FileOriented; + pdt->pl_seq = 65; + pdt->pl_init = (plD_init_fp) plD_init_wincairo; + pdt->pl_line = (plD_line_fp) plD_line_cairo; + pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; + pdt->pl_bop = (plD_bop_fp) plD_bop_cairo; + pdt->pl_eop = (plD_eop_fp) plD_eop_wincairo; + pdt->pl_tidy = (plD_tidy_fp) plD_tidy_wincairo; + pdt->pl_state = (plD_state_fp) plD_state_cairo; + pdt->pl_esc = (plD_esc_fp) plD_esc_cairo; +} + +/*--------------------------------------------------------------------- + * plD_init_wincairo() + * + * Initialize Cairo Microsoft Windows driver. + * ----------------------------------------------------------------------*/ + +void plD_init_wincairo( PLStream *pls ) +{ + PLCairo *aStream; + + /* Setup the PLStream and the font lookup table */ + aStream = stream_and_font_setup( pls, 0 ); + + /* Save the pointer to the structure in the PLplot stream */ + pls->dev = aStream; + + /* Create window */ + memset( &aStream->wndclass, 0, sizeof ( WNDCLASSEX )); + + /* This class is called WinTestWin */ + aStream->wndclass.lpszClassName = szWndClass; + + /* cbSize gives the size of the structure for extensibility. */ + aStream->wndclass.cbSize = sizeof ( WNDCLASSEX ); + + /* All windows of this class redraw when resized. */ + aStream->wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC | CS_PARENTDC; + + /* All windows of this class use the PlplotCairoWndProc window function. */ + aStream->wndclass.lpfnWndProc = PlplotCairoWndProc; + + /* This class is used with the current program instance. */ + + aStream->wndclass.hInstance = GetModuleHandle( NULL ); + + /* Use standard application icon and arrow cursor provided by the OS */ + aStream->wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); + aStream->wndclass.hIconSm = LoadIcon( NULL, IDI_APPLICATION ); + aStream->wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); + /* Color the background white */ + aStream->wndclass.hbrBackground = NULL; + + aStream->wndclass.cbWndExtra = sizeof ( pls ); + + + /* + * Now register the window class for use. + */ + + RegisterClassEx( &aStream->wndclass ); + + /* + * Create our main window using that window class. + */ + aStream->hwnd = CreateWindowEx( WS_EX_WINDOWEDGE + WS_EX_LEFT, + szWndClass, /* Class name */ + pls->program, /* Caption */ + WS_OVERLAPPEDWINDOW, /* Style */ + pls->xoffset, /* Initial x (use default) */ + pls->yoffset, /* Initial y (use default) */ + /* This is a little lame since the window border size might change. */ + pls->xlength+5, /* Initial x size (use default) */ + pls->ylength+30, /* Initial y size (use default) */ + NULL, /* No parent window */ + NULL, /* No menu */ + aStream->wndclass.hInstance, /* This program instance */ + NULL /* Creation parameters */ + ); + + +/* + * Attach a pointer to the stream to the window's user area + * this pointer will be used by the windows call back for + * process this window + */ + + SetWindowLong( aStream->hwnd, GWL_USERDATA, (long) pls ); + aStream->SCRN_hdc = aStream->hdc = GetDC( aStream->hwnd ); + +/* + * Setup the popup menu + */ + +/* + dev->PopupMenu = CreatePopupMenu(); + AppendMenu( dev->PopupMenu, MF_STRING, PopupPrint, "Print" ); + AppendMenu( dev->PopupMenu, MF_STRING, PopupNextPage, "Next Page" ); + AppendMenu( dev->PopupMenu, MF_STRING, PopupQuit, "Quit" ); +*/ + + // plD_state_wingcc( pls, PLSTATE_COLOR0 ); + /* + * Display the window which we just created (using the nShow + * passed by the OS, which allows for start minimized and that + * sort of thing). + */ + ShowWindow( aStream->hwnd, SW_SHOWDEFAULT ); + SetForegroundWindow( aStream->hwnd ); + +/* + * Now we have to find out, from windows, just how big our drawing area is + * when we specified the page size earlier on, that includes the borders, + * title bar etc... so now that windows has done all its initialisations, + * we will ask how big the drawing area is, and tell plplot + */ + +/* + GetClientRect( dev->hwnd, &dev->rect ); + dev->width = dev->rect.right; + dev->height = dev->rect.bottom; +*/ + +/* + * Initialize Cairo Surface using the windows hdc. + */ + + aStream->cairoSurface = (cairo_surface_t *)cairo_win32_surface_create(aStream->hdc); + aStream->cairoContext = cairo_create(aStream->cairoSurface); + + /* Invert the surface so that the graphs are drawn right side up. */ + rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, pls->ylength ); + + /* Set graphics aliasing */ + cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); +} + +/*--------------------------------------------------------------------- + * plD_eop_wincairo() + * + * Clean up Cairo Microsoft Windows driver. + * ---------------------------------------------------------------------*/ + +void +plD_eop_wincairo( PLStream *pls ) +{ + PLCairo *aStream = (PLCairo *) pls->dev; + + if ( !pls->nopause ) + { + while ( GetMessage( &aStream->msg, NULL, 0, 0 )) + { + TranslateMessage( &aStream->msg ); + switch ((int) aStream->msg.message ) + { + case WM_CHAR: + if (((TCHAR) ( aStream->msg.wParam ) == 13 ) || + ((TCHAR) ( aStream->msg.wParam ) == 'q' ) || + ((TCHAR) ( aStream->msg.wParam ) == 'Q' )) + { + PostQuitMessage( 0 ); + } + break; + + default: + DispatchMessage( &aStream->msg ); + break; + } + } + } +} + +/*--------------------------------------------------------------------- + * plD_tidy_wincairo() + * + * Clean up Cairo Microsoft Windows driver. + * ---------------------------------------------------------------------*/ + +void plD_tidy_wincairo( PLStream *pls ) +{ + PLCairo *aStream = (PLCairo *) pls->dev; + + if ( aStream != NULL ) + { + if ( aStream->hdc != NULL ) ReleaseDC( aStream->hwnd, aStream->hdc ); + free_mem( pls->dev ); + } +} + +#endif Modified: trunk/drivers/cairo.rc.in =================================================================== --- trunk/drivers/cairo.rc.in 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/drivers/cairo.rc.in 2010-01-20 02:21:19 UTC (rev 10758) @@ -1,7 +1,8 @@ -xcairo:Cairo X Windows Driver:1:cairo:59:xcairo -pdfcairo:Cairo PDF Driver:0:cairo:60:pdfcairo -pscairo:Cairo PS Driver:0:cairo:61:pscairo -svgcairo:Cairo SVG Driver:0:cairo:62:svgcairo -pngcairo:Cairo PNG Driver:0:cairo:63:pngcairo -memcairo:Cairo Memory Driver:0:cairo:64:memcairo -extcairo:Cairo External Context Driver:0:cairo:65:extcairo +xcairo:Cairo X Windows Driver:1:cairo:100:xcairo +pdfcairo:Cairo PDF Driver:0:cairo:101:pdfcairo +pscairo:Cairo PS Driver:0:cairo:102:pscairo +svgcairo:Cairo SVG Driver:0:cairo:103:svgcairo +pngcairo:Cairo PNG Driver:0:cairo:104:pngcairo +memcairo:Cairo Memory Driver:0:cairo:105:memcairo +extcairo:Cairo External Context Driver:0:cairo:106:extcairo +wincairo:Cairo Microscoft Windows Driver:0:cairo:107:wincairo \ No newline at end of file Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2010-01-20 02:21:19 UTC (rev 10758) @@ -198,6 +198,7 @@ set(PLD_ntk @PLD_ntk@) set(PLD_qtwidget @PLD_qtwidget@) set(PLD_tk @PLD_tk@) +set(PLD_wincairo @PLD_wincairo@) set(PLD_wingcc @PLD_wingcc@) set(PLD_wxwidgets @PLD_wxwidgets@) set(PLD_xcairo @PLD_xcairo@) Modified: trunk/include/drivers.h =================================================================== --- trunk/include/drivers.h 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/include/drivers.h 2010-01-20 02:21:19 UTC (rev 10758) @@ -97,6 +97,7 @@ PLDLLIMPEXP_DRIVER void plD_dispatch_init_pngcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_memcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_extcairo( PLDispatchTable *pdt ); +PLDLLIMPEXP_DRIVER void plD_dispatch_init_wincairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_bmpqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_jpgqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pngqt( PLDispatchTable *pdt ); Modified: trunk/include/plDevs.h.cmake =================================================================== --- trunk/include/plDevs.h.cmake 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/include/plDevs.h.cmake 2010-01-20 02:21:19 UTC (rev 10758) @@ -85,6 +85,7 @@ #cmakedefine PLD_pngcairo #cmakedefine PLD_memcairo #cmakedefine PLD_extcairo +#cmakedefine PLD_wincairo #cmakedefine PLD_bmpqt #cmakedefine PLD_jpgqt #cmakedefine PLD_pngqt Modified: trunk/include/plcore.h =================================================================== --- trunk/include/plcore.h 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/include/plcore.h 2010-01-20 02:21:19 UTC (rev 10758) @@ -297,6 +297,9 @@ #if defined ( PLD_extcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_extcairo, #endif +#if defined ( PLD_wincairo ) && !defined ( ENABLE_DYNDRIVERS ) + plD_dispatch_init_wincairo, +#endif #if defined ( PLD_bmpqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_bmpqt, #endif Modified: trunk/plplot_test/plplot-test.sh.cmake =================================================================== --- trunk/plplot_test/plplot-test.sh.cmake 2010-01-19 00:11:03 UTC (rev 10757) +++ trunk/plplot_test/plplot-test.sh.cmake 2010-01-20 02:21:19 UTC (rev 10758) @@ -305,6 +305,7 @@ #interactive PLD_tkwin=@PLD_tkwin@ PLD_versaterm=@PLD_versaterm@ PLD_vlt=@PLD_vlt@ +#interactive PLD_wincairo=@PLD_wincairo@ #interactive PLD_wingcc=@PLD_wingcc@ PLD_wxpng=@PLD_wxpng@ #interactive PLD_wxwidgets=@PLD_wxwidgets@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-01-20 03:33:13
|
Revision: 10759 http://plplot.svn.sourceforge.net/plplot/?rev=10759&view=rev Author: hbabcock Date: 2010-01-20 03:33:06 +0000 (Wed, 20 Jan 2010) Log Message: ----------- Style cairo.c. Update README.release. Modified Paths: -------------- trunk/README.release trunk/drivers/cairo.c Modified: trunk/README.release =================================================================== --- trunk/README.release 2010-01-20 02:21:19 UTC (rev 10758) +++ trunk/README.release 2010-01-20 03:33:06 UTC (rev 10759) @@ -141,6 +141,7 @@ 1.1 Make PLplot aware of LC_NUMERIC locale 1.2 Linear gradients have been implemented +1.3 Cairo Windows driver implemented 2. Changes relative to PLplot 5.8.0 (the previous stable release) @@ -183,6 +184,7 @@ detected 2.36 Make PLplot aware of LC_NUMERIC locale 2.37 Linear gradients have been implemented +2.38 Cairo Windows driver implemented 1. Changes relative to PLplot 5.9.5 (the previous development release) @@ -264,6 +266,12 @@ and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. +1.3 Cairo Windows driver implemented + +A cairo Windows driver has been implemented. This provides an +interactive cairo driver for Windows similar to xcairo on Linux. +Work to improve its functionality is ongoing. + 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -825,3 +833,9 @@ and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. +2.38 Cairo Windows driver implemented + +A cairo Windows driver has been implemented. This provides an +interactive cairo driver for Windows similar to xcairo on Linux. +Work to improve its functionality is ongoing. + Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-01-20 02:21:19 UTC (rev 10758) +++ trunk/drivers/cairo.c 2010-01-20 03:33:06 UTC (rev 10759) @@ -116,11 +116,11 @@ char bigendian; #endif #if defined ( PLD_wincairo ) - WNDCLASSEX wndclass; - HWND hwnd; - MSG msg; - HDC hdc; - HDC SCRN_hdc; + WNDCLASSEX wndclass; + HWND hwnd; + MSG msg; + HDC hdc; + HDC SCRN_hdc; #endif } PLCairo; @@ -2636,8 +2636,8 @@ switch ( nMsg ) { case WM_DESTROY: - // if ( dev ) - // Debug( "WM_DESTROY\t" ); + // if ( dev ) + // Debug( "WM_DESTROY\t" ); PostQuitMessage( 0 ); return ( 0 ); break; @@ -2757,9 +2757,9 @@ WS_OVERLAPPEDWINDOW, /* Style */ pls->xoffset, /* Initial x (use default) */ pls->yoffset, /* Initial y (use default) */ - /* This is a little lame since the window border size might change. */ - pls->xlength+5, /* Initial x size (use default) */ - pls->ylength+30, /* Initial y size (use default) */ + /* This is a little lame since the window border size might change. */ + pls->xlength + 5, /* Initial x size (use default) */ + pls->ylength + 30, /* Initial y size (use default) */ NULL, /* No parent window */ NULL, /* No menu */ aStream->wndclass.hInstance, /* This program instance */ @@ -2781,11 +2781,11 @@ */ /* - dev->PopupMenu = CreatePopupMenu(); - AppendMenu( dev->PopupMenu, MF_STRING, PopupPrint, "Print" ); - AppendMenu( dev->PopupMenu, MF_STRING, PopupNextPage, "Next Page" ); - AppendMenu( dev->PopupMenu, MF_STRING, PopupQuit, "Quit" ); -*/ + * dev->PopupMenu = CreatePopupMenu(); + * AppendMenu( dev->PopupMenu, MF_STRING, PopupPrint, "Print" ); + * AppendMenu( dev->PopupMenu, MF_STRING, PopupNextPage, "Next Page" ); + * AppendMenu( dev->PopupMenu, MF_STRING, PopupQuit, "Quit" ); + */ // plD_state_wingcc( pls, PLSTATE_COLOR0 ); /* @@ -2804,17 +2804,17 @@ */ /* - GetClientRect( dev->hwnd, &dev->rect ); - dev->width = dev->rect.right; - dev->height = dev->rect.bottom; -*/ + * GetClientRect( dev->hwnd, &dev->rect ); + * dev->width = dev->rect.right; + * dev->height = dev->rect.bottom; + */ /* * Initialize Cairo Surface using the windows hdc. */ - aStream->cairoSurface = (cairo_surface_t *)cairo_win32_surface_create(aStream->hdc); - aStream->cairoContext = cairo_create(aStream->cairoSurface); + aStream->cairoSurface = (cairo_surface_t *) cairo_win32_surface_create( aStream->hdc ); + aStream->cairoContext = cairo_create( aStream->cairoSurface ); /* Invert the surface so that the graphs are drawn right side up. */ rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, pls->ylength ); @@ -2842,9 +2842,9 @@ switch ((int) aStream->msg.message ) { case WM_CHAR: - if (((TCHAR) ( aStream->msg.wParam ) == 13 ) || - ((TCHAR) ( aStream->msg.wParam ) == 'q' ) || - ((TCHAR) ( aStream->msg.wParam ) == 'Q' )) + if (((TCHAR) ( aStream->msg.wParam ) == 13 ) || + ((TCHAR) ( aStream->msg.wParam ) == 'q' ) || + ((TCHAR) ( aStream->msg.wParam ) == 'Q' )) { PostQuitMessage( 0 ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-01-25 20:21:38
|
Revision: 10766 http://plplot.svn.sourceforge.net/plplot/?rev=10766&view=rev Author: airwin Date: 2010-01-25 20:21:19 +0000 (Mon, 25 Jan 2010) Log Message: ----------- Retire djgpp following advice from Andrew Roach. Modified Paths: -------------- trunk/INSTALL trunk/README.release trunk/doc/docbook/src/os_notes.xml trunk/www/index.php Removed Paths: ------------- trunk/sys/dos/ Modified: trunk/INSTALL =================================================================== --- trunk/INSTALL 2010-01-22 21:46:11 UTC (rev 10765) +++ trunk/INSTALL 2010-01-25 20:21:19 UTC (rev 10766) @@ -5,10 +5,9 @@ http://www.miscdebris.net/plplot_wiki/index.php?title=Building_PLplot. The material below is cut and pasted from there as of 2009-01-10. -With the exception of DJGPP on (Free)DOS (where you should follow the -directions at sys/dos/djgpp/readme) all PLplot builds are done with our -CMake-based build system which gives good results on Unix, Linux, and Mac OS -X and Cygwin, MinGW, MinGW/MSYS, and bare windows. +All PLplot builds are done with our CMake-based build system which +gives good results on Unix, Linux, and Mac OS X and Cygwin, MinGW, +MinGW/MSYS, and bare windows. Building PLplot with our CMake-based build system ================================================= Modified: trunk/README.release =================================================================== --- trunk/README.release 2010-01-22 21:46:11 UTC (rev 10765) +++ trunk/README.release 2010-01-25 20:21:19 UTC (rev 10766) @@ -135,6 +135,12 @@ well-known issue for years (incorrect colours) which has never been fixed indicating nobody is interested in maintaining this device. +XV. As of release 5.9.6 we have retired our platform support of djgpp +that used to reside in sys/dos/djgpp. The developer (Andrew Roach) +who used to maintain those support files for djgpp feels that the +djgpp platform is no longer actively developed, and he no longer uses +djgpp himself. + INDEX 1. Changes relative to PLplot 5.9.5 (the previous development release) @@ -276,9 +282,8 @@ 2.1 All autotools-related files have now been removed -CMake (with the exception of a special build script for the DJGPP platform) -is now the only supported build system. It has been tested on Linux / Unix, -Mac OS-X and Windows platforms. +CMake is now the only supported build system. It has been tested on +Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Modified: trunk/doc/docbook/src/os_notes.xml =================================================================== --- trunk/doc/docbook/src/os_notes.xml 2010-01-22 21:46:11 UTC (rev 10765) +++ trunk/doc/docbook/src/os_notes.xml 2010-01-25 20:21:19 UTC (rev 10766) @@ -43,9 +43,7 @@ that we support. Currently, those are all operating systems supported by CMake (all forms of Unix including Linux and Mac OS X, and all forms of Windows including MinGW, MinGW/MSYS, Cygwin, and essentially all Windows - variants directly supported by Microsoft) as well as the DJGPP operating - system (supported by an independent build system since CMake is not - available for DJGPP). + variants directly supported by Microsoft). </para> <sect1 id="linux-unix-notes"> @@ -102,19 +100,4 @@ </sect2> </sect1> - - <sect1 id="djgpp-notes"> - <title>DJGPP Notes</title> - <sect2> - <title>DJGPP Configure and Build</title> - <para> - Since DJGPP is not supported by CMake it has an independent build system - which is documented at sys/dos/djgpp/readme. The eventual plan is to - incorporate that material into this documentation, - but we haven't done it yet so this section NEEDS DOCUMENTATION. - </para> - </sect2> - - </sect1> - </chapter> Modified: trunk/www/index.php =================================================================== --- trunk/www/index.php 2010-01-22 21:46:11 UTC (rev 10765) +++ trunk/www/index.php 2010-01-25 20:21:19 UTC (rev 10766) @@ -31,10 +31,9 @@ <ul class="arrowlist"> <li>Linux, Mac OS X, and other Unices</li> <li>Windows (2000, XP and Vista)</li> - <li>MS-DOS (DJGPP)</li> </ul> - <p>With the exception of DJGPP, where we have implemented a custom build system, PLplot is built on the above platforms using our CMake-based build system.</p> + <p>PLplot is built on the above platforms using our CMake-based build system.</p> <h4><a name="languages">Language Bindings</a></h4> <p>There are many bindings to the PLplot library</p> <ul class="arrowlist"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-01-29 23:08:35
|
Revision: 10777 http://plplot.svn.sourceforge.net/plplot/?rev=10777&view=rev Author: airwin Date: 2010-01-29 23:08:29 +0000 (Fri, 29 Jan 2010) Log Message: ----------- Commit changes so that the test_interactive target will work for the case where blanks are embedded in directory names. Modified Paths: -------------- trunk/examples/CMakeLists.txt trunk/plplot_test/plplot-test-interactive.sh.in trunk/plplot_test/test_c_interactive.sh.in Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2010-01-29 22:20:06 UTC (rev 10776) +++ trunk/examples/CMakeLists.txt 2010-01-29 23:08:29 UTC (rev 10777) @@ -582,9 +582,10 @@ endif(ENABLE_DYNDRIVERS) add_custom_target(test_c_${device} COMMAND ${CMAKE_COMMAND} -E echo "Generate C results for ${device} interactive device" - COMMAND ${custom_env} ${custom_test_command} --verbose --interactive --device=${device} + COMMAND env ${custom_env} ${custom_test_command} --verbose --interactive --device=${device} DEPENDS ${interactive_device_depends_${device}} + VERBATIM ) if(device STREQUAL "tk") if(CORE_BUILD) Modified: trunk/plplot_test/plplot-test-interactive.sh.in =================================================================== --- trunk/plplot_test/plplot-test-interactive.sh.in 2010-01-29 22:20:06 UTC (rev 10776) +++ trunk/plplot_test/plplot-test-interactive.sh.in 2010-01-29 23:08:29 UTC (rev 10777) @@ -85,7 +85,7 @@ # This script is only designed to work when EXAMPLES_DIR is a directory # with a subdirectory called "c". Check whether this conditions is true. -if [ ! -d $EXAMPLES_DIR/c ] ; then +if [ ! -d "$EXAMPLES_DIR"/c ] ; then echo ' This script is only designed to work when the EXAMPLES_DIR environment variable (overridden by option --examples-dir) is a directory with a @@ -151,7 +151,7 @@ for device in $INTERACTIVE_DEVICES_LIST ; do for index in $INDEX_LIST ; do echo "${EXAMPLES_DIR}/c/x${index}c -dev $device" - ${EXAMPLES_DIR}/c/x${index}c -dev $device 2> test.error + "${EXAMPLES_DIR}"/c/x${index}c -dev $device 2> test.error # Look for any status codes (segfaults, plexit) from the examples themselves status_code=$? if [ "$status_code" -ne 0 ] ; then @@ -272,7 +272,7 @@ done if [ "@ENABLE_tk@" = "ON" ] ; then - cd ${SRC_EXAMPLES_DIR}/tcl + cd "${SRC_EXAMPLES_DIR}"/tcl plserver <<EOF plstdwin . plxframe .plw @@ -282,7 +282,7 @@ 1 exit EOF - cd ${EXAMPLES_DIR}/tk + cd "${EXAMPLES_DIR}"/tk pwd # Drop 14 because multiple devices do not seem to work in this context. # Drop 31 since it produces empty plot (by design). Modified: trunk/plplot_test/test_c_interactive.sh.in =================================================================== --- trunk/plplot_test/test_c_interactive.sh.in 2010-01-29 22:20:06 UTC (rev 10776) +++ trunk/plplot_test/test_c_interactive.sh.in 2010-01-29 23:08:29 UTC (rev 10777) @@ -30,7 +30,7 @@ if [ "$verbose_test" ] ; then echo "x${index}${lang}" fi - $DEBUG_CMD $cdir/x${index}${lang} -dev $device \ + $DEBUG_CMD "$cdir"/x${index}${lang} -dev $device \ 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${device}.txt # Look for any status codes (segfaults, plexit) from the examples # themselves. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-01-30 07:03:00
|
Revision: 10783 http://plplot.svn.sourceforge.net/plplot/?rev=10783&view=rev Author: airwin Date: 2010-01-30 07:02:54 +0000 (Sat, 30 Jan 2010) Log Message: ----------- Purge everything to do with HAVE_TCL_GT_84 since that is no longer required. Modified Paths: -------------- trunk/cmake/modules/tcl-related.cmake trunk/config.h.cmake Modified: trunk/cmake/modules/tcl-related.cmake =================================================================== --- trunk/cmake/modules/tcl-related.cmake 2010-01-30 06:18:52 UTC (rev 10782) +++ trunk/cmake/modules/tcl-related.cmake 2010-01-30 07:02:54 UTC (rev 10783) @@ -67,18 +67,9 @@ if(TCL_TCLSH) message(STATUS "Looking for tclsh - found") message(STATUS "TCL_TCLSH = ${TCL_TCLSH}") - # test to determine HAVE_TCL_GT_84 - execute_process( - COMMAND ${TCL_TCLSH} CheckTCL_GT_84.tcl - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/modules - OUTPUT_VARIABLE HAVE_TCL_GT_84 - ) else(TCL_TCLSH) message(STATUS "Looking for tclsh - not found") - # Fall back to user option for determining HAVE_TCL_GT_84. - option(HAVE_TCL_GT_84 "if Tcl version is greater than 8.4" OFF) endif(TCL_TCLSH) - message(STATUS "HAVE_TCL_GT_84 = ${HAVE_TCL_GT_84}") else(TCL_FOUND) message(STATUS "Looking for include paths and libraries for Tcl/Tk - not found" Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2010-01-30 06:18:52 UTC (rev 10782) +++ trunk/config.h.cmake 2010-01-30 07:02:54 UTC (rev 10783) @@ -81,9 +81,6 @@ /* Define if Tk is available */ #cmakedefine ENABLE_tk -/* Define if Tcl version is greater than 8.4 */ -#cmakedefine HAVE_TCL_GT_84 - /* Define if [incr], [Tk] is available */ #cmakedefine HAVE_ITK This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-01-31 20:02:49
|
Revision: 10784 http://plplot.svn.sourceforge.net/plplot/?rev=10784&view=rev Author: hezekiahcarty Date: 2010-01-31 20:02:42 +0000 (Sun, 31 Jan 2010) Log Message: ----------- Change uncrustify.cfg to always add spaces between nested parens This also includes a small error message fix in the style_source.sh script which still mentioned the previously required uncrustify version of 0.53 rather than the new 0.55. Modified Paths: -------------- trunk/scripts/style_source.sh trunk/uncrustify.cfg Modified: trunk/scripts/style_source.sh =================================================================== --- trunk/scripts/style_source.sh 2010-01-30 07:02:54 UTC (rev 10783) +++ trunk/scripts/style_source.sh 2010-01-31 20:02:42 UTC (rev 10784) @@ -86,7 +86,7 @@ if [ "$version" != "uncrustify 0.55" ] ; then echo " Detected uncrustify version = '$version'. -This script only works with uncrustify 0.53." +This script only works with uncrustify 0.55." exit 1 fi Modified: trunk/uncrustify.cfg =================================================================== --- trunk/uncrustify.cfg 2010-01-30 07:02:54 UTC (rev 10783) +++ trunk/uncrustify.cfg 2010-01-31 20:02:42 UTC (rev 10784) @@ -211,7 +211,7 @@ sp_inside_paren = force # ignore/add/remove/force # Add or remove space between nested parens -sp_paren_paren = remove # ignore/add/remove/force +sp_paren_paren = force # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-02-06 01:48:46
|
Revision: 10793 http://plplot.svn.sourceforge.net/plplot/?rev=10793&view=rev Author: hbabcock Date: 2010-02-06 01:48:39 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Apply patches from David MacMahon on 01-28-10 and 02-05-10 Modified Paths: -------------- trunk/cmake/modules/plplot.cmake trunk/config.h.cmake trunk/examples/c/x14c.c trunk/examples/c++/x14.cc trunk/examples/d/x14d.d trunk/examples/f77/x14f.fm4 trunk/examples/f95/x14f.f90 trunk/examples/java/x14.java trunk/examples/lua/x14.lua trunk/examples/ocaml/x14.ml trunk/examples/octave/x14c.m trunk/examples/perl/x14.pl trunk/examples/tcl/x14.tcl trunk/src/plargs.c Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/cmake/modules/plplot.cmake 2010-02-06 01:48:39 UTC (rev 10793) @@ -38,6 +38,7 @@ option(USE_FILL_INTERSECTION_POLYGON "use fill_intersection_polygon" OFF) # Need these modules to do subsequent checks. +include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckFunctionExists) include(CheckSymbolExists) @@ -189,6 +190,7 @@ check_include_files(unistd.h PL_HAVE_UNISTD_H) check_include_files(termios.h HAVE_TERMIOS_H) check_include_files(stdint.h PL_HAVE_STDINT_H) +check_include_file(crt_externs.h HAVE_CRT_EXTERNS_H) # AC_HEADER_SYS_WAIT include(TestForStandardHeaderwait) @@ -244,6 +246,7 @@ check_function_exists(usleep PL_HAVE_USLEEP) check_function_exists(mkstemp PL_HAVE_MKSTEMP) check_function_exists(mkstemp PL_HAVE_UNLINK) +check_function_exists(_NSGetArgc HAVE_NSGETARGC) # Check for FP functions, including underscored version which # are sometimes all that is available on windows Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/config.h.cmake 2010-02-06 01:48:39 UTC (rev 10793) @@ -121,6 +121,9 @@ /* Define if popen is available */ #cmakedefine HAVE_POPEN +/* Define if _NSGetArgc is available */ +#cmakedefine HAVE_NSGETARGC + /* Define if pthreads is available */ #cmakedefine HAVE_PTHREAD @@ -150,6 +153,9 @@ /* Define to 1 if you have the <termios.h> header file. */ #cmakedefine HAVE_TERMIOS_H 1 +/* Define to 1 if you have the <crt_externs.h> header file. */ +#cmakedefine HAVE_CRT_EXTERNS_H 1 + /* Define to 1 if the function unlink is available */ #cmakedefine PL_HAVE_UNLINK 1 Modified: trunk/examples/c/x14c.c =================================================================== --- trunk/examples/c/x14c.c 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/c/x14c.c 2010-02-06 01:48:39 UTC (rev 10793) @@ -58,7 +58,7 @@ char geometry_master[] = "500x410+100+200"; char geometry_slave[] = "500x410+650+200"; - char driver[80]; + char driver[80] = ""; PLINT fam, num, bmax; PLFLT xp0, yp0; @@ -70,13 +70,6 @@ (void) plparseopts( &argc, argv, PL_PARSE_FULL ); - plgdev( driver ); - plgfam( &fam, &num, &bmax ); - - printf( "Demo of multiple output streams via the %s driver.\n", driver ); - printf( "Running with the second stream as slave to the first.\n" ); - printf( "\n" ); - /* If valid geometry specified on command line, use it for both streams. */ plgpage( &xp0, &yp0, &xleng0, &yleng0, &xoff0, &yoff0 ); valid_geometry = ( xleng0 > 0 && yleng0 > 0 ); @@ -88,10 +81,16 @@ else plsetopt( "geometry", geometry_master ); - plsdev( driver ); plssub( 2, 2 ); plinit(); + plgdev( driver ); + plgfam( &fam, &num, &bmax ); + + printf( "Demo of multiple output streams via the %s driver.\n", driver ); + printf( "Running with the second stream as slave to the first.\n" ); + printf( "\n" ); + /* Start next stream */ plsstrm( 1 ); Modified: trunk/examples/c++/x14.cc =================================================================== --- trunk/examples/c++/x14.cc 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/c++/x14.cc 2010-02-06 01:48:39 UTC (rev 10793) @@ -92,7 +92,7 @@ // Using DP results in a crash at the end due to some odd cleanup problems // The geometry strings MUST be in writable memory - char driver[80]; + char driver[80] = ""; PLINT fam, num, bmax; @@ -110,13 +110,6 @@ // Parse and process command line arguments. 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; - cout << "Running with the second stream as slave to the first.\n" << endl; - //If valid geometry specified on command line, use it for both streams. pls1->gpage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); valid_geometry = ( xleng0 > 0 && yleng0 > 0 ); @@ -128,12 +121,18 @@ else pls1->setopt( "geometry", geometry_master ); - pls1->sdev( driver ); pls1->ssub( 2, 2 ); // Initialize PLplot. pls1->init(); + pls1->gdev( driver ); + pls1->gfam( fam, num, bmax ); + + cout << "Demo of multiple output streams via the " << + driver << " driver." << endl; + cout << "Running with the second stream as slave to the first.\n" << endl; + pls2 = new plstream(); if ( valid_geometry ) Modified: trunk/examples/d/x14d.d =================================================================== --- trunk/examples/d/x14d.d 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/d/x14d.d 2010-02-06 01:48:39 UTC (rev 10793) @@ -51,15 +51,6 @@ /* Parse and process command line arguments */ plparseopts( args, PL_PARSE_FULL ); - string driver; - plgdev( driver ); - - PLINT fam, num, bmax; - plgfam( &fam, &num, &bmax ); - - writefln( "Demo of multiple output streams via the %s driver.", driver ); - writefln( "Running with the second stream as slave to the first.\n" ); - /* If valid geometry specified on command line, use it for both streams. */ PLFLT xp0, yp0; PLINT xleng0, yleng0, xoff0, yoff0; @@ -72,10 +63,18 @@ else plsetopt( "geometry", geometry_master ); - plsdev( driver ); plssub( 2, 2 ); plinit(); + string driver; + plgdev( driver ); + + PLINT fam, num, bmax; + plgfam( &fam, &num, &bmax ); + + writefln( "Demo of multiple output streams via the %s driver.", driver ); + writefln( "Running with the second stream as slave to the first.\n" ); + /* Start next stream */ plsstrm( 1 ); @@ -366,4 +365,4 @@ pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); plflush(); } -} \ No newline at end of file +} Modified: trunk/examples/f77/x14f.fm4 =================================================================== --- trunk/examples/f77/x14f.fm4 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/f77/x14f.fm4 2010-02-06 01:48:39 UTC (rev 10793) @@ -54,18 +54,6 @@ c Process command-line arguments call plparseopts(PL_PARSE_FULL) - call plgdev(driver) - call plgfam(fam,num,bmax) - - write(6,'(3A)') 'Demo of multiple output streams via the ', - & driver(:lnblnk(driver)), ' driver.' - write(6,'(A)') 'Running with the second stream as slave '// - & 'to the first.' - write(6,*) -c flush unit 6 so this part of stdout is guaranteed to be written prior -c to stdout generated by second plinit below. - call flush(6) - c If valid geometry specified on command line, use it for both streams. call plgpage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) valid_geometry = (xleng0 .gt. 0 .and. yleng0 .gt. 0) @@ -78,10 +66,21 @@ call plsetopt( 'geometry', geometry_master) endif - call plsdev(driver) call plssub(2, 2) call plinit() + call plgdev(driver) + call plgfam(fam,num,bmax) + + write(6,'(3A)') 'Demo of multiple output streams via the ', + & driver(:lnblnk(driver)), ' driver.' + write(6,'(A)') 'Running with the second stream as slave '// + & 'to the first.' + write(6,*) +c flush unit 6 so this part of stdout is guaranteed to be written prior +c to stdout generated by second plinit below. + call flush(6) + c Start next stream call plsstrm(1) Modified: trunk/examples/f95/x14f.f90 =================================================================== --- trunk/examples/f95/x14f.f90 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/f95/x14f.f90 2010-02-06 01:48:39 UTC (rev 10793) @@ -51,18 +51,6 @@ ! Process command-line arguments call plparseopts(PL_PARSE_FULL) - call plgdev(driver) - call plgfam(fam,num,bmax) - - write(6,'(3A)') 'Demo of multiple output streams via the ', & - trim(driver), ' driver.' - write(6,'(A)') 'Running with the second stream as slave '// & - 'to the first.' - write(6,*) -! flush unit 6 so this part of stdout is guaranteed to be written prior -! to stdout generated by second plinit below. - call flush(6) - ! If valid geometry specified on command line, use it for both streams. call plgpage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) valid_geometry = (xleng0 .gt. 0 .and. yleng0 .gt. 0) @@ -75,10 +63,21 @@ call plsetopt( 'geometry', geometry_master) endif - call plsdev(driver) call plssub(2, 2) call plinit() + call plgdev(driver) + call plgfam(fam,num,bmax) + + write(6,'(3A)') 'Demo of multiple output streams via the ', & + trim(driver), ' driver.' + write(6,'(A)') 'Running with the second stream as slave '// & + 'to the first.' + write(6,*) +! flush unit 6 so this part of stdout is guaranteed to be written prior +! to stdout generated by second plinit below. + call flush(6) + ! Start next stream call plsstrm(1) Modified: trunk/examples/java/x14.java =================================================================== --- trunk/examples/java/x14.java 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/java/x14.java 2010-02-06 01:48:39 UTC (rev 10793) @@ -63,15 +63,6 @@ pls1.parseopts( args, PLStream.PL_PARSE_FULL | PLStream.PL_PARSE_NOPROGRAM ); - 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." ); - System.out.println( "" ); - // If valid geometry specified on command line, use it for both streams. pls1.gpage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); @@ -84,10 +75,18 @@ else pls1.setopt( "geometry", geometry_master ); - pls1.sdev( sdriver ); pls1.ssub( 2, 2 ); pls1.init(); + 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." ); + System.out.println( "" ); + // Start next stream // Turn off pause to make this a slave (must follow master) Modified: trunk/examples/lua/x14.lua =================================================================== --- trunk/examples/lua/x14.lua 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/lua/x14.lua 2010-02-06 01:48:39 UTC (rev 10793) @@ -268,12 +268,6 @@ -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -driver = pl.gdev() -fam, num, bmax = pl.gfam() - -print("Demo of multiple output streams via the " .. driver .." driver.") -print("Running with the second stream as slave to the first.\n") - -- If valid geometry specified on command line, use it for both streams. xp0, yp0, xleng0, yleng0, xoff0, yoff0 = pl.gpage() valid_geometry = xleng0>0 and yleng0>0 @@ -285,10 +279,15 @@ pl.setopt("geometry", geometry_master) end -pl.sdev(driver) pl.ssub(2, 2) pl.init() +driver = pl.gdev() +fam, num, bmax = pl.gfam() + +print("Demo of multiple output streams via the " .. driver .." driver.") +print("Running with the second stream as slave to the first.\n") + -- Start next stream pl.sstrm(1) Modified: trunk/examples/ocaml/x14.ml =================================================================== --- trunk/examples/ocaml/x14.ml 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/ocaml/x14.ml 2010-02-06 01:48:39 UTC (rev 10793) @@ -227,27 +227,26 @@ (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; - let driver = plgdev () in - let fam, num, bmax = plgfam () in - (* If valid geometry specified on command line, use it for both streams. *) let xp0, yp0, xleng0, yleng0, xoff0, yoff0 = plgpage () in let valid_geometry = ( xleng0 > 0 && yleng0 > 0 ) 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"; - printf "\n"; - (* Set up first stream *) if valid_geometry then plspage xp0 yp0 xleng0 yleng0 xoff0 yoff0 else plsetopt "geometry" geometry_master; - plsdev driver; plssub 2 2; plinit (); + 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"; + printf "\n"; + (* Start next stream *) plsstrm 1; Modified: trunk/examples/octave/x14c.m =================================================================== --- trunk/examples/octave/x14c.m 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/octave/x14c.m 2010-02-06 01:48:39 UTC (rev 10793) @@ -34,13 +34,6 @@ plplot_stub endif - device = sprintf("%s",plgdev'); - if(isempty(device)) - device = "xwin"; - endif - - [fam, num, bmax] = plgfam(); - xleng0 = 400; yleng0 = 300; xoff0 = 200; yoff0 = 200; xleng1 = 400; yleng1 = 300; xoff1 = 500; yoff1 = 500; @@ -49,11 +42,6 @@ geometry_master = "500x410+100+200"; geometry_slave = "500x410+650+200"; - fprintf(strm,"Demo of multiple output streams via the %s driver.\n", device); - fprintf(strm,"Running with the second stream as slave to the first.\n"); - ##fprintf(strm,"To advance to the next plot, press the third mouse button\n"); - ##fprintf(strm,"or the enter key in the first (left) window\n"); - ## This is an entirely bogus message since the output file name is ## set by the function arguments - but it does ensure that stdout ## is identical to the C version of the example for ctest. @@ -66,10 +54,21 @@ ## Set up first stream */ plSetOpt("geometry", geometry_master); - plsdev(device); plssub(2,2); plinit(); + device = sprintf("%s",plgdev'); + if(isempty(device)) + device = "xwin"; + endif + + [fam, num, bmax] = plgfam(); + + fprintf(strm,"Demo of multiple output streams via the %s driver.\n", device); + fprintf(strm,"Running with the second stream as slave to the first.\n"); + ##fprintf(strm,"To advance to the next plot, press the third mouse button\n"); + ##fprintf(strm,"or the enter key in the first (left) window\n"); + ## Start next stream */ plsstrm(1); Modified: trunk/examples/perl/x14.pl =================================================================== --- trunk/examples/perl/x14.pl 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/perl/x14.pl 2010-02-06 01:48:39 UTC (rev 10793) @@ -56,13 +56,6 @@ 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" - . "\n"); - # If valid geometry specified on command line, use it for both streams. my ($xp0, $yp0, $xleng0, $yleng0, $xoff0, $yoff0) = plgpage (); printf("%s %i, %i\n", "xleng0, yleng0 = ", $xleng0, $yleng0); @@ -82,10 +75,16 @@ plsetopt ("geometry", $geometry_master); } - plsdev ($driver); plssub (2, 2); plinit (); + 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" + . "\n"); + # Start next stream plsstrm (1); Modified: trunk/examples/tcl/x14.tcl =================================================================== --- trunk/examples/tcl/x14.tcl 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/examples/tcl/x14.tcl 2010-02-06 01:48:39 UTC (rev 10793) @@ -7,19 +7,18 @@ set geometry_master "500x410+100+200" 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 "" - # Set up first stream $w cmd plsetopt "geometry" $geometry_master - if {$driver != ""} {$w cmd plsdev $driver} $w cmd plssub 2 2 $w cmd plinit + $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 "" + # Start next stream $w cmd plsstrm 1 Modified: trunk/src/plargs.c =================================================================== --- trunk/src/plargs.c 2010-02-01 15:59:44 UTC (rev 10792) +++ trunk/src/plargs.c 2010-02-06 01:48:39 UTC (rev 10793) @@ -98,6 +98,13 @@ #include "plplotP.h" #include <ctype.h> +#ifdef HAVE_CRT_EXTERNS_H +/* + * This include file has the declaration for _NSGetArgc(). See below. + */ +#include <crt_externs.h> +#endif + /* Support functions */ static int ParseOpt( int *, const char ***, int *, const char ***, PLOptionTable * ); @@ -926,7 +933,19 @@ *argsave++ = *argv++; if ( argsave < argend ) + { *argsave = NULL; +#ifdef HAVE_NSGETARGC + /* + * Modify the global argc variable to match the shortened argv. + * The global argc and argv must be kept consistent so that future + * users of them (e.g. libraries loaded later with a device driver) + * will not try to dereference the null pointer at the end of the + * shortened argv array. + */ + *_NSGetArgc() = *p_argc; +#endif + } } return status; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-02-18 21:38:59
|
Revision: 10805 http://plplot.svn.sourceforge.net/plplot/?rev=10805&view=rev Author: airwin Date: 2010-02-18 21:38:39 +0000 (Thu, 18 Feb 2010) Log Message: ----------- Reorganize language support using the CMAKE_MODULES_PATH list to have different language support depending on whether the cmake version is 2.6.x or 2.8.x. The new locations for all language support files are cmake/modules/language_support/cmake cmake/modules/language_support/cmake/Platform cmake/modules/language_support/cmake-2.6 cmake/modules/language_support/cmake-2.6/Platform cmake/modules/language_support/cmake-2.8 cmake/modules/language_support/cmake-2.8/Platform The cmake subdirectory is used for all language support infrastructure files (currently Ada and D) that are independent of whether the version of CMake is 2.6.x or 2.8.x. The cmake-2.6 subdirectory is used for all language support infrastructure files (currently Fortran for CMake-2.6.x) that depend on CMake-2.6.x. The cmake-2.8 subdirectory (currently empty) is to be used for all language support infrastructure files (Fortran for CMake-2.8.x as soon as Arjen's work is done for that) that depend on CMake-2.8.x. Currently tested just for Linux with gfortran, the standard Linux Ada and D compilers, and CMake-2.8.1-RC3. So obviously more testing is needed for Linux and CMake-2.6.4 and especially on the Windows platforms (both for CMake-2.6.4 and CMake-2.8.1-RC3) with all their special language support requirements. Modified Paths: -------------- trunk/CMakeLists.txt trunk/cmake/modules/language_support.cmake trunk/examples/CMakeLists.txt Added Paths: ----------- trunk/cmake/modules/language_support/ trunk/cmake/modules/language_support/cmake/ trunk/cmake/modules/language_support/cmake/CMakeAdaCompiler.cmake.in trunk/cmake/modules/language_support/cmake/CMakeAdaInformation.cmake trunk/cmake/modules/language_support/cmake/CMakeDCompiler.cmake.in trunk/cmake/modules/language_support/cmake/CMakeDInformation.cmake trunk/cmake/modules/language_support/cmake/CMakeD_Copyright.txt trunk/cmake/modules/language_support/cmake/CMakeDetermineAdaCompiler.cmake trunk/cmake/modules/language_support/cmake/CMakeDetermineDCompiler.cmake trunk/cmake/modules/language_support/cmake/CMakeTestAdaCompiler.cmake trunk/cmake/modules/language_support/cmake/CMakeTestDCompiler.cmake trunk/cmake/modules/language_support/cmake/Platform/ trunk/cmake/modules/language_support/cmake-2.6/ trunk/cmake/modules/language_support/cmake-2.6/CMakeFortranInformation.cmake trunk/cmake/modules/language_support/cmake-2.6/Platform/ trunk/cmake/modules/language_support/cmake-2.6/Platform/Cygwin-GNU-Fortran.cmake trunk/cmake/modules/language_support/cmake-2.6/Platform/Windows-GNU-Fortran.cmake trunk/cmake/modules/language_support/cmake-2.6/Platform/Windows-df.cmake trunk/cmake/modules/language_support/cmake-2.6/Platform/Windows-f90.cmake trunk/cmake/modules/language_support/cmake-2.8/ trunk/cmake/modules/language_support/cmake-2.8/Platform/ Removed Paths: ------------- trunk/cmake/modules/CMakeAdaCompiler.cmake.in trunk/cmake/modules/CMakeAdaInformation.cmake trunk/cmake/modules/CMakeDCompiler.cmake.in trunk/cmake/modules/CMakeDInformation.cmake trunk/cmake/modules/CMakeD_Copyright.txt trunk/cmake/modules/CMakeDetermineAdaCompiler.cmake trunk/cmake/modules/CMakeDetermineDCompiler.cmake trunk/cmake/modules/CMakeFortranInformation.cmake trunk/cmake/modules/CMakeTestAdaCompiler.cmake trunk/cmake/modules/CMakeTestDCompiler.cmake trunk/cmake/modules/Platform/ trunk/cmake/modules/language_support/cmake/Platform/Cygwin-GNU-Fortran.cmake trunk/cmake/modules/language_support/cmake/Platform/Windows-GNU-Fortran.cmake trunk/cmake/modules/language_support/cmake/Platform/Windows-df.cmake trunk/cmake/modules/language_support/cmake/Platform/Windows-f90.cmake Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/CMakeLists.txt 2010-02-18 21:38:39 UTC (rev 10805) @@ -55,8 +55,20 @@ set(PACKAGE plplot) -# Location where PLplot cmake build system first looks for cmake modules. -set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) +# Locations where PLplot cmake build system first looks for cmake modules. +if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 6) + set(CMAKE_MODULE_PATH + ${PROJECT_SOURCE_DIR}/cmake/modules + ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake + ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake-2.6 + ) +else(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 6) + set(CMAKE_MODULE_PATH + ${PROJECT_SOURCE_DIR}/cmake/modules + ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake + ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake-2.8 + ) +endif(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 6) # We need the path to the MinGW/Borland compiler in order to find # the import libraries for system libraries. Deleted: trunk/cmake/modules/CMakeAdaCompiler.cmake.in =================================================================== --- trunk/cmake/modules/CMakeAdaCompiler.cmake.in 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeAdaCompiler.cmake.in 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,17 +0,0 @@ -SET(CMAKE_Ada_COMPILER "@CMAKE_Ada_COMPILER@") -SET(CMAKE_Ada_COMPILER_ARG1 "@CMAKE_Ada_COMPILER_ARG1@") -SET(CMAKE_AR "@CMAKE_AR@") -SET(CMAKE_RANLIB "@CMAKE_RANLIB@") -SET(CMAKE_Ada_COMPILER_LOADED 1) - -SET(CMAKE_Ada_COMPILER_ENV_VAR "ADA") - -SET(CMAKE_Ada_SOURCE_FILE_EXTENSIONS adb) -SET(CMAKE_Ada_IGNORE_EXTENSIONS ads;h;H;o;O;obj;OBJ;def;DEF;rc;RC) -SET(CMAKE_Ada_LINKER_PREFERENCE Prefered) -IF(UNIX OR MINGW) - SET(CMAKE_Ada_OUTPUT_EXTENSION .o) -ELSE(UNIX OR MINGW) - SET(CMAKE_Ada_OUTPUT_EXTENSION .obj) -ENDIF(UNIX OR MINGW) -SET(CMAKE_Ada_OUTPUT_EXTENSION_REPLACE 1) Deleted: trunk/cmake/modules/CMakeAdaInformation.cmake =================================================================== --- trunk/cmake/modules/CMakeAdaInformation.cmake 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeAdaInformation.cmake 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,244 +0,0 @@ -# This file sets the basic flags for the Ada language in CMake. -# It also loads the available platform file for the system-compiler -# if it exists. - -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_Ada_COMPILER} NAME_WE) -SET(CMAKE_SYSTEM_AND_Ada_COMPILER_INFO_FILE - ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) -INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) - -# This should be included before the _INIT variables are -# used to initialize the cache. Since the rule variables -# have if blocks on them, users can still define them here. -# But, it should still be after the platform file so changes can -# be made to those values. - -IF(CMAKE_USER_MAKE_RULES_OVERRIDE) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) - -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_Ada) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Ada}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_Ada) - -# Create a set of shared library variable specific to Ada -# For 90% of the systems, these are the same flags as the C versions -# so if these are not set just copy the flags from the c version - -IF(NOT CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS) - SET(CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS) - -IF(NOT CMAKE_SHARED_LIBRARY_Ada_FLAGS) - SET(CMAKE_SHARED_LIBRARY_Ada_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_Ada_FLAGS) - -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_FLAGS) - SET(CMAKE_SHARED_LIBRARY_LINK_Ada_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_FLAGS) - -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG) - -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP) - -IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG) - SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG) - -# repeat for modules -IF(NOT CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS) - SET(CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS) - -IF(NOT CMAKE_SHARED_MODULE_Ada_FLAGS) - SET(CMAKE_SHARED_MODULE_Ada_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_Ada_FLAGS) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG) - SET(CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG_SEP) - SET(CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG_SEP) - -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG) - SET(CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG) - -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG_SEP) - SET(CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG_SEP) - -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Ada_FLAG) - SET(CMAKE_EXECUTABLE_RPATH_LINK_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Ada_FLAG) - -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_WITH_RUNTIME_PATH) - SET(CMAKE_SHARED_LIBRARY_LINK_Ada_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_WITH_RUNTIME_PATH) - -IF(NOT CMAKE_INCLUDE_FLAG_Ada) - SET(CMAKE_INCLUDE_FLAG_Ada ${CMAKE_INCLUDE_FLAG_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_Ada) - -IF(NOT CMAKE_INCLUDE_FLAG_SEP_Ada) - SET(CMAKE_INCLUDE_FLAG_SEP_Ada ${CMAKE_INCLUDE_FLAG_SEP_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_Ada) - -# Copy C version of this flag which is normally determined in platform file. -IF(NOT CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG) - SET(CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG) - -SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") - -SET(CMAKE_Ada_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Ada_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -IF(CMAKE_Ada_FLAGS_INIT STREQUAL " ") - SET(CMAKE_Ada_FLAGS_INIT) -ENDIF(CMAKE_Ada_FLAGS_INIT STREQUAL " ") -SET (CMAKE_Ada_FLAGS "${CMAKE_Ada_FLAGS_INIT}" CACHE STRING - "Flags for Ada compiler.") - -INCLUDE(CMakeCommonLanguageInclude) - -# now define the following rule variables - -# CMAKE_Ada_CREATE_SHARED_LIBRARY -# CMAKE_Ada_CREATE_SHARED_MODULE -# CMAKE_Ada_CREATE_STATIC_LIBRARY -# CMAKE_Ada_COMPILE_OBJECT -# CMAKE_Ada_LINK_EXECUTABLE - -# variables supplied by the generator at use time -# <TARGET> -# <TARGET_BASE> the target without the suffix -# <OBJECTS> -# <OBJECT> -# <LINK_LIBRARIES> -# <FLAGS> -# <LINK_FLAGS> - -# Ada compiler information -# <CMAKE_Ada_COMPILER> -# <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> -# <CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS> -# <CMAKE_Ada_LINK_FLAGS> - -# Static library tools -# <CMAKE_AR> -# <CMAKE_RANLIB> - - -# create an Ada shared library -IF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY) - IF(APPLE) - # Temporary fixup for one user's Ada/Mac OS X problems when using the - # the 4.2 version of the http://macada.org/ version of the GNAT compiler. - SET(CMAKE_Ada_CREATE_SHARED_LIBRARY - "<CMAKE_Ada_COMPILER> <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -lgcc_s.1" - ) - ELSE(APPLE) - SET(CMAKE_Ada_CREATE_SHARED_LIBRARY - "<CMAKE_Ada_COMPILER> <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" - ) - ENDIF(APPLE) -ENDIF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY) - -# create an Ada shared module just copy the shared library rule -IF(NOT CMAKE_Ada_CREATE_SHARED_MODULE) - SET(CMAKE_Ada_CREATE_SHARED_MODULE ${CMAKE_Ada_CREATE_SHARED_LIBRARY}) -ENDIF(NOT CMAKE_Ada_CREATE_SHARED_MODULE) - -# create an Ada static library -IF(NOT CMAKE_Ada_CREATE_STATIC_LIBRARY) - SET(CMAKE_Ada_CREATE_STATIC_LIBRARY - "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " - "<CMAKE_RANLIB> <TARGET> ") -ENDIF(NOT CMAKE_Ada_CREATE_STATIC_LIBRARY) - -# compile a Ada file into an object file -IF(NOT CMAKE_Ada_COMPILE_OBJECT) - SET(CMAKE_Ada_COMPILE_OBJECT - "<CMAKE_Ada_COMPILER> <FLAGS> -c <SOURCE> -o <OBJECT> - ") -ENDIF(NOT CMAKE_Ada_COMPILE_OBJECT) - -# Constraints: GNAT_EXECUTABLE_BUILDER = gnatmake -# is required to do the compile+bind+link of -# Ada executables, and it requires a source file name which is constructed from -# <TARGET>.adb. The source file arguments of add_executable are -# all compiled by the above rule (which must remain that form since it -# is also used to compile objects for Ada libraries), but the results are -# ignored since they are put in a different directory while gnatmake assumes -# objects are located in the _current_ directory. Thus, put in a minimal -# source file (with correct .adb suffix to identify the Ada language) -# to reduce this useless compilation to a minimum. Usually, the main Ada -# routine qualifies since it is normally small. Thus, the normal usage is -# add_executable(foo foo.adb), but add_executable(foo path/minimal.adb) would -# work as well so long as both path/minimal.adb existed and foo.adb existed. -# Also, note there is no way to specify -# ${CMAKE_CURRENT_SOURCE_DIR}/<TARGET>.adb as the code for gnatmake to compile -# because in this context ${CMAKE_CURRENT_SOURCE_DIR} is set to the top -# of the source tree and not the expected sub-directory of the source tree. -# Thus, LINK_FLAGS -aI${CMAKE_CURRENT_SOURCE_DIR} must be set using -# set_target_properties in order to specify the directory where <TARGET>.adb -# exists. Note, LINK_FLAGS can also be used to set other gnatmake flags -# such as -aL. - -# In sum, you have to be careful of your target name, the nominal source file -# name has to be compilable, but otherwise it is ignored, and you must specify -# the required -aI and other GNAT_EXECUTABLE_BUILDER = gnatmake options -# using LINK_FLAGS specified with set_target_properties. -# However, so long as you pay attention to these -# constraints, add_executable should work for the Ada language. - -IF(NOT CMAKE_Ada_LINK_EXECUTABLE) - # N.B. under some circumstances (build tests) GNAT_EXECUTABLE_BUILDER is not - # defined at this stage for unknown reasons so try to find it again as a - # last resort. - GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_Ada_COMPILER}" - PATH) - FIND_PROGRAM(GNAT_EXECUTABLE_BUILDER NAMES gnatmake PATHS ${COMPILER_LOCATION} ) - - IF(APPLE) - # Temporary fixup for one user's Ada/Mac OS X problems when using the - # the 4.2 version of the http://macada.org/ version of the GNAT compiler. - SET(CMAKE_Ada_LINK_EXECUTABLE - "${GNAT_EXECUTABLE_BUILDER} <CMAKE_Ada_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE>.adb -cargs <FLAGS> -largs <LINK_LIBRARIES> -lgcc_s.1") - ELSE(APPLE) - SET(CMAKE_Ada_LINK_EXECUTABLE - "${GNAT_EXECUTABLE_BUILDER} <CMAKE_Ada_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE>.adb -cargs <FLAGS> -largs <LINK_LIBRARIES>") - ENDIF(APPLE) -ENDIF(NOT CMAKE_Ada_LINK_EXECUTABLE) - -IF(CMAKE_Ada_STANDARD_LIBRARIES_INIT) - SET(CMAKE_Ada_STANDARD_LIBRARIES "${CMAKE_Ada_STANDARD_LIBRARIES_INIT}" - CACHE STRING "Libraries linked by default with all Ada applications.") - MARK_AS_ADVANCED(CMAKE_Ada_STANDARD_LIBRARIES) -ENDIF(CMAKE_Ada_STANDARD_LIBRARIES_INIT) - -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - SET (CMAKE_Ada_FLAGS_DEBUG "${CMAKE_Ada_FLAGS_DEBUG_INIT}" CACHE STRING - "Flags used by the compiler during debug builds.") - SET (CMAKE_Ada_FLAGS_MINSIZEREL "${CMAKE_Ada_FLAGS_MINSIZEREL_INIT}" CACHE STRING - "Flags used by the compiler during release minsize builds.") - SET (CMAKE_Ada_FLAGS_RELEASE "${CMAKE_Ada_FLAGS_RELEASE_INIT}" CACHE STRING - "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") - SET (CMAKE_Ada_FLAGS_RELWITHDEBINFO "${CMAKE_Ada_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING - "Flags used by the compiler during Release with Debug Info builds.") -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - -MARK_AS_ADVANCED( -CMAKE_Ada_FLAGS -CMAKE_Ada_FLAGS_DEBUG -CMAKE_Ada_FLAGS_MINSIZEREL -CMAKE_Ada_FLAGS_RELEASE -CMAKE_Ada_FLAGS_RELWITHDEBINFO -) -SET(CMAKE_Ada_INFORMATION_LOADED 1) Deleted: trunk/cmake/modules/CMakeDCompiler.cmake.in =================================================================== --- trunk/cmake/modules/CMakeDCompiler.cmake.in 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeDCompiler.cmake.in 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,46 +0,0 @@ -# -# CMakeD - CMake module for D Language -# -# Copyright (c) 2007, Selman Ulug <sel...@gm...> -# Tim Burrell <tim...@gm...> -# -# All rights reserved. -# -# See Copyright.txt for details. -# -# Modified from CMake 2.6.5 CMakeCCompiler.cmake.in -# See http://www.cmake.org/HTML/Copyright.html for details -# - -SET(CMAKE_D_COMPILER "@CMAKE_D_COMPILER@") -SET(CMAKE_D_COMPILER_ARG1 "@CMAKE_D_COMPILER_ARG1@") -SET(CMAKE_AR "@CMAKE_AR@") -SET(CMAKE_RANLIB "@CMAKE_RANLIB@") -SET(CMAKE_COMPILER_IS_GDC @CMAKE_COMPILER_IS_GDC@) -SET(CMAKE_COMPILER_IS_DMD @CMAKE_COMPILER_IS_DMD@) -SET(CMAKE_D_COMPILER_LOADED 1) -SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) -SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) -IF(CMAKE_COMPILER_IS_CYGWIN) - SET(CYGWIN 1) - SET(UNIX 1) -ENDIF(CMAKE_COMPILER_IS_CYGWIN) - -SET(CMAKE_D_COMPILER_ENV_VAR "DC") - -IF(CMAKE_COMPILER_IS_MINGW) - SET(MINGW 1) -ENDIF(CMAKE_COMPILER_IS_MINGW) -SET(CMAKE_COMPILER_IS_GDC_RUN 1) -SET(CMAKE_D_SOURCE_FILE_EXTENSIONS d) -SET(CMAKE_D_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) -SET(CMAKE_D_LINKER_PREFERENCE None) -IF(UNIX) - SET(CMAKE_D_OUTPUT_EXTENSION .o) -ELSE(UNIX) - SET(CMAKE_D_OUTPUT_EXTENSION .obj) -ENDIF(UNIX) -SET(CMAKE_D_OUTPUT_EXTENSION_REPLACE 1) -# save the size of void* in case where cache is removed -# and the this file is still around -#SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@) Deleted: trunk/cmake/modules/CMakeDInformation.cmake =================================================================== --- trunk/cmake/modules/CMakeDInformation.cmake 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeDInformation.cmake 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,297 +0,0 @@ -# -# CMakeD - CMake module for D Language -# -# Copyright (c) 2007, Selman Ulug <sel...@gm...> -# Tim Burrell <tim...@gm...> -# -# All rights reserved. -# -# See Copyright.txt for details. -# -# Modified from CMake 2.6.5 CMakeCInformation.cmake -# See http://www.cmake.org/HTML/Copyright.html for details -# - -# This file sets the basic flags for the D language in CMake. -# It also loads the available platform file for the system-compiler -# if it exists. - -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_D_COMPILER} NAME_WE) -IF(CMAKE_COMPILER_IS_GDC) - SET(CMAKE_BASE_NAME gdc) -ELSE(CMAKE_COMPILER_IS_GDC) - SET(CMAKE_BASE_NAME dmd) -ENDIF(CMAKE_COMPILER_IS_GDC) -SET(CMAKE_SYSTEM_AND_D_COMPILER_INFO_FILE - ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) -INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) - -# This should be included before the _INIT variables are -# used to initialize the cache. Since the rule variables -# have if blocks on them, users can still define them here. -# But, it should still be after the platform file so changes can -# be made to those values. - -IF(CMAKE_USER_MAKE_RULES_OVERRIDE) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) - -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_D) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_D}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_D) - -# Create a set of shared library variable specific to D -# For 90% of the systems, these are the same flags as the C versions -# so if these are not set just copy the flags from the c version -IF(NOT CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS) - SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS) - -IF(NOT CMAKE_SHARED_LIBRARY_D_FLAGS) - SET(CMAKE_SHARED_LIBRARY_D_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_D_FLAGS) - -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_D_FLAGS) - SET(CMAKE_SHARED_LIBRARY_LINK_D_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_D_FLAGS) - -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG) - -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP) - -IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG) - SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG) - -# repeat for modules -IF(NOT CMAKE_SHARED_MODULE_CREATE_D_FLAGS) - SET(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_D_FLAGS) - -IF(NOT CMAKE_SHARED_MODULE_D_FLAGS) - SET(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_D_FLAGS) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_D_FLAG) - SET(CMAKE_SHARED_MODULE_RUNTIME_D_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_D_FLAG) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_D_FLAG_SEP) - SET(CMAKE_SHARED_MODULE_RUNTIME_D_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_D_FLAG_SEP) - -IF(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG) - SET(CMAKE_EXECUTABLE_RUNTIME_D_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG) - -IF(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP) - SET(CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP) - -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG) - SET(CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG) - -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_D_WITH_RUNTIME_PATH) - SET(CMAKE_SHARED_LIBRARY_LINK_D_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_D_WITH_RUNTIME_PATH) - -IF(NOT CMAKE_INCLUDE_FLAG_D) - SET(CMAKE_INCLUDE_FLAG_D ${CMAKE_INCLUDE_FLAG_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_D) - -IF(NOT CMAKE_INCLUDE_FLAG_SEP_D) - SET(CMAKE_INCLUDE_FLAG_SEP_D ${CMAKE_INCLUDE_FLAG_SEP_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_D) - -SET (CMAKE_D_FLAGS "$ENV{CFLAGS} ${CMAKE_D_FLAGS_INIT}" CACHE STRING - "Flags for D compiler.") - -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) -# default build type is none - IF(NOT CMAKE_NO_BUILD_TYPE) - SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING - "Choose the type of build, options are: None(CMAKE_D_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") - ENDIF(NOT CMAKE_NO_BUILD_TYPE) - SET (CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG_INIT}" CACHE STRING - "Flags used by the compiler during debug builds.") - SET (CMAKE_D_FLAGS_MINSIZEREL "${CMAKE_D_FLAGS_MINSIZEREL_INIT}" CACHE STRING - "Flags used by the compiler during release minsize builds.") - SET (CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE_INIT}" CACHE STRING - "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") - SET (CMAKE_D_FLAGS_RELWITHDEBINFO "${CMAKE_D_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING - "Flags used by the compiler during Release with Debug Info builds.") -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - -IF(CMAKE_D_STANDARD_LIBRARIES_INIT) - SET(CMAKE_D_STANDARD_LIBRARIES "${CMAKE_D_STANDARD_LIBRARIES_INIT}" - CACHE STRING "Libraries linked by default with all D applications.") - MARK_AS_ADVANCED(CMAKE_D_STANDARD_LIBRARIES) -ENDIF(CMAKE_D_STANDARD_LIBRARIES_INIT) - -INCLUDE(CMakeCommonLanguageInclude) - -# now define the following rule variables - -# CMAKE_D_CREATE_SHARED_LIBRARY -# CMAKE_D_CREATE_SHARED_MODULE -# CMAKE_D_CREATE_STATIC_LIBRARY -# CMAKE_D_COMPILE_OBJECT -# CMAKE_D_LINK_EXECUTABLE - -# variables supplied by the generator at use time -# <TARGET> -# <TARGET_BASE> the target without the suffix -# <OBJECTS> -# <OBJECT> -# <LINK_LIBRARIES> -# <FLAGS> -# <LINK_FLAGS> - -# D compiler information -# <CMAKE_D_COMPILER> -# <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> -# <CMAKE_SHARED_MODULE_CREATE_D_FLAGS> -# <CMAKE_D_LINK_FLAGS> - -# Static library tools -# <CMAKE_AR> -# <CMAKE_RANLIB> - -IF("$ENV{D_PATH}" STREQUAL "") - STRING(LENGTH ${CMAKE_D_COMPILER} CMAKE_D_COMPILER_LENGTH) - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 12") - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 8") - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - STRING(SUBSTRING ${CMAKE_D_COMPILER} 0 ${CMAKE_D_COMPILER_LENGTH} D_PATH) -ELSE("$ENV{D_PATH}" STREQUAL "") - SET(D_PATH "$ENV{D_PATH}") -ENDIF("$ENV{D_PATH}" STREQUAL "") -MESSAGE(STATUS "D Compiler Install Prefix (use D_PATH env var to override): ${D_PATH}") - -IF(CMAKE_COMPILER_IS_GDC) - SET(CMAKE_OUTPUT_D_FLAG "-o ") - SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC") - SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared") - SET(CMAKE_INCLUDE_FLAG_D "-I") # -I - SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty - SET(CMAKE_LIBRARY_PATH_FLAG "-L") - SET(CMAKE_LINK_LIBRARY_FLAG "-l") - SET(CMAKE_D_VERSION_FLAG "-fversion=") -ELSE(CMAKE_COMPILER_IS_GDC) - SET(CMAKE_OUTPUT_D_FLAG "-of") - SET(CMAKE_D_VERSION_FLAG "-version=") - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_INCLUDE_FLAG_D "-I") # -I - SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty - SET(CMAKE_LINK_LIBRARY_FLAG "-L+") - SET(CMAKE_LIBRARY_PATH_FLAG "-L+") - SET(CMAKE_LIBRARY_PATH_TERMINATOR "\\") - FIND_PROGRAM(DMD_LIBRARIAN "lib.exe") - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC") - SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared") - SET(CMAKE_INCLUDE_FLAG_D "-I") # -I - SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty - SET(CMAKE_LIBRARY_PATH_FLAG "-L") - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") -ENDIF(CMAKE_COMPILER_IS_GDC) - -IF(CMAKE_D_USE_TANGO) - IF(CMAKE_COMPILER_IS_GDC) - SET(DSTDLIB_TYPE "-fversion=Tango") - SET(DSTDLIB_FLAGS "-lgtango") - ELSE(CMAKE_COMPILER_IS_GDC) - SET(DSTDLIB_TYPE "-version=Tango") - SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos") - ENDIF(CMAKE_COMPILER_IS_GDC) -ENDIF(CMAKE_D_USE_TANGO) -IF(CMAKE_D_USE_PHOBOS) - IF(CMAKE_COMPILER_IS_GDC) - SET(DSTDLIB_TYPE "-fversion=Phobos") - SET(DSTDLIB_FLAGS "-lgphobos") - ELSE(CMAKE_COMPILER_IS_GDC) - SET(DSTDLIB_TYPE "-version=Phobos") - SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -lphobos") - ENDIF(CMAKE_COMPILER_IS_GDC) -ENDIF(CMAKE_D_USE_PHOBOS) - -# create a D shared library -IF(NOT CMAKE_D_CREATE_SHARED_LIBRARY) - IF(CMAKE_COMPILER_IS_GDC) - SET(CMAKE_D_CREATE_SHARED_LIBRARY - "<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES>") - ELSE(CMAKE_COMPILER_IS_GDC) - SET(CMAKE_D_CREATE_SHARED_LIBRARY - "<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES> ${DSTDLIB_FLAGS}") - ENDIF(CMAKE_COMPILER_IS_GDC) -ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY) - -# create a D shared module just copy the shared library rule -IF(NOT CMAKE_D_CREATE_SHARED_MODULE) - SET(CMAKE_D_CREATE_SHARED_MODULE ${CMAKE_D_CREATE_SHARED_LIBRARY}) -ENDIF(NOT CMAKE_D_CREATE_SHARED_MODULE) - -# create a D static library -IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY) - IF(CMAKE_COMPILER_IS_GDC) - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_D_CREATE_STATIC_LIBRARY - "<CMAKE_AR> cr <TARGET>.lib <LINK_FLAGS> <OBJECTS> " - "<CMAKE_RANLIB> <TARGET>.lib " - "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " - "<CMAKE_RANLIB> <TARGET> " - ) - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_D_CREATE_STATIC_LIBRARY - "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " - "<CMAKE_RANLIB> <TARGET> " - ) - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - ELSE(CMAKE_COMPILER_IS_GDC) - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_D_CREATE_STATIC_LIBRARY - "${DMD_LIBRARIAN} -c -p256 <TARGET> <OBJECTS>") - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_D_CREATE_STATIC_LIBRARY - "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>" - "<CMAKE_RANLIB> <TARGET>") - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - ENDIF(CMAKE_COMPILER_IS_GDC) -ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY) - -# compile a D file into an object file -IF(NOT CMAKE_D_COMPILE_OBJECT) - SET(CMAKE_D_COMPILE_OBJECT - "<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_OUTPUT_D_FLAG}<OBJECT> -c <SOURCE>") -ENDIF(NOT CMAKE_D_COMPILE_OBJECT) - -IF(NOT CMAKE_D_LINK_EXECUTABLE) - IF(CMAKE_COMPILER_IS_GDC) - SET(CMAKE_D_LINK_EXECUTABLE - "<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES> ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE}") - ELSE(CMAKE_COMPILER_IS_GDC) - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_D_LINK_EXECUTABLE - "<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES>") - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - SET(CMAKE_D_LINK_EXECUTABLE - "gcc ${DLINK_FLAGS} <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -lpthread -lm ${DSTDLIB_FLAGS}") - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - ENDIF(CMAKE_COMPILER_IS_GDC) -ENDIF(NOT CMAKE_D_LINK_EXECUTABLE) - -MARK_AS_ADVANCED( -CMAKE_D_FLAGS -CMAKE_D_FLAGS_DEBUG -CMAKE_D_FLAGS_MINSIZEREL -CMAKE_D_FLAGS_RELEASE -CMAKE_D_FLAGS_RELWITHDEBINFO -) -SET(CMAKE_D_INFORMATION_LOADED 1) Deleted: trunk/cmake/modules/CMakeD_Copyright.txt =================================================================== --- trunk/cmake/modules/CMakeD_Copyright.txt 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeD_Copyright.txt 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,30 +0,0 @@ -CMakeD - CMake module for D Language - -Copyright (c) 2007, Selman Ulug <sel...@gm...> - Tim Burrell <tim...@gm...> - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Deleted: trunk/cmake/modules/CMakeDetermineAdaCompiler.cmake =================================================================== --- trunk/cmake/modules/CMakeDetermineAdaCompiler.cmake 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeDetermineAdaCompiler.cmake 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,62 +0,0 @@ -# Determine the compiler to use for Ada programs -# NOTE, a generator may set CMAKE_Ada_COMPILER before -# loading this file to force a compiler. -# use environment variable ADA first if defined by user, next use -# the cmake variable CMAKE_GENERATOR_ADA which can be defined by a generator -# as a default compiler - -IF(NOT CMAKE_Ada_COMPILER) - - # prefer the environment variable ADA - IF($ENV{ADA} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_Ada_COMPILER_INIT $ENV{ADA} PROGRAM PROGRAM_ARGS CMAKE_Ada_FLAGS_ENV_INIT) - IF(CMAKE_Ada_FLAGS_ENV_INIT) - SET(CMAKE_Ada_COMPILER_ARG1 "${CMAKE_Ada_FLAGS_ENV_INIT}" CACHE STRING "First argument to Ada compiler") - ENDIF(CMAKE_Ada_FLAGS_ENV_INIT) - IF(EXISTS ${CMAKE_Ada_COMPILER_INIT}) - ELSE(EXISTS ${CMAKE_Ada_COMPILER_INIT}) - MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable ADA:\n$ENV{ADA}.") - ENDIF(EXISTS ${CMAKE_Ada_COMPILER_INIT}) - ENDIF($ENV{ADA} MATCHES ".+") - - # next try prefer the compiler specified by the generator - IF(CMAKE_GENERATOR_ADA) - IF(NOT CMAKE_Ada_COMPILER_INIT) - SET(CMAKE_Ada_COMPILER_INIT ${CMAKE_GENERATOR_ADA}) - ENDIF(NOT CMAKE_Ada_COMPILER_INIT) - ENDIF(CMAKE_GENERATOR_ADA) - - # finally list compilers to try - IF(CMAKE_Ada_COMPILER_INIT) - SET(CMAKE_Ada_COMPILER_LIST ${CMAKE_Ada_COMPILER_INIT}) - ELSE(CMAKE_Ada_COMPILER_INIT) - SET(CMAKE_Ada_COMPILER_LIST gnatgcc gcc) - ENDIF(CMAKE_Ada_COMPILER_INIT) - - # Find the compiler. - FIND_PROGRAM(CMAKE_Ada_COMPILER NAMES ${CMAKE_Ada_COMPILER_LIST} DOC "Ada compiler") - IF(CMAKE_Ada_COMPILER_INIT AND NOT CMAKE_Ada_COMPILER) - SET(CMAKE_Ada_COMPILER "${CMAKE_Ada_COMPILER_INIT}" CACHE FILEPATH "Ada compiler" FORCE) - ENDIF(CMAKE_Ada_COMPILER_INIT AND NOT CMAKE_Ada_COMPILER) -ENDIF(NOT CMAKE_Ada_COMPILER) -MARK_AS_ADVANCED(CMAKE_Ada_COMPILER) - -GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_Ada_COMPILER}" - PATH) - -FIND_PROGRAM(GNAT_EXECUTABLE_BUILDER NAMES gnatmake PATHS ${COMPILER_LOCATION} ) -FIND_PROGRAM(CMAKE_AR NAMES ar PATHS ${COMPILER_LOCATION} ) - -FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib) -IF(NOT CMAKE_RANLIB) - SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") -ENDIF(NOT CMAKE_RANLIB) -MARK_AS_ADVANCED(CMAKE_RANLIB) - -# configure variables set in this file for fast reload later on -#CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeAdaCompiler.cmake.in -CONFIGURE_FILE(${CMAKE_MODULE_PATH}/CMakeAdaCompiler.cmake.in - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeAdaCompiler.cmake" IMMEDIATE) -MARK_AS_ADVANCED(CMAKE_AR) - -SET(CMAKE_Ada_COMPILER_ENV_VAR "ADA") Deleted: trunk/cmake/modules/CMakeDetermineDCompiler.cmake =================================================================== --- trunk/cmake/modules/CMakeDetermineDCompiler.cmake 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeDetermineDCompiler.cmake 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,108 +0,0 @@ -# -# CMakeD - CMake module for D Language -# -# Copyright (c) 2007, Selman Ulug <sel...@gm...> -# Tim Burrell <tim...@gm...> -# -# All rights reserved. -# -# See Copyright.txt for details. -# -# Modified from CMake 2.6.5 CMakeDetermineCCompiler.cmake -# See http://www.cmake.org/HTML/Copyright.html for details -# - -# determine the compiler to use for D programs -# NOTE, a generator may set CMAKE_D_COMPILER before -# loading this file to force a compiler. -# use environment variable DC first if defined by user, next use -# the cmake variable CMAKE_GENERATOR_D which can be defined by a generator -# as a default compiler - -IF(NOT CMAKE_D_COMPILER) - - # prefer the environment variable DC - IF($ENV{DC} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_D_COMPILER_INIT $ENV{DC} PROGRAM PROGRAM_ARGS CMAKE_D_FLAGS_ENV_INIT) - IF(CMAKE_D_FLAGS_ENV_INIT) - SET(CMAKE_D_COMPILER_ARG1 "${CMAKE_D_FLAGS_ENV_INIT}" CACHE STRING "First argument to D compiler") - ENDIF(CMAKE_D_FLAGS_ENV_INIT) - IF(EXISTS ${CMAKE_D_COMPILER_INIT}) - ELSE(EXISTS ${CMAKE_D_COMPILER_INIT}) - MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable C:\n$ENV{DC}.") - ENDIF(EXISTS ${CMAKE_D_COMPILER_INIT}) - ENDIF($ENV{DC} MATCHES ".+") - - # next try prefer the compiler specified by the generator - IF(CMAKE_GENERATOR_D) - IF(NOT CMAKE_D_COMPILER_INIT) - SET(CMAKE_D_COMPILER_INIT ${CMAKE_GENERATOR_D}) - ENDIF(NOT CMAKE_D_COMPILER_INIT) - ENDIF(CMAKE_GENERATOR_D) - - # finally list compilers to try - IF(CMAKE_D_COMPILER_INIT) - SET(CMAKE_D_COMPILER_LIST ${CMAKE_D_COMPILER_INIT}) - ELSE(CMAKE_D_COMPILER_INIT) - SET(CMAKE_D_COMPILER_LIST gdc dmd) - ENDIF(CMAKE_D_COMPILER_INIT) - - # Find the compiler. - FIND_PROGRAM(CMAKE_D_COMPILER NAMES ${CMAKE_D_COMPILER_LIST} DOC "C compiler") - IF(CMAKE_D_COMPILER_INIT AND NOT CMAKE_D_COMPILER) - SET(CMAKE_D_COMPILER "${CMAKE_D_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE) - ENDIF(CMAKE_D_COMPILER_INIT AND NOT CMAKE_D_COMPILER) -ENDIF(NOT CMAKE_D_COMPILER) -MARK_AS_ADVANCED(CMAKE_D_COMPILER) -GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_D_COMPILER}" PATH) - -FIND_PROGRAM(CMAKE_AR NAMES ar PATHS ${COMPILER_LOCATION} ) - -FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib) -IF(NOT CMAKE_RANLIB) - SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") -ENDIF(NOT CMAKE_RANLIB) -MARK_AS_ADVANCED(CMAKE_RANLIB) - -# do not test for GNU if the generator is visual studio -IF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - SET(CMAKE_COMPILER_IS_GDC_RUN 1) -ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - - -IF(NOT CMAKE_COMPILER_IS_GDC_RUN) - # test to see if the d compiler is gdc - SET(CMAKE_COMPILER_IS_GDC_RUN 1) - IF("${CMAKE_D_COMPILER}" MATCHES ".*gdc.*" ) - SET(CMAKE_COMPILER_IS_GDC 1) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the D compiler is GDC succeeded with " - "the following output:\n${CMAKE_D_COMPILER}\n\n") - EXEC_PROGRAM(${CMAKE_D_COMPILER} ARGS "--version" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*mingw.*" ) - SET(CMAKE_COMPILER_IS_MINGW 1) - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*mingw.*" ) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - SET(CMAKE_COMPILER_IS_CYGWIN 1) - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - ELSE("${CMAKE_D_COMPILER}" MATCHES ".*dmd.*" ) - SET(CMAKE_COMPILER_IS_DMD 1) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the D compiler is DMD succeeded with " - "the following output:\n${CMAKE_D_COMPILER}\n\n") - ENDIF("${CMAKE_D_COMPILER}" MATCHES ".*gdc.*" ) -ENDIF(NOT CMAKE_COMPILER_IS_GDC_RUN) - - -# configure variables set in this file for fast reload later on -IF(EXISTS ${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in) - CONFIGURE_FILE(${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in - "${CMAKE_PLATFORM_ROOT_BIN}/CMakeDCompiler.cmake" IMMEDIATE) -ELSE(EXISTS ${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in) - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in - "${CMAKE_PLATFORM_ROOT_BIN}/CMakeDCompiler.cmake" IMMEDIATE) -ENDIF(EXISTS ${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in) - -MARK_AS_ADVANCED(CMAKE_AR) -SET(CMAKE_D_COMPILER_ENV_VAR "DC") - Deleted: trunk/cmake/modules/CMakeFortranInformation.cmake =================================================================== --- trunk/cmake/modules/CMakeFortranInformation.cmake 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeFortranInformation.cmake 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,189 +0,0 @@ - -# This file sets the basic flags for the Fortran language in CMake. -# It also loads the available platform file for the system-compiler -# if it exists. - -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER} NAME_WE) -# since the gnu compiler has several names force g++ -IF(CMAKE_COMPILER_IS_GNUG77) - SET(CMAKE_BASE_NAME g77) -ENDIF(CMAKE_COMPILER_IS_GNUG77) -IF(CMAKE_Fortran_COMPILER_ID) - IF(EXISTS ${CMAKE_MODULE_PATH}/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake OR EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake) - SET(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER_ID}-Fortran) - ENDIF(EXISTS ${CMAKE_MODULE_PATH}/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake OR EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake) -ENDIF(CMAKE_Fortran_COMPILER_ID) -IF(EXISTS ${CMAKE_MODULE_PATH}/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) - # Use this file if it exists. - SET(CMAKE_SYSTEM_AND_Fortran_COMPILER_INFO_FILE - ${CMAKE_MODULE_PATH}/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) -ELSE(EXISTS ${CMAKE_MODULE_PATH}/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) - # This one apparently doesn't have to actually exist, see OPTIONAL below. - SET(CMAKE_SYSTEM_AND_Fortran_COMPILER_INFO_FILE - ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) -ENDIF(EXISTS ${CMAKE_MODULE_PATH}/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) -INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) - -# This should be included before the _INIT variables are -# used to initialize the cache. Since the rule variables -# have if blocks on them, users can still define them here. -# But, it should still be after the platform file so changes can -# be made to those values. - -IF(CMAKE_USER_MAKE_RULES_OVERRIDE) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) - -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran) - - -# Fortran needs cmake to do a requires step during its build process to -# catch any modules -SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1) - -# Create a set of shared library variable specific to Fortran -# For 90% of the systems, these are the same flags as the C versions -# so if these are not set just copy the flags from the c version -IF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) - SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) - -IF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) - SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) - -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) - SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) - -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) - -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) - -IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) - SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) - -# repeat for modules -IF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) - SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) - -IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) - SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG) - SET(CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG_SEP) - SET(CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG_SEP) - -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) - SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) - -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) - SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) - -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) - SET(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) - -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) - SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) - -IF(NOT CMAKE_INCLUDE_FLAG_Fortran) - SET(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_Fortran) - -IF(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran) - SET(CMAKE_INCLUDE_FLAG_SEP_Fortran ${CMAKE_INCLUDE_FLAG_SEP_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran) - -SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") - -SET(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -IF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") - SET(CMAKE_Fortran_FLAGS_INIT) -ENDIF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") -SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING - "Flags for Fortran compiler.") - -INCLUDE(CMakeCommonLanguageInclude) - -# now define the following rule variables -# CMAKE_Fortran_CREATE_SHARED_LIBRARY -# CMAKE_Fortran_CREATE_SHARED_MODULE -# CMAKE_Fortran_CREATE_STATIC_LIBRARY -# CMAKE_Fortran_COMPILE_OBJECT -# CMAKE_Fortran_LINK_EXECUTABLE - -# create a Fortran shared library -IF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY) - SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "<CMAKE_Fortran_COMPILER> <CMAKE_SHARED_LIBRARY_Fortran_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") -ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY) - -# create a Fortran shared module just copy the shared library rule -IF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE) - SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) -ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE) - -# create a Fortran static library -IF(NOT CMAKE_Fortran_CREATE_STATIC_LIBRARY) - SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY - "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " - "<CMAKE_RANLIB> <TARGET> ") -ENDIF(NOT CMAKE_Fortran_CREATE_STATIC_LIBRARY) - -# compile a Fortran file into an object file -IF(NOT CMAKE_Fortran_COMPILE_OBJECT) - SET(CMAKE_Fortran_COMPILE_OBJECT - "<CMAKE_Fortran_COMPILER> -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>") -ENDIF(NOT CMAKE_Fortran_COMPILE_OBJECT) - -# link a fortran program -IF(NOT CMAKE_Fortran_LINK_EXECUTABLE) - SET(CMAKE_Fortran_LINK_EXECUTABLE - "<CMAKE_Fortran_COMPILER> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") -ENDIF(NOT CMAKE_Fortran_LINK_EXECUTABLE) - -IF(CMAKE_Fortran_STANDARD_LIBRARIES_INIT) - SET(CMAKE_Fortran_STANDARD_LIBRARIES "${CMAKE_Fortran_STANDARD_LIBRARIES_INIT}" - CACHE STRING "Libraries linked by defalut with all Fortran applications.") - MARK_AS_ADVANCED(CMAKE_Fortran_STANDARD_LIBRARIES) -ENDIF(CMAKE_Fortran_STANDARD_LIBRARIES_INIT) - -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG_INIT}" CACHE STRING - "Flags used by the compiler during debug builds.") - SET (CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_MINSIZEREL_INIT}" CACHE STRING - "Flags used by the compiler during release minsize builds.") - SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE_INIT}" CACHE STRING - "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") - SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING - "Flags used by the compiler during Release with Debug Info builds.") - -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - -MARK_AS_ADVANCED( -CMAKE_Fortran_FLAGS -CMAKE_Fortran_FLAGS_DEBUG -CMAKE_Fortran_FLAGS_MINSIZEREL -CMAKE_Fortran_FLAGS_RELEASE -CMAKE_Fortran_FLAGS_RELWITHDEBINFO) - -# set this variable so we can avoid loading this more than once. -SET(CMAKE_Fortran_INFORMATION_LOADED 1) Deleted: trunk/cmake/modules/CMakeTestAdaCompiler.cmake =================================================================== --- trunk/cmake/modules/CMakeTestAdaCompiler.cmake 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeTestAdaCompiler.cmake 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,60 +0,0 @@ -# This file is used by EnableLanguage in cmGlobalGenerator to determine that -# the Ada builder GNAT_EXECUTABLE_BUILDER = gnatmake can actually compile -# and link the most basic of programs. If not, a fatal error is set and -# cmake stops processing commands and will not generate any makefiles or -# projects. - -IF(NOT CMAKE_Ada_COMPILER_WORKS) - MESSAGE(STATUS "Check for working Ada builder: ${GNAT_EXECUTABLE_BUILDER}") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testadacompiler.adb - " -procedure testAdaCompiler is -begin - null; -end; - " - ) - - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt - " -# FIXME: This specific location currently needs to be changed whenever the -# location of the experimental Ada support files is changed. -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) -set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL \"\" FORCE) -project(test Ada) -add_executable(testadacompiler testadacompiler.adb) - " - ) - -# To avoid try_compile recurse error, use any binary directory other than -# ${CMAKE_BINARY_DIR}. The choice of -# bindir = ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp is -# especially advantageous since it makes an in-source build which -# means that no special variables need to be set to find files. - try_compile(CMAKE_Ada_COMPILER_WORKS - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp - projectName - OUTPUT_VARIABLE OUTPUT - ) - SET(ADA_TEST_WAS_RUN 1) -ENDIF(NOT CMAKE_Ada_COMPILER_WORKS) - -IF(NOT CMAKE_Ada_COMPILER_WORKS) - MESSAGE(STATUS "Check for working Ada builder: ${GNAT_EXECUTABLE_BUILDER} -- broken") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Ada builder works failed with " - "the following output:\n${OUTPUT}\n\n") - MESSAGE(FATAL_ERROR "The Ada builder \"${GNAT_EXECUTABLE_BUILDER}\" " - "is not able to compile, bind, and link a simple test program.\nIt fails " - "with the following output:\n ${OUTPUT}\n\n" - "CMake will not be able to correctly generate this project.") -ELSE(NOT CMAKE_Ada_COMPILER_WORKS) - IF(ADA_TEST_WAS_RUN) - MESSAGE(STATUS "Check for working Ada builder: ${GNAT_EXECUTABLE_BUILDER} -- works") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Ada builder works passed with " - "the following output:\n${OUTPUT}\n\n") - ENDIF(ADA_TEST_WAS_RUN) - SET(CMAKE_Ada_COMPILER_WORKS 1 CACHE INTERNAL "") -ENDIF(NOT CMAKE_Ada_COMPILER_WORKS) Deleted: trunk/cmake/modules/CMakeTestDCompiler.cmake =================================================================== --- trunk/cmake/modules/CMakeTestDCompiler.cmake 2010-02-17 21:41:03 UTC (rev 10804) +++ trunk/cmake/modules/CMakeTestDCompiler.cmake 2010-02-18 21:38:39 UTC (rev 10805) @@ -1,175 +0,0 @@ -# -# CMakeD - CMake module for D Language -# -# Copyright (c) 2007, Selman Ulug <sel...@gm...> -# Tim Burrell <tim...@gm...> -# -# All rights reserved. -# -# See Copyright.txt for details. -# -# Modified from CMake 2.6.5 CMakeTestCCompiler.cmake -# See http://www.cmake.org/HTML/Copyright.html for details -# - -# This file is used by EnableLanguage in cmGlobalGenerator to -# determine that that selected D compiler can actually compile -# and link the most basic of programs. If not, a fatal error -# is set and cmake stops processing commands and will not generate -# any makefiles or projects. - -IF(NOT CMAKE_D_COMPILER_WORKS) - MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER}") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - "int main(char[][] args)\n" - "{return args.sizeof-1;}\n") - STRING(REGEX MATCH "dmd" DMDTEST "${CMAKE_D_COMPILER}") - IF(DMDTEST STREQUAL "dmd") - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - OUTPUT_VARIABLE OUTPUT) - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a" - OUTPUT_VARIABLE OUTPUT) - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - ELSE(DMDTEST STREQUAL "dmd") - TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - OUTPUT_VARIABLE OUTPUT) - ENDIF(DMDTEST STREQUAL "dmd") - SET(C_TEST_WAS_RUN 1) -ENDIF(NOT CMAKE_D_COMPILER_WORKS) - -IF(NOT CMAKE_D_COMPILER_WORKS) - MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- broken") - message(STATUS "To force a specific D compiler set the DC environment variable") - message(STATUS " ie - export DC=\"/opt/dmd/bin/dmd\"") - message(STATUS "If the D path is not set please use the D_PATH variable") - message(STATUS " ie - export D_PATH=\"/opt/dmd\"") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the D compiler works failed with " - "the following output:\n${OUTPUT}\n\n") - MESSAGE(FATAL_ERROR "The D compiler \"${CMAKE_D_COMPILER}\" " - "is not able to compile a simple test program.\nIt fails " - "with the following output:\n ${OUTPUT}\n\n" - "CMake will not be able to correctly generate this project.") -ELSE(NOT CMAKE_D_COMPILER_WORKS) - IF(C_TEST_WAS_RUN) - MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- works") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the D compiler works passed with " - "the following output:\n${OUTPUT}\n\n") - ENDIF(C_TEST_WAS_RUN) - SET(CMAKE_D_COMPILER_WORKS 1 CACHE INTERNAL "") - # re-configure this file CMakeDCompiler.cmake so that it gets - # the value for CMAKE_SIZEOF_VOID_P - # configure variables set in this file for fast reload later on - IF(EXISTS ${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in) - CONFIGURE_FILE(${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE) - ELSE(EXISTS ${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in) - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE) - ENDIF(EXISTS ${CMAKE_MODULE_PATH}/CMakeDCompiler.cmake.in) -ENDIF(NOT CMAKE_D_COMPILER_WORKS) - -IF(NOT CMAKE_D_PHOBOS_WORKS) - MESSAGE(STATUS "Check for working Phobos") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - "import std.stdio;\n" - "int main(char[][] args)\n" - "{ writefln(\"%s\", args[0]); return args.sizeof-1;}\n") - IF(CMAKE_COMPILER_IS_GDC) - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - #CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos" - OUTPUT_VARIABLE OUTPUT) - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos" - OUTPUT_VARIABLE OUTPUT) - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - ELSE(CMAKE_COMPILER_IS_GDC) - IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - OUTPUT_VARIABLE OUTPUT) - ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a" - COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import" - OUTPUT_VARIABLE OUTPUT) - ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - ENDIF(CMAKE_COMPILER_IS_GDC) - SET(C_TEST_WAS_RUN 1) -ENDIF(NOT CMAKE_D_PHOBOS_WORKS) - -IF(NOT CMAKE_D_PHOBOS_WORKS) - MESSAGE(STATUS "Check for working Phobos -- unavailable") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if Phobos works failed with " - "the following output:\n${OUTPUT}\n\n") - #MESSAGE(FATAL_ERROR "Phobos does not work") -ELSE(NOT CMAKE_D_PHOBOS_WORKS) - IF(C_TEST_WAS_RUN) - MESSAGE(STATUS "Check for working Phobos -- works") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if Phobos works passed with " - "the following output:\n${OUTPUT}\n\n") - ENDIF(C_TEST_WAS_RUN) - SET(CMAKE_D_PHOBOS_WORKS 1 CACHE INTERNAL "") -ENDIF(NOT CMAKE_D_PHOBOS_WORKS) - -IF(NOT CMAKE_D_TANGO_WORKS) - MESSAGE(STATUS "Check for working Tango") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d - "import tango.io.Stdout;" - "int main(char[][] args)\n" - "{Stdout.newline();return args.sizeof-1;}\n") - IF(CMAKE_COMPILER_IS_GDC) - TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAK... [truncated message content] |
From: <ai...@us...> - 2010-03-05 19:24:00
|
Revision: 10851 http://plplot.svn.sourceforge.net/plplot/?rev=10851&view=rev Author: airwin Date: 2010-03-05 19:23:53 +0000 (Fri, 05 Mar 2010) Log Message: ----------- Implement test_octave_$device (e.g., test_octave_xwin) targets where $device is any of our interactive devices. Currently this runs all the "p" octave examples interactively for the given device and shows some bugs that will be discussed on list. Because of the bugs, the dependencies of the test_interactive target on these interactive octave testing targets has been temporarily commented out. Modified Paths: -------------- trunk/examples/CMakeLists.txt trunk/plplot_test/CMakeLists.txt trunk/plplot_test/plplot-test.sh.cmake Added Paths: ----------- trunk/plplot_test/test_octave_interactive.sh.in Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2010-03-05 19:16:05 UTC (rev 10850) +++ trunk/examples/CMakeLists.txt 2010-03-05 19:23:53 UTC (rev 10851) @@ -603,6 +603,25 @@ endif(CORE_BUILD) endif(device STREQUAL "tk") list(APPEND interactive_targets_LIST test_c_${device}) + + if(ENABLE_octave) + add_custom_target(test_octave_${device} + COMMAND ${CMAKE_COMMAND} -E echo "Generate interactive octave results for ${device} interactive device" + COMMAND env ${custom_env} ${custom_test_command} --verbose --interactive_octave --device=${device} + DEPENDS + ${interactive_device_depends_${device}} + VERBATIM + ) + if(device STREQUAL "tk") + if(CORE_BUILD) + add_dependencies(test_octave_tk tclIndex_tk tclIndex_tcl plserver xwin) + else(CORE_BUILD) + add_dependencies(test_octave_tk plserver xwin) + endif(CORE_BUILD) + endif(device STREQUAL "tk") + # Comment this out until interactive octave tests work better. + #list(APPEND interactive_targets_LIST test_octave_${device}) + endif(ENABLE_octave) endforeach(interactive_devices_info ${INTERACTIVE_DEVICES_LIST}) if(PLD_xcairo) Modified: trunk/plplot_test/CMakeLists.txt =================================================================== --- trunk/plplot_test/CMakeLists.txt 2010-03-05 19:16:05 UTC (rev 10850) +++ trunk/plplot_test/CMakeLists.txt 2010-03-05 19:23:53 UTC (rev 10851) @@ -49,6 +49,13 @@ ) list(APPEND SCRIPTS test_c_interactive.sh) + configure_file( + test_octave_interactive.sh.in + ${CMAKE_CURRENT_BINARY_DIR}/test_octave_interactive.sh + @ONLY + ) + list(APPEND SCRIPTS test_octave_interactive.sh) + add_test(examples_c ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=c" ) Modified: trunk/plplot_test/plplot-test.sh.cmake =================================================================== --- trunk/plplot_test/plplot-test.sh.cmake 2010-03-05 19:16:05 UTC (rev 10850) +++ trunk/plplot_test/plplot-test.sh.cmake 2010-03-05 19:23:53 UTC (rev 10851) @@ -60,6 +60,7 @@ Specify location where the resulting files are stored. Defaults to "." [--interactive] Run subset of C examples for interactive devices only. + [--interactive_octave] Run interactive octave examples for interactive devices only. [--verbose] Echo each PLplot example that is executed. [--debug="debug command"] Run examples with given debug command. @@ -100,6 +101,9 @@ --interactive) interactive=on ;; + --interactive_octave) + interactive_octave=on + ;; --verbose) export verbose_test=on ;; @@ -173,7 +177,7 @@ scripts_dir=`echo "$0" | sed 's:/[^/][^/]*$::'` fi -if [ "$interactive" = "on" ] ; then +if [ "$interactive" = "on" -o "$interactive_octave" = "on" ] ; then # List of interactive devices for PLplot that _might_ be enabled. PLD_aqt=@PLD_aqt@ PLD_qtwidget=@PLD_qtwidget@ @@ -207,9 +211,27 @@ fi status=0 - export cdir="$EXAMPLES_DIR"/c - echo "Testing subset of C examples for device $device" - script="$scripts_dir"/test_c_interactive.sh + if [ "$interactive" = "on" ] ; then + export cdir="$EXAMPLES_DIR"/c + echo "Testing subset of C examples for device $device" + script="$scripts_dir"/test_c_interactive.sh + else + # This case must be "$interactive_octave" = "on" + export options= + export octave=@OCTAVE@ + export octavedir=\ +"$EXAMPLES_DIR"/../bindings/octave:\ +"$SRC_EXAMPLES_DIR"/../bindings/octave/PLplot:\ +"$SRC_EXAMPLES_DIR"/../bindings/octave/PLplot/support:\ +"$SRC_EXAMPLES_DIR"/../bindings/octave/misc:\ +"$SRC_EXAMPLES_DIR"/octave:\ +"@PLPLOT_OCTAVE_DIR@":\ +"@PLPLOT_OCTAVE_DIR@"/support:\ +"@OCTAVE_M_DIR@"/PLplot:\ +"@OCTAVE_OCT_DIR@": + echo "Testing interactive octave examples for device $device" + script="$scripts_dir"/test_octave_interactive.sh + fi if [ "@WIN32@" != "1" ] ; then chmod +x "$script" fi Copied: trunk/plplot_test/test_octave_interactive.sh.in (from rev 10837, trunk/plplot_test/test_octave.sh.in) =================================================================== --- trunk/plplot_test/test_octave_interactive.sh.in (rev 0) +++ trunk/plplot_test/test_octave_interactive.sh.in 2010-03-05 19:23:53 UTC (rev 10851) @@ -0,0 +1,67 @@ +#!@SH_EXECUTABLE@ +# Test suite for interactive ("p??") octave examples. +# +# Copyright (C) 2004-2010 Alan W. Irwin +# Copyright (C) 2004 Rafael Laboissiere +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Library Public License as published +# by the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# This is called from plplot-test.sh with $octave, $octavedir, $options, +# and $device defined. + +# The following is only need for the build tree! It should has no effect +# when this script is launched from the install tree. +lang="o" +export lang +TOPDIR=`pwd`/.. +echo "$TOPDIR" +export LD_LIBRARY_PATH="$TOPDIR"/src:"$TOPDIR"/lib/csa:"$TOPDIR"/lib/nn + +# Launch an Octave script that exercises all the "p" demos. +$octave -f -q -p "$octavedir" <<EOF 2> test.error + +# Check verbose_test variable +if (strcmp(getenv("verbose_test"),"on") == 1) + verbose_test = 1; +else + verbose_test = 0; +endif + +plplot_stub; +t = split("$options", "-"); +if (t); t(1,:)=""; endif; +for i=1:rows(t) + tt = deblank (t(i,:)); len = length(tt); + ix = index(tt," "); + if (ix == 0); ix = len; len = 0; endif + plsetopt(tt(1:ix), tt(ix+1:len)); +endfor + +for i=[1:21] ; + if (verbose_test) + printf("p%d\n",i); + endif + figure(i,"$device",sprintf("${OUTPUT_DIR}/p%d%%n.$dsuffix",i)); + feval(sprintf("p%d",i)) + closefig +endfor +EOF +status_code=$? +cat test.error +if [ "$status_code" -ne 0 ] ; then + exit $status_code +fi Property changes on: trunk/plplot_test/test_octave_interactive.sh.in ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Revision Added: svn:mergeinfo + Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-03-07 00:43:22
|
Revision: 10858 http://plplot.svn.sourceforge.net/plplot/?rev=10858&view=rev Author: airwin Date: 2010-03-07 00:43:15 +0000 (Sun, 07 Mar 2010) Log Message: ----------- Introduce FORCE_OCAMLC option to force using ocamlc rather than ocamlopt (defaults to NO). Fix CMake logic bug for the case when OCAMLOPT is not true. Modified Paths: -------------- trunk/bindings/ocaml/plcairo/CMakeLists.txt trunk/cmake/modules/ocaml.cmake Modified: trunk/bindings/ocaml/plcairo/CMakeLists.txt =================================================================== --- trunk/bindings/ocaml/plcairo/CMakeLists.txt 2010-03-06 19:11:19 UTC (rev 10857) +++ trunk/bindings/ocaml/plcairo/CMakeLists.txt 2010-03-07 00:43:15 UTC (rev 10858) @@ -209,12 +209,14 @@ # file-dependency chains. Therefore, to avoid screwing up parallel # builds must serialize with target depends. add_dependencies(target_plcairo_cmi target_lib_plcairo_stubs) - # ocamlc + # ocamlc used regardless add_dependencies(target_plcairo_cmo target_plcairo_cmi) add_dependencies(target_plcairo_cma target_plcairo_cmo) - # ocamlopt - add_dependencies(target_plcairo_cmx target_plcairo_cmi) - add_dependencies(target_plcairo_cmxa target_plcairo_cmx) + # ocamlopt only used if OCAMLOPT is true. + if(OCAMLOPT) + add_dependencies(target_plcairo_cmx target_plcairo_cmi) + add_dependencies(target_plcairo_cmxa target_plcairo_cmx) + endif(OCAMLOPT) # Basic build done, now trying to finish up by adapting bits # and pieces of old build procedure below. Modified: trunk/cmake/modules/ocaml.cmake =================================================================== --- trunk/cmake/modules/ocaml.cmake 2010-03-06 19:11:19 UTC (rev 10857) +++ trunk/cmake/modules/ocaml.cmake 2010-03-07 00:43:15 UTC (rev 10858) @@ -67,7 +67,11 @@ endif(ENABLE_ocaml) if(ENABLE_ocaml) - find_program(OCAMLOPT NAMES ocamlopt.opt ocamlopt) + option(FORCE_OCAMLC "Force use of ocamlc rather than ocamlopt?" OFF) + if(NOT FORCE_OCAMLC) + find_program(OCAMLOPT NAMES ocamlopt.opt ocamlopt) + endif(NOT FORCE_OCAMLC) + if (OCAMLOPT) message(STATUS "OCAMLOPT = ${OCAMLOPT}") else (OCAMLOPT) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-03-13 23:37:36
|
Revision: 10864 http://plplot.svn.sourceforge.net/plplot/?rev=10864&view=rev Author: airwin Date: 2010-03-13 23:37:28 +0000 (Sat, 13 Mar 2010) Log Message: ----------- Apply patch from David MacMahon to support arbitrary storage of 2D user data. This is a roll-up of all previous PLplot patches related to supporting arbitrary storage of 2D user data. This patch is based on (and should apply cleanly to) svn trunk r10859. Adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbtrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t stucture of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ --- bindings/f77/sccont.c | 182 --------------------- bindings/f95/sccont.c | 182 --------------------- examples/c/x08c.c | 45 ++++-- include/plplot.h | 238 ++++++++++++++++++++++++++-- src/CMakeLists.txt | 1 + src/plcont.c | 207 +++++++++++++++++++++++- src/plf2ops.c | 426 +++++++++++++++++++++++++++++++++++++++++++++++++ src/plgridd.c | 120 ++++++++------ src/plimage.c | 49 +++++-- src/plot3d.c | 212 ++++++++++++++++--------- src/plshade.c | 81 ++++++++-- src/plvect.c | 17 +-- 12 files changed, 1200 insertions(+), 560 deletions(-) Modified Paths: -------------- trunk/bindings/f77/sccont.c trunk/bindings/f95/sccont.c trunk/examples/c/x08c.c trunk/include/plplot.h trunk/src/CMakeLists.txt trunk/src/plcont.c trunk/src/plfill.c trunk/src/plgridd.c trunk/src/plimage.c trunk/src/plot3d.c trunk/src/plshade.c trunk/src/plvect.c Modified: trunk/bindings/f77/sccont.c =================================================================== --- trunk/bindings/f77/sccont.c 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/bindings/f77/sccont.c 2010-03-13 23:37:28 UTC (rev 10864) @@ -40,188 +40,6 @@ } /*----------------------------------------------------------------------*\ - * pltr2f() - * - * Does linear interpolation from doubly dimensioned coord arrays - * (row dominant, i.e. Fortran ordering). - * - * This routine includes lots of checks for out of bounds. This would - * occur occasionally due to a bug in the contour plotter that is now fixed. - * If an out of bounds coordinate is obtained, the boundary value is provided - * along with a warning. These checks should stay since no harm is done if - * if everything works correctly. - \*----------------------------------------------------------------------*/ - -void -pltr2f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ) -{ - PLINT ul, ur, vl, vr; - PLFLT du, dv; - PLFLT xll, xlr, xrl, xrr; - PLFLT yll, ylr, yrl, yrr; - PLFLT xmin, xmax, ymin, ymax; - - PLcGrid *cgrid = (PLcGrid *) pltr_data; - PLFLT *xg = cgrid->xg; - PLFLT *yg = cgrid->yg; - PLINT nx = cgrid->nx; - PLINT ny = cgrid->ny; - - ul = (PLINT) x; - ur = ul + 1; - du = x - ul; - - vl = (PLINT) y; - vr = vl + 1; - dv = y - vl; - - xmin = 0; - xmax = nx - 1; - ymin = 0; - ymax = ny - 1; - - if ( x < xmin || x > xmax || y < ymin || y > ymax ) - { - plwarn( "pltr2f: Invalid coordinates" ); - - if ( x < xmin ) - { - if ( y < ymin ) - { - *tx = *xg; - *ty = *yg; - } - else if ( y > ymax ) - { - *tx = *( xg + ( ny - 1 ) * nx ); - *ty = *( yg + ( ny - 1 ) * nx ); - } - else - { - ul = 0; - xll = *( xg + ul + vl * nx ); - yll = *( yg + ul + vl * nx ); - xlr = *( xg + ul + vr * nx ); - ylr = *( yg + ul + vr * nx ); - - *tx = xll * ( 1 - dv ) + xlr * ( dv ); - *ty = yll * ( 1 - dv ) + ylr * ( dv ); - } - } - else if ( x > xmax ) - { - if ( y < ymin ) - { - *tx = *( xg + ( nx - 1 ) ); - *ty = *( yg + ( nx - 1 ) ); - } - else if ( y > ymax ) - { - *tx = *( xg + ( nx - 1 ) + ( ny - 1 ) * nx ); - *ty = *( yg + ( nx - 1 ) + ( ny - 1 ) * nx ); - } - else - { - ul = nx - 1; - xll = *( xg + ul + vl * nx ); - yll = *( yg + ul + vl * nx ); - xlr = *( xg + ul + vr * nx ); - ylr = *( yg + ul + vr * nx ); - - *tx = xll * ( 1 - dv ) + xlr * ( dv ); - *ty = yll * ( 1 - dv ) + ylr * ( dv ); - } - } - else - { - if ( y < ymin ) - { - vl = 0; - xll = *( xg + ul + vl * nx ); - xrl = *( xg + ur + vl * nx ); - yll = *( yg + ul + vl * nx ); - yrl = *( yg + ur + vl * nx ); - - *tx = xll * ( 1 - du ) + xrl * ( du ); - *ty = yll * ( 1 - du ) + yrl * ( du ); - } - else if ( y > ymax ) - { - vr = ny - 1; - xlr = *( xg + ul + vr * nx ); - xrr = *( xg + ur + vr * nx ); - ylr = *( yg + ul + vr * nx ); - yrr = *( yg + ur + vr * nx ); - - *tx = xlr * ( 1 - du ) + xrr * ( du ); - *ty = ylr * ( 1 - du ) + yrr * ( du ); - } - } - } - -/* Normal case. - * Look up coordinates in row-dominant array. - * Have to handle right boundary specially -- if at the edge, we'd - * better not reference the out of bounds point. */ - - else - { - xll = *( xg + ul + vl * nx ); - yll = *( yg + ul + vl * nx ); - -/* ur is out of bounds */ - - if ( ur == nx && vr < ny ) - { - xlr = *( xg + ul + vr * nx ); - ylr = *( yg + ul + vr * nx ); - - *tx = xll * ( 1 - dv ) + xlr * ( dv ); - *ty = yll * ( 1 - dv ) + ylr * ( dv ); - } - -/* vr is out of bounds */ - - else if ( ur < nx && vr == ny ) - { - xrl = *( xg + ur + vl * nx ); - yrl = *( yg + ur + vl * nx ); - - *tx = xll * ( 1 - du ) + xrl * ( du ); - *ty = yll * ( 1 - du ) + yrl * ( du ); - } - -/* both ur and vr are out of bounds */ - - else if ( ur == nx && vr == ny ) - { - *tx = xll; - *ty = yll; - } - -/* everything in bounds */ - - else - { - xrl = *( xg + ur + vl * nx ); - xlr = *( xg + ul + vr * nx ); - xrr = *( xg + ur + vr * nx ); - - yrl = *( yg + ur + vl * nx ); - ylr = *( yg + ul + vr * nx ); - yrr = *( yg + ur + vr * nx ); -/* INDENT OFF */ - *tx = xll * ( 1 - du ) * ( 1 - dv ) + xlr * ( 1 - du ) * ( dv ) + - xrl * ( du ) * ( 1 - dv ) + xrr * ( du ) * ( dv ); - - *ty = yll * ( 1 - du ) * ( 1 - dv ) + ylr * ( 1 - du ) * ( dv ) + - yrl * ( du ) * ( 1 - dv ) + yrr * ( du ) * ( dv ); -/* INDENT ON */ - } - } -} - -/*----------------------------------------------------------------------*\ * Contour plotter front-ends. * These specify the row-dominant function evaluator in the plfcont * argument list. NO TRANSPOSE IS NECESSARY. The routines are as follows: Modified: trunk/bindings/f95/sccont.c =================================================================== --- trunk/bindings/f95/sccont.c 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/bindings/f95/sccont.c 2010-03-13 23:37:28 UTC (rev 10864) @@ -40,188 +40,6 @@ } /*----------------------------------------------------------------------*\ - * pltr2f() - * - * Does linear interpolation from doubly dimensioned coord arrays - * (row dominant, i.e. Fortran ordering). - * - * This routine includes lots of checks for out of bounds. This would - * occur occasionally due to a bug in the contour plotter that is now fixed. - * If an out of bounds coordinate is obtained, the boundary value is provided - * along with a warning. These checks should stay since no harm is done if - * if everything works correctly. - \*----------------------------------------------------------------------*/ - -void -pltr2f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ) -{ - PLINT ul, ur, vl, vr; - PLFLT du, dv; - PLFLT xll, xlr, xrl, xrr; - PLFLT yll, ylr, yrl, yrr; - PLFLT xmin, xmax, ymin, ymax; - - PLcGrid *cgrid = (PLcGrid *) pltr_data; - PLFLT *xg = cgrid->xg; - PLFLT *yg = cgrid->yg; - PLINT nx = cgrid->nx; - PLINT ny = cgrid->ny; - - ul = (PLINT) x; - ur = ul + 1; - du = x - ul; - - vl = (PLINT) y; - vr = vl + 1; - dv = y - vl; - - xmin = 0; - xmax = nx - 1; - ymin = 0; - ymax = ny - 1; - - if ( x < xmin || x > xmax || y < ymin || y > ymax ) - { - plwarn( "pltr2f: Invalid coordinates" ); - - if ( x < xmin ) - { - if ( y < ymin ) - { - *tx = *xg; - *ty = *yg; - } - else if ( y > ymax ) - { - *tx = *( xg + ( ny - 1 ) * nx ); - *ty = *( yg + ( ny - 1 ) * nx ); - } - else - { - ul = 0; - xll = *( xg + ul + vl * nx ); - yll = *( yg + ul + vl * nx ); - xlr = *( xg + ul + vr * nx ); - ylr = *( yg + ul + vr * nx ); - - *tx = xll * ( 1 - dv ) + xlr * ( dv ); - *ty = yll * ( 1 - dv ) + ylr * ( dv ); - } - } - else if ( x > xmax ) - { - if ( y < ymin ) - { - *tx = *( xg + ( nx - 1 ) ); - *ty = *( yg + ( nx - 1 ) ); - } - else if ( y > ymax ) - { - *tx = *( xg + ( nx - 1 ) + ( ny - 1 ) * nx ); - *ty = *( yg + ( nx - 1 ) + ( ny - 1 ) * nx ); - } - else - { - ul = nx - 1; - xll = *( xg + ul + vl * nx ); - yll = *( yg + ul + vl * nx ); - xlr = *( xg + ul + vr * nx ); - ylr = *( yg + ul + vr * nx ); - - *tx = xll * ( 1 - dv ) + xlr * ( dv ); - *ty = yll * ( 1 - dv ) + ylr * ( dv ); - } - } - else - { - if ( y < ymin ) - { - vl = 0; - xll = *( xg + ul + vl * nx ); - xrl = *( xg + ur + vl * nx ); - yll = *( yg + ul + vl * nx ); - yrl = *( yg + ur + vl * nx ); - - *tx = xll * ( 1 - du ) + xrl * ( du ); - *ty = yll * ( 1 - du ) + yrl * ( du ); - } - else if ( y > ymax ) - { - vr = ny - 1; - xlr = *( xg + ul + vr * nx ); - xrr = *( xg + ur + vr * nx ); - ylr = *( yg + ul + vr * nx ); - yrr = *( yg + ur + vr * nx ); - - *tx = xlr * ( 1 - du ) + xrr * ( du ); - *ty = ylr * ( 1 - du ) + yrr * ( du ); - } - } - } - -/* Normal case. - * Look up coordinates in row-dominant array. - * Have to handle right boundary specially -- if at the edge, we'd - * better not reference the out of bounds point. */ - - else - { - xll = *( xg + ul + vl * nx ); - yll = *( yg + ul + vl * nx ); - -/* ur is out of bounds */ - - if ( ur == nx && vr < ny ) - { - xlr = *( xg + ul + vr * nx ); - ylr = *( yg + ul + vr * nx ); - - *tx = xll * ( 1 - dv ) + xlr * ( dv ); - *ty = yll * ( 1 - dv ) + ylr * ( dv ); - } - -/* vr is out of bounds */ - - else if ( ur < nx && vr == ny ) - { - xrl = *( xg + ur + vl * nx ); - yrl = *( yg + ur + vl * nx ); - - *tx = xll * ( 1 - du ) + xrl * ( du ); - *ty = yll * ( 1 - du ) + yrl * ( du ); - } - -/* both ur and vr are out of bounds */ - - else if ( ur == nx && vr == ny ) - { - *tx = xll; - *ty = yll; - } - -/* everything in bounds */ - - else - { - xrl = *( xg + ur + vl * nx ); - xlr = *( xg + ul + vr * nx ); - xrr = *( xg + ur + vr * nx ); - - yrl = *( yg + ur + vl * nx ); - ylr = *( yg + ul + vr * nx ); - yrr = *( yg + ur + vr * nx ); -/* INDENT OFF */ - *tx = xll * ( 1 - du ) * ( 1 - dv ) + xlr * ( 1 - du ) * ( dv ) + - xrl * ( du ) * ( 1 - dv ) + xrr * ( du ) * ( dv ); - - *ty = yll * ( 1 - du ) * ( 1 - dv ) + ylr * ( 1 - du ) * ( dv ) + - yrl * ( du ) * ( 1 - dv ) + yrr * ( du ) * ( dv ); -/* INDENT ON */ - } - } -} - -/*----------------------------------------------------------------------*\ * Contour plotter front-ends. * These specify the row-dominant function evaluator in the plfcont * argument list. NO TRANSPOSE IS NECESSARY. The routines are as follows: Modified: trunk/examples/c/x08c.c =================================================================== --- trunk/examples/c/x08c.c 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/examples/c/x08c.c 2010-03-13 23:37:28 UTC (rev 10864) @@ -26,6 +26,10 @@ #include "plcdemos.h" +/* plexit not declared in public header! */ +PLDLLIMPEXP void +plexit( const char *errormsg ); + #define XPTS 35 /* Data points in x */ #define YPTS 46 /* Data points in y */ @@ -120,14 +124,15 @@ int main( int argc, const char *argv[] ) { - int i, j, k; - PLFLT *x, *y, **z; - PLFLT xx, yy, r; - PLINT ifshade; - PLFLT zmin, zmax, step; - PLFLT clevel[LEVELS]; - PLINT nlevel = LEVELS; - int rosen = 1; + int i, j, k; + PLFLT *x, *y, **z, *z_row_major, *z_col_major; + PLfGrid2 grid_c, grid_row_major, grid_col_major; + PLFLT xx, yy, r; + PLINT ifshade; + PLFLT zmin, zmax, step; + PLFLT clevel[LEVELS]; + PLINT nlevel = LEVELS; + int rosen = 1; /* Parse and process command line arguments */ plMergeOpts( options, "x08c options", NULL ); @@ -145,7 +150,17 @@ y = (PLFLT *) calloc( YPTS, sizeof ( PLFLT ) ); plAlloc2dGrid( &z, XPTS, YPTS ); + z_row_major = (PLFLT *) malloc( XPTS * YPTS * sizeof ( PLFLT ) ); + z_col_major = (PLFLT *) malloc( XPTS * YPTS * sizeof ( PLFLT ) ); + if ( !z_row_major || !z_col_major ) + plexit( "Memory allocation error" ); + grid_c.f = z; + grid_row_major.f = (PLFLT **) z_row_major; + grid_col_major.f = (PLFLT **) z_col_major; + grid_c.nx = grid_row_major.nx = grid_col_major.nx = XPTS; + grid_c.ny = grid_row_major.ny = grid_col_major.ny = YPTS; + for ( i = 0; i < XPTS; i++ ) { x[i] = ( (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ) ); @@ -169,6 +184,7 @@ if ( rosen ) { z[i][j] = pow( 1. - xx, 2. ) + 100. * pow( yy - pow( xx, 2. ), 2. ); + /* The log argument may be zero for just the right grid. */ if ( z[i][j] > 0. ) z[i][j] = log( z[i][j] ); @@ -180,6 +196,9 @@ r = sqrt( xx * xx + yy * yy ); z[i][j] = exp( -r * r ) * cos( 2.0 * M_PI * r ); } + + z_row_major[i * YPTS + j] = z[i][j]; + z_col_major[i + XPTS * j] = z[i][j]; } } @@ -213,22 +232,22 @@ if ( ifshade == 0 ) /* diffuse light surface plot */ { cmap1_init( 1 ); - plsurf3d( x, y, z, XPTS, YPTS, 0, NULL, 0 ); + plfsurf3d( x, y, plf2ops_c(), (PLPointer) z, XPTS, YPTS, 0, NULL, 0 ); } else if ( ifshade == 1 ) /* magnitude colored plot */ { cmap1_init( 0 ); - plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR, NULL, 0 ); + plfsurf3d( x, y, plf2ops_grid_c(), ( PLPointer ) & grid_c, XPTS, YPTS, MAG_COLOR, NULL, 0 ); } else if ( ifshade == 2 ) /* magnitude colored plot with faceted squares */ { cmap1_init( 0 ); - plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | FACETED, NULL, 0 ); + plfsurf3d( x, y, plf2ops_grid_row_major(), ( PLPointer ) & grid_row_major, XPTS, YPTS, MAG_COLOR | FACETED, NULL, 0 ); } else /* magnitude colored plot with contours */ { cmap1_init( 0 ); - plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | SURF_CONT | BASE_CONT, clevel, nlevel ); + plfsurf3d( x, y, plf2ops_grid_col_major(), ( PLPointer ) & grid_col_major, XPTS, YPTS, MAG_COLOR | SURF_CONT | BASE_CONT, clevel, nlevel ); } } } @@ -238,6 +257,8 @@ free( (void *) x ); free( (void *) y ); plFree2dGrid( z, XPTS, YPTS ); + free( (void *) z_row_major ); + free( (void *) z_col_major ); plend(); Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/include/plplot.h 2010-03-13 23:37:28 UTC (rev 10864) @@ -191,7 +191,6 @@ typedef PLINT PLBOOL; /* For passing user data, as with X's XtPointer */ - typedef void* PLPointer; /*--------------------------------------------------------------------------*\ @@ -527,6 +526,42 @@ PLINT nValues; } PLAttribute; +/* + * typedefs for access methods for arbitrary (i.e. user defined) data storage + */ + +/* + * This type of struct holds pointers to functions that are used to get, set, + * modify, and test individual 2-D data points referenced by a PLPointer. How + * the PLPointer is used depends entirely on the functions that implement the + * various operations. Certain common data representations have predefined + * instances of this structure prepopulated with pointers to predefined + * functions. + */ + +typedef struct +{ + PLFLT ( *get )( PLPointer p, PLINT ix, PLINT iy ); + PLFLT ( *set )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); + PLFLT ( *add )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); + PLFLT ( *sub )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); + PLFLT ( *mul )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); + PLFLT ( *div )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); + PLINT ( *is_nan )( PLPointer p, PLINT ix, PLINT iy ); + void ( *minmax )( PLPointer p, PLINT nx, PLINT ny, PLFLT *zmim, PLFLT *zmax ); + /* + * f2eval is backwards compatible signature for "f2eval" functions that + * existed before plf2ops "operator function families" were used. + */ + PLFLT ( *f2eval )( PLINT ix, PLINT iy, PLPointer p ); +} plf2ops_t; + +/* + * A typedef to facilitate declaration of a pointer to a plfops_t structure. + */ + +typedef plf2ops_t * PLF2OPS; + /*--------------------------------------------------------------------------*\ * BRAINDEAD-ness * @@ -1079,6 +1114,11 @@ PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data ); +PLDLLIMPEXP void +plfgriddata( PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, + PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, + PLF2OPS zops, PLPointer zgp, PLINT type, PLFLT data ); + /* type of gridding algorithm for plgriddata() */ #define GRID_CSA 1 /* Bivariate Cubic Spline approximation */ @@ -1199,12 +1239,24 @@ PLDLLIMPEXP void c_plmesh( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt ); +/* Like plmesh, but uses an evaluator function to access z data from zp */ + +PLDLLIMPEXP void +plfmesh( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt ); + /* Plots a mesh representation of the function z[x][y] with contour */ PLDLLIMPEXP void c_plmeshc( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); +/* Like plmeshc, but uses an evaluator function to access z data from zp */ + +PLDLLIMPEXP void +plfmeshc( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); + /* Creates a new stream and makes it the default. */ PLDLLIMPEXP void @@ -1228,6 +1280,12 @@ c_plot3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); +/* Like plot3d, but uses an evaluator function to access z data from zp */ + +PLDLLIMPEXP void +plfplot3d( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); + /* Plots a 3-d representation of the function z[x][y] with contour. */ PLDLLIMPEXP void @@ -1235,6 +1293,12 @@ PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); +/* Like plot3dc, but uses an evaluator function to access z data from zp */ + +PLDLLIMPEXP void +plfplot3dc( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); + /* Plots a 3-d representation of the function z[x][y] with contour and * y index limits. */ @@ -1244,6 +1308,14 @@ PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax ); +/* Like plot3dcl, but uses an evaluator function to access z data from zp */ + +PLDLLIMPEXP void +plfplot3dcl( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, + PLFLT *clevel, PLINT nlevel, + PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax ); + /* * definitions for the opt argument in plot3dc() and plsurf3d() * @@ -1505,6 +1577,16 @@ PLPointer pltr_data ); PLDLLIMPEXP void +plfshades( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT ( *defined )( PLFLT, PLFLT ), + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + +PLDLLIMPEXP void plfshade( PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), PLPointer f2eval_data, PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ), @@ -1519,6 +1601,18 @@ void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); +PLDLLIMPEXP void +plfshade1( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT ( *defined )( PLFLT, PLFLT ), + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + /* Setup a user-provided custom labeling function */ PLDLLIMPEXP void @@ -1621,6 +1715,18 @@ void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); +/* + * Like plimagefr, but uses an evaluator function to access image data from + * idatap. getminmax is only used if zmin == zmax. + */ + +PLDLLIMPEXP void +plfimagefr( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + /* plots a 2d image (or a matrix too large for plshade() ) - colors * automatically scaled */ @@ -1629,6 +1735,16 @@ PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); +/* + * Like plimage, but uses an operator functions to access image data from + * idatap. + */ + +PLDLLIMPEXP void +plfimage( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); + /* Set up a new line style */ PLDLLIMPEXP void @@ -1640,6 +1756,12 @@ c_plsurf3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); +/* Like plsurf3d, but uses an evaluator function to access z data from zp */ + +PLDLLIMPEXP void +plfsurf3d( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); + /* Plots the 3d surface representation of the function z[x][y] with y * index limits. */ @@ -1648,7 +1770,14 @@ PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax ); +/* Like plsurf3dl, but uses an evaluator function to access z data from zp */ + PLDLLIMPEXP void +plfsurf3dl( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT opt, PLFLT *clevel, PLINT nlevel, + PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax ); + +PLDLLIMPEXP void c_plsvect( PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill ); /* Sets the edges of the viewport to the specified absolute coordinates */ @@ -1707,7 +1836,18 @@ void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); +/* + * Routine to plot a vector array with arbitrary coordinate + * and vector transformations + */ PLDLLIMPEXP void +plfvect( PLFLT ( *getuv )( PLINT, PLINT, PLPointer ), + PLPointer up, PLPointer vp, + PLINT nx, PLINT ny, PLFLT scale, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + +PLDLLIMPEXP void c_plvpas( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect ); /* Creates a viewport with the specified normalized subpage coordinates. */ @@ -1826,33 +1966,105 @@ PLDLLIMPEXP void pltr2p( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ); -/* Identity transformation for plots from Fortran. */ - -PLDLLIMPEXP void -pltr0f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ); - /* Does linear interpolation from doubly dimensioned coord arrays */ /* (row dominant, i.e. Fortran ordering). */ PLDLLIMPEXP void pltr2f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ); -/* Function evaluators */ +/* + * Returns a pointer to a plf2ops_t stucture with pointers to functions for + * accessing 2-D data referenced as (PLFLT **), such as the C variable z + * declared as... + * + * PLFLT z[nx][ny]; + */ -/* Does a lookup from a 2d function array. Array is of type (PLFLT **), */ -/* and is column dominant (normal C ordering). */ +PLDLLIMPEXP PLF2OPS +plf2ops_c(); +/* + * Returns a pointer to a plf2ops_t stucture with pointers to functions for accessing 2-D data + * referenced as (PLfGrid2 *), where the PLfGrid2's "f" is treated as type + * (PLFLT **). + */ + +PLDLLIMPEXP PLF2OPS +plf2ops_grid_c(); + +/* + * Returns a pointer to a plf2ops_t stucture with pointers to functions for + * accessing 2-D data stored in (PLfGrid2 *), with the PLfGrid2's "f" field + * treated as type (PLFLT *) pointing to 2-D data stored in row-major order. + * In the context of plotting, it might be easier to think of it as "X-major" + * order. In this ordering, values for a single X index are stored in + * consecutive memory locations. + */ + +PLDLLIMPEXP PLF2OPS +plf2ops_grid_row_major(); + +/* + * Returns a pointer to a plf2ops_t stucture with pointers to functions for + * accessing 2-D data stored in (PLfGrid2 *), with the PLfGrid2's "f" field + * treated as type (PLFLT *) pointing to 2-D data stored in column-major order. + * In the context of plotting, it might be easier to think of it as "Y-major" + * order. In this ordering, values for a single Y index are stored in + * consecutive memory locations. + */ + +PLDLLIMPEXP PLF2OPS +plf2ops_grid_col_major(); + + +/* Function evaluators (Should these be deprecated in favor of plf2ops?) */ + +/* + * Does a lookup from a 2d function array. plf2eval_data is treated as type + * (PLFLT **) and data for (ix,iy) is returned from... + * + * plf2eval_data[ix][iy]; + */ + PLDLLIMPEXP PLFLT +plf2eval1( PLINT ix, PLINT iy, PLPointer plf2eval_data ); + +/* + * Does a lookup from a 2d function array. plf2eval_data is treated as type + * (PLfGrid2 *) and data for (ix,iy) is returned from... + * + * plf2eval_data->f[ix][iy]; + */ + +PLDLLIMPEXP PLFLT plf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data ); -/* Does a lookup from a 2d function array. Array is of type (PLFLT *), */ -/* and is column dominant (normal C ordering). */ +/* + * Does a lookup from a 2d function array. plf2eval_data is treated as type + * (PLfGrid *) and data for (ix,iy) is returned from... + * + * plf2eval_data->f[ix * plf2eval_data->ny + iy]; + * + * This is commonly called "row-major order", but in the context of plotting, + * it might be easier to think of it as "X-major order". In this ordering, + * values for a single X index are stored in consecutive memory locations. + * This is also known as C ordering. + */ PLDLLIMPEXP PLFLT plf2eval( PLINT ix, PLINT iy, PLPointer plf2eval_data ); -/* Does a lookup from a 2d function array. Array is of type (PLFLT *), */ -/* and is row dominant (Fortran ordering). */ +/* + * Does a lookup from a 2d function array. plf2eval_data is treated as type + * (PLfGrid *) and data for (ix,iy) is returned from... + * + * plf2eval_data->f[ix + iy * plf2eval_data->nx]; + * + * This is commonly called "column-major order", but in the context of + * plotting, it might be easier to think of it as "Y-major order". In this + * ordering, values for a single Y index are stored in consecutive memory + * locations. This is also known as FORTRAN ordering. + */ PLDLLIMPEXP PLFLT plf2evalr( PLINT ix, PLINT iy, PLPointer plf2eval_data ); Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/src/CMakeLists.txt 2010-03-13 23:37:28 UTC (rev 10864) @@ -31,6 +31,7 @@ plcvt.c pldeprecated.c pldtik.c + plf2ops.c plfill.c plfreetype.c plgradient.c Modified: trunk/src/plcont.c =================================================================== --- trunk/src/plcont.c 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/src/plcont.c 2010-03-13 23:37:28 UTC (rev 10864) @@ -405,13 +405,29 @@ return ( ( y - plsc->wpyoff ) / plsc->wpyscl ); } +/*--------------------------------------------------------------------------*\ + * plf2eval1() + * + * Does a lookup from a 2d function array. Array is of type (PLFLT **), + * and is column dominant (normal C ordering). + \*--------------------------------------------------------------------------*/ +PLFLT +plf2eval1( PLINT ix, PLINT iy, PLPointer plf2eval_data ) +{ + PLFLT value; + PLFLT **z = (PLFLT **) plf2eval_data; + value = z[ix][iy]; + + return value; +} + /*--------------------------------------------------------------------------*\ * plf2eval2() * - * Does a lookup from a 2d function array. Array is of type (PLFLT **), - * and is column dominant (normal C ordering). + * Does a lookup from a 2d function array. plf2eval_data is treated as type + * (PLfGrid2 *). \*--------------------------------------------------------------------------*/ PLFLT @@ -501,8 +517,6 @@ void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ) { - PLfGrid2 grid; - if ( pltr == NULL ) { /* If pltr is undefined, abort with an error. */ @@ -510,8 +524,7 @@ return; } - grid.f = f; - plfcont( plf2eval2, ( PLPointer ) & grid, + plfcont( plf2eval1, ( PLPointer ) f, nx, ny, kx, lx, ky, ly, clevel, nlevel, pltr, pltr_data ); } @@ -1261,3 +1274,185 @@ } } } + +/*----------------------------------------------------------------------*\ + * pltr2f() + * + * Does linear interpolation from doubly dimensioned coord arrays + * (row dominant, i.e. Fortran ordering). + * + * This routine includes lots of checks for out of bounds. This would + * occur occasionally due to a bug in the contour plotter that is now fixed. + * If an out of bounds coordinate is obtained, the boundary value is provided + * along with a warning. These checks should stay since no harm is done if + * if everything works correctly. + \*----------------------------------------------------------------------*/ + +void +pltr2f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ) +{ + PLINT ul, ur, vl, vr; + PLFLT du, dv; + PLFLT xll, xlr, xrl, xrr; + PLFLT yll, ylr, yrl, yrr; + PLFLT xmin, xmax, ymin, ymax; + + PLcGrid *cgrid = (PLcGrid *) pltr_data; + PLFLT *xg = cgrid->xg; + PLFLT *yg = cgrid->yg; + PLINT nx = cgrid->nx; + PLINT ny = cgrid->ny; + + ul = (PLINT) x; + ur = ul + 1; + du = x - ul; + + vl = (PLINT) y; + vr = vl + 1; + dv = y - vl; + + xmin = 0; + xmax = nx - 1; + ymin = 0; + ymax = ny - 1; + + if ( x < xmin || x > xmax || y < ymin || y > ymax ) + { + plwarn( "pltr2f: Invalid coordinates" ); + + if ( x < xmin ) + { + if ( y < ymin ) + { + *tx = *xg; + *ty = *yg; + } + else if ( y > ymax ) + { + *tx = *( xg + ( ny - 1 ) * nx ); + *ty = *( yg + ( ny - 1 ) * nx ); + } + else + { + ul = 0; + xll = *( xg + ul + vl * nx ); + yll = *( yg + ul + vl * nx ); + xlr = *( xg + ul + vr * nx ); + ylr = *( yg + ul + vr * nx ); + + *tx = xll * ( 1 - dv ) + xlr * ( dv ); + *ty = yll * ( 1 - dv ) + ylr * ( dv ); + } + } + else if ( x > xmax ) + { + if ( y < ymin ) + { + *tx = *( xg + ( nx - 1 ) ); + *ty = *( yg + ( nx - 1 ) ); + } + else if ( y > ymax ) + { + *tx = *( xg + ( nx - 1 ) + ( ny - 1 ) * nx ); + *ty = *( yg + ( nx - 1 ) + ( ny - 1 ) * nx ); + } + else + { + ul = nx - 1; + xll = *( xg + ul + vl * nx ); + yll = *( yg + ul + vl * nx ); + xlr = *( xg + ul + vr * nx ); + ylr = *( yg + ul + vr * nx ); + + *tx = xll * ( 1 - dv ) + xlr * ( dv ); + *ty = yll * ( 1 - dv ) + ylr * ( dv ); + } + } + else + { + if ( y < ymin ) + { + vl = 0; + xll = *( xg + ul + vl * nx ); + xrl = *( xg + ur + vl * nx ); + yll = *( yg + ul + vl * nx ); + yrl = *( yg + ur + vl * nx ); + + *tx = xll * ( 1 - du ) + xrl * ( du ); + *ty = yll * ( 1 - du ) + yrl * ( du ); + } + else if ( y > ymax ) + { + vr = ny - 1; + xlr = *( xg + ul + vr * nx ); + xrr = *( xg + ur + vr * nx ); + ylr = *( yg + ul + vr * nx ); + yrr = *( yg + ur + vr * nx ); + + *tx = xlr * ( 1 - du ) + xrr * ( du ); + *ty = ylr * ( 1 - du ) + yrr * ( du ); + } + } + } + +/* Normal case. + * Look up coordinates in row-dominant array. + * Have to handle right boundary specially -- if at the edge, we'd + * better not reference the out of bounds point. */ + + else + { + xll = *( xg + ul + vl * nx ); + yll = *( yg + ul + vl * nx ); + +/* ur is out of bounds */ + + if ( ur == nx && vr < ny ) + { + xlr = *( xg + ul + vr * nx ); + ylr = *( yg + ul + vr * nx ); + + *tx = xll * ( 1 - dv ) + xlr * ( dv ); + *ty = yll * ( 1 - dv ) + ylr * ( dv ); + } + +/* vr is out of bounds */ + + else if ( ur < nx && vr == ny ) + { + xrl = *( xg + ur + vl * nx ); + yrl = *( yg + ur + vl * nx ); + + *tx = xll * ( 1 - du ) + xrl * ( du ); + *ty = yll * ( 1 - du ) + yrl * ( du ); + } + +/* both ur and vr are out of bounds */ + + else if ( ur == nx && vr == ny ) + { + *tx = xll; + *ty = yll; + } + +/* everything in bounds */ + + else + { + xrl = *( xg + ur + vl * nx ); + xlr = *( xg + ul + vr * nx ); + xrr = *( xg + ur + vr * nx ); + + yrl = *( yg + ur + vl * nx ); + ylr = *( yg + ul + vr * nx ); + yrr = *( yg + ur + vr * nx ); +/* INDENT OFF */ + *tx = xll * ( 1 - du ) * ( 1 - dv ) + xlr * ( 1 - du ) * ( dv ) + + xrl * ( du ) * ( 1 - dv ) + xrr * ( du ) * ( dv ); + + *ty = yll * ( 1 - du ) * ( 1 - dv ) + ylr * ( 1 - du ) * ( dv ) + + yrl * ( du ) * ( 1 - dv ) + yrr * ( du ) * ( dv ); +/* INDENT ON */ + } + } +} Modified: trunk/src/plfill.c =================================================================== --- trunk/src/plfill.c 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/src/plfill.c 2010-03-13 23:37:28 UTC (rev 10864) @@ -1895,9 +1895,10 @@ status = status | PL_NEAR_PARALLEL; else status = status | PL_PARALLEL; - /* Choice of intersect is arbitrary in this case. Choose A1, A2, - * B1, or B2 (in that order) if any of them lie inside or near - * the other line segment. Otherwise, choose the average point. */ + /* Choice of intersect is arbitrary in this case. Choose A1 + * A2, B1, or B2 (in that order) if any of them lie inside or + * near the other line segment. Otherwise, choose the average + * point. */ if ( ( BETW_NBCC( xA1, xB1, xB2 ) && BETW_NBCC( yA1, yB1, yB2 ) ) ) { fxintersect = xA1; @@ -1945,11 +1946,11 @@ * Find out which. */ if ( fabs( fxintersect - xA1 ) <= PL_NBCC && fabs( fyintersect - yA1 ) <= PL_NBCC ) status = status | PL_NEAR_A1; - else if ( fabs( fxintersect - xA2 ) <= PL_NBCC && fabs( fyintersect - yA2 ) <= PL_NBCC ) + if ( fabs( fxintersect - xA2 ) <= PL_NBCC && fabs( fyintersect - yA2 ) <= PL_NBCC ) status = status | PL_NEAR_A2; - else if ( fabs( fxintersect - xB1 ) <= PL_NBCC && fabs( fyintersect - yB1 ) <= PL_NBCC ) + if ( fabs( fxintersect - xB1 ) <= PL_NBCC && fabs( fyintersect - yB1 ) <= PL_NBCC ) status = status | PL_NEAR_B1; - else if ( fabs( fxintersect - xB2 ) <= PL_NBCC && fabs( fyintersect - yB2 ) <= PL_NBCC ) + if ( fabs( fxintersect - xB2 ) <= PL_NBCC && fabs( fyintersect - yB2 ) <= PL_NBCC ) status = status | PL_NEAR_B2; /* N.B. if none of the above conditions hold then status remains at * zero to signal we have a definite crossing. */ @@ -2021,6 +2022,13 @@ int i1m1, i2, i2m1, ifnotcrossed; int ifxsort, ifascend, count_crossings = 0, status = 0; PLINT xintersect, yintersect; + PLINT ifnear_a1, ifnear_a2, ifnear_a, ifnear_b1, ifnear_b2, ifnear_b; + PLINT crossing_index[4]; + /* The following are floating point to avoid integer overflows while + * still having exact arithmetic (except for very large values beyond + * the 53 bits of the significand). */ + PLFLT xline, yline, xpoint0, ypoint0, xpoint1, ypoint1, + inprod0, inprod1, product_NBCC; i1m1 = i1 - 1; if ( i1m1 < 0 ) @@ -2053,7 +2061,124 @@ ifnotcrossed = notcrossed( &xintersect, &yintersect, x1[i1m1], y1[i1m1], x1[i1], y1[i1], x2[i2m1], y2[i2m1], x2[i2], y2[i2] ); + if ( ifnotcrossed && !( ifnotcrossed & ( PL_PARALLEL | PL_NEAR_PARALLEL | PL_NOT_CROSSED ) ) ) + { + /* intersection near at least one of the vertices, but not + * near parallel and not parallel */ + ifnear_a1 = ifnotcrossed & PL_NEAR_A1; + ifnear_a2 = ifnotcrossed & PL_NEAR_A2; + ifnear_a = ifnotcrossed & ( PL_NEAR_A1 | PL_NEAR_A2 ); + ifnear_b1 = ifnotcrossed & PL_NEAR_B1; + ifnear_b2 = ifnotcrossed & PL_NEAR_B2; + ifnear_b = ifnotcrossed & ( PL_NEAR_B1 | PL_NEAR_B2 ); + if ( ( ifnear_a1 && ifnear_a2 ) || ( ifnear_b1 && ifnear_b2 ) || + !( ifnear_a || ifnear_b ) ) + plwarn( "number_crossings; internal logic error" ); + if ( ifnear_a1 ) + { + crossing_index[0] = i1; + crossing_index[2] = i1m1 - 1; + if ( crossing_index[2] < 0 ) + crossing_index[2] += n1; + } + else if ( ifnear_a2 ) + { + crossing_index[0] = i1m1; + crossing_index[2] = i1 + 1; + if ( crossing_index[2] >= n1 ) + crossing_index[2] -= n1; + } + if ( ifnear_b1 ) + { + crossing_index[1] = i2; + crossing_index[3] = i2m1 - 1; + if ( crossing_index[3] < 0 ) + crossing_index[3] += n2; + } + else if ( ifnear_b2 ) + { + crossing_index[1] = i2m1; + crossing_index[3] = i2 + 1; + if ( crossing_index[3] >= n2 ) + crossing_index[3] -= n2; + } + /* Never count ifnear_a1 since that should be a duplicate + * of ifnear_a2 for the next i1 index. */ + if ( ifnear_a2 && !ifnear_b ) + { + /* Are the points defined by crossing_index[0] (point + * 0) and crossing_index[2] (point 1) on opposite + * sides of the line defined by the polygon 2 edge + * from i2m1 to i2? If so, indicate definite + * crossing. */ + /* Use point i2m1 as origin of coordinate system and take + * dot products of both point 0 and point 1 vectors with + * perpendicular to point i2 vector. */ + xline = -( y2[i2] - y2[i2m1] ); + yline = x2[i2] - x2[i2m1]; + xpoint0 = x1[crossing_index[0]] - x2[i2m1]; + ypoint0 = y1[crossing_index[0]] - y2[i2m1]; + xpoint1 = x1[crossing_index[2]] - x2[i2m1]; + ypoint1 = y1[crossing_index[2]] - y2[i2m1]; + inprod0 = xpoint0 * xline + ypoint0 * yline; + inprod1 = xpoint1 * xline + ypoint1 * yline; + /* maximum error of product of inner products for + * an error of PL_NBCC of the right sign for + * each original position. */ + product_NBCC = 2. * PL_NBCC * ( + ( fabs( xpoint0 ) + fabs( xline ) + + fabs( ypoint0 ) + fabs( yline ) ) * fabs( inprod1 ) + + ( fabs( xpoint1 ) + fabs( xline ) + + fabs( ypoint1 ) + fabs( yline ) ) * fabs( inprod0 ) ); + + /* Not crossed if sine 0 proportional to inprod0 has + * same sign (subject to error) as sine 1 proportional + * to inprod1. */ + ifnotcrossed = inprod0 * inprod1 >= -product_NBCC; + } + /* Never count ifnear_b1 since that should be a duplicate + * of ifnear_b2 for the next i2 index. */ + else if ( ifnear_b2 && !ifnear_a ) + { + /* Are the points defined by crossing_index[1] (point + * 0) and crossing_index[3] (point 1) on opposite + * sides of the line defined by the polygon 1 edge + * from i1m1 to i1? If so, indicate definite + * crossing. */ + + /* Use point i1m1 as origin of coordinate system and take + * dot products of both point 0 and point 1 vectors with + * perpendicular to point i1 vector. */ + xline = -( y1[i1] - y1[i1m1] ); + yline = x1[i1] - x1[i1m1]; + xpoint0 = x2[crossing_index[1]] - x1[i1m1]; + ypoint0 = y2[crossing_index[1]] - y1[i1m1]; + xpoint1 = x2[crossing_index[3]] - x1[i1m1]; + ypoint1 = y2[crossing_index[3]] - y1[i1m1]; + inprod0 = xpoint0 * xline + ypoint0 * yline; + inprod1 = xpoint1 * xline + ypoint1 * yline; + /* maximum error of product of inner products for + * an error of PL_NBCC of the right sign for + * each original position. */ + product_NBCC = 2. * PL_NBCC * ( + ( fabs( xpoint0 ) + fabs( xline ) + + fabs( ypoint0 ) + fabs( yline ) ) * fabs( inprod1 ) + + ( fabs( xpoint1 ) + fabs( xline ) + + fabs( ypoint1 ) + fabs( yline ) ) * fabs( inprod0 ) ); + + /* Not crossed if sine 0 proportional to inprod0 has + * same sign (subject to error) as sine 1 proportional + * to inprod1. */ + ifnotcrossed = inprod0 * inprod1 >= -product_NBCC; + } + else if ( ifnear_a && ifnear_b ) + { + plwarn( "notcrossing: coincident vertices not implemented yet." ); + ifnotcrossed = 0; + } + } + if ( !ifnotcrossed ) { count_crossings++; Modified: trunk/src/plgridd.c =================================================================== --- trunk/src/plgridd.c 2010-03-13 19:39:09 UTC (rev 10863) +++ trunk/src/plgridd.c 2010-03-13 23:37:28 UTC (rev 10864) @@ -38,33 +38,36 @@ /* forward declarations */ static void grid_nnaidw( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg ); + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp ); static void grid_nnli( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg, - PLFLT threshold ); + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp, PLFLT threshold ); static void grid_nnidw( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg, - int knn_order ); + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp, int knn_order ); #ifdef WITH_CSA static void grid_csa( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg ); + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp ); #endif #ifdef HAVE_QHULL static void grid_nni( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg, - PLFLT wmin ); + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp, PLFLT wmin ); static void grid_dtli( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg ); + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp ); #endif static void @@ -112,6 +115,14 @@ PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data ) { + plfgriddata( x, y, z, npts, xg, nptsx, yg, nptsy, plf2ops_c(), (PLPointer) zg, type, data ); +} + +void +plfgriddata( PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, + PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, + PLF2OPS zops, PLPointer zgp, PLINT type, PLFLT data ) +{ int i, j; if ( npts < 1 || nptsx < 1 || nptsy < 1 ) @@ -142,46 +153,46 @@ /* clear array to return */ for ( i = 0; i < nptsx; i++ ) for ( j = 0; j < nptsy; j++ ) - zg[i][j] = 0.; /* NaN signals a not processed grid point */ + zops->set( zgp, i, j, 0.0 ); /* NaN signals a not processed grid point */ switch ( type ) { case ( GRID_CSA ): /* Bivariate Cubic Spline Approximation */ #ifdef WITH_CSA - grid_csa( x, y, z, npts, xg, nptsx, yg, nptsy, zg ); + grid_csa( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp ); #else plwarn( "plgriddata(): PLplot was configured to not use GRID_CSA.\n Reverting to GRID_NNAIDW." ); - grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zg ); + grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp ); #endif break; case ( GRID_NNIDW ): /* Nearest Neighbors Inverse Distance Weighted */ - grid_nnidw( x, y, z, npts, xg, nptsx, yg, nptsy, zg, (int) data ); + grid_nnidw( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp, (int) data ); break; case ( GRID_NNLI ): /* Nearest Neighbors Linear Interpolation */ - grid_nnli( x, y, z, npts, xg, nptsx, yg, nptsy, zg, data ); + grid_nnli( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp, data ); break; case ( GRID_NNAIDW ): /* Nearest Neighbors "Around" Inverse Distance Weighted */ - grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zg ); + grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp ); break; case ( GRID_DTLI ): /* Delaunay Triangulation Linear Interpolation */ #ifdef HAVE_QHULL - grid_dtli( x, y, z, npts, xg, nptsx, yg, nptsy, zg ); + grid_dtli( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp ); #else plwarn( "plgriddata(): you must have the Qhull library installed to use GRID_DTLI.\n Reverting to GRID_NNAIDW." ); - grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zg ); + grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp ); #endif break; case ( GRID_NNI ): /* Natural Neighbors */ #ifdef HAVE_QHULL - grid_nni( x, y, z, npts, xg, nptsx, yg, nptsy, zg, data ); + grid_nni( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp, data ); #else plwarn( "plgriddata(): you must have the Qhull library installed to use GRID_NNI.\n Reverting to GRID_NNAIDW." ); - grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zg ); + grid_nnaidw( x, y, z, npts, xg, nptsx, yg, nptsy, zops, zgp ); #endif break; @@ -199,7 +210,8 @@ static void grid_csa( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg ) + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp ) { PLFLT *xt, *yt, *zt; point *pin, *pgrid, *pt; @@ -248,8 +260,8 @@ { for ( j = 0; j < nptsy; j++ ) { - pt = &pgrid[j * nptsx + i]; - zg[i][j] = (PLFLT) pt->z; + pt = &pgrid[j * nptsx + i]; + zops->set( zgp, i, j, (PLFLT) pt->z ); } } @@ -269,8 +281,8 @@ static void grid_nnidw( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg, - int knn_order ) + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp, int knn_order ) { int i, j, k; PLFLT wi, nt; @@ -300,8 +312,8 @@ if ( items[k].dist > md ) md = items[k].dist; #endif - zg[i][j] = 0.; - nt = 0.; + zops->set( zgp, i, j, 0.0 ); + nt = 0.; for ( k = 0; k < knn_order; k++ ) { @@ -313,13 +325,13 @@ #else wi = 1. / ( items[k].dist * items[k].dist ); #endif - zg[i][j] += wi * z[items[k].item]; - nt += wi; + zops->add( zgp, i, j, wi * z[items[k].item] ); + nt += wi; } if ( nt != 0. ) - zg[i][j] /= nt; + zops->div( zgp, i, j, nt ); else - zg[i][j] = NaN; + zops->set( zgp, i, j, NaN ); } } } @@ -332,8 +344,8 @@ static void grid_nnli( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg, - PLFLT threshold ) + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLF2OPS zops, PLPointer zgp, PLFLT threshold ) { PLFLT xx[4], yy[4], zz[4], t, A, B, C, D, d1, d2, d3, max_thick; int i, j, ii, excl, cnt, excl_item; @@ -369,7 +381,7 @@ if ( d1 == 0. || d2 == 0. || d3 == 0. ) /* coincident points */ { - zg[i][j] = NaN; + zops->set( zgp, i, j, NaN ); continue; } @@ -387,7 +399,7 @@ if ( ( d1 + d2 ) / d3 < threshold ) /* thin triangle! */ { - zg[i][j] = NaN; /* deal with it latter */ + zops->set( zgp, i, j, NaN ); /* deal with it later */ } else /* calculate the plane passing through the three points */ @@ -398,7 +410,7 @@ D = -A * xx[0] - B * yy[0] - C * zz[0]; /* and interpolate (or extrapolate...) */ - zg[i][j] = -xg[i] * A / C - yg[j] * B / C - D / C; + zops->set( zgp, i, j, -xg[i] * A / C - yg[j] * B / C - D / C ); } } } @@ -417,7 +429,7 @@ { for ( j = 0; j < nptsy; j++ ) { - if ( isnan( zg[i][j] ) ) + if ( zops->is_nan( zgp, i, j ) ) { dist1( xg[i], yg[j], x, y, npts, 4 ); @@ -494,7 +506,7 @@ D = -A * xx[0] - B * yy[0] - C * zz[0]; /* and interpolate (or extrapolate...) */ - zg[i][j] = -xg[i] * A / C - yg[j] * B / C - D / C; + zops->set( zgp, i, j, -xg[i] * A / C - yg[j] * B / C - D / C ); } } } @@ -510,7 +522,7 @@ static void grid_nnaidw( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg ) + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLF2OPS zops, PLPointer zgp ) { PLFLT d, nt; int i, j, k; @@ -520,21 +532,21 @@ for ( j = 0; j < nptsy; j++ ) { dist2( xg[i], yg[j], x, y, npts ); - zg[i][j] = 0.; - nt = 0.; + zops->set( zgp, i, j, 0. ); + nt = 0.; for ( k = 0; k < 4; k++ ) { if ( items[k].item != -1 ) /* was found */ { - d = 1. / ( items[k].dist * items[k].dist ); /* 1/square distance */ - zg[i][j] += d * z[items[k].item]; - nt += d; + d = 1. / ( items[k].dist * items[k].dist ); /* 1/square distance */ + zops->add( zgp, i, j, d * z[items[k].item] ); + nt += d; } } if ( nt == 0. ) /* no points found?! */ - zg[i][j] = NaN; + zops->set( zgp, i, j, NaN ); else - zg[i][j] /= nt; + zops->div( zgp, i, j, nt ); } } } @@ -553,7 +565,7 @@ static void grid_dtli( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg ) + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLF2OPS zops, PLPointer zgp ) { point *pin, *pgrid, *pt; PLFLT *xt, *yt, *zt; @@ -604,8 +616,8 @@ { for ( j = 0; j < nptsy; j++ ) { - pt = &pgrid[j * nptsx + i]; - zg[i][j] = (PLFLT) pt->z; + pt = &pgrid[j * nptsx + i]; + zops->set( zgp, i, j, (PLFLT) pt->z ); } } @@ -622,7 +634,7 @@ static void grid_nni( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg, + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLF2OPS zops, PLPointer zgp, PLFLT wmin ) { PLFLT *xt, *yt, *zt; @@ -681,8 +693,8 @@ { for ( j = 0; j < nptsy; j++ ) { - pt = &pgrid[j * nptsx + i]; - zg[i][j] = (PLFLT) pt->z; + pt = &pgrid[j * nptsx + i]; + zops->set( ... [truncated message content] |
From: <hba...@us...> - 2010-03-23 19:30:45
|
Revision: 10879 http://plplot.svn.sourceforge.net/plplot/?rev=10879&view=rev Author: hbabcock Date: 2010-03-23 19:29:55 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Change xcairo keyPress hanlding to match that used by xev. Properly initialize PLGraphicsIn structure for the wincairo device. Modify example 1 to output gin.string as well as gin.keysym in locate mode. Modified Paths: -------------- trunk/drivers/cairo.c trunk/examples/c/x01c.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-03-21 20:36:33 UTC (rev 10878) +++ trunk/drivers/cairo.c 2010-03-23 19:29:55 UTC (rev 10879) @@ -1907,6 +1907,8 @@ void xcairo_get_cursor( PLStream *pls, PLGraphicsIn *gin ) { int number_chars; + char *ksname; + char str[257]; KeySym keysym; XComposeStatus cs; XEvent event; @@ -1931,8 +1933,13 @@ /* Get key pressed (if any) */ if ( event.type == KeyPress ) { - number_chars = XLookupString( (XKeyEvent *) &event, gin->string, 10, &keysym, &cs ); - gin->string[number_chars] = '\0'; + number_chars = XLookupString( (XKeyEvent *) &event, str, 100, &keysym, NULL ); + if (keysym == NoSymbol) + ksname = "NoSymbol"; + else if (!(ksname = XKeysymToString(keysym))) + ksname = "(no name)"; + strcpy(gin->string, ksname); + // gin->string[number_chars] = '\0'; switch ( keysym ) { case XK_BackSpace: @@ -2823,6 +2830,9 @@ int located = 0; PLCairo *aStream = (PLCairo *) pls->dev; + /* Initialize PLplot mouse event structure */ + plGinInit( gin ); + while ( GetMessage( &aStream->msg, NULL, 0, 0 ) && !located) { TranslateMessage( &aStream->msg ); Modified: trunk/examples/c/x01c.c =================================================================== --- trunk/examples/c/x01c.c 2010-03-21 20:36:33 UTC (rev 10878) +++ trunk/examples/c/x01c.c 2010-03-23 19:29:55 UTC (rev 10879) @@ -202,11 +202,11 @@ pltext(); if ( gin.keysym < 0xFF && isprint( gin.keysym ) ) - printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = '%c'\n", - gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym ); + printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = '%c' s = '%s'\n", + gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); else - printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x\n", - gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym ); + printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x s - '%s'\n", + gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); plgra(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-04-08 18:30:59
|
Revision: 10893 http://plplot.svn.sourceforge.net/plplot/?rev=10893&view=rev Author: airwin Date: 2010-04-08 18:30:53 +0000 (Thu, 08 Apr 2010) Log Message: ----------- Address long-standing issues in ascii index for plpoin to make results conform as closely as possible to the ideal that is documented which is codes between 32 and 127 should correspond to the corresponding ascii character. 92 changed from dot to backslash (804 in the Hershey index) 94 changed from degree symbol to caret (832 in the Hershey index) 95 changed from dot to 590 in the Hershey index. N.B. 590 is a placeholder for the underscore. There is currently no Hershey glyph at that position, but in future an underscore glyph should be put there. Note, 590 is the Hershey index used by PGplot for the underscore so the 590 placeholder for underscore should assure future compatibility with PGplot in this regard. The new results for plstnd5.fnt and plxtnd5.fnt were generated using -DBUILD_HERSHEY_FONTS=ON and running the resulting executables ./generate_xtndfonts, and ./generate_stndfonts in the fonts subdirectory of the build tree and copying the results back to the data subdirectory of the source tree. Modified Paths: -------------- trunk/data/plstnd5.fnt trunk/data/plxtnd5.fnt trunk/fonts/font11.c Modified: trunk/data/plstnd5.fnt =================================================================== (Binary files differ) Modified: trunk/data/plxtnd5.fnt =================================================================== (Binary files differ) Modified: trunk/fonts/font11.c =================================================================== --- trunk/fonts/font11.c 2010-04-08 13:54:20 UTC (rev 10892) +++ trunk/fonts/font11.c 2010-04-08 18:30:53 UTC (rev 10893) @@ -256,7 +256,7 @@ 2241, 726, 2242, 715, 2273, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, - 526, 2223, 729, 2224, 718, 729, 2249, 601, 602, 603, + 526, 2223, 804, 2224, 832, 590, 2249, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 2225, 723, 2226, 2246, 699, 527, 528, @@ -276,7 +276,7 @@ 2241, 2238, 2242, 2215, 2273, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, - 2026, 2223, 2236, 2224, 2218, 2236, 2249, 2101, 2102, 2103, + 2026, 2223, 804, 2224, 832, 590, 2249, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2225, 2229, 2226, 2246, 2199, 2027, 2028, @@ -296,7 +296,7 @@ 2241, 2776, 2242, 2765, 2273, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, - 2076, 2223, 2236, 2224, 2779, 2236, 2249, 2151, 2152, 2153, + 2076, 2223, 804, 2224, 832, 590, 2249, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2225, 2229, 2226, 2246, 2199, 2027, 2028, @@ -316,7 +316,7 @@ 2241, 2776, 2242, 2765, 2273, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, - 2576, 2223, 2236, 2224, 2779, 2236, 2249, 2651, 2652, 2653, + 2576, 2223, 804, 2224, 832, 590, 2249, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2225, 2229, 2226, 2246, 2199, 2027, 2028, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-04-11 05:05:54
|
Revision: 10898 http://plplot.svn.sourceforge.net/plplot/?rev=10898&view=rev Author: airwin Date: 2010-04-11 05:05:48 +0000 (Sun, 11 Apr 2010) Log Message: ----------- Add some minimal documentation of buffer (subbuffer); findex (subindex); and hersh (subhersh); that are used throughout fonts/font??. to define the Hershey fonts and various indexing schemes for them that are used by Plplot. Add underscore glyph in Hershey fonts. Thanks to David MacMahon for the implementation. Move underscore position from 590 (which matched PGplot) to 795. This changes the corresponding shortened index position of the underscore in the standard fonts from 51 to 133. This change results in a much more logical layout of the standard font that is displayed in first two pages of example 7. 795 is also a reasonable position for the underscore in the extended Hershey font index which is displayed by the remaining pages of example 7 (see especially page 6 of that example). Modified Paths: -------------- trunk/data/plstnd5.fnt trunk/data/plxtnd5.fnt trunk/fonts/font01.c trunk/fonts/font11.c Modified: trunk/data/plstnd5.fnt =================================================================== (Binary files differ) Modified: trunk/data/plxtnd5.fnt =================================================================== (Binary files differ) Modified: trunk/fonts/font01.c =================================================================== --- trunk/fonts/font01.c 2010-04-10 16:40:14 UTC (rev 10897) +++ trunk/fonts/font01.c 2010-04-11 05:05:48 UTC (rev 10898) @@ -5,6 +5,14 @@ * */ +// buffer (defined by subbuffer??) contains coordinates describing the +// Hershey glyphs; findex (defined by subindex??) indexes those glyphs +// by Hershey index position; and hersh (defined by subhersh?) +// indexes the Hershey index by the plpoint "ascii" index that in the +// range from 0 to 31 points to Hershey indices that point to useful +// plotting symbols and from 32 to 126 indexes Hershey indices that +// point to ascii printable characters. + /* short int findex[3000] */ /* short int buffer[27000] */ /* short int hersh[0:175,4] */ @@ -230,7 +238,7 @@ 3499, 3541, 3573, 3621, 3656, 3688, 3722, 3757, 3798, 3829, 3857, 3893, 3928, 3956, 3995, 4036, 0, 0, 0, 0, 0, 0, 4079, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; short int subindex06[100] = { 4091, 4112, 4133, 4151, 4172, 4193, 4205, 4231, 4245, 4257, @@ -254,7 +262,7 @@ 6894, 6903, 6913, 6923, 6947, 6971, 7005, 7030, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7063, 7069, 7075, 7081, 7087 + 0, 0, 0, 0,26692, 7063, 7069, 7075, 7081, 7087 }; short int subindex08[100] = { 7093, 7099, 7105, 7111, 7117, 7123, 7129, 7135, 7141, 7147, Modified: trunk/fonts/font11.c =================================================================== --- trunk/fonts/font11.c 2010-04-10 16:40:14 UTC (rev 10897) +++ trunk/fonts/font11.c 2010-04-11 05:05:48 UTC (rev 10898) @@ -207,7 +207,7 @@ 7362, 7361, 7487, 7870, 8766, 64, 7877, 7620, 7490, 7489, 7615, 7870, 64, 8510, 8125, 7996, 7736, 7607, 64, 8510, 8253, 8124, 7864, 7735, 7479, 7352, 7226, 64, 8375, 9271, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, -16, 7116, 7114, 7093, 9397, 0, 0, 0, 0 }; short int subbuffer267[100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -256,7 +256,7 @@ 2241, 726, 2242, 715, 2273, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, - 526, 2223, 804, 2224, 832, 590, 2249, 601, 602, 603, + 526, 2223, 804, 2224, 832, 795, 2249, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 2225, 723, 2226, 2246, 699, 527, 528, @@ -276,7 +276,7 @@ 2241, 2238, 2242, 2215, 2273, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, - 2026, 2223, 804, 2224, 832, 590, 2249, 2101, 2102, 2103, + 2026, 2223, 804, 2224, 832, 795, 2249, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2225, 2229, 2226, 2246, 2199, 2027, 2028, @@ -296,7 +296,7 @@ 2241, 2776, 2242, 2765, 2273, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, - 2076, 2223, 804, 2224, 832, 590, 2249, 2151, 2152, 2153, + 2076, 2223, 804, 2224, 832, 795, 2249, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2225, 2229, 2226, 2246, 2199, 2027, 2028, @@ -316,7 +316,7 @@ 2241, 2776, 2242, 2765, 2273, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, - 2576, 2223, 804, 2224, 832, 590, 2249, 2651, 2652, 2653, + 2576, 2223, 804, 2224, 832, 795, 2249, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2225, 2229, 2226, 2246, 2199, 2027, 2028, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-04-12 04:14:21
|
Revision: 10903 http://plplot.svn.sourceforge.net/plplot/?rev=10903&view=rev Author: hezekiahcarty Date: 2010-04-12 04:14:12 +0000 (Mon, 12 Apr 2010) Log Message: ----------- Simplify the way axes are drawn in the OCaml Plplot.Plot module This should both simplify axis customization and make the interface more consistent. Modified Paths: -------------- trunk/bindings/ocaml/plplot.ml trunk/bindings/ocaml/plplot.mli trunk/examples/ocaml/xplot01.ml Modified: trunk/bindings/ocaml/plplot.ml =================================================================== --- trunk/bindings/ocaml/plplot.ml 2010-04-11 23:51:49 UTC (rev 10902) +++ trunk/bindings/ocaml/plplot.ml 2010-04-12 04:14:12 UTC (rev 10903) @@ -124,7 +124,10 @@ | Unconventional_label | Label | Custom_label - | Minor_ticks | Major_ticks + | Minor_ticks + | Minor_tick_count of int + | Major_ticks + | Major_tick_spacing of float | Vertical_label type stream_t = { @@ -179,6 +182,8 @@ type plot_t = (* Standard plot elements *) | Arc of (color_t * float * float * float * float * float * float * bool) + | Axes of + (color_t * axis_options_t list * axis_options_t list * int * line_style_t) | Contours of (color_t * pltr_t * float array * float array array) | Image of image_t | Image_fr of (image_t * (float * float)) @@ -485,6 +490,13 @@ let arc ?(fill = false) color x y a b angle1 angle2 = Arc (color, x, y, a, b, angle1, angle2, fill) + (** [axes ?color ?style ?width xopt yopt] *) + let axes ?(color = Black) ?(style = Solid_line) ?(width = 1) xopt yopt = + Axes (color, xopt, yopt, width, style) + + (** Default axes *) + let default_axes = axes default_axis_options default_axis_options + (** [circle ?fill color x y r] - A special case of [arc]. *) let circle ?fill color x y r = arc ?fill color x y r r 0.0 360.0 @@ -647,6 +659,38 @@ () ) + (** An easier to deduce alternative to {Plplot.plbox} *) + let plot_axes ?stream xoptions yoptions = + let xtick = ref 0.0 in + let xsub = ref 0 in + let ytick = ref 0.0 in + let ysub = ref 0 in + let map_axis_options tick sub ol = + List.map ( + function + | Axis -> "a" + | Frame0 -> "b" + | Frame1 -> "c" + | Time -> "d" + | Fixed_point -> "f" + | Major_grid -> "g" + | Minor_grid -> "h" + | Invert_ticks -> "i" + | Log -> "l" + | Unconventional_label -> "m" + | Label -> "n" + | Custom_label -> "o" + | Minor_ticks -> "s" + | Minor_tick_count t_sub -> sub := t_sub; "s" + | Major_ticks -> "t" + | Major_tick_spacing t_space -> tick := t_space; "t" + | Vertical_label -> "v" + ) ol + in + let xopt = String.concat "" (map_axis_options xtick xsub xoptions) in + let yopt = String.concat "" (map_axis_options ytick ysub yoptions) ^ "v" in + with_stream ?stream (fun () -> plbox xopt !xtick !xsub yopt !ytick !ysub) + (** [plot stream l] plots the data in [l] to the plot [stream]. *) let rec plot ?stream plottable_list = (* TODO: Add legend support. *) @@ -681,6 +725,17 @@ fun () -> plarc x y a b angle1 angle2 fill; ) in + let plot_axes (color, xopt, yopt, width, style) = + set_color_in color ( + fun () -> + let old_width = plgwid () in + plwid width; + set_line_style style; + plot_axes xopt yopt; + set_line_style Solid_line; + plwid old_width; + ) + in let plot_contours (color, pltr, contours, data) = set_color_in color ( fun () -> @@ -801,6 +856,7 @@ let one_plot p = match p with | Arc a -> plot_arc a + | Axes ax -> plot_axes ax | Contours c -> plot_contours c | Image i -> plot_image i | Image_fr (i, scale) -> plot_imagefr i scale @@ -825,33 +881,6 @@ let label ?stream x y title = with_stream ?stream (fun () -> pllab x y title) - (** An easier to deduce alternative to {Plplot.plbox} *) - let plot_axes ?stream ?(xtick = 0.0) ?(xsub =0) - ?(ytick = 0.0) ?(ysub = 0) xoptions yoptions = - let map_axis_options ol = - List.map ( - function - | Axis -> "a" - | Frame0 -> "b" - | Frame1 -> "c" - | Time -> "d" - | Fixed_point -> "f" - | Major_grid -> "g" - | Minor_grid -> "h" - | Invert_ticks -> "i" - | Log -> "l" - | Unconventional_label -> "m" - | Label -> "n" - | Custom_label -> "o" - | Minor_ticks -> "s" - | Major_ticks -> "t" - | Vertical_label -> "v" - ) ol - in - let xopt = String.concat "" (map_axis_options xoptions) in - let yopt = String.concat "" (map_axis_options yoptions) ^ "v" in - with_stream ?stream (fun () -> plbox xopt xtick xsub yopt ytick ysub) - (** [colorbar_base ?label ?log ?pos values] draws a colorbar, using the given values for the color range. [label] gives the position and text of the colorbar label; if [log] is true then the scale is taken to be log rather @@ -1065,48 +1094,17 @@ colorbar_base ?custom_axis ?label ?log ?pos ?width (`shade values) ) - (** Default page ending steps. Just draw the plot axes. *) - let default_finish ?stream ?axis ?xtick ?ytick () = - let xopt, yopt = - match axis with - | None -> default_axis_options, default_axis_options - | Some s -> s - in - set_color_in ?stream Black ( - fun () -> - plot_axes ?stream ?xtick xopt ?ytick yopt; - ) + (** Finish the current page, start a new one (alias for {!start_page}). *) + let next_page = start_page - (** Plot axes, but don't advance the page or end the session. This is used - internally by [finish]. *) - let finish_page ?stream ?f ?post ?axis ?xtick ?ytick () = - with_stream ?stream ( - fun () -> - let actual_finish = - match f with - | Some custom_finish -> custom_finish - | None -> default_finish ?stream ?axis ?xtick ?ytick - in - actual_finish (); - Option.may (fun f -> f ()) post; - ) - - (** Finish the current page, start a new one. *) - let next_page ?stream ?f ?post ?axis ?xtick ?ytick - (x0, y0) (x1, y1) axis_scaling = - finish_page ?stream ?f ?post ?axis ?xtick ?ytick (); - start_page ?stream (x0, y0) (x1, y1) axis_scaling; - () - (** End the current plot stream *) - let end_stream ~stream = - with_stream ~stream plend1 + let end_stream ?stream () = + with_stream ?stream plend1 - (** Finish up the plot by plotting axes and ending the session. This must - be called after plotting is complete. *) - let finish ?stream ?f ?post ?axis ?xtick ?ytick () = - finish_page ?stream ?f ?post ?axis ?xtick ?ytick (); - with_stream ?stream plend1 + (** Finish up the plot by plotting axes and ending the stream. *) + let finish ?stream () = + plot ?stream [default_axes]; + end_stream ?stream () end (** The [Quick_plot] module is intended to be used for quick, "throw-away" @@ -1158,7 +1156,7 @@ let xs_list, ys_list = List.split xs_ys_list in let xmin, xmax, ymin, ymax = extents xs_list ys_list in let ys_array = Array.of_list ys_list in - let p = init ?filename (xmin, ymin) (xmax, ymax) Greedy device in + let stream = init ?filename (xmin, ymin) (xmax, ymax) Greedy device in let plottable_points = Array.to_list ( Array.mapi ( @@ -1168,9 +1166,13 @@ ) (Array.of_list xs_list) ) in - plot ~stream:p plottable_points; - Option.may (fun (x, y, t) -> label ~stream:p x y t) labels; - finish ~stream:p ~axis:(maybe_log log) (); + let x_axis, y_axis = maybe_log log in + plot ~stream [ + list plottable_points; + axes x_axis y_axis; + ]; + Option.may (fun (x, y, t) -> label ~stream x y t) labels; + end_stream ~stream (); () (** [lines [xs, ys; ...] plots the line segments described by the coordinates @@ -1179,7 +1181,7 @@ let xs_list, ys_list = List.split xs_ys_list in let xmin, xmax, ymin, ymax = extents xs_list ys_list in let ys_array = Array.of_list ys_list in - let p = init ?filename (xmin, ymin) (xmax, ymax) Greedy device in + let stream = init ?filename (xmin, ymin) (xmax, ymax) Greedy device in let colors = Array.mapi (fun i _ -> Index_color (i + 1)) ys_array in let plottable_lines = Array.to_list ( @@ -1188,10 +1190,14 @@ ) (Array.of_list xs_list) ) in - plot ~stream:p plottable_lines; - Option.may (fun (x, y, t) -> label ~stream:p x y t) labels; - Option.may (fun n -> draw_legend ~stream:p n (Array.to_list colors)) names; - finish ~stream:p ~axis:(maybe_log log) (); + let x_axis, y_axis = maybe_log log in + plot ~stream [ + list plottable_lines; + axes x_axis y_axis; + ]; + Option.may (fun (x, y, t) -> label ~stream x y t) labels; + Option.may (fun n -> draw_legend ~stream n (Array.to_list colors)) names; + end_stream ~stream (); () (** [image ?log m] plots the image [m] with a matching colorbar. If [log] is @@ -1201,12 +1207,15 @@ let xmin, ymin = 0.0, 0.0 in let xmax, ymax = Array_ext.matrix_dims m in let xmax, ymax = float_of_int xmax, float_of_int ymax in - let p = init ?filename (xmin, ymin) (xmax, ymax) Equal_square device in - Option.may (load_palette ~stream:p) palette; - plot ~stream:p [image (xmin, ymin) (xmax, ymax) m]; - Option.may (fun (x, y, t) -> label ~stream:p x y t) labels; - colorbar ~stream:p ?log ~pos:(Right 0.12) (m_min, m_max); - finish ~stream:p (); + let stream = init ?filename (xmin, ymin) (xmax, ymax) Equal_square device in + Option.may (load_palette ~stream) palette; + plot ~stream [ + image (xmin, ymin) (xmax, ymax) m; + default_axes; + ]; + Option.may (fun (x, y, t) -> label ~stream x y t) labels; + colorbar ~stream ?log ~pos:(Right 0.12) (m_min, m_max); + end_stream ~stream (); () (** [func ?point ?step fs (min, max)] plots the functions [fs] from [x = min] @@ -1237,10 +1246,13 @@ in let ymax, ymin = plMinMax2dGrid ys in let stream = init ?filename (xmin, ymin) (xmax, ymax) Greedy device in - plot ~stream plot_content; + plot ~stream [ + list plot_content; + default_axes; + ]; Option.may (fun n -> draw_legend ~stream n (Array.to_list colors)) names; Option.may (fun (x, y, t) -> label ~stream x y t) labels; - finish ~stream (); + end_stream ~stream (); () let shades ?filename ?(device = Window Cairo) ?labels ?log ?palette ?contours @@ -1248,18 +1260,21 @@ let xmin, ymin = 0.0, 0.0 in let xmax, ymax = Array_ext.matrix_dims m in let xmax, ymax = float_of_int xmax, float_of_int ymax in - let p = init ?filename (xmin, ymin) (xmax, ymax) Equal_square device in - Option.may (load_palette ~stream:p) palette; + let stream = init ?filename (xmin, ymin) (xmax, ymax) Equal_square device in + Option.may (load_palette ~stream) palette; let contours = contours |? ( let m_max, m_min = plMinMax2dGrid m in Array_ext.range ~n:11 m_min m_max ) in - plot ~stream:p [shades (xmin, ymin) (xmax, ymax) contours m]; - Option.may (fun (x, y, t) -> label ~stream:p x y t) labels; - shadebar ~stream:p ?log ~pos:(Right 0.12) contours; - finish ~stream:p (); + plot ~stream [ + shades (xmin, ymin) (xmax, ymax) contours m; + default_axes; + ]; + Option.may (fun (x, y, t) -> label ~stream x y t) labels; + shadebar ~stream ?log ~pos:(Right 0.12) contours; + end_stream ~stream (); () end Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2010-04-11 23:51:49 UTC (rev 10902) +++ trunk/bindings/ocaml/plplot.mli 2010-04-12 04:14:12 UTC (rev 10903) @@ -55,7 +55,9 @@ | Label | Custom_label | Minor_ticks + | Minor_tick_count of int | Major_ticks + | Major_tick_spacing of float | Vertical_label (** A plot stream. *) @@ -172,6 +174,11 @@ ?stream:stream_t -> float * float -> float * float -> plot_scaling_t -> unit + (** An alias for {!start_page}. *) + val next_page : + ?stream:stream_t -> + float * float -> float * float -> plot_scaling_t -> unit + (** Create a new plot instance. See {!init} for a description of the parameters. *) val make : @@ -246,6 +253,17 @@ ?fill:bool -> color_t -> float -> float -> float -> float -> float -> float -> plot_t + (** [axes ?color ?style ?width xopt yopt] *) + val axes : + ?color:color_t -> + ?style:line_style_t -> + ?width:int -> + axis_options_t list -> axis_options_t list -> plot_t + + (** [default_axes] is equivalent to + [axes default_axis_options default_axis_options] *) + val default_axes : plot_t + (** [circle ?fill color x y r] *) val circle : ?fill:bool -> color_t -> float -> float -> float -> plot_t @@ -404,43 +422,16 @@ (** Draw the plot axes on the current plot page *) val plot_axes : ?stream:stream_t -> - ?xtick:float -> - ?xsub:int -> - ?ytick:float -> - ?ysub:int -> axis_options_t list -> axis_options_t list -> unit (** {4 Finishing up a plot page} *) - (** Plot axes, but don't advance the page or end the session. This is used - internally by [finish]. *) - val finish_page : - ?stream:stream_t -> - ?f:(unit -> unit) -> - ?post:(unit -> unit) -> - ?axis:axis_options_t list * axis_options_t list -> - ?xtick:float -> ?ytick:float -> - unit -> unit + (** [end_stream ?stream ()] ends [stream]. This or {!finish} should be + called once all plotting is complete. *) + val end_stream : ?stream:stream_t -> unit -> unit - (** Finish the current page, start a new one. *) - val next_page : - ?stream:stream_t -> - ?f:(unit -> unit) -> - ?post:(unit -> unit) -> - ?axis:axis_options_t list * axis_options_t list -> - ?xtick:float -> - ?ytick:float -> - float * float -> float * float -> plot_scaling_t -> unit - - (** [finish ?stream xstep ystep] finishes up the plot [stream], using - [xstep] and [ystep] for the axis tick. *) - val finish : - ?stream:stream_t -> - ?f:(unit -> unit) -> - ?post:(unit -> unit) -> - ?axis:axis_options_t list * axis_options_t list -> - ?xtick:float -> ?ytick:float -> - unit -> unit + (** [finish ?stream ()] draws default x and y axes, then closes [stream]. *) + val finish : ?stream:stream_t -> unit -> unit end (** {3 A module for quick, "throw-away" plots} *) Modified: trunk/examples/ocaml/xplot01.ml =================================================================== --- trunk/examples/ocaml/xplot01.ml 2010-04-11 23:51:49 UTC (rev 10902) +++ trunk/examples/ocaml/xplot01.ml 2010-04-12 04:14:12 UTC (rev 10903) @@ -98,11 +98,10 @@ P.points ~symbol:P.Solar_symbol P.Green xs ys; (* Draw the line through the data *) P.lines P.Red x y; + (* Show the axes *) + P.default_axes; ]; - (* Show the axes *) - P.finish_page ~stream (); - (* All done. *) stream @@ -128,16 +127,18 @@ ) in - (* Draw the line *) - P.plot ~stream [P.lines ~width:2 P.Red x y]; - (* Show the axes *) - let axis = + let x_axis, y_axis = P.Axis :: P.default_axis_options, P.Axis :: P.default_axis_options in - P.finish_page ~stream ~axis (); + (* Draw the line *) + P.plot ~stream [ + P.lines ~width:2 P.Red x y; + P.axes x_axis y_axis; + ]; + (* All done. *) () @@ -149,15 +150,6 @@ from -1.2 to 1.2.*) P.start_page ~stream (0.0, -1.2) (360.0, 1.2) P.Greedy; - (* Superimpose a dashed line grid, with 1.5 mm marks and spaces. *) - P.with_stream ~stream ( - fun () -> - plstyl [|mark1|] [|space1|]; - P.set_color P.Yellow; - P.plot_axes ~xtick:30.0 ~ytick:0.2 [P.Major_grid] [P.Major_grid]; - plstyl [||] [||]; - ); - P.set_color ~stream P.Red; P.label ~stream "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function"; @@ -165,22 +157,28 @@ let x = Array.init 101 (fun i -> 3.6 *. float_of_int i) in let y = Array.init 101 (fun i -> sin (x.(i) *. pi /. 180.0)) in - P.plot ~stream [P.lines P.Brown x y]; - (* For the final graph we wish to override the default axis attributes, including tick intervals. Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. *) - let axis = + let x_axis, y_axis = (* x-axis *) - [P.Frame0; P.Frame1; P.Label; P.Minor_ticks; P.Major_ticks], + [P.Frame0; P.Frame1; P.Label; P.Minor_ticks; P.Major_tick_spacing 60.0], (* y-axis *) [ - P.Frame0; P.Frame1; P.Label; P.Minor_ticks; P.Major_ticks; + P.Frame0; P.Frame1; P.Label; P.Minor_ticks; P.Major_tick_spacing 0.2; P.Vertical_label ] in - P.finish_page ~stream ~axis ~xtick:60.0 ~ytick:0.2 (); + P.plot ~stream [ + (* Superimpose a dashed line grid, with 1.5 mm marks and spaces. *) + P.axes ~color:P.Yellow ~style:(P.Custom_line [mark1, space1]) + [P.Major_grid; P.Major_tick_spacing 30.0] + [P.Major_grid; P.Major_tick_spacing 0.2]; + P.lines P.Brown x y; + (* The normal plot axes *) + P.axes x_axis y_axis; + ]; (* All done. *) () @@ -232,9 +230,9 @@ plot3 stream; - (* Don't forget to finish off! Each function does the needed end-of-page - steps, so all we need to do here is wrap up the plotting session. *) - P.finish ~stream ~f:(fun () -> ()) (); + (* Don't forget to finish off! All we need to do here is close up the + plot stream. *) + P.end_stream ~stream (); () let () = main true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-04-12 05:23:49
|
Revision: 10905 http://plplot.svn.sourceforge.net/plplot/?rev=10905&view=rev Author: hezekiahcarty Date: 2010-04-12 05:23:41 +0000 (Mon, 12 Apr 2010) Log Message: ----------- Add basic global/universal coordinate transform support This commit adds a function plstransform which allows a user to define a global coordinate transform which will be used by all PLplot plotting functions which act inside the plotting window. C example 19 has been updated with an extra page to illustrate the use of plstransform. This commit also adds the plpath function which acts like pljoin when no transform is defined and approximates the translated path with a given number of line segments when a transform is defined. The OCaml bindings have been updated to include support for plstransform and plpath. OCaml example 19 has been updated to match the updated C example. No other language bindings are updated by this commit. The API documentation has been updated to reflect these changes. Modified Paths: -------------- trunk/bindings/ocaml/plplot.mli trunk/bindings/ocaml/plplot_core.idl trunk/bindings/ocaml/plplot_h trunk/bindings/ocaml/plplot_h.inc trunk/bindings/ocaml/plplot_impl.c trunk/doc/docbook/src/api.xml trunk/doc/docbook/src/plplotdoc.xml.in trunk/examples/c/x19c.c trunk/examples/ocaml/x19.ml trunk/include/plplot.h trunk/include/plplotP.h trunk/include/plstrm.h trunk/src/plbox.c trunk/src/plcore.c trunk/src/plfill.c trunk/src/plline.c trunk/src/plmap.c trunk/src/plshade.c trunk/src/plsym.c Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/bindings/ocaml/plplot.mli 2010-04-12 05:23:41 UTC (rev 10905) @@ -660,6 +660,8 @@ = "camlidl_plplot_core_c_plot3dc" external plpat : int array -> int array -> unit = "camlidl_plplot_core_c_plpat" +external plpath : int -> float -> float -> float -> float -> unit + = "camlidl_plplot_core_c_plpath" external plpoin : float array -> float array -> int -> unit = "camlidl_plplot_core_c_plpoin" external plpoin3 : float array -> float array -> float array -> int -> unit @@ -868,6 +870,8 @@ val plunset_mapform : unit -> unit val plset_defined : (float -> float -> int) -> unit val plunset_defined : unit -> unit +val plstransform : (float -> float -> (float * float)) -> unit +val plunset_transform : unit -> unit type plplot_grid_method_type = PL_GRID_CSA | PL_GRID_DTLI Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/bindings/ocaml/plplot_core.idl 2010-04-12 05:23:41 UTC (rev 10905) @@ -172,6 +172,19 @@ "let plunset_defined () = Callback.register \"caml_plplot_defined\" 0"); quote(mli, "val plunset_defined : unit -> unit"); +// Setting the translation function for the global coordinate transform +quote(ml, "external ml_plstransform : unit -> unit = \"ml_plstransform\""); +quote(ml, + "let plstransform (f : float -> float -> (float * float)) =\ + Callback.register \"caml_plplot_transform\" f;\ + ml_plstransform ()"); +quote(mli, "val plstransform : (float -> float -> (float * float)) -> unit"); +quote(ml, + "let plunset_transform () =\ + Callback.register \"caml_plplot_transform\" 0;\ + ml_plstransform ()"); +quote(mli, "val plunset_transform : unit -> unit"); + // Hand-translated PL_GRID_* flags for use with plgriddata quote(mlmli, "type plplot_grid_method_type = \ PL_GRID_CSA | \ Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/bindings/ocaml/plplot_h 2010-04-12 05:23:41 UTC (rev 10905) @@ -294,6 +294,9 @@ c_plpat(PLINT nlin, PLINT *inc, PLINT *del); void +c_plpath(PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2); + + void c_plpoin(PLINT n, PLFLT *x, PLFLT *y, PLINT code); void Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/bindings/ocaml/plplot_h.inc 2010-04-12 05:23:41 UTC (rev 10905) @@ -71,6 +71,7 @@ [mlname(plot3d)] void c_plot3d ( [size_is(nx), in] double * x, [size_is(ny), in] double * y, [size_is(nx, ny), in] double ** z, int nx, int ny, plplot3d_style opt, boolean side ); [mlname(plot3dc)] void c_plot3dc ( [size_is(nx), in] double * x, [size_is(ny), in] double * y, [size_is(nx, ny), in] double ** z, int nx, int ny, plplot3d_style opt, [size_is(nlevel), in] double * clevel, int nlevel ); [mlname(plpat)] void c_plpat ( int nlin, [in, size_is(nlin)] int * inc, [in, size_is(nlin)] int * del ); +[mlname(plpath)] void c_plpath ( int n, double x1, double y1, double x2, double y2); [mlname(plpoin)] void c_plpoin ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, int code ); [mlname(plpoin3)] void c_plpoin3 ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [in, size_is(n)] double * z, int code ); [mlname(plprec)] void c_plprec ( int setp, int prec ); Modified: trunk/bindings/ocaml/plplot_impl.c =================================================================== --- trunk/bindings/ocaml/plplot_impl.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/bindings/ocaml/plplot_impl.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -33,13 +33,14 @@ #include <stdio.h> -#define MAX_EXCEPTION_MESSAGE_LENGTH 1000 -#define CAML_PLPLOT_PLOTTER_FUNC_NAME "caml_plplot_plotter" -#define CAML_PLPLOT_MAPFORM_FUNC_NAME "caml_plplot_mapform" -#define CAML_PLPLOT_DEFINED_FUNC_NAME "caml_plplot_defined" -#define CAML_PLPLOT_LABEL_FUNC_NAME "caml_plplot_customlabel" -#define CAML_PLPLOT_ABORT_FUNC_NAME "caml_plplot_abort" -#define CAML_PLPLOT_EXIT_FUNC_NAME "caml_plplot_exit" +#define MAX_EXCEPTION_MESSAGE_LENGTH 1000 +#define CAML_PLPLOT_PLOTTER_FUNC_NAME "caml_plplot_plotter" +#define CAML_PLPLOT_MAPFORM_FUNC_NAME "caml_plplot_mapform" +#define CAML_PLPLOT_DEFINED_FUNC_NAME "caml_plplot_defined" +#define CAML_PLPLOT_LABEL_FUNC_NAME "caml_plplot_customlabel" +#define CAML_PLPLOT_ABORT_FUNC_NAME "caml_plplot_abort" +#define CAML_PLPLOT_EXIT_FUNC_NAME "caml_plplot_exit" +#define CAML_PLPLOT_TRANSFORM_FUNC_NAME "caml_plplot_transform" typedef void ( *ML_PLOTTER_FUNC )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ); typedef PLINT ( *ML_DEFINED_FUNC )( PLFLT, PLFLT ); @@ -200,6 +201,30 @@ CAMLreturn( Int_val( result ) ); } +// A simple routine to wrap a properly registered OCaml callback in a form +// usable by PLPlot routines. If an appropriate callback is not registered +// then nothing is done. +void ml_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) +{ + CAMLparam0(); + CAMLlocal1( result ); + + // Get the OCaml callback function (if there is one) + static value * transform = NULL; + if ( transform == NULL ) + transform = caml_named_value( CAML_PLPLOT_TRANSFORM_FUNC_NAME ); + + // No check to see if a callback function has been designated yet, + // because that is checked before we get to this point. + result = + caml_callback2( *transform, caml_copy_double( x ), caml_copy_double( y ) ); + + *xt = Double_val( Field( result, 0 ) ); + *yt = Double_val( Field( result, 1 ) ); + + CAMLreturn0; +} + // Check if the matching OCaml callback is defined. Return NULL if it is not, // and the proper function pointer if it is. ML_PLOTTER_FUNC get_ml_plotter_func() @@ -316,6 +341,27 @@ CAMLreturn( Val_unit ); } +// Set a global coordinate transform +value ml_plstransform( value unit ) +{ + CAMLparam1( unit ); + static value * handler = NULL; + if ( handler == NULL ) + handler = caml_named_value( CAML_PLPLOT_TRANSFORM_FUNC_NAME ); + + if ( handler == NULL || Val_int( 0 ) == *handler ) + { + // No handler defined + plstransform( NULL, NULL ); + } + else + { + // Handler is defined + plstransform( ml_transform, NULL ); + } + CAMLreturn( Val_unit ); +} + /* * * CONTOURING, SHADING and IMAGE FUNCTIONS Modified: trunk/doc/docbook/src/api.xml =================================================================== --- trunk/doc/docbook/src/api.xml 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/doc/docbook/src/api.xml 2010-04-12 05:23:41 UTC (rev 10905) @@ -7934,6 +7934,106 @@ </sect1> + <sect1 id="plpath" renderas="sect3"> + <title> + <function>plpath</function>: Draw a line between two points, accounting + for coordinate transforms. + </title> + + <para> + <funcsynopsis> + <funcprototype> + <funcdef> + <function>plpath</function> + </funcdef> + <paramdef><parameter>n</parameter></paramdef> + <paramdef><parameter>x1</parameter></paramdef> + <paramdef><parameter>y1</parameter></paramdef> + <paramdef><parameter>x2</parameter></paramdef> + <paramdef><parameter>y2</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </para> + + <para> + Joins the point <literal>(<parameter>x1</parameter>, + <parameter>y1</parameter>)</literal> to + <literal>(<parameter>x2</parameter>, + <parameter>y2</parameter>)</literal>. If a global coordinate transform + is defined then the line is broken in to + <literal><parameter>n</parameter></literal> segments to approximate the + path. If no transform is defined then this simply acts like a call to + &pljoin;. + </para> + + <variablelist> + <varlistentry> + <term> + <parameter>n</parameter> + (<literal>PLINT</literal>, input) + </term> + <listitem> + <para> + number of points to use to approximate the path. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <parameter>x1</parameter> + (<literal>PLFLT</literal>, input) + </term> + <listitem> + <para> + x coordinate of first point. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <parameter>y1</parameter> + (<literal>PLFLT</literal>, input) + </term> + <listitem> + <para> + y coordinate of first point. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <parameter>x2</parameter> + (<literal>PLFLT</literal>, input) + </term> + <listitem> + <para> + x coordinate of second point. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <parameter>y2</parameter> + (<literal>PLFLT</literal>, input) + </term> + <listitem> + <para> + y coordinate of second point. + </para> + </listitem> + </varlistentry> + </variablelist> + + <para> + Redacted form: <function>plpath(n,x1,y1,x2,y2)</function> + </para> + + <para> + This function is not used in any examples. + </para> + + </sect1> + <sect1 id="plpoin" renderas="sect3"> <title> <function>plpoin</function>: Plots a character at the specified points @@ -12899,6 +12999,79 @@ </sect1> + <sect1 id="plstransform" renderas="sect3"> + <title> + <function>plstransform</function>: Set a global coordinate transform + function + </title> + + <para> + <funcsynopsis> + <funcprototype> + <funcdef> + <function>plstransform</function> + </funcdef> + <paramdef><parameter>transform_fun</parameter></paramdef> + <paramdef><parameter>data</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </para> + + <para> + This function can be used to define a coordinate transformation which + affects all elements drawn within the current plot window. The + transformation function is similar to that provided for the &plmap; + and &plmeridians; functions. The + <literal><parameter>data</parameter></literal> parameter may be used to + pass extra data to + <literal><parameter>transform_fun</parameter></literal>. + </para> + + <variablelist> + <varlistentry> + <term> + <parameter>transform_fun</parameter> + (<literal>void (*) (PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) + </literal>, input) + </term> + <listitem> + <para> + Pointer to a function that defines a transformation from the + input (x, y) coordinate to a new plot world coordiante. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <parameter>data</parameter> + (<literal>PLPointer</literal>, input) + </term> + <listitem> + <para> + Optional extra data for + <parameter><literal>transform_fun</literal></parameter>. + </para> + </listitem> + </varlistentry> + </variablelist> + + <para> + Redacted form: + <itemizedlist> + <listitem> + <para> + General: <function>plstransform(transform_fun, data)</function> + </para> + </listitem> + </itemizedlist> + </para> + + <para> + This function is used in example 19. + </para> + + </sect1> + <sect1 id="plstripa" renderas="sect3"> <title> <function>plstripa</function>: Add a point to a stripchart Modified: trunk/doc/docbook/src/plplotdoc.xml.in =================================================================== --- trunk/doc/docbook/src/plplotdoc.xml.in 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/doc/docbook/src/plplotdoc.xml.in 2010-04-12 05:23:41 UTC (rev 10905) @@ -153,6 +153,8 @@ <!ENTITY plline '<link linkend="plline"><function>plline</function></link>'> <!ENTITY plline3 '<link linkend="plline3"><function>plline3</function></link>'> <!ENTITY pllsty '<link linkend="pllsty"><function>pllsty</function></link>'> +<!ENTITY plmap '<link linkend="plmap"><function>plmap</function></link>'> +<!ENTITY plmeridians '<link linkend="plmeridians"><function>plmeridians</function></link>'> <!ENTITY plMergeOpts '<link linkend="plMergeOpts"><function>plMergeOpts</function></link>'> <!ENTITY plmesh '<link linkend="plmesh"><function>plmesh</function></link>'> <!ENTITY plmeshc '<link linkend="plmeshc"><function>plmeshc</function></link>'> @@ -169,6 +171,7 @@ <!ENTITY plparseoptsfortran95 '<link linkend="plparseoptsfortran95"><function>plparseoptsfortran95</function></link>'> <!ENTITY plparseoptsfortran77 '<link linkend="plparseoptsfortran77"><function>plparseoptsfortran77</function></link>'> <!ENTITY plpat '<link linkend="plpat"><function>plpat</function></link>'> +<!ENTITY plpath '<link linkend="plpath"><function>plpath</function></link>'> <!ENTITY plpoin '<link linkend="plpoin"><function>plpoin</function></link>'> <!ENTITY plpoin3 '<link linkend="plpoin3"><function>plpoin3</function></link>'> <!ENTITY plpoly3 '<link linkend="plpoly3"><function>plpoly3</function></link>'> @@ -224,6 +227,7 @@ <!ENTITY plstripc '<link linkend="plstripc"><function>plstripc</function></link>'> <!ENTITY plstripd '<link linkend="plstripd"><function>plstripd</function></link>'> <!ENTITY plstart '<link linkend="plstart"><function>plstart</function></link>'> +<!ENTITY plstransform '<link linkend="plstransform"><function>plstransform</function></link>'> <!ENTITY plstyl '<link linkend="plstyl"><function>plstyl</function></link>'> <!ENTITY plsurf3d '<link linkend="plsurf3d"><function>plsurf3d</function></link>'> <!ENTITY plsvect '<link linkend="plsvect"><function>plsvect</function></link>'> Modified: trunk/examples/c/x19c.c =================================================================== --- trunk/examples/c/x19c.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/examples/c/x19c.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -6,6 +6,16 @@ #include "plcdemos.h" +void +map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) +{ + double radius; + + radius = 90.0 - y; + *xt = radius * cos( x * M_PI / 180.0 ); + *yt = radius * sin( x * M_PI / 180.0 ); +} + /*--------------------------------------------------------------------------*\ * mapform19 * @@ -18,14 +28,12 @@ mapform19( PLINT n, PLFLT *x, PLFLT *y ) { int i; - double xp, yp, radius; + double xp, yp; for ( i = 0; i < n; i++ ) { - radius = 90.0 - y[i]; - xp = radius * cos( x[i] * M_PI / 180.0 ); - yp = radius * sin( x[i] * M_PI / 180.0 ); - x[i] = xp; - y[i] = yp; + map_transform( x[i], y[i], &xp, &yp, NULL ); + x[i] = xp; + y[i] = yp; } } @@ -159,6 +167,35 @@ pllsty( 2 ); plmeridians( mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); + +/* Polar, Northern hemisphere, this time with a PLplot-wide transform */ + + minx = 0; + maxx = 360; + + plstransform( map_transform, NULL ); + + pllsty( 1 ); + plenv( -75., 75., -75., 75., 1, -1 ); + /* No need to set the map transform here as the global transform will be + * used. */ + plmap( NULL, "globe", minx, maxx, miny, maxy ); + + pllsty( 2 ); + plmeridians( NULL, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); + + /* Show Baltimore, MD on the map */ + plcol0( 2 ); + plssym( 0.0, 2.0 ); + PLFLT x = -76.6125; + PLFLT y = 39.2902778; + plpoin( 1, &x, &y, 18 ); + plssym( 0.0, 1.0 ); + plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); + + /* For C, this is how the global transform is cleared */ + plstransform( NULL, NULL ); + plend(); exit( 0 ); } Modified: trunk/examples/ocaml/x19.ml =================================================================== --- trunk/examples/ocaml/x19.ml 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/examples/ocaml/x19.ml 2010-04-12 05:23:41 UTC (rev 10905) @@ -144,5 +144,33 @@ (* This call to plmeridians is also after the set_mapform call, so it uses the same projection as the plmap call above. *) plmeridians 10.0 10.0 0.0 360.0 (-10.0) 80.0; + + plunset_mapform (); + + (* Polar, Northern hemisphere, this time with a PLplot-wide transform *) + let minx = 0.0 in + let maxx = 360.0 in + + plstransform mapform19; + + pllsty 1; + plenv (-75.) 75. (-75.) 75. 1 (-1); + (* No need to set the map transform here as the global transform will be + used. *) + plmap "globe" minx maxx miny maxy; + + pllsty 2; + plmeridians 10.0 10.0 0.0 360.0 (-10.0) 80.0; + + (* Show Baltimore, MD on the map *) + plcol0 2; + plssym 0.0 2.0; + plpoin [|-76.6125|] [|39.2902778|] 18; + plssym 0.0 1.0; + plptex ~-.76.6125 43.0 0.0 0.0 0.0 "Baltimore, MD"; + + (* For OCaml, this is how the global transform is cleared *) + plunset_transform (); + plend (); () Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/include/plplot.h 2010-04-12 05:23:41 UTC (rev 10905) @@ -656,6 +656,7 @@ #define plgcolbg c_plgcolbg #define plgcolbga c_plgcolbga #define plgcompression c_plgcompression +#define plstransform c_plstransform #define plgdev c_plgdev #define plgdidev c_plgdidev #define plgdiori c_plgdiori @@ -688,6 +689,7 @@ #define pllab c_pllab #define pllightsource c_pllightsource #define plline c_plline +#define plpath c_plpath #define plline3 c_plline3 #define pllsty c_pllsty #define plmap c_plmap @@ -1046,6 +1048,10 @@ PLDLLIMPEXP void c_plgcompression( PLINT *compression ); +/* Set the coordinate transform */ +PLDLLIMPEXP void +c_plstransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ), PLPointer coordinate_transform_data ); + /* Get the current device (keyword) name */ PLDLLIMPEXP void @@ -1349,6 +1355,11 @@ PLDLLIMPEXP void c_plpat( PLINT nlin, PLINT *inc, PLINT *del ); +/* Draw a line connecting two points, accounting for coordinate transforms */ + +PLDLLIMPEXP void +c_plpath( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ); + /* Plots array y against x for n points using ASCII code "code".*/ PLDLLIMPEXP void Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/include/plplotP.h 2010-04-12 05:23:41 UTC (rev 10905) @@ -195,26 +195,29 @@ /* Lots of cool math macros */ #ifndef MAX -#define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) +#define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef MIN -#define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) +#define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef ABS -#define ABS( a ) ( ( a ) < 0 ? -( a ) : ( a ) ) +#define ABS( a ) ( ( a ) < 0 ? -( a ) : ( a ) ) #endif #ifndef ROUND -#define ROUND( a ) (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) ) +#define ROUND( a ) (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) ) #endif #ifndef BETW -#define BETW( ix, ia, ib ) ( ( ( ix ) <= ( ia ) && ( ix ) >= ( ib ) ) || ( ( ix ) >= ( ia ) && ( ix ) <= ( ib ) ) ) +#define BETW( ix, ia, ib ) ( ( ( ix ) <= ( ia ) && ( ix ) >= ( ib ) ) || ( ( ix ) >= ( ia ) && ( ix ) <= ( ib ) ) ) #endif #ifndef SSQR -#define SSQR( a, b ) sqrt( ( a ) * ( a ) + ( b ) * ( b ) ) +#define SSQR( a, b ) sqrt( ( a ) * ( a ) + ( b ) * ( b ) ) #endif #ifndef SIGN -#define SIGN( a ) ( ( a ) < 0 ? -1 : 1 ) +#define SIGN( a ) ( ( a ) < 0 ? -1 : 1 ) #endif +#ifndef TRANSFORM +#define TRANSFORM( x, y, xnew, ynew ) if ( plsc->coordinate_transform ) { plsc->coordinate_transform( ( x ), ( y ), ( xnew ), ( ynew ), plsc->coordinate_transform_data ); } else { *xnew = x; *ynew = y; } +#endif /* A coordinate value that should never occur */ Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/include/plstrm.h 2010-04-12 05:23:41 UTC (rev 10905) @@ -519,6 +519,11 @@ PLINT ipls, level, verbose, debug, initialized, dev_initialized; const char *program; +/* Plot-wide coordinate transform */ + + void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ); + PLPointer coordinate_transform_data; + /* Colormaps */ PLINT icol0, ncol0, icol1, ncol1, ncp1, curcmap; Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/src/plbox.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -24,9 +24,10 @@ #include "plplotP.h" -#define STRING_LEN 40 -#define FORMAT_LEN 10 -#define TEMP_LEN 30 +#define STRING_LEN 40 +#define FORMAT_LEN 10 +#define TEMP_LEN 30 +#define N_EDGE_SEGMENTS 50 static PLFLT xlog[8] = { Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/src/plcore.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -4230,3 +4230,16 @@ plsc->plbuf_write = plbuf_write; #endif /* END dev_fastimg COMMENT */ } + +/*--------------------------------------------------------------------------*\ + * plstransform + * + * Set a universal coordinate transform function which will be applied to all + * plotted items. + \*--------------------------------------------------------------------------*/ +void +c_plstransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ), PLPointer coordinate_transform_data ) +{ + plsc->coordinate_transform = coordinate_transform; + plsc->coordinate_transform_data = coordinate_transform_data; +} Modified: trunk/src/plfill.c =================================================================== --- trunk/src/plfill.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/src/plfill.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -132,6 +132,7 @@ { PLINT xpoly[PL_MAXPOLY], ypoly[PL_MAXPOLY]; PLINT i; + PLFLT xt, yt; if ( plsc->level < 3 ) { @@ -150,15 +151,17 @@ } for ( i = 0; i < n; i++ ) { - xpoly[i] = plP_wcpcx( x[i] ); - ypoly[i] = plP_wcpcy( y[i] ); + TRANSFORM( x[i], y[i], &xt, &yt ); + xpoly[i] = plP_wcpcx( xt ); + ypoly[i] = plP_wcpcy( yt ); } if ( x[0] != x[n - 1] || y[0] != y[n - 1] ) { if ( n < PL_MAXPOLY ) n++; - xpoly[n - 1] = plP_wcpcx( x[0] ); - ypoly[n - 1] = plP_wcpcy( y[0] ); + TRANSFORM( x[0], y[0], &xt, &yt ); + xpoly[n - 1] = plP_wcpcx( xt ); + ypoly[n - 1] = plP_wcpcy( yt ); } plP_plfclp( xpoly, ypoly, n, plsc->clpxmi, plsc->clpxma, Modified: trunk/src/plline.c =================================================================== --- trunk/src/plline.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/src/plline.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -49,6 +49,11 @@ /* Determines if a point is inside a polygon or not */ +/* Interpolate between two points in n steps */ + +static PLFLT * +interpolate_between( int n, PLFLT a, PLFLT b ); + /*----------------------------------------------------------------------*\ * void pljoin() * @@ -80,6 +85,42 @@ } /*----------------------------------------------------------------------*\ + * void plpath() + * + * Draws a line segment from (x1, y1) to (x2, y2). If a coordinate + * transform is defined then break the line up in to n pieces to approximate + * the path. Otherwise it simply calls pljoin(). + \*----------------------------------------------------------------------*/ + +void +c_plpath( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ) +{ + PLFLT *xs, *ys; + + if ( plsc->coordinate_transform == NULL ) + { + /* No transform, so fall back on pljoin for a normal straight line */ + pljoin( x1, y1, x2, y2 ); + } + else + { + /* Approximate the path in transformed space with a sequence of line + * segments. */ + xs = interpolate_between( n, x1, x2 ); + ys = interpolate_between( n, y1, y2 ); + if ( xs == NULL || ys == NULL ) + { + plexit( "c_plpath: Insufficient memory" ); + return; + } + plline( n, xs, ys ); + /* plP_interpolate allocates memory, so we have to free it here. */ + free( xs ); + free( ys ); + } +} + +/*----------------------------------------------------------------------*\ * void plline3(n, x, y, z) * * Draws a line in 3 space. You must first set up the viewport, the @@ -450,8 +491,11 @@ void plP_movwor( PLFLT x, PLFLT y ) { - plsc->currx = plP_wcpcx( x ); - plsc->curry = plP_wcpcy( y ); + PLFLT xt, yt; + TRANSFORM( x, y, &xt, &yt ); + + plsc->currx = plP_wcpcx( xt ); + plsc->curry = plP_wcpcy( yt ); } /*----------------------------------------------------------------------*\ @@ -463,10 +507,13 @@ void plP_drawor( PLFLT x, PLFLT y ) { + PLFLT xt, yt; + TRANSFORM( x, y, &xt, &yt ); + xline[0] = plsc->currx; - xline[1] = plP_wcpcx( x ); + xline[1] = plP_wcpcx( xt ); yline[0] = plsc->curry; - yline[1] = plP_wcpcy( y ); + yline[1] = plP_wcpcy( yt ); pllclp( xline, yline, 2 ); } @@ -510,6 +557,7 @@ plP_drawor_poly( PLFLT *x, PLFLT *y, PLINT n ) { PLINT i, j, ib, ilim; + PLFLT xt, yt; for ( ib = 0; ib < n; ib += PL_MAXPOLY - 1 ) { @@ -517,9 +565,10 @@ for ( i = 0; i < ilim; i++ ) { - j = ib + i; - xline[i] = plP_wcpcx( x[j] ); - yline[i] = plP_wcpcy( y[j] ); + j = ib + i; + TRANSFORM( x[j], y[j], &xt, &yt ); + xline[i] = plP_wcpcx( xt ); + yline[i] = plP_wcpcy( yt ); } pllclp( xline, yline, ilim ); } @@ -914,3 +963,35 @@ lasty = ytmp; } } + +/*----------------------------------------------------------------------*\ + * interpolate_between() + * + * Returns a pointer to an array of PLFLT values which interpolate in n steps + * from a to b. + * Note: + * The returned array is allocated by the function and needs to be freed by + * the function's caller. + * If the return value is NULL, the allocation failed and it is up to the + * caller to handle the error. + \*----------------------------------------------------------------------*/ + +PLFLT *interpolate_between( PLINT n, PLFLT a, PLFLT b ) +{ + PLFLT *values; + PLFLT step_size; + int i; + + if ( ( values = (PLFLT *) malloc( n * sizeof ( PLFLT ) ) ) == NULL ) + { + return NULL; + } + + step_size = ( b - a ) / (PLFLT) ( n - 1 ); + for ( i = 0; i < n; i++ ) + { + values[i] = a + step_size * (PLFLT) i; + } + + return values; +} Modified: trunk/src/plmap.c =================================================================== --- trunk/src/plmap.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/src/plmap.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -292,10 +292,7 @@ { if ( mapform == NULL ) { - y[0] = y[1] = yy; - x[0] = minlong; - x[1] = maxlong; - plline( 2, x, y ); + plpath( NSEG, minlong, yy, maxlong, yy ); } else { @@ -316,10 +313,7 @@ { if ( mapform == NULL ) { - x[0] = x[1] = xx; - y[0] = minlat; - y[1] = maxlat; - plline( 2, x, y ); + plpath( NSEG, xx, minlat, xx, maxlat ); } else { Modified: trunk/src/plshade.c =================================================================== --- trunk/src/plshade.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/src/plshade.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -514,7 +514,7 @@ return; } - if ( pltr == NULL ) + if ( pltr == NULL && plsc->coordinate_transform == NULL ) rectangular = 1; int_val = shade_max - shade_min; Modified: trunk/src/plsym.c =================================================================== --- trunk/src/plsym.c 2010-04-12 05:11:37 UTC (rev 10904) +++ trunk/src/plsym.c 2010-04-12 05:23:41 UTC (rev 10905) @@ -87,6 +87,7 @@ c_plsym( PLINT n, PLFLT *x, PLFLT *y, PLINT code ) { PLINT i; + PLFLT xt, yt; if ( plsc->level < 3 ) { @@ -101,7 +102,8 @@ for ( i = 0; i < n; i++ ) { - plhrsh( code, plP_wcpcx( x[i] ), plP_wcpcy( y[i] ) ); + TRANSFORM( x[i], y[i], &xt, &yt ); + plhrsh( code, plP_wcpcx( xt ), plP_wcpcy( yt ) ); } } @@ -122,6 +124,7 @@ c_plpoin( PLINT n, PLFLT *x, PLFLT *y, PLINT code ) { PLINT i, sym, ifont = plsc->cfont; + PLFLT xt, yt; if ( plsc->level < 3 ) { @@ -137,7 +140,10 @@ if ( code == -1 ) { for ( i = 0; i < n; i++ ) - pljoin( x[i], y[i], x[i], y[i] ); + { + TRANSFORM( x[i], y[i], &xt, &yt ); + pljoin( xt, yt, xt, yt ); + } } else { @@ -148,7 +154,10 @@ // fprintf(stdout, "plploin code, sym = %d, %d\n", code, sym); for ( i = 0; i < n; i++ ) - plhrsh( sym, plP_wcpcx( x[i] ), plP_wcpcy( y[i] ) ); + { + TRANSFORM( x[i], y[i], &xt, &yt ); + plhrsh( sym, plP_wcpcx( xt ), plP_wcpcy( yt ) ); + } } } @@ -598,6 +607,7 @@ PLFLT xform[4], diag; PLFLT chrdef, chrht; PLFLT dispx, dispy; + PLFLT wxt, wyt, dxt, dyt; if ( plsc->level < 3 ) { @@ -605,13 +615,19 @@ return; } - if ( dx == 0.0 && dy == 0.0 ) + /* Transform both the origin and offset values */ + TRANSFORM( wx, wy, &wxt, &wyt ); + TRANSFORM( wx + dx, wy + dy, &dxt, &dyt ); + dxt = dxt - wxt; + dyt = dyt - wyt; + if ( dxt == 0.0 && dyt == 0.0 ) { - dx = 1.0; - dy = 0.0; + dxt = 1.0; + dyt = 0.0; } - cc = plsc->wmxscl * dx; - ss = plsc->wmyscl * dy; + + cc = plsc->wmxscl * dxt; + ss = plsc->wmyscl * dyt; diag = sqrt( cc * cc + ss * ss ); cc /= diag; ss /= diag; @@ -621,8 +637,8 @@ xform[2] = ss; xform[3] = cc; - xdv = plP_wcdcx( wx ); - ydv = plP_wcdcy( wy ); + xdv = plP_wcdcx( wxt ); + ydv = plP_wcdcy( wyt ); dispx = 0.; dispy = 0.; @@ -1828,6 +1844,7 @@ else plP_affine_scale( affineL, 1. / stride, 1.e300 ); plP_affine_multiply( xform, affineL, xform ); + plP_text( 0, just, xform, (PLINT) xpc, (PLINT) ypc, (PLINT) xrefpc, (PLINT) yrefpc, text ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-04-12 22:10:25
|
Revision: 10909 http://plplot.svn.sourceforge.net/plplot/?rev=10909&view=rev Author: airwin Date: 2010-04-12 22:10:19 +0000 (Mon, 12 Apr 2010) Log Message: ----------- Style recent changes. Modified Paths: -------------- trunk/drivers/cairo.c trunk/examples/c/x01c.c trunk/examples/c/x06c.c trunk/examples/c/x07c.c trunk/fonts/font01.c trunk/fonts/font11.c trunk/fonts/plhershey-unicode-gen.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-04-12 21:51:06 UTC (rev 10908) +++ trunk/drivers/cairo.c 2010-04-12 22:10:19 UTC (rev 10909) @@ -74,8 +74,8 @@ #define MAX_MARKUP_LEN MAX_STRING_LEN * 10 /* Values to reset the dirty rectangle regions */ -#define DIRTY_MIN (1.0e50) -#define DIRTY_MAX (-1.0e50) +#define DIRTY_MIN ( 1.0e50 ) +#define DIRTY_MAX ( -1.0e50 ) static int text_clipping; static int text_anti_aliasing; @@ -290,13 +290,13 @@ /* Create an image surface and context for the offscreen rendering */ aStream->cairoSurface_raster = - /* - cairo_surface_create_similar( aStream->cairoSurface, - CAIRO_CONTENT_COLOR, - pls->xlength, pls->ylength ); - */ + /* + * cairo_surface_create_similar( aStream->cairoSurface, + * CAIRO_CONTENT_COLOR, + * pls->xlength, pls->ylength ); + */ cairo_image_surface_create( CAIRO_FORMAT_ARGB32, - pls->xlength, pls->ylength ); + pls->xlength, pls->ylength ); aStream->cairoContext_raster = cairo_create( aStream->cairoSurface_raster ); /* Disable antialiasing for the raster surface. The output seems to look @@ -1615,13 +1615,13 @@ aStream->cairoContext_X = cairo_create( aStream->cairoSurface_X ); /* This is the Cairo surface PLplot will actually plot to. */ aStream->cairoSurface = - /* - cairo_surface_create_similar( aStream->cairoSurface_X, - CAIRO_CONTENT_COLOR, - pls->xlength, pls->ylength ); - */ + /* + * cairo_surface_create_similar( aStream->cairoSurface_X, + * CAIRO_CONTENT_COLOR, + * pls->xlength, pls->ylength ); + */ cairo_image_surface_create( CAIRO_FORMAT_RGB24, - pls->xlength, pls->ylength ); + pls->xlength, pls->ylength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); /* Invert the surface so that the graphs are drawn right side up. */ @@ -1705,7 +1705,7 @@ cairo_rectangle( aStream->cairoContext_X, x, y, w, h ); cairo_set_operator( aStream->cairoContext_X, CAIRO_OPERATOR_SOURCE ); cairo_set_source_surface( aStream->cairoContext_X, aStream->cairoSurface, - 0.0, 0.0 ); + 0.0, 0.0 ); cairo_fill( aStream->cairoContext_X ); cairo_restore( aStream->cairoContext_X ); @@ -1794,7 +1794,7 @@ if ( expose->count == 0 ) { blit_to_x( aStream, expose->x, expose->y, - expose->width, expose->height ); + expose->width, expose->height ); } break; } @@ -1847,14 +1847,14 @@ { case PLESC_FLUSH: /* forced update of the window */ blit_to_x( aStream, aStream->dirty_x1, aStream->dirty_y1, - aStream->dirty_x2 - aStream->dirty_x1, - aStream->dirty_y2 - aStream->dirty_y1 ); + aStream->dirty_x2 - aStream->dirty_x1, + aStream->dirty_y2 - aStream->dirty_y1 ); XFlush( aStream->XDisplay ); break; case PLESC_GETC: /* get cursor position */ blit_to_x( aStream, aStream->dirty_x1, aStream->dirty_y1, - aStream->dirty_x2 - aStream->dirty_x1, - aStream->dirty_y2 - aStream->dirty_y1 ); + aStream->dirty_x2 - aStream->dirty_x1, + aStream->dirty_y2 - aStream->dirty_y1 ); XFlush( aStream->XDisplay ); xcairo_get_cursor( pls, (PLGraphicsIn*) ptr ); break; @@ -1940,15 +1940,15 @@ gin->dY = (PLFLT) ( pls->ylength - event.xbutton.y ) / ( (PLFLT) ( pls->ylength ) ); /* Get key pressed (if any) */ - if ( event.type == KeyPress || event.type == KeyRelease ) + if ( event.type == KeyPress || event.type == KeyRelease ) { number_chars = XLookupString( (XKeyEvent *) &event, str, 100, &keysym, NULL ); - if (keysym == NoSymbol) - ksname = "NoSymbol"; - else if (!(ksname = XKeysymToString(keysym))) - ksname = "(no name)"; - strcpy(gin->string, ksname); - // gin->string[number_chars] = '\0'; + if ( keysym == NoSymbol ) + ksname = "NoSymbol"; + else if ( !( ksname = XKeysymToString( keysym ) ) ) + ksname = "(no name)"; + strcpy( gin->string, ksname ); + // gin->string[number_chars] = '\0'; switch ( keysym ) { case XK_BackSpace: @@ -1965,8 +1965,8 @@ } else // button press { - sprintf(gin->string, "button %u", gin->button); - gin->keysym = 0x20; + sprintf( gin->string, "button %u", gin->button ); + gin->keysym = 0x20; } /* Switch back to normal cursor */ @@ -2825,39 +2825,39 @@ * ---------------------------------------------------------------------*/ void -handle_locate( PLStream *pls , PLGraphicsIn *gin) +handle_locate( PLStream *pls, PLGraphicsIn *gin ) { - int located = 0; + int located = 0; PLCairo *aStream = (PLCairo *) pls->dev; /* Initialize PLplot mouse event structure */ plGinInit( gin ); - while ( GetMessage( &aStream->msg, NULL, 0, 0 ) && !located) - { - TranslateMessage( &aStream->msg ); + while ( GetMessage( &aStream->msg, NULL, 0, 0 ) && !located ) + { + TranslateMessage( &aStream->msg ); - switch ( (int) aStream->msg.message ) - { - case WM_MOUSEMOVE: - case WM_LBUTTONDOWN: - gin->state = 1; - gin->button = 1; - gin->pX = LOWORD(aStream->msg.lParam); - gin->pY = pls->ylength - HIWORD(aStream->msg.lParam); - gin->dX = (PLFLT) LOWORD(aStream->msg.lParam) / ((PLFLT) pls->xlength); - gin->dY = (PLFLT) (pls->ylength - HIWORD(aStream->msg.lParam)) / ((PLFLT) pls->ylength); - break; - case WM_CHAR: - gin->keysym = aStream->msg.wParam; - located = 1; - break; - - default: - DispatchMessage( &aStream->msg ); - break; - } - } + switch ( (int) aStream->msg.message ) + { + case WM_MOUSEMOVE: + case WM_LBUTTONDOWN: + gin->state = 1; + gin->button = 1; + gin->pX = LOWORD( aStream->msg.lParam ); + gin->pY = pls->ylength - HIWORD( aStream->msg.lParam ); + gin->dX = (PLFLT) LOWORD( aStream->msg.lParam ) / ( (PLFLT) pls->xlength ); + gin->dY = (PLFLT) ( pls->ylength - HIWORD( aStream->msg.lParam ) ) / ( (PLFLT) pls->ylength ); + break; + case WM_CHAR: + gin->keysym = aStream->msg.wParam; + located = 1; + break; + + default: + DispatchMessage( &aStream->msg ); + break; + } + } } /*--------------------------------------------------------------------- @@ -3092,7 +3092,7 @@ InvalidateRect( aStream->hwnd, NULL, TRUE ); break; case PLESC_GETC: - handle_locate(pls, (PLGraphicsIn*) ptr); + handle_locate( pls, (PLGraphicsIn*) ptr ); break; default: plD_esc_cairo( pls, op, ptr ); Modified: trunk/examples/c/x01c.c =================================================================== --- trunk/examples/c/x01c.c 2010-04-12 21:51:06 UTC (rev 10908) +++ trunk/examples/c/x01c.c 2010-04-12 22:10:19 UTC (rev 10909) @@ -203,10 +203,10 @@ pltext(); if ( gin.keysym < 0xFF && isprint( gin.keysym ) ) printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = '%c' s = '%s'\n", - gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); + gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); else printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x s - '%s'\n", - gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); + gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); plgra(); } Modified: trunk/examples/c/x06c.c =================================================================== --- trunk/examples/c/x06c.c 2010-04-12 21:51:06 UTC (rev 10908) +++ trunk/examples/c/x06c.c 2010-04-12 22:10:19 UTC (rev 10909) @@ -26,64 +26,66 @@ plinit(); - for(kind_font=0;kind_font<2; kind_font++) { - plfontld (kind_font); - if(kind_font == 0) - maxfont = 1; - else - maxfont = 4; + for ( kind_font = 0; kind_font < 2; kind_font++ ) + { + plfontld( kind_font ); + if ( kind_font == 0 ) + maxfont = 1; + else + maxfont = 4; - for(font=0; font<maxfont; font++) { - plfont(font+1); + for ( font = 0; font < maxfont; font++ ) + { + plfont( font + 1 ); - pladv( 0 ); + pladv( 0 ); /* Set up viewport and window */ - plcol0( 2 ); - plvpor( 0.1, 1.0, 0.1, 0.9 ); - plwind( 0.0, 1.0, 0.0, 1.3 ); + plcol0( 2 ); + plvpor( 0.1, 1.0, 0.1, 0.9 ); + plwind( 0.0, 1.0, 0.0, 1.3 ); /* Draw the grid using plbox */ - plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); + plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); /* Write the digits below the frame */ - plcol0( 15 ); - for ( i = 0; i <= 9; i++ ) - { - sprintf( text, "%d", i ); - plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); - } + plcol0( 15 ); + for ( i = 0; i <= 9; i++ ) + { + sprintf( text, "%d", i ); + plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); + } - k = 0; - for ( i = 0; i <= 12; i++ ) - { - /* Write the digits to the left of the frame */ + k = 0; + for ( i = 0; i <= 12; i++ ) + { + /* Write the digits to the left of the frame */ - sprintf( text, "%d", 10 * i ); - plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, text ); - for ( j = 0; j <= 9; j++ ) - { - x = 0.1 * j + 0.05; - y = 1.25 - 0.1 * i; + sprintf( text, "%d", 10 * i ); + plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, text ); + for ( j = 0; j <= 9; j++ ) + { + x = 0.1 * j + 0.05; + y = 1.25 - 0.1 * i; - /* Display the symbols (plpoin expects that x and y are arrays so */ - /* pass pointers) */ + /* Display the symbols (plpoin expects that x and y are arrays so */ + /* pass pointers) */ - if ( k < 128 ) - plpoin( 1, &x, &y, k ); - k = k + 1; + if ( k < 128 ) + plpoin( 1, &x, &y, k ); + k = k + 1; + } + } + + if ( kind_font == 0 ) + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); + else + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); } } - - if(kind_font == 0) - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); - else - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); -} -} plend(); exit( 0 ); } Modified: trunk/examples/c/x07c.c =================================================================== --- trunk/examples/c/x07c.c 2010-04-12 21:51:06 UTC (rev 10908) +++ trunk/examples/c/x07c.c 2010-04-12 22:10:19 UTC (rev 10909) @@ -10,7 +10,7 @@ #include "plcdemos.h" static int base[20] = -{ 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, +{ 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900 }; /*--------------------------------------------------------------------------*\ @@ -37,7 +37,7 @@ plfontld( 0 ); for ( l = 0; l < 20; l++ ) { - if (l == 2) plfontld(1); + if ( l == 2 ) plfontld( 1 ); pladv( 0 ); /* Set up viewport and window */ @@ -78,11 +78,10 @@ } } - if( l < 2) - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); + if ( l < 2 ) + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); else - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); - + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); } plend(); exit( 0 ); Modified: trunk/fonts/font01.c =================================================================== --- trunk/fonts/font01.c 2010-04-12 21:51:06 UTC (rev 10908) +++ trunk/fonts/font01.c 2010-04-12 22:10:19 UTC (rev 10909) @@ -238,7 +238,7 @@ 3499, 3541, 3573, 3621, 3656, 3688, 3722, 3757, 3798, 3829, 3857, 3893, 3928, 3956, 3995, 4036, 0, 0, 0, 0, 0, 0, 4079, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; short int subindex06[100] = { 4091, 4112, 4133, 4151, 4172, 4193, 4205, 4231, 4245, 4257, @@ -253,16 +253,16 @@ 0, 0, 0, 0, 0, 0, 5825, 5830, 5835, 5840 }; short int subindex07[100] = { - 5861, 5869, 5887, 5906, 5916, 5937, 5964, 5973, 6006, 6033, - 6042, 6054, 6069, 6087, 6099, 6123, 6129, 6138, 6155, 6185, - 6191, 6205, 6219, 6225, 6231, 6240, 6249, 6258, 6270, 6279, - 6290, 6301, 6313, 6328, 6366, 0, 6397, 6406, 6415, 6422, - 6443, 6479, 6508, 6531, 6582, 6640, 0, 0, 0, 6698, - 6719, 6738, 6750, 6781, 6810, 6827, 6840, 6854, 6870, 6884, - 6894, 6903, 6913, 6923, 6947, 6971, 7005, 7030, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,26692, 7063, 7069, 7075, 7081, 7087 + 5861, 5869, 5887, 5906, 5916, 5937, 5964, 5973, 6006, 6033, + 6042, 6054, 6069, 6087, 6099, 6123, 6129, 6138, 6155, 6185, + 6191, 6205, 6219, 6225, 6231, 6240, 6249, 6258, 6270, 6279, + 6290, 6301, 6313, 6328, 6366, 0, 6397, 6406, 6415, 6422, + 6443, 6479, 6508, 6531, 6582, 6640, 0, 0, 0, 6698, + 6719, 6738, 6750, 6781, 6810, 6827, 6840, 6854, 6870, 6884, + 6894, 6903, 6913, 6923, 6947, 6971, 7005, 7030, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 26692, 7063, 7069, 7075, 7081, 7087 }; short int subindex08[100] = { 7093, 7099, 7105, 7111, 7117, 7123, 7129, 7135, 7141, 7147, Modified: trunk/fonts/font11.c =================================================================== --- trunk/fonts/font11.c 2010-04-12 21:51:06 UTC (rev 10908) +++ trunk/fonts/font11.c 2010-04-12 22:10:19 UTC (rev 10909) @@ -276,7 +276,7 @@ 2241, 2238, 2242, 2215, 2273, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, - 2026, 2223, 804, 2224, 832, 795, 2249, 2101, 2102, 2103, + 2026, 2223, 804, 2224, 832, 795, 2249, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2225, 2229, 2226, 2246, 2199, 2027, 2028, @@ -296,7 +296,7 @@ 2241, 2776, 2242, 2765, 2273, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, - 2076, 2223, 804, 2224, 832, 795, 2249, 2151, 2152, 2153, + 2076, 2223, 804, 2224, 832, 795, 2249, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2225, 2229, 2226, 2246, 2199, 2027, 2028, @@ -316,7 +316,7 @@ 2241, 2776, 2242, 2765, 2273, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, - 2576, 2223, 804, 2224, 832, 795, 2249, 2651, 2652, 2653, + 2576, 2223, 804, 2224, 832, 795, 2249, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2225, 2229, 2226, 2246, 2199, 2027, 2028, Modified: trunk/fonts/plhershey-unicode-gen.c =================================================================== --- trunk/fonts/plhershey-unicode-gen.c 2010-04-12 21:51:06 UTC (rev 10908) +++ trunk/fonts/plhershey-unicode-gen.c 2010-04-12 22:10:19 UTC (rev 10909) @@ -89,7 +89,7 @@ int *Hershey = NULL; int *Unicode = NULL; char *Font = NULL; - int Hershey_old = 0; + int Hershey_old = 0; int i = 0; int number_of_lines = 0; @@ -126,10 +126,10 @@ while ( ( fgets( readbuffer, 255, fr ) != NULL ) ) { sscanf( readbuffer, "%x,%d,%c", (int *) &Unicode[i], (int *) &Hershey[i], (char *) &Font[i] ); - if (Hershey[i] <= Hershey_old) + if ( Hershey[i] <= Hershey_old ) { - fprintf(stderr, "Error: Hershey index = %d is not ascending\n", Hershey[i]); - return(1); + fprintf( stderr, "Error: Hershey index = %d is not ascending\n", Hershey[i] ); + return ( 1 ); } Hershey_old = Hershey[i]; i++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-04-28 06:58:48
|
Revision: 10940 http://plplot.svn.sourceforge.net/plplot/?rev=10940&view=rev Author: airwin Date: 2010-04-28 06:58:38 +0000 (Wed, 28 Apr 2010) Log Message: ----------- Style recent changes. Modified Paths: -------------- trunk/drivers/pdf.c trunk/drivers/pstex.c trunk/include/plfci-type1.h trunk/src/plcore.c trunk/src/plstripc.c trunk/src/plsym.c Modified: trunk/drivers/pdf.c =================================================================== --- trunk/drivers/pdf.c 2010-04-27 21:53:09 UTC (rev 10939) +++ trunk/drivers/pdf.c 2010-04-28 06:58:38 UTC (rev 10940) @@ -553,26 +553,25 @@ // fci = 0 is a special value indicating the Type 1 Symbol font // is desired. This value cannot be confused with a normal FCI value // because it doesn't have the PL_FCI_MARK. - if ( fci == 0) + if ( fci == 0 ) { - font = "Symbol"; - dev->nlookup = number_of_entries_in_unicode_to_symbol_table; - dev->lookup = unicode_to_symbol_lookup_table; - dev->if_symbol_font = 1; + font = "Symbol"; + dev->nlookup = number_of_entries_in_unicode_to_symbol_table; + dev->lookup = unicode_to_symbol_lookup_table; + dev->if_symbol_font = 1; } else { - /* convert the fci to Base14/Type1 font information */ - font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); - dev->nlookup = number_of_entries_in_unicode_to_standard_table; - dev->lookup = unicode_to_standard_lookup_table; - dev->if_symbol_font = 0; + /* convert the fci to Base14/Type1 font information */ + font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); + dev->nlookup = number_of_entries_in_unicode_to_standard_table; + dev->lookup = unicode_to_standard_lookup_table; + dev->if_symbol_font = 0; } if ( !( dev->m_font = HPDF_GetFont( dev->pdf, font, NULL ) ) ) plexit( "ERROR: Couldn't open font\n" ); HPDF_Page_SetFontAndSize( dev->page, dev->m_font, dev->fontSize * dev->fontScale ); - } @@ -612,106 +611,106 @@ if ( ucs4[i] != (PLUNICODE) plplotEsc ) /* a character to display */ { type1_string[s] = plunicode2type1( ucs4[i], dev->lookup, dev->nlookup ); - if(ucs4[i] != ' ' && type1_string[s] == ' ') + if ( ucs4[i] != ' ' && type1_string[s] == ' ' ) { - // failed lookup - if(! dev->if_symbol_font) - { - // failed standard font lookup. Try "last chance" - // symbol font instead. - type1_string[s] = '\0'; - PSDrawTextToCanvas( dev, type1_string, drawText ); - s = 0; - last_chance = 1; - PSSetFont( dev, 0 ); - continue; - } - else if(!last_chance) - { - // failed symbol font lookup that is not right - // after a failed standard font lookup (i.e., - // last_change = 0). Try standard fonts lookup instead. - type1_string[s] = '\0'; - PSDrawTextToCanvas( dev, type1_string, drawText ); - s = 0; - last_chance = 0; - PSSetFont( dev, fci ); - continue; - } - else - { - // failed "last_chance" symbol font lookup that - // has occurred right after a failed standard - // fonts lookup. Just accept blank result and - // move on using standard fonts. - PSDrawTextToCanvas( dev, type1_string, drawText ); - s = 0; - last_chance = 0; - PSSetFont( dev, fci ); - i++; - continue; - } + // failed lookup + if ( !dev->if_symbol_font ) + { + // failed standard font lookup. Try "last chance" + // symbol font instead. + type1_string[s] = '\0'; + PSDrawTextToCanvas( dev, type1_string, drawText ); + s = 0; + last_chance = 1; + PSSetFont( dev, 0 ); + continue; + } + else if ( !last_chance ) + { + // failed symbol font lookup that is not right + // after a failed standard font lookup (i.e., + // last_change = 0). Try standard fonts lookup instead. + type1_string[s] = '\0'; + PSDrawTextToCanvas( dev, type1_string, drawText ); + s = 0; + last_chance = 0; + PSSetFont( dev, fci ); + continue; + } + else + { + // failed "last_chance" symbol font lookup that + // has occurred right after a failed standard + // fonts lookup. Just accept blank result and + // move on using standard fonts. + PSDrawTextToCanvas( dev, type1_string, drawText ); + s = 0; + last_chance = 0; + PSSetFont( dev, fci ); + i++; + continue; + } } else { - // font lookup succeeded. - s++; - i++; - last_chance = 0; - continue; + // font lookup succeeded. + s++; + i++; + last_chance = 0; + continue; } } i++; if ( ucs4[i] == (PLUNICODE) plplotEsc ) /* a escape character to display */ { type1_string[s] = plunicode2type1( ucs4[i], dev->lookup, dev->nlookup ); - if(ucs4[i] != ' ' && type1_string[s] == ' ') + if ( ucs4[i] != ' ' && type1_string[s] == ' ' ) { - // failed lookup - if(! dev->if_symbol_font) - { - // failed standard font lookup. Try "last chance" - // symbol font instead. - type1_string[s] = '\0'; - PSDrawTextToCanvas( dev, type1_string, drawText ); - s = 0; - last_chance = 1; - PSSetFont( dev, 0 ); - continue; - } - else if(!last_chance) - { - // failed symbol font lookup that is not right - // after a failed standard font lookup (i.e., - // last_change = 0). Try standard fonts lookup instead. - type1_string[s] = '\0'; - PSDrawTextToCanvas( dev, type1_string, drawText ); - s = 0; - last_chance = 0; - PSSetFont( dev, fci ); - continue; - } - else - { - // failed "last_chance" symbol font lookup that - // has occurred right after a failed standard - // fonts lookup. Just accept blank result and - // move on using standard fonts. - PSDrawTextToCanvas( dev, type1_string, drawText ); - s = 0; - last_chance = 0; - PSSetFont( dev, fci ); - i++; - continue; - } + // failed lookup + if ( !dev->if_symbol_font ) + { + // failed standard font lookup. Try "last chance" + // symbol font instead. + type1_string[s] = '\0'; + PSDrawTextToCanvas( dev, type1_string, drawText ); + s = 0; + last_chance = 1; + PSSetFont( dev, 0 ); + continue; + } + else if ( !last_chance ) + { + // failed symbol font lookup that is not right + // after a failed standard font lookup (i.e., + // last_change = 0). Try standard fonts lookup instead. + type1_string[s] = '\0'; + PSDrawTextToCanvas( dev, type1_string, drawText ); + s = 0; + last_chance = 0; + PSSetFont( dev, fci ); + continue; + } + else + { + // failed "last_chance" symbol font lookup that + // has occurred right after a failed standard + // fonts lookup. Just accept blank result and + // move on using standard fonts. + PSDrawTextToCanvas( dev, type1_string, drawText ); + s = 0; + last_chance = 0; + PSSetFont( dev, fci ); + i++; + continue; + } } else { - // font lookup succeeded. - s++; - i++; - last_chance = 0; - continue; + // font lookup succeeded. + s++; + i++; + last_chance = 0; + continue; } } else Modified: trunk/drivers/pstex.c =================================================================== --- trunk/drivers/pstex.c 2010-04-27 21:53:09 UTC (rev 10939) +++ trunk/drivers/pstex.c 2010-04-28 06:58:38 UTC (rev 10940) @@ -51,10 +51,10 @@ void plD_init_pstex( PLStream *pls ) { - char *ofile; + char *ofile; size_t len; - PSDev *dev; - FILE *fp; + PSDev *dev; + FILE *fp; plParseDrvOpts( pstex_options ); if ( color ) @@ -68,10 +68,10 @@ pls->dev_unicode = 0; /* don't want unicode */ /* open latex output file */ - len = strlen( pls->FileName ) + 3; - ofile = (char *) malloc( sizeof( char )*len ); + len = strlen( pls->FileName ) + 3; + ofile = (char *) malloc( sizeof ( char ) * len ); snprintf( ofile, len, "%s_t", pls->FileName ); - fp = fopen( ofile, "w" ); + fp = fopen( ofile, "w" ); free( ofile ); dev->fp = fp; Modified: trunk/include/plfci-type1.h =================================================================== --- trunk/include/plfci-type1.h 2010-04-27 21:53:09 UTC (rev 10939) +++ trunk/include/plfci-type1.h 2010-04-28 06:58:38 UTC (rev 10940) @@ -23,20 +23,20 @@ */ /* This file only relevant to device drivers (currently just pdf and - ps) that use Type1 fonts. */ + * ps) that use Type1 fonts. */ /* There are no good choices for script fonts for Type1 so default to - the Helvetica (sans) variants in that case. */ + * the Helvetica (sans) variants in that case. */ /* Default to Helvetica (sans) variants for symbol fonts to follow - what is done for all modern unicode-aware TrueType font devices. */ + * what is done for all modern unicode-aware TrueType font devices. */ /* N.B. if the glyph lookup comes up blank for any of the fonts below, - then an additional search of the Type1 Symbol font glyphs is - implemented in the Type1 device drivers as a fallback. */ + * then an additional search of the Type1 Symbol font glyphs is + * implemented in the Type1 device drivers as a fallback. */ /* N.B. When updating this table by hand be sure to keep it in - ascending order in fci! */ + * ascending order in fci! */ #define N_Type1Lookup 30 static const FCI_to_FontName_Table Type1Lookup[N_Type1Lookup] = { Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-04-27 21:53:09 UTC (rev 10939) +++ trunk/src/plcore.c 2010-04-28 06:58:38 UTC (rev 10940) @@ -862,8 +862,8 @@ switch ( string[i + 1] ) { case '(': /* hershey code */ - i += 2 + text2num( &string[i + 2], ')', &code ); - idx = plhershey2unicode( code ); + i += 2 + text2num( &string[i + 2], ')', &code ); + idx = plhershey2unicode( code ); args.n_char = \ (PLUNICODE) hershey_to_unicode_lookup_table[idx].Unicode; plP_esc( PLESC_TEXT_CHAR, &args ); @@ -872,7 +872,7 @@ break; case '[': /* unicode */ - i += 2 + text2num( &string[i + 2], ']', &code ); + i += 2 + text2num( &string[i + 2], ']', &code ); args.n_char = code; plP_esc( PLESC_TEXT_CHAR, &args ); skip = 1; Modified: trunk/src/plstripc.c =================================================================== --- trunk/src/plstripc.c 2010-04-27 21:53:09 UTC (rev 10939) +++ trunk/src/plstripc.c 2010-04-28 06:58:38 UTC (rev 10940) @@ -310,10 +310,10 @@ else stripc->xlen = stripc->xlen * ( 1 + stripc->xjump ); - if( stripc->acc == 0 ) - stripc->xmin = stripc->xmin + stripc->xlen * stripc->xjump; - else - stripc->xmin = stripc->x[p][0]; + if ( stripc->acc == 0 ) + stripc->xmin = stripc->xmin + stripc->xlen * stripc->xjump; + else + stripc->xmin = stripc->x[p][0]; stripc->xmax = stripc->xmax + stripc->xlen * stripc->xjump; plstrip_gen( stripc ); Modified: trunk/src/plsym.c =================================================================== --- trunk/src/plsym.c 2010-04-27 21:53:09 UTC (rev 10939) +++ trunk/src/plsym.c 2010-04-28 06:58:38 UTC (rev 10940) @@ -288,8 +288,8 @@ args.string = NULL; /* Since we are using unicode, we want this to be NULL */ /* "array method" */ plgesc( &esc ); - args.xform = xform; - args.unicode_array_len = 1; + args.xform = xform; + args.unicode_array_len = 1; plhrsh_unicode_buffer[0] = unicode_char; /* watch out for escape character and unescape it by appending * one extra. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-04-28 19:50:04
|
Revision: 10943 http://plplot.svn.sourceforge.net/plplot/?rev=10943&view=rev Author: airwin Date: 2010-04-28 19:49:58 +0000 (Wed, 28 Apr 2010) Log Message: ----------- Minor ps device driver cleanup following what is done in pdf.c; define and use set_font static routine. Modified Paths: -------------- trunk/drivers/ps.c trunk/include/ps.h Modified: trunk/drivers/ps.c =================================================================== --- trunk/drivers/ps.c 2010-04-28 19:47:52 UTC (rev 10942) +++ trunk/drivers/ps.c 2010-04-28 19:49:58 UTC (rev 10943) @@ -4,7 +4,7 @@ * * Copyright (C) 1992, 2001 Geoffrey Furnish * Copyright (C) 1992, 1993, 1994, 1995, 2001 Maurice LeBrun - * Copyright (C) 2000, 2001, 2002, 2004, 2005 Alan W. Irwin + * Copyright (C) 2000-2010 Alan W. Irwin * Copyright (C) 2001, 2002 Joao Cardoso * Copyright (C) 2001, 2003, 2004 Rafael Laboissiere * Copyright (C) 2004, 2005 Thomas J. Duck @@ -81,6 +81,9 @@ const Unicode_to_Type1_table lookup[], const int number_of_entries ); +static void +set_font( PSDev* dev, PLUNICODE fci ); + /* text > 0 uses some postscript tricks, namely a transformation matrix * that scales, rotates (with slanting) and offsets text strings. * It has yet some bugs for 3d plots. */ @@ -761,9 +764,7 @@ if ( args->unicode_array_len > 0 ) { int j, s, f; - char *fonts[PROC_STR_STRING_LENGTH]; - int nlookup; - const Unicode_to_Type1_table *lookup; + char *fonts[PROC_STR_STRING_LENGTH]; const PLUNICODE *cur_text; PLUNICODE fci; /* translate from unicode into type 1 font index. */ @@ -774,25 +775,8 @@ plgesc( &esc ); plgfci( &fci ); - font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); - if ( font == NULL ) - { - fprintf( stderr, "fci = 0x%x, font name pointer = NULL \n", fci ); - plabort( "proc_str: FCI inconsistent with Type1Lookup; " - "internal PLplot error" ); - return; - } - pldebug( "proc_str", "fci = 0x%x, font name = %s\n", fci, font ); - if ( !strcmp( font, "Symbol" ) ) - { - nlookup = number_of_entries_in_unicode_to_symbol_table; - lookup = unicode_to_symbol_lookup_table; - } - else - { - nlookup = number_of_entries_in_unicode_to_standard_table; - lookup = unicode_to_standard_lookup_table; - } + set_font( dev, fci ); + font = dev->font; cur_text = args->unicode_array; for ( f = s = j = 0; j < args->unicode_array_len; j++ ) { @@ -804,24 +788,8 @@ */ if ( ( f < PROC_STR_STRING_LENGTH ) && ( s + 3 < PROC_STR_STRING_LENGTH ) ) { - fonts[f] = plP_FCI2FontName( cur_text[j], Type1Lookup, N_Type1Lookup ); - if ( fonts[f] == NULL ) - { - fprintf( stderr, "string-supplied FCI = 0x%x, font name pointer = NULL \n", cur_text[j] ); - plabort( "proc_str: string-supplied FCI inconsistent with Type1Lookup;" ); - return; - } - pldebug( "proc_str", "string-supplied FCI = 0x%x, font name = %s\n", cur_text[j], fonts[f] ); - if ( !strcmp( fonts[f++], "Symbol" ) ) - { - lookup = unicode_to_symbol_lookup_table; - nlookup = number_of_entries_in_unicode_to_symbol_table; - } - else - { - lookup = unicode_to_standard_lookup_table; - nlookup = number_of_entries_in_unicode_to_standard_table; - } + set_font( dev, cur_text[j] ); + fonts[f++] = dev->font; cur_str[s++] = esc; cur_str[s++] = 'f'; cur_str[s++] = 'f'; @@ -831,14 +799,14 @@ { #undef PL_TEST_TYPE1 #ifdef PL_TEST_TYPE1 - // Use this test case only to conveniently view type 1 font + // Use this test case only to conveniently view Type1 font // possibilities (as in test_type1.py example). if ( 0 <= cur_text[j] && cur_text[j] < 256 ) cur_str[s++] = cur_text[j]; else cur_str[s++] = 32; #else - cur_str[s++] = plunicode2type1( cur_text[j], lookup, nlookup ); + cur_str[s++] = plunicode2type1( cur_text[j], dev->lookup, dev->nlookup ); #endif pldebug( "proc_str", "unicode = 0x%x, type 1 code = %d\n", cur_text[j], cur_str[s - 1] ); @@ -1139,11 +1107,40 @@ /* jlo is invalid or it is valid and index > lookup[jlo].Unicode. * jhi is invalid or it is valid and index < lookup[jhi].Unicode. * All these conditions together imply index cannot be found in lookup. - * Mark with 32 (which is normally a blank in type 1 fonts). + * Mark with ' ' (which is normally the index for blank in type 1 fonts). */ - return ( 32 ); + return ( ' ' ); } +/*********************************************************************** + * set_font( PSDev* dev, PLUNICODE fci ) + * + * Sets the Type1 font. + ***********************************************************************/ +static void +set_font( PSDev* dev, PLUNICODE fci ) +{ + // fci = 0 is a special value indicating the Type 1 Symbol font + // is desired. This value cannot be confused with a normal FCI value + // because it doesn't have the PL_FCI_MARK. + if ( fci == 0 ) + { + dev->font = "Symbol"; + dev->nlookup = number_of_entries_in_unicode_to_symbol_table; + dev->lookup = unicode_to_symbol_lookup_table; + dev->if_symbol_font = 1; + } + else + { + /* convert the fci to Base14/Type1 font information */ + dev->font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); + dev->nlookup = number_of_entries_in_unicode_to_standard_table; + dev->lookup = unicode_to_standard_lookup_table; + dev->if_symbol_font = 0; + } + pldebug( "set_font", "fci = 0x%x, font name = %s\n", fci, dev->font ); +} + #else int pldummy_ps() Modified: trunk/include/ps.h =================================================================== --- trunk/include/ps.h 2010-04-28 19:47:52 UTC (rev 10942) +++ trunk/include/ps.h 2010-04-28 19:49:58 UTC (rev 10943) @@ -6,6 +6,8 @@ #ifndef __PS_H__ #define __PS_H__ +#include "plunicode-type1.h" + /* top level declarations */ #define LINELENGTH 78 @@ -47,6 +49,10 @@ PLFLT xscale_dev, yscale_dev; int llx, lly, urx, ury, ptcnt; + // font variables. + char *font; + int nlookup, if_symbol_font; + const Unicode_to_Type1_table *lookup; /* These are only used by the pstex driver for the additional * file required in this case */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-04-28 22:54:09
|
Revision: 10944 http://plplot.svn.sourceforge.net/plplot/?rev=10944&view=rev Author: andrewross Date: 2010-04-28 22:54:03 +0000 (Wed, 28 Apr 2010) Log Message: ----------- Fix up octave stripc function so that interactive example p11 works (missing call to pladv) Fix up example p12 so that it can by run non-interactively (for example 20) Update test_octave_interactive script so that the device is honoured even for examples which call figure internally. Previously some examples always used xwin, whatever device was called. Update comments on failing xwin and qtwidget examples. Modified Paths: -------------- trunk/bindings/octave/PLplot/stripc.m trunk/examples/octave/p12.m trunk/examples/octave/p20.m trunk/plplot_test/test_octave_interactive.sh.in Modified: trunk/bindings/octave/PLplot/stripc.m =================================================================== --- trunk/bindings/octave/PLplot/stripc.m 2010-04-28 19:49:58 UTC (rev 10943) +++ trunk/bindings/octave/PLplot/stripc.m 2010-04-28 22:54:03 UTC (rev 10944) @@ -48,6 +48,10 @@ colline(3) = 3; colline(4) = 4; + if ( plglevel == 1 ) + pladv(0); + end + id = plstripc("bcnst", "bcnstv", xmin, xmax, xjump, ymin, ymax, __pl.legend_xpos(strm), __pl.legend_ypos(strm), Modified: trunk/examples/octave/p12.m =================================================================== --- trunk/examples/octave/p12.m 2010-04-28 19:49:58 UTC (rev 10943) +++ trunk/examples/octave/p12.m 2010-04-28 22:54:03 UTC (rev 10944) @@ -12,7 +12,7 @@ ## ## This file is part of plplot_octave. -function p12 +function p12(fg) global pl_automatic_replot t = pl_automatic_replot; @@ -23,11 +23,13 @@ x=0:0.1:4; plot(x,exp(x)); text(1,20,"Click Here -> + "); - [x y]=ginput(1); - if (round(x) != 2 || round(y) != 20) - text(x,y,"You missed!") - else - text(x,y,"ouch! Gently!") + if (!nargin) + [x y]=ginput(1); + if (round(x) != 2 || round(y) != 20) + text(x,y,"You missed!") + else + text(x,y,"ouch! Gently!") + endif endif legend("on"); Modified: trunk/examples/octave/p20.m =================================================================== --- trunk/examples/octave/p20.m 2010-04-28 19:49:58 UTC (rev 10943) +++ trunk/examples/octave/p20.m 2010-04-28 22:54:03 UTC (rev 10944) @@ -47,7 +47,7 @@ subwindow(4 ,3) p14(1) subwindow(1 ,2) - p12 + p12(1) subwindow(4, 4) p17(1) oneplot; Modified: trunk/plplot_test/test_octave_interactive.sh.in =================================================================== --- trunk/plplot_test/test_octave_interactive.sh.in 2010-04-28 19:49:58 UTC (rev 10943) +++ trunk/plplot_test/test_octave_interactive.sh.in 2010-04-28 22:54:03 UTC (rev 10944) @@ -58,33 +58,27 @@ # slowness issue # with that device). # The following comments are for -dev qtwidget. -# 11 (many invalid limits); # 12 (hangs); # 14 (looks pretty to start but then segfaults); # 17 (error: plrb: device is not xor capable); -# 18 (pthread_mutex_lock.c:285:) -# 19 (failed to exit properly); -# 20 (failed to exit properly); -# 21 (plot was just dark background) +# 18 (hangs); +# The issues with 12, 17 and 18 are all because qtwidget does not handle plGetCursor # -dev wxwidgets had similar issues except possibly for examples 18 # and 19 which seemed fine, but there is no way to tell for sure with # second wxwidgets example (no matter what) always segfaulting. # -dev xwin worked except for the following: -# 11 (many invalid limits); -# 14 (locked xterm); -# 19 (failed to exit properly); -# 20 (failed to exit properly); -# 21 (plot was just dark background) -# Drop everything that fails to work for -dev xwin except for 21. +# 14 (animation does not work right); -for i=[1:10 12:13 15:18 21]; +plsetopt("dev","$device"); +for i=[1:21]; if (verbose_test) printf("p%d\n",i); endif #figure(i,"$device",sprintf("${OUTPUT_DIR}/p%d%%n.$dsuffix",i)); figure(i,"$device"); + plsetopt("dev","$device"); feval(sprintf("p%d",i)) closefig endfor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-04-29 15:11:27
|
Revision: 10950 http://plplot.svn.sourceforge.net/plplot/?rev=10950&view=rev Author: airwin Date: 2010-04-29 15:11:18 +0000 (Thu, 29 Apr 2010) Log Message: ----------- Change static function set_font to get_font which allows dropping font from PSDev struct. Use set_font to reimplement PL_TEST_TYPE1 case. This gave good results for the one test case (examples/python/test_type1.py) where it is useful, but PL_TEST_TYPE1 is normally #undefed (as in this commit). ToDo: fallback to Symbol font for normal case. Modified Paths: -------------- trunk/drivers/ps.c trunk/include/ps.h Modified: trunk/drivers/ps.c =================================================================== --- trunk/drivers/ps.c 2010-04-29 04:57:12 UTC (rev 10949) +++ trunk/drivers/ps.c 2010-04-29 15:11:18 UTC (rev 10950) @@ -81,8 +81,8 @@ const Unicode_to_Type1_table lookup[], const int number_of_entries ); -static void -set_font( PSDev* dev, PLUNICODE fci ); +static char * +get_font( PSDev* dev, PLUNICODE fci ); /* text > 0 uses some postscript tricks, namely a transformation matrix * that scales, rotates (with slanting) and offsets text strings. @@ -763,7 +763,7 @@ /* unicode only! so test for it. */ if ( args->unicode_array_len > 0 ) { - int j, s, f; + int j, s, f, last_chance = 0; char *fonts[PROC_STR_STRING_LENGTH]; const PLUNICODE *cur_text; PLUNICODE fci; @@ -775,10 +775,10 @@ plgesc( &esc ); plgfci( &fci ); - set_font( dev, fci ); - font = dev->font; + font = get_font( dev, fci ); cur_text = args->unicode_array; - for ( f = s = j = 0; j < args->unicode_array_len; j++ ) + f = s = j = 0; + while ( j < args->unicode_array_len ) { if ( cur_text[j] & PL_FCI_MARK ) { @@ -788,8 +788,7 @@ */ if ( ( f < PROC_STR_STRING_LENGTH ) && ( s + 3 < PROC_STR_STRING_LENGTH ) ) { - set_font( dev, cur_text[j] ); - fonts[f++] = dev->font; + fonts[f++] = get_font( dev, cur_text[j] ); cur_str[s++] = esc; cur_str[s++] = 'f'; cur_str[s++] = 'f'; @@ -801,16 +800,25 @@ #ifdef PL_TEST_TYPE1 // Use this test case only to conveniently view Type1 font // possibilities (as in test_type1.py example). + // This functionality is useless other than for this test case. + PLINT ifamily, istyle, iweight; + plgfont( &ifamily, &istyle, &iweight ); if ( 0 <= cur_text[j] && cur_text[j] < 256 ) cur_str[s++] = cur_text[j]; else cur_str[s++] = 32; + // Overwrite font just for this special case. + if ( ifamily == PL_FCI_SYMBOL ) + font = get_font( dev, 0 ); + else + font = get_font( dev, fci ); #else cur_str[s++] = plunicode2type1( cur_text[j], dev->lookup, dev->nlookup ); #endif pldebug( "proc_str", "unicode = 0x%x, type 1 code = %d\n", cur_text[j], cur_str[s - 1] ); } + j++; } cur_str[s] = '\0'; @@ -1113,19 +1121,20 @@ } /*********************************************************************** - * set_font( PSDev* dev, PLUNICODE fci ) + * get_font( PSDev* dev, PLUNICODE fci ) * * Sets the Type1 font. ***********************************************************************/ -static void -set_font( PSDev* dev, PLUNICODE fci ) +static char * +get_font( PSDev* dev, PLUNICODE fci ) { + char *font; // fci = 0 is a special value indicating the Type 1 Symbol font // is desired. This value cannot be confused with a normal FCI value // because it doesn't have the PL_FCI_MARK. if ( fci == 0 ) { - dev->font = "Symbol"; + font = "Symbol"; dev->nlookup = number_of_entries_in_unicode_to_symbol_table; dev->lookup = unicode_to_symbol_lookup_table; dev->if_symbol_font = 1; @@ -1133,12 +1142,13 @@ else { /* convert the fci to Base14/Type1 font information */ - dev->font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); + font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); dev->nlookup = number_of_entries_in_unicode_to_standard_table; dev->lookup = unicode_to_standard_lookup_table; dev->if_symbol_font = 0; } - pldebug( "set_font", "fci = 0x%x, font name = %s\n", fci, dev->font ); + pldebug( "set_font", "fci = 0x%x, font name = %s\n", fci, font ); + return ( font ); } #else Modified: trunk/include/ps.h =================================================================== --- trunk/include/ps.h 2010-04-29 04:57:12 UTC (rev 10949) +++ trunk/include/ps.h 2010-04-29 15:11:18 UTC (rev 10950) @@ -50,7 +50,6 @@ int llx, lly, urx, ury, ptcnt; // font variables. - char *font; int nlookup, if_symbol_font; const Unicode_to_Type1_table *lookup; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-05-01 19:58:10
|
Revision: 10960 http://plplot.svn.sourceforge.net/plplot/?rev=10960&view=rev Author: hezekiahcarty Date: 2010-05-01 19:58:03 +0000 (Sat, 01 May 2010) Log Message: ----------- (OCaml) Allow colorbars and labeling to be defined as plot elements This change is intended to make building individual plots for use with the Plplot.Plot.plot function a bit easier. Modified Paths: -------------- trunk/bindings/ocaml/plplot.ml trunk/bindings/ocaml/plplot.mli trunk/examples/ocaml/xplot01.ml Modified: trunk/bindings/ocaml/plplot.ml =================================================================== --- trunk/bindings/ocaml/plplot.ml 2010-05-01 16:16:24 UTC (rev 10959) +++ trunk/bindings/ocaml/plplot.ml 2010-05-01 19:58:03 UTC (rev 10960) @@ -1,5 +1,5 @@ (* -Copyright 2009 Hezekiah M. Carty +Copyright 2009, 2010 Hezekiah M. Carty This file is part of PLplot. @@ -185,10 +185,15 @@ | Axes of (color_t * axis_options_t list * axis_options_t list * int * line_style_t * (plplot_axis_type -> float -> string) option) + | Colorbar of + (float plot_side_t option * string plot_side_t option * bool option * + float option * [`image of (float * float) | `shade of (float array)] * + axis_options_t list option) | Contours of (color_t * pltr_t * float array * float array array) | Image of image_t | Image_fr of (image_t * (float * float)) | Join of (color_t * float * float * float * float * int * line_style_t) + | Labels of (color_t * string * string * string) | Lines of (string option * color_t * float array * float array * int * line_style_t) | Map of (color_t * map_t * float * float * float * float) @@ -501,6 +506,14 @@ (** [circle ?fill color x y r] - A special case of [arc]. *) let circle ?fill color x y r = arc ?fill color x y r r 0.0 360.0 + (** Draw a colorbar, optionally log scaled and labeled. *) + let image_colorbar ?custom_axis ?label ?log ?pos ?width data = + Colorbar (pos, label, log, width, `image data, custom_axis) + + (** Draw a shaded colorbar, optionally log scaled and labeled. *) + let shade_colorbar ?custom_axis ?label ?log ?pos ?width data = + Colorbar (pos, label, log, width, `shade data, custom_axis) + (** [contours color pltr contours data] *) let contours color pltr contours data = Contours (color, pltr, contours, data) @@ -516,6 +529,10 @@ let join ?style ?width color (x0, y0) (x1, y1) = Join (color, x0, y0, x1, y1, width |? 1, style |? Solid_line) + (** [label x y title] labels the axes and adds plot title *) + let label ?(color = Black) x y title = + Labels (color, x, y, title) + (** [lines ?label color xs ys] *) let lines ?label ?style ?width color xs ys = Lines (label, color, xs, ys, width |? 1, style |? Solid_line) @@ -727,6 +744,170 @@ (xmin, ymin), (xmax, ymax) in *) + (** [colorbar_base ?label ?log ?pos values] draws a colorbar, using the given + values for the color range. [label] gives the position and text of the + colorbar label; if [log] is true then the scale is taken to be log rather + than linear ; [pos] sets the position of the colorbar itself, both the + side of the plot to put it on and the distance from the edge + (normalized device units); [width] is the width of the colorbar (again in + normalized device units). + NOTE: This potentially wrecks the current viewport and + window settings, among others, so it should be called AFTER the current + plot page is otherwise complete. *) + let colorbar_base ?custom_axis ?label ?log ?(pos = Right 0.07) ?(width = 0.03) + data = + (* Save the state of the current plot window. *) + let dxmin, dxmax, dymin, dymax = plgvpd () in + let wxmin, wxmax, wymin, wymax = plgvpw () in + (*let old_default, old_scale = plgchr () in*) + + let old_color = plg_current_col0 () in + + (* Small font *) + plschr 0.0 0.75; + (* Small ticks on the vertical axis *) + plsmaj 0.0 0.5; + plsmin 0.0 0.5; + + (* Offset from the edge of the plot surface in normalized device units *) + let offset = + match pos with + | Right off + | Top off -> 1.0 -. off + | Left off + | Bottom off -> off -. width + in + (* Put the bar on the proper side, with the proper offsets. *) + (* Unit major-axis, minor-axis scaled to contour values. *) + let width_start = offset in + let width_end = offset +. width in + + (* Set the viewport and window *) + let init_window min_value max_value = + match pos with + | Right _ + | Left _ -> + plvpor width_start width_end 0.15 0.85; + plwind 0.0 1.0 min_value max_value; + | Top _ + | Bottom _ -> + plvpor 0.15 0.85 width_start width_end; + plwind min_value max_value 0.0 1.0; + in + + (* "Rotate" the image if we have a horizontal (Top or Bottom) colorbar. *) + (* Also, double the amount of data because plshades won't work properly + otherwise. *) + let colorbar_data values = + match pos with + | Right off + | Left off -> [|values; values|] + | Top off + | Bottom off -> Array.map (fun x -> [|x; x|]) values + in + + (* Draw the image or shaded data, depending on what was requested *) + let () = + match data with + | `image (min_value, max_value) -> + (* Draw the color bar as an image. *) + (* TODO FIXME XXX: Change "100" to be the number of color palette 1 + colors once the attribute getting + setting functions are in + place. *) + let colorbar_steps = Array_ext.range ~n:100 min_value max_value in + let data = colorbar_data colorbar_steps in + init_window min_value max_value; + (match pos with + | Right _ + | Left _ -> plot [image (0.0, min_value) (1.0, max_value) data] + | Top _ + | Bottom _ -> plot [image (min_value, 0.0) (max_value, 1.0) data]) + | `shade contours -> + let shade_data = colorbar_data contours in + let max_value, min_value = plMinMax2dGrid [|contours|] in + init_window min_value max_value; + (match pos with + | Right _ + | Left _ -> + plot [ + pltr (pltr1 [|0.0; 1.0|] contours); + shades (0.0, min_value) (1.0, max_value) contours shade_data; + clear_pltr; + ] + | Top _ + | Bottom _ -> + plot [ + pltr (pltr1 contours [|0.0; 1.0|]); + shades (min_value, 0.0) (max_value, 1.0) contours shade_data; + clear_pltr; + ]) + in + + (* Draw a box and tick marks around the color bar. *) + set_color Black; + (* Draw ticks and labels on the major axis. Add other options as + appropriate. *) + let major_axis_opt = + List.concat [ + [Frame0; Frame1; Major_ticks]; + (* Log? *) + (match log with + | None -> [] + | Some b -> if b then [Minor_ticks; Log] else []); + (* Which side gets the label *) + (match pos with + | Right _ + | Top _ -> [Unconventional_label] + | Left _ + | Bottom _ -> [Label]); + (* Perpendicular labeling? *) + (match pos with + | Right _ + | Left _ -> [Vertical_label] + | Top _ + | Bottom _ -> []); + (* User-specified axis options? *) + (match custom_axis with + | None -> [] + | Some l -> l); + ] + in + (* Just draw the minor axis sides, no labels or ticks. *) + let minor_axis_opt = [Frame0; Frame1] in + let x_opt, y_opt = + match pos with + | Top _ + | Bottom _ -> major_axis_opt, minor_axis_opt + | Left _ + | Right _ -> minor_axis_opt, major_axis_opt + in + plot_axes x_opt y_opt; + + (* Draw the label *) + Option.may ( + fun l -> + (* Which side to draw the label on and the offset from that side in + units of character height. *) + let label_string, label_pos_string, label_offset = + match l with + | Right s -> s, "r", 4.0 + | Left s -> s, "l", 4.0 + | Top s -> s, "t", 1.5 + | Bottom s -> s, "b", 1.5 + in + plmtex label_pos_string label_offset 0.5 0.5 label_string + ) label; + + (* TODO XXX FIXME - Make sure setting are all properly restored... *) + (* Restore the old plot window settings. *) + plvpor dxmin dxmax dymin dymax; + plwind wxmin wxmax wymin wymax; + plschr 0.0 1.0; + plsmaj 0.0 1.0; + plsmin 0.0 1.0; + set_color (Index_color old_color); + () + in let plot_arc (color, x, y, a, b, angle1, angle2, fill) = set_color_in color ( fun () -> plarc x y a b angle1 angle2 fill; @@ -745,6 +926,9 @@ plwid old_width; ) in + let plot_colorbar (pos, label, log, width, data, custom_axis) = + colorbar_base ?custom_axis ?label ?log ?pos ?width data + in let plot_contours (color, pltr, contours, data) = set_color_in color ( fun () -> @@ -778,6 +962,11 @@ plwid old_width; ) in + let plot_labels (color, x, y, title) = + set_color_in color ( + fun () -> pllab x y title + ) + in let plot_lines (label, color, xs, ys, width, style) = set_color_in color ( fun () -> @@ -866,10 +1055,12 @@ match p with | Arc a -> plot_arc a | Axes ax -> plot_axes ax + | Colorbar cb -> plot_colorbar cb | Contours c -> plot_contours c | Image i -> plot_image i | Image_fr (i, scale) -> plot_imagefr i scale | Join j -> plot_join j + | Labels lab -> plot_labels lab | Lines l -> plot_lines l | Map m -> plot_map m | Points p -> plot_points p @@ -888,174 +1079,6 @@ fun plottable -> with_stream ?stream (fun () -> one_plot plottable) ) plottable_list - (** Label the axes and plot title *) - let label ?stream x y title = - with_stream ?stream (fun () -> pllab x y title) - - (** [colorbar_base ?label ?log ?pos values] draws a colorbar, using the given - values for the color range. [label] gives the position and text of the - colorbar label; if [log] is true then the scale is taken to be log rather - than linear ; [pos] sets the position of the colorbar itself, both the - side of the plot to put it on and the distance from the edge - (normalized device units); [width] is the width of the colorbar (again in - normalized device units). - NOTE: This potentially wrecks the current viewport and - window settings, among others, so it should be called AFTER the current - plot page is otherwise complete. *) - let colorbar_base ?custom_axis ?label ?log ?(pos = Right 0.07) ?(width = 0.03) - data = - (* Save the state of the current plot window. *) - let dxmin, dxmax, dymin, dymax = plgvpd () in - let wxmin, wxmax, wymin, wymax = plgvpw () in - (*let old_default, old_scale = plgchr () in*) - - let old_color = plg_current_col0 () in - - (* Small font *) - plschr 0.0 0.75; - (* Small ticks on the vertical axis *) - plsmaj 0.0 0.5; - plsmin 0.0 0.5; - - (* Offset from the edge of the plot surface in normalized device units *) - let offset = - match pos with - | Right off - | Top off -> 1.0 -. off - | Left off - | Bottom off -> off -. width - in - (* Put the bar on the proper side, with the proper offsets. *) - (* Unit major-axis, minor-axis scaled to contour values. *) - let width_start = offset in - let width_end = offset +. width in - - (* Set the viewport and window *) - let init_window min_value max_value = - match pos with - | Right _ - | Left _ -> - plvpor width_start width_end 0.15 0.85; - plwind 0.0 1.0 min_value max_value; - | Top _ - | Bottom _ -> - plvpor 0.15 0.85 width_start width_end; - plwind min_value max_value 0.0 1.0; - in - - (* "Rotate" the image if we have a horizontal (Top or Bottom) colorbar. *) - (* Also, double the amount of data because plshades won't work properly - otherwise. *) - let colorbar_data values = - match pos with - | Right off - | Left off -> [|values; values|] - | Top off - | Bottom off -> Array.map (fun x -> [|x; x|]) values - in - - (* Draw the image or shaded data, depending on what was requested *) - let () = - match data with - | `image (min_value, max_value) -> - (* Draw the color bar as an image. *) - (* TODO FIXME XXX: Change "100" to be the number of color palette 1 - colors once the attribute getting + setting functions are in - place. *) - let colorbar_steps = Array_ext.range ~n:100 min_value max_value in - let data = colorbar_data colorbar_steps in - init_window min_value max_value; - (match pos with - | Right _ - | Left _ -> plot [image (0.0, min_value) (1.0, max_value) data] - | Top _ - | Bottom _ -> plot [image (min_value, 0.0) (max_value, 1.0) data]) - | `shade contours -> - let shade_data = colorbar_data contours in - let max_value, min_value = plMinMax2dGrid [|contours|] in - init_window min_value max_value; - (match pos with - | Right _ - | Left _ -> - plot [ - pltr (pltr1 [|0.0; 1.0|] contours); - shades (0.0, min_value) (1.0, max_value) contours shade_data; - clear_pltr; - ] - | Top _ - | Bottom _ -> - plot [ - pltr (pltr1 contours [|0.0; 1.0|]); - shades (min_value, 0.0) (max_value, 1.0) contours shade_data; - clear_pltr; - ]) - in - - (* Draw a box and tick marks around the color bar. *) - set_color Black; - (* Draw ticks and labels on the major axis. Add other options as - appropriate. *) - let major_axis_opt = - List.concat [ - [Frame0; Frame1; Major_ticks]; - (* Log? *) - (match log with - | None -> [] - | Some b -> if b then [Minor_ticks; Log] else []); - (* Which side gets the label *) - (match pos with - | Right _ - | Top _ -> [Unconventional_label] - | Left _ - | Bottom _ -> [Label]); - (* Perpendicular labeling? *) - (match pos with - | Right _ - | Left _ -> [Vertical_label] - | Top _ - | Bottom _ -> []); - (* User-specified axis options? *) - (match custom_axis with - | None -> [] - | Some l -> l); - ] - in - (* Just draw the minor axis sides, no labels or ticks. *) - let minor_axis_opt = [Frame0; Frame1] in - let x_opt, y_opt = - match pos with - | Top _ - | Bottom _ -> major_axis_opt, minor_axis_opt - | Left _ - | Right _ -> minor_axis_opt, major_axis_opt - in - plot_axes x_opt y_opt; - - (* Draw the label *) - Option.may ( - fun l -> - (* Which side to draw the label on and the offset from that side in - units of character height. *) - let label_string, label_pos_string, label_offset = - match l with - | Right s -> s, "r", 4.0 - | Left s -> s, "l", 4.0 - | Top s -> s, "t", 1.5 - | Bottom s -> s, "b", 1.5 - in - plmtex label_pos_string label_offset 0.5 0.5 label_string - ) label; - - (* TODO XXX FIXME - Make sure setting are all properly restored... *) - (* Restore the old plot window settings. *) - plvpor dxmin dxmax dymin dymax; - plwind wxmin wxmax wymin wymax; - plschr 0.0 1.0; - plsmaj 0.0 1.0; - plsmin 0.0 1.0; - set_color (Index_color old_color); - () - (** [colorbar_labeler ?log ?min ?max axis n] can be used as a custom axis labeling function when a colorbar is meant to represent values beyond those which are represented. So if the colorbar labeling shows @@ -1091,20 +1114,6 @@ | Some false -> normal_text n | Some true -> log10_text n - (** Draw a colorbar, optionally log scaled and labeled. *) - let colorbar ?stream ?custom_axis ?label ?log ?pos ?width (min, max) = - with_stream ?stream ( - fun () -> - colorbar_base ?custom_axis ?label ?log ?pos ?width (`image (min, max)) - ) - - (** Draw a shaded colorbar, optionally log scaled and labeled. *) - let shadebar ?stream ?custom_axis ?label ?log ?pos ?width values = - with_stream ?stream ( - fun () -> - colorbar_base ?custom_axis ?label ?log ?pos ?width (`shade values) - ) - (** Finish the current page, start a new one (alias for {!start_page}). *) let next_page = start_page @@ -1181,8 +1190,8 @@ plot ~stream [ list plottable_points; axes x_axis y_axis; + Option.map_default (fun (x, y, t) -> label x y t) (list []) labels; ]; - Option.may (fun (x, y, t) -> label ~stream x y t) labels; end_stream ~stream (); () @@ -1205,8 +1214,8 @@ plot ~stream [ list plottable_lines; axes x_axis y_axis; + Option.map_default (fun (x, y, t) -> label x y t) (list []) labels; ]; - Option.may (fun (x, y, t) -> label ~stream x y t) labels; Option.may (fun n -> draw_legend ~stream n (Array.to_list colors)) names; end_stream ~stream (); () @@ -1223,9 +1232,9 @@ plot ~stream [ image (xmin, ymin) (xmax, ymax) m; default_axes; + Option.map_default (fun (x, y, t) -> label x y t) (list []) labels; + image_colorbar ?log ~pos:(Right 0.12) (m_min, m_max); ]; - Option.may (fun (x, y, t) -> label ~stream x y t) labels; - colorbar ~stream ?log ~pos:(Right 0.12) (m_min, m_max); end_stream ~stream (); () @@ -1260,9 +1269,9 @@ plot ~stream [ list plot_content; default_axes; + Option.map_default (fun (x, y, t) -> label x y t) (list []) labels; ]; Option.may (fun n -> draw_legend ~stream n (Array.to_list colors)) names; - Option.may (fun (x, y, t) -> label ~stream x y t) labels; end_stream ~stream (); () @@ -1282,9 +1291,9 @@ plot ~stream [ shades (xmin, ymin) (xmax, ymax) contours m; default_axes; + Option.map_default (fun (x, y, t) -> label x y t) (list []) labels; + shade_colorbar ?log ~pos:(Right 0.12) contours; ]; - Option.may (fun (x, y, t) -> label ~stream x y t) labels; - shadebar ~stream ?log ~pos:(Right 0.12) contours; end_stream ~stream (); () end Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2010-05-01 16:16:24 UTC (rev 10959) +++ trunk/bindings/ocaml/plplot.mli 2010-05-01 19:58:03 UTC (rev 10960) @@ -282,6 +282,29 @@ (** [circle ?fill color x y r] *) val circle : ?fill:bool -> color_t -> float -> float -> float -> plot_t + (** [image_colorbar ?label ?log ?pos ?width (min, max)] add a + color bar to a plot using the current color scale. This function + should be called after the rest of the plot is complete. *) + val image_colorbar : + ?custom_axis:axis_options_t list -> + ?label:string plot_side_t -> + ?log:bool -> + ?pos:float plot_side_t -> + ?width:float -> + float * float -> plot_t + + (** [shade_colorbar ?label ?log ?pos ?width contours] add a shaded + color bar to a plot using the current color scale. This is similar to + {!image_colorbar} but takes [contours] as rather than a range. This + function should be called after the rest of the plot is complete. *) + val shade_colorbar : + ?custom_axis:axis_options_t list -> + ?label:string plot_side_t -> + ?log:bool -> + ?pos:float plot_side_t -> + ?width:float -> + float array -> plot_t + (** [contours color tranform_func contours data] *) val contours : color_t -> pltr_t -> float array -> float array array -> plot_t @@ -303,6 +326,9 @@ ?width:int -> color_t -> float * float -> float * float -> plot_t + (** [label ?color x_label y_label title] adds axis labels and a title. *) + val label : ?color:color_t -> string -> string -> string -> plot_t + (** [lines ?label ?style color xs ys] *) val lines : ?label:string -> @@ -398,38 +424,9 @@ (** Draw a legend, given a list of titles and colors *) val draw_legend : ?stream:stream_t -> - ?line_length:'a -> + ?line_length:float -> ?x:float -> ?y:float -> string list -> color_t list -> unit - (** [label x_label y_label title] adds axis labels and a title to the given - plot [stream]. *) - val label : ?stream:stream_t -> string -> string -> string -> unit - - (** [colorbar ?stream ?label ?log ?pos ?width (min, max)] add a color bar - to a plot using the current color scale. This function should be - called after the rest of the plot is complete. *) - val colorbar : - ?stream:stream_t -> - ?custom_axis:axis_options_t list -> - ?label:string plot_side_t -> - ?log:bool -> - ?pos:float plot_side_t -> - ?width:float -> - float * float -> unit - - (** [shadebar ?stream ?label ?log ?pos ?width contours] add a shaded color - bar to a plot using the current color scale. This is similar to - {!colorbar} but takes contours as [values]. This function should be - called after the rest of the plot is complete. *) - val shadebar : - ?stream:stream_t -> - ?custom_axis:axis_options_t list -> - ?label:string plot_side_t -> - ?log:bool -> - ?pos:float plot_side_t -> - ?width:float -> - float array -> unit - (** [colorbar_labeler ?log ?min ?max axis n] can be used as a custom axis labeling function when a colorbar is meant to represent values beyond those which are represented. So if the colorbar labeling shows @@ -439,7 +436,7 @@ ?log:bool -> ?min:float -> ?max:float -> - 'a -> float -> string + plplot_axis_type -> float -> string (** Draw the plot axes on the current plot page *) val plot_axes : Modified: trunk/examples/ocaml/xplot01.ml =================================================================== --- trunk/examples/ocaml/xplot01.ml 2010-05-01 16:16:24 UTC (rev 10959) +++ trunk/examples/ocaml/xplot01.ml 2010-05-01 19:58:03 UTC (rev 10960) @@ -91,7 +91,6 @@ let ys = Array.init 6 (fun i -> y.(i * 10 + 3)) in P.set_color ~stream P.Blue; - P.label ~stream "(x)" "(y)" "#frPLplot Example 1 - y=x#u2"; P.plot ~stream [ (* Plot the data points *) @@ -100,6 +99,8 @@ P.lines P.Red x y; (* Show the axes *) P.default_axes; + (* Title and axis labels *) + P.label "(x)" "(y)" "#frPLplot Example 1 - y=x#u2"; ]; (* All done. *) @@ -113,7 +114,6 @@ P.start_page ~stream (-2.0, -0.4) (10.0, 1.2) P.Greedy; P.set_color ~stream P.Blue; - P.label ~stream "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"; (* Fill up the arrays *) let x = Array.init 100 (fun i -> (float_of_int i -. 19.0) /. 6.0) in @@ -137,6 +137,7 @@ P.plot ~stream [ P.lines ~width:2 P.Red x y; P.axes x_axis y_axis; + P.label "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"; ]; (* All done. *) @@ -151,8 +152,6 @@ P.start_page ~stream (0.0, -1.2) (360.0, 1.2) P.Greedy; P.set_color ~stream P.Red; - P.label ~stream "Angle (degrees)" "sine" - "#frPLplot Example 1 - Sine function"; let x = Array.init 101 (fun i -> 3.6 *. float_of_int i) in let y = Array.init 101 (fun i -> sin (x.(i) *. pi /. 180.0)) in @@ -178,6 +177,9 @@ P.lines P.Brown x y; (* The normal plot axes *) P.axes x_axis y_axis; + (* Plot title and axis labels *) + P.label "Angle (degrees)" "sine" + "#frPLplot Example 1 - Sine function"; ]; (* All done. *) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |