On Sep 7, 2010, at 9:44 PM, Alan W. Irwin wrote:

> Hi Jerry:
>
> On 2010-09-07 19:49-0700 Jerry wrote:
>
>>
>> User programs that previously relied on the built-in declarations of
>> Vector and Matrix _might_ now have a problem.
>
> From my tests, I don't think the standard Ada (both thin and thick)
> examples are affected by this.  Do those examples do something special
> to avoid the problem?  If so, perhaps the documentation should
> advertise what that is (if it doesn't do that now).
>
> Alan
> __________________________

No, they don't do anything special. All they do is reference the  
Vector and Matrix declarations which are in PLplot_auxiliary.ads and  
look like this:

type Real_Vector is array (Integer range <>) of Long_Float;
type Real_Matrix is array (Integer range <>, Integer range <>) of  
Long_Float;

These are "open arrays" or in Ada, unconstrained arrays, indicated by  
<> instead of actual index ranges such as 3..7.

The examples and any user program need only to reference the package  
which contains these. In Ada, this looks like

with PLplot_Auxiliary;
(and optionally,)
use PLplot_Auxiliary;

The examples or user program then needs to declare variables of these  
types with actual bounds specified. For example, in x01a.adb, there is  
this:

xs, ys : Real_Vector (0 .. 5);

but this is SOP for Ada.

If, when the user begins writing his/her program and (1) knows that  
there will no use of the Ada 2005 numerical BLAS-LAPACK vector-matrix  
stuff (eigenthings, solvers, etc.) and (2) plans on using PLplot, then  
the Ada bindings will just work. This is how the Ada examples are  
written.

However, if the user either (a) needs to use the numerical stuff in  
Ada or (b) begins writing the program using the "official" Ada  
declarations and realizes later that PLplot is needed, then he/she  
will need to either (*) comment two lines in PLplot_Auxiliary.adb and  
uncomment three lines, then recompile the Ada part and make sure the  
link to BLAS and LAPACK happens, or (+) insert an explicit type  
conversion when those "official" vectors and matrices are passed to  
PLplot.

I have explained this in the documentation pretty much like this.

By the way, this "easy switching" of declaration styles is the only  
remaining reason for keeping PLplot_Auxiliary.ad[bs] (some PLplot- 
specific utilities notwithstanding). I could eliminate it for all of  
Ada in PLplot but then it obscures how to do the "switch." It's a  
little ugly. I suppose other languages would do this with compiler  
pragmas but Ada does not have them--apparently someone thought they  
are unsafe.

Jerry

  

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to