I'd like to raise a possibility about a better way to handle the Ada  
bindings. Here's the deal.

There has been a recent new standard for the Ada language, known  
frequently as Ada 2005, Ada 05, Ada 2007 or Ada 07. (The most  
frequent is Ada 2005 although the standard was not officially  
approved until 2007, as I understand it. The first Ada is known as  
Ada 83.) Ada 2007 has added a numerics capability described in the  
Ada Reference Manual in Annex G.3. It provides, among other things,  
"official" declarations for vectors and matrices.

I want to let the PLplot bindings use those declarations if the user  
is using an Ada 2007 compiler; otherwise, I declare them myself in  
the bindings. There are only two lines of declarations but the the  
"with" clauses need to be adjusted in several files. ("with" is a  
little like "include" in C.) I could just leave my own declarations  
in, even for Ada 2007 compilers, but I really want to take advantage  
of the language to the maximum extent possible, and to reduce the  
likelihood of there being confusion (in the Ada 2007 case) of whether  
the user needs to use my declarations or the Annex G.3 declarations.

The way that I have handled this so far is to comment lines in or out  
as necessary. The bindings as included in PLplot so far have been for  
Ada 95. For my own use (non-PLplot development), I edit the source  
code to be compatible with Ada 2007. I don't think this is a good  
solution.

I asked the comp.lang.ada list about this. There were several  
solutions offered and several of them depended on using GNAT  
functionality that lies outside the compiler proper. (GNAT is gnu  
Ada.) For example, a GNAT preprocessor was mentioned as was a GNAT  
project file which would select different source files depending on  
the compiler type. In writing the bindings, I have not made them GNAt- 
dependent except for one little spot which should be easy to fix--I  
would prefer to not add more GNAT dependency by requiring a GNAt  
preprocessor or GNAT project file but rather keep the bindings so  
that they work for any Ada compiler.

Since the c.l.a. list strongly suggested, in any case, multiple  
source files, it seems to me that we could take one of two routes.  
One is for me to supply two sets of files, one that compiles with Ada  
95 and one that compiles with Ada 2007. Since there are already a  
number of files (three bindings of two files each and two auxiliary  
files), I would do this by a bit of sed trickery, I suppose--sort of  
a little non-GNAT preprocessor. This would require some kludgey file  
naming but should work.

The other way, very similar, would for me to keep the same number of  
binding files and let the build system take care of the sed stuff and  
create derived files with standardized names.

These two approaches also have the advantage that nobody has to  
bother themselves with any extra-compiler GNAT stuff. The differences  
in the sources for the two scenarios is really quite small. I could  
figure out how to write the source files to make the sed easy, and  
create the sed myself, but someone else would need to incorporate it  
into the build system.

I suppose, if necessary, we could just supply Ada 95 bindings since  
there probably aren't very many people using Ada 2007 yet.

I haven't thought through this very much mainly because I don't know  
what is necessary or possible with the build system or how much work  
this would require. However, I want to bring this up because I  
realized that I think that I have been inadvertently (and ignorantly)  
ignoring this problem.

Sorry for making a fuss this close to a release. I wouldn't mind if  
this issue slipped past the pending release, but would prefer to see  
it resolved.

Jerry

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to