Jerry, This latest change to the Ada bindings causes a build error for me with gnat 4.2.3 on Ubuntu.
plplot.adb:2751:37: non-local pointer cannot point to local object The offending line is PL_Pen_Labels(Index) := Temp_C_String'Unchecked_Access; Cheers Andrew On Thu, Aug 14, 2008 at 10:15:34PM +0000, [EMAIL PROTECTED] wrote: > Revision: 8657 > http://plplot.svn.sourceforge.net/plplot/?rev=8657&view=rev > Author: jbauck > Date: 2008-08-14 22:15:33 +0000 (Thu, 14 Aug 2008) > > Log Message: > ----------- > Adjusted Ada bindings for stripchart stuff, affecting x17a.adb and > xthick17a.adb. Ada stripchart legend labels still duplicate the fourth one > across all four. > > 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 > > Modified: trunk/bindings/ada/plplot.adb.cmake > =================================================================== > --- trunk/bindings/ada/plplot.adb.cmake 2008-08-14 22:06:23 UTC (rev > 8656) > +++ trunk/bindings/ada/plplot.adb.cmake 2008-08-14 22:15:33 UTC (rev > 8657) > @@ -1503,6 +1503,18 @@ > plgdev(PL_Device_Name); > Device_Name := To_Ada(PL_Device_Name, True); > end Get_Device_Name; > + > + > + -- Make a function version of plgdev so that the caller can use it > whereever > + -- a String type is expected without fooling around with conversions > between > + -- Ada string types. See Example 14 for useage. > + -- THIS IS NOT IN THE C API. > + function Get_Device_Name return String is > + PL_Device_Name : char_array(0..79); > + begin > + PLplot_Thin.plgdev(PL_Device_Name); > + return To_Ada(PL_Device_Name, True); > + end Get_Device_Name; > > > -- Function version of the procedure Get_Device_Name; not part of the > PLplot API. > @@ -2716,11 +2728,12 @@ > X_Label, Y_Label, Title_Label : String := > To_String(Default_Label_String)) is > > PL_Autoscale_Y, PL_Accumulate : PLBOOL; > - PL_Pen_Labels : Stripchart_String_Array; > + PL_Pen_Labels : PL_Stripchart_String_Array; > > x_LP : Long_Float renames x_Legend_Position; > y_LP : Long_Float renames y_Legend_Position; > > + Temp_C_String : aliased PL_Stripchart_String; > begin > if Autoscale_Y then > PL_Autoscale_Y := PLtrue; > @@ -2734,12 +2747,23 @@ > PL_Accumulate := PLfalse; > end if; > > - -- Adapt strings for Pen_Labels to C. > - for Index in 1..4 loop > - PL_Pen_Labels(Index) := To_C(To_String(Pen_Labels(Index)), True); > + -- Adapt strings for Pen_Labels to C. Head truncates or pads as > + -- necessary to the length of Stripchart_String - 1; we then append > + -- a null terminator which I suppose C needs. This could have also > been > + -- accomplished using char_array from the C interfaces. > + -- fix this NOTE that the current implementation displays all four > + -- legend labels the same, and equal to the fourth legend label. The > + -- goal is to match const char *legline[4] in plstripc.c and e.g. > + -- in x17c.c. > + for Index in Pen_Labels'range loop > + Temp_C_String := To_String(Head(Pen_Labels(Index), > PL_Stripchart_String'length - 1) & Character'val(0)); > + PL_Pen_Labels(Index) := Temp_C_String'Unchecked_Access; > end loop; > > - plstripc(ID, To_C(X_Options), To_C(Y_Options), x_Min, x_Max, x_Jump, > y_Min, y_Max, x_LP, y_LP, PL_Autoscale_Y, PL_Accumulate, Box_Color, > Legend_Color, Pen_Colors, Line_Styles, PL_Pen_Labels, To_C(x_Label), > To_C(y_Label), To_C(Title_Label)); > + plstripc(ID, To_C(X_Options), To_C(Y_Options), > + x_Min, x_Max, x_Jump, y_Min, y_Max, x_LP, y_LP, PL_Autoscale_Y, > + PL_Accumulate, Box_Color, Legend_Color, Pen_Colors, Line_Styles, > + PL_Pen_Labels, To_C(x_Label), To_C(y_Label), To_C(Title_Label)); > end Create_Stripchart; > > > > Modified: trunk/bindings/ada/plplot.ads.cmake > =================================================================== > --- trunk/bindings/ada/plplot.ads.cmake 2008-08-14 22:06:23 UTC (rev > 8656) > +++ trunk/bindings/ada/plplot.ads.cmake 2008-08-14 22:15:33 UTC (rev > 8657) > @@ -117,7 +117,8 @@ > Default_Label_String : constant Unbounded_String := > To_Unbounded_String(""); > type Label_String_Array_Type is array (1..Max_Lines_For_Multiplot) of > Unbounded_String; > Default_Label_String_Array : Label_String_Array_Type := (others => > Default_Label_String); > - type Stripchart_Label_String_Array_Type is array (1..4) of > Unbounded_String; > + Maximum_Number_Of_Stripcharts : Integer := 4; -- Limited by PLplot > designers. > + type Stripchart_Label_String_Array_Type is array (1 .. > Maximum_Number_Of_Stripcharts) of Unbounded_String; > > -- Justification for plots > subtype Justification_Type is Integer range -1..2; > @@ -880,6 +881,13 @@ > -- plgdev > function Get_Device_Name return String; > > + -- Make a function version of plgdev so that the caller can use it > whereever > + -- a String type is expected without fooling around with conversions > between > + -- Ada string types. See Example 14 for useage. > + -- THIS IS NOT IN THE C API. > + function Get_Device_Name return String; > + > + > -- Retrieve current window into device space > -- plgdidev > procedure Get_Device_Window_Parameters > > Modified: trunk/bindings/ada/plplot_thin.ads.cmake > =================================================================== > --- trunk/bindings/ada/plplot_thin.ads.cmake 2008-08-14 22:06:23 UTC (rev > 8656) > +++ trunk/bindings/ada/plplot_thin.ads.cmake 2008-08-14 22:15:33 UTC (rev > 8657) > @@ -83,7 +83,26 @@ > -- PLplot-specific things > -- > > -------------------------------------------------------------------------------- > > - type Stripchart_String_Array is array (1..4) of char_array(1..3); > + -- Make a string and array therefore for legends that is compatible with > the > + -- C code of plstripc which creates a strip chart. The C code will > accept > + -- any length of string and each of the four strings can be different > lengths. > + -- These types are a bit of a hack whereby each of the legend strings is > the > + -- same length, so that they can be accessed as an array. They are 41 > + -- characters long here including a null terminator; I suppose any > length > + -- will work since the stripchart program doesn't seem to mind. The user > + -- will probably never see this type since he is allowed to set up the > + -- legend strings as an array of unbounded strings. Only in preparing to > + -- call the underlying C are the fixed-length strings used. If the user > + -- specifies unbounded legend strings that are longer than allowed here, > + -- they are truncated or padded with spaces, as appropriate, to meet the > + -- required length. Although that length is now 41, it is OK to make it > + -- longer or shorter simply by changing the following line, since > everything > + -- else (padding, truncation, conversion to C-style) works > automatically. > + -- See the fix this note in plplot.adb and plplot_traditional.adb about > how > + -- all this somehow doesn't work correctly, causing all four stripchart > + -- legends to be the same and equal to the fourth one. > + subtype PL_Stripchart_String is String(1 .. 41); > + type PL_Stripchart_String_Array is array (1 .. 4) of access > PL_Stripchart_String; > > > -- Access-to-procedure type for Draw_Vector_Plot and its kin. > @@ -1456,7 +1475,7 @@ > xlpos : PLFLT; ylpos : PLFLT; > y_ascl : PLBOOL; acc : PLBOOL; > colbox : PLINT; collab : PLINT; > - colline : PL_Integer_Array; styline : PL_Integer_Array; legline : > Stripchart_String_Array; > + colline : PL_Integer_Array; styline : PL_Integer_Array; legline : > PL_Stripchart_String_Array; > labx : char_array; laby : char_array; labtop : char_array); > pragma Import(C, plstripc, "c_plstripc"); > > > Modified: trunk/bindings/ada/plplot_traditional.adb.cmake > =================================================================== > --- trunk/bindings/ada/plplot_traditional.adb.cmake 2008-08-14 22:06:23 UTC > (rev 8656) > +++ trunk/bindings/ada/plplot_traditional.adb.cmake 2008-08-14 22:15:33 UTC > (rev 8657) > @@ -2585,13 +2585,14 @@ > Line_Styles : Integer_Array_1D; > Pen_Labels : > Stripchart_Label_String_Array_Type; > X_Label, Y_Label, Title_Label : String := > To_String(Default_Label_String)) is > - > + > PL_Autoscale_Y, PL_Accumulate : PLBOOL; > - PL_Pen_Labels : Stripchart_String_Array; > + PL_Pen_Labels : PL_Stripchart_String_Array; > > x_LP : Long_Float renames x_Legend_Position; > y_LP : Long_Float renames y_Legend_Position; > > + Temp_C_String : aliased PL_Stripchart_String; > begin > if Autoscale_Y then > PL_Autoscale_Y := PLtrue; > @@ -2605,15 +2606,23 @@ > PL_Accumulate := PLfalse; > end if; > > - -- Adapt strings for Pen_Labels to C. > - for Index in 1..4 loop > - PL_Pen_Labels(Index) := To_C(To_String(Pen_Labels(Index)), True); > + -- Adapt strings for Pen_Labels to C. Head truncates or pads as > + -- necessary to the length of Stripchart_String - 1; we then append > + -- a null terminator which I suppose C needs. This could have also > been > + -- accomplished using char_array from the C interfaces. > + -- fix this NOTE that the current implementation displays all four > + -- legend labels the same, and equal to the fourth legend label. The > + -- goal is to match const char *legline[4] in plstripc.c and e.g. > + -- in x17c.c. > + for Index in Pen_Labels'range loop > + Temp_C_String := To_String(Head(Pen_Labels(Index), > PL_Stripchart_String'length - 1) & Character'val(0)); > + PL_Pen_Labels(Index) := Temp_C_String'Unchecked_Access; > end loop; > - > + > PLplot_Thin.plstripc(ID, To_C(X_Options), To_C(Y_Options), > - x_Min, x_Max, x_Jump, y_Min, y_Max, x_LP, y_LP, PL_Autoscale_Y, > - PL_Accumulate, Box_Color, Legend_Color, Pen_Colors, Line_Styles, > - PL_Pen_Labels, To_C(x_Label), To_C(y_Label), To_C(Title_Label)); > + x_Min, x_Max, x_Jump, y_Min, y_Max, x_LP, y_LP, PL_Autoscale_Y, > + PL_Accumulate, Box_Color, Legend_Color, Pen_Colors, Line_Styles, > + PL_Pen_Labels, To_C(x_Label), To_C(y_Label), To_C(Title_Label)); > end plstripc; > > > > Modified: trunk/bindings/ada/plplot_traditional.ads.cmake > =================================================================== > --- trunk/bindings/ada/plplot_traditional.ads.cmake 2008-08-14 22:06:23 UTC > (rev 8656) > +++ trunk/bindings/ada/plplot_traditional.ads.cmake 2008-08-14 22:15:33 UTC > (rev 8657) > @@ -119,7 +119,8 @@ > Default_Label_String : constant Unbounded_String := > To_Unbounded_String(""); > type Label_String_Array_Type is array (1..Max_Lines_For_Multiplot) of > Unbounded_String; > Default_Label_String_Array : Label_String_Array_Type := (others => > Default_Label_String); > - type Stripchart_Label_String_Array_Type is array (1..4) of > Unbounded_String; > + Maximum_Number_Of_Stripcharts : Integer := 4; -- Limited by PLplot > designers. > + type Stripchart_Label_String_Array_Type is array (1 .. > Maximum_Number_Of_Stripcharts) of Unbounded_String; > > -- Justification for plots > subtype Justification_Type is Integer range -1..2; > @@ -842,6 +843,13 @@ > -- Function version of the procedure Get_Device_Name; not part of the > PLplot API. > function plgdev return String; > > + -- Make a function version of plgdev so that the caller can use it > whereever > + -- a String type is expected without fooling around with conversions > between > + -- Ada string types. See Example 14 for useage. > + -- THIS IS NOT IN THE C API. > + function plgdev return String; > + > + > -- Retrieve current window into device space > procedure plgdidev > (Relative_Margin_Width : out Long_Float; > > > This was sent by the SourceForge.net collaborative development platform, the > world's largest Open Source development site. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Plplot-cvs mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/plplot-cvs > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel