From: <ai...@us...> - 2007-08-15 23:02:26
|
Revision: 7803 http://plplot.svn.sourceforge.net/plplot/?rev=7803&view=rev Author: airwin Date: 2007-08-15 16:02:28 -0700 (Wed, 15 Aug 2007) Log Message: ----------- AWI for Jerry Bauck. Clean up and improve comments. Add an optional with-use clause to plplot_auxiliary.ads to accommodate compiling with or without Ada 2005 Annex G.3. Make "simple log" plotters accept optional arbitrary log base. Default is 10.0 which value was previously hardwired. Callers can be unmodified since the new argument is the last argument in the list. Modified Paths: -------------- trunk/bindings/ada/plplot.adb trunk/bindings/ada/plplot.ads trunk/bindings/ada/plplot_auxiliary.ads trunk/bindings/ada/plplot_traditional.adb trunk/bindings/ada/plplot_traditional.ads Modified: trunk/bindings/ada/plplot.adb =================================================================== --- trunk/bindings/ada/plplot.adb 2007-08-15 19:16:53 UTC (rev 7802) +++ trunk/bindings/ada/plplot.adb 2007-08-15 23:02:28 UTC (rev 7803) @@ -183,7 +183,6 @@ if x1'length /= 1 and y1'length /= 1 then Write_Labels(To_String(X_Labels(1)), To_String(Y_Labels(1)), To_String(Title_Labels(1))); Set_Pen_Color(Colors(1)); - --Set_Pen_Width(Line_Widths(1)); Select_Line_Style(Line_Styles(1)); Draw_Curve(x1, y1); end if; @@ -191,7 +190,6 @@ if x2'length /= 1 and y2'length /= 1 then Write_Labels(To_String(X_Labels(2)), To_String(Y_Labels(2)), To_String(Title_Labels(2))); Set_Pen_Color(Colors(2)); - --Set_Pen_Width(Line_Widths(2)); Select_Line_Style(Line_Styles(2)); Draw_Curve(x2, y2); end if; @@ -199,7 +197,6 @@ if x3'length /= 1 and y3'length /= 1 then Write_Labels(To_String(X_Labels(3)), To_String(Y_Labels(3)), To_String(Title_Labels(3))); Set_Pen_Color(Colors(3)); - --Set_Pen_Width(Line_Widths(3)); Select_Line_Style(Line_Styles(3)); Draw_Curve(x3, y3); end if; @@ -207,7 +204,6 @@ if x4'length /= 1 and y4'length /= 1 then Write_Labels(To_String(X_Labels(4)), To_String(Y_Labels(4)), To_String(Title_Labels(4))); Set_Pen_Color(Colors(4)); - --Set_Pen_Width(Line_Widths(4)); Select_Line_Style(Line_Styles(4)); Draw_Curve(x4, y4); end if; @@ -215,7 +211,6 @@ if x5'length /= 1 and y5'length /= 1 then Write_Labels(To_String(X_Labels(5)), To_String(Y_Labels(5)), To_String(Title_Labels(5))); Set_Pen_Color(Colors(5)); - --Set_Pen_Width(Line_Widths(5)); Select_Line_Style(Line_Styles(5)); Draw_Curve(x5, y5); end if; @@ -259,6 +254,8 @@ -- Simple log x plotter for single x array and multiple y arrays + -- fix this: Automatically skip zero-valued abscissa; place marker at the + -- left-hand side of the plot at the ordinate of the deleted point. procedure Simple_Plot_Log_X (x : Real_Vector; y1 : Real_Vector := Dont_Plot_This; @@ -268,7 +265,8 @@ y5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)) is + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; @@ -282,7 +280,7 @@ Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. for i in x_Log'range loop - x_Log(i) := Log(x(i), 10.0); + x_Log(i) := Log(x(i), Log_Base); end loop; Multiplot_Pairs(x_Log, y1, x_Log, y2, x_Log, y3, x_Log, y4, x_Log, y5, X_Labels => X_Label_String_Array, @@ -293,6 +291,8 @@ -- Simple log y plotter for multiple x arrays and single y array + -- fix this: Automatically skip zero-valued ordinate; place marker at the + -- bottom of the plot at the abscissa of the deleted point. procedure Simple_Plot_Log_Y (x1 : Real_Vector := Dont_Plot_This; y : Real_Vector := Dont_Plot_This; -- Beware of argument order. @@ -302,7 +302,8 @@ x5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)) is + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; @@ -316,7 +317,7 @@ Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. for i in y_Log'range loop - y_Log(i) := Log(y(i), 10.0); + y_Log(i) := Log(y(i), Log_Base); end loop; Multiplot_Pairs(x1, y_Log, x2, y_Log, x3, y_Log, x4, y_Log, x5, y_Log, X_Labels => X_Label_String_Array, @@ -327,10 +328,12 @@ -- Simple log x - log y plotter - procedure Simple_Plot_Log_XY(x, y : Real_Vector; + procedure Simple_Plot_Log_XY + (x, y : Real_Vector; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)) is + Title_Label : String := To_String(Default_Label_String); + x_Log_Base, y_Log_Base : Long_Float := 10.0) is -- Should this default to e? X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; @@ -344,8 +347,8 @@ Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. for i in x_Log'range loop - x_Log(i) := Log(x(i), 10.0); - y_Log(i) := Log(y(i), 10.0); + x_Log(i) := Log(x(i), x_Log_Base); + y_Log(i) := Log(y(i), y_Log_Base); end loop; Multiplot_Pairs(x_Log, y_Log, X_Labels => X_Label_String_Array, Modified: trunk/bindings/ada/plplot.ads =================================================================== --- trunk/bindings/ada/plplot.ads 2007-08-15 19:16:53 UTC (rev 7802) +++ trunk/bindings/ada/plplot.ads 2007-08-15 23:02:28 UTC (rev 7803) @@ -22,7 +22,7 @@ -- Default dummy arrays for various plotters which take multiple inputs. subtype Length_One_Real_Vector is Real_Vector(1..1); - Dont_Plot_This : Length_One_Real_Vector := (1..1 => 0.0); + Dont_Plot_This : Length_One_Real_Vector := (1..1 => Long_Float'small); -- Default colors for Color Map 0. -- These are hard-wired to the current colors of color map 0; if that @@ -289,7 +289,8 @@ y5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0); -- Should this default to e? -- Simple log y plotter for multiple x arrays and single y array @@ -302,14 +303,17 @@ x5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0); -- Should this default to e? -- Simple log x - log y plotter - procedure Simple_Plot_Log_XY(x, y : Real_Vector; + procedure Simple_Plot_Log_XY + (x, y : Real_Vector; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)); + Title_Label : String := To_String(Default_Label_String); + x_Log_Base, y_Log_Base : Long_Float := 10.0); -- Should this default to e? -- Simple plotter for multiple x-y arrays specified pairwise. Modified: trunk/bindings/ada/plplot_auxiliary.ads =================================================================== --- trunk/bindings/ada/plplot_auxiliary.ads 2007-08-15 19:16:53 UTC (rev 7802) +++ trunk/bindings/ada/plplot_auxiliary.ads 2007-08-15 23:02:28 UTC (rev 7803) @@ -8,21 +8,22 @@ package PLplot_Auxiliary is +-- COMMENT THIS LINE IF YOUR COMPILER DOES NOT INCLUDE THESE +-- DEFINITIONS, FOR EXAMPLE, IF IT IS NOT ADA 2005 WITH ANNEX G.3 COMPLIANCE. +--with Ada.Numerics.Long_Real_Arrays; use Ada.Numerics.Long_Real_Arrays; + -------------------------------------------------------------------------------- -- Utility type declarations used by the bindings -- -------------------------------------------------------------------------------- - -- UN-COMMENT THESE TWO LINES IF YOUR COMPILER DOES NOT INCLUDE THESE + -- UN-COMMENT THE NEXT TWO LINES IF YOUR COMPILER DOES NOT INCLUDE THESE -- DEFINITIONS, FOR EXAMPLE, IF IT IS NOT ADA 2005 WITH ANNEX G.3 COMPLIANCE. -- COMMENT THESE TWO LINES IF YOUR COMPILER DECLARES SIMILAR TYPES (E.G. IT - -- IS ADA 2005 WITH ANNEX G.3) IN THAT CASE, YOU WILL NEED TO ADD A LINE - -- LIKE THIS SOMEWHERE: - -- with Ada.Numerics.Long_Real_Arrays; use Ada.Numerics.Long_Real_Arrays; + -- IS ADA 2005 WITH ANNEX G.3) -- ALSO, YOU WILL NEED TO MAKE A SINGLE-LINE EDIT TO THESE BINDING FILES: -- plplot.ads, plplot.adb, plplot_traditional.ads, plplot_traditional.adb, -- and plplot_thin.ads. - -- type Real_Vector is array (Integer range <>) of Long_Float; type Real_Matrix is array (Integer range <>, Integer range <>) of Long_Float; Modified: trunk/bindings/ada/plplot_traditional.adb =================================================================== --- trunk/bindings/ada/plplot_traditional.adb 2007-08-15 19:16:53 UTC (rev 7802) +++ trunk/bindings/ada/plplot_traditional.adb 2007-08-15 23:02:28 UTC (rev 7803) @@ -258,6 +258,8 @@ -- Simple log x plotter for single x array and multiple y arrays + -- fix this: Automatically skip zero-valued abscissa; place marker at the + -- left-hand side of the plot at the ordinate of the deleted point. procedure Simple_Plot_Log_X (x : Real_Vector; y1 : Real_Vector := Dont_Plot_This; @@ -267,7 +269,8 @@ y5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)) is + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; @@ -281,7 +284,7 @@ Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. for i in x_Log'range loop - x_Log(i) := Log(x(i), 10.0); + x_Log(i) := Log(x(i), Log_Base); end loop; Multiplot_Pairs(x_Log, y1, x_Log, y2, x_Log, y3, x_Log, y4, x_Log, y5, X_Labels => X_Label_String_Array, @@ -292,6 +295,8 @@ -- Simple log y plotter for multiple x arrays and single y array + -- fix this: Automatically skip zero-valued ordinate; place marker at the + -- bottom of the plot at the abscissa of the deleted point. procedure Simple_Plot_Log_Y (x1 : Real_Vector := Dont_Plot_This; y : Real_Vector := Dont_Plot_This; -- Beware of argument order. @@ -301,7 +306,8 @@ x5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)) is + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; @@ -315,7 +321,7 @@ Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. for i in y_Log'range loop - y_Log(i) := Log(y(i), 10.0); + y_Log(i) := Log(y(i), Log_Base); end loop; Multiplot_Pairs(x1, y_Log, x2, y_Log, x3, y_Log, x4, y_Log, x5, y_Log, X_Labels => X_Label_String_Array, @@ -326,10 +332,12 @@ -- Simple log x - log y plotter - procedure Simple_Plot_Log_XY(x, y : Real_Vector; + procedure Simple_Plot_Log_XY + (x, y : Real_Vector; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)) is + Title_Label : String := To_String(Default_Label_String); + x_Log_Base, y_Log_Base : Long_Float := 10.0) is -- Should this default to e? X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; @@ -343,8 +351,8 @@ Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. for i in x_Log'range loop - x_Log(i) := Log(x(i), 10.0); - y_Log(i) := Log(y(i), 10.0); + x_Log(i) := Log(x(i), x_Log_Base); + y_Log(i) := Log(y(i), y_Log_Base); end loop; Multiplot_Pairs(x_Log, y_Log, X_Labels => X_Label_String_Array, Modified: trunk/bindings/ada/plplot_traditional.ads =================================================================== --- trunk/bindings/ada/plplot_traditional.ads 2007-08-15 19:16:53 UTC (rev 7802) +++ trunk/bindings/ada/plplot_traditional.ads 2007-08-15 23:02:28 UTC (rev 7803) @@ -22,7 +22,7 @@ -- Default dummy arrays for various plotters which take multiple inputs. subtype Length_One_Real_Vector is Real_Vector(1..1); - Dont_Plot_This : Length_One_Real_Vector := (1..1 => 0.0); + Dont_Plot_This : Length_One_Real_Vector := (1..1 => Long_Float'small); -- Default colors for Color Map 0. -- These are hard-wired to the current colors of color map 0; if that @@ -288,7 +288,8 @@ y5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0); -- Should this default to e? -- Simple log y plotter for multiple x arrays and single y array @@ -301,14 +302,17 @@ x5 : Real_Vector := Dont_Plot_This; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0); -- Should this default to e? -- Simple log x - log y plotter - procedure Simple_Plot_Log_XY(x, y : Real_Vector; + procedure Simple_Plot_Log_XY + (x, y : Real_Vector; X_Label : String := To_String(Default_Label_String); Y_Label : String := To_String(Default_Label_String); - Title_Label : String := To_String(Default_Label_String)); + Title_Label : String := To_String(Default_Label_String); + x_Log_Base, y_Log_Base : Long_Float := 10.0); -- Should this default to e? -- Simple plotter for multiple x-y arrays specified pairwise. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |