On 2015-05-21 07:53-0000 Arjen Markus wrote:

> Hi Alan, James,
>
>
>
> In the attachment you will find a demonstration of the sort of Fortran 
> bindings I have in mind. The essence is:
>
> -        Use iso_c_binding to call the C functions directly (no intervening C 
> wrapper if that can be avoided)
>
> -        Use the renaming feature of the use statement to switch between 
> single and double precision without code duplication. The result is that the 
> bindings provide two versions, one for single-precision arguments and one for 
> double-precision arguments, which are selected automatically by the compiler. 
> (Mixtures of precisions within a single call are not supported - that would 
> lead to a very akward combinatorics and I doubt this at all a practical use 
> case.)
>
> -        Hide those things like parameters that are not intended for the 
> public interface. I will probably go and use "private" as the default and 
> make the individual items public instead of what I have now (default "public" 
> and hide the things that are not needed)
>
> The source code currently is tuned to example x00f, slightly modified wrt the 
> trunk. You can change the worknig precision parameter "wp" to select the 
> other precision.
>
> Notes:
>
> -        newbinding.f90 is the topmost source file. All other files are 
> included into it.
>
> -        To link the example you need the PLplot C library. See the shell 
> script "mk", which was set up for Cygwin
>
> -        With slight modifications this should work on Linux too (there you 
> can use the libplplot.so shared object directly).
>

Hi Arjen:

A Linux adaptation of those build instructions got that build to work
for me (with some spurious warnings because of my old gfortran 4.7.2
version as we have discussed before.)

The end result was

irwin@raven> ./x00f

worked and prompted me for device and device file name, and the
resulting PostScript plot looked good.

So that is an excellent start, and I especially like the absence of
any extra C layer at this stage (although we will ultimately need an
extremely limited C layer for some of the more complex API argument
processing); the freedom to choose any real type in the examples (so
long as that real type is chosen consistently for a single call to a
PLplot function); and the form of how you have implemented the
interface which avoids duplicate code to handle the two different
PLFLT cases.

However, there are three things we should fix before expanding
this further.

1. Fix plsparseopts 
> -        I have not tested this with command-line arguments yet - that is the 
> trickier part of the code.

In fact, it turns out command-line options do not work correctly, e.g.,

irwin@raven> ./x00f -dev psttfc -o test.psc

Bad command line option "test.psc"
[....]

2. Fix naming scheme for kind values so the examples (and more
importantly user's programmes which are depending on plflt) can remain unchanged
for backwards compatibility.  I have developed some detailed ideas in
the way I want to do this, but instead of describing those in English
I would like to present a commit instead that you could evaluate in
detail for yourself.

3. Integrate these changes into our current build and test scheme.
Again, I would be happy to take responsibility for this.

In sum, I suggest we continue from this good start on the new Fortran
binding topic with you taking responsibility for topic 1 and me taking
responsibility for topics 2 and 3 above.

Of course, if I am going to contribute to this development I do need
git access to your private topic branch work using the usual "git
format-patch" and "git am" method that is described in
README.developers. So for now I suggest your first priority would be
to present exactly what you have given us here as a tarball in "git
format-patch" form instead with no further changes (except possibly
not including the x00f.f90 change since I would just revert that, see
above).  And that solid git start with just your present work and no
further except possibly excluding the x00f.f90 change would allow us
to develop this private topic from there. Of course, I am aware you
have had some problems with using "git format-patch" in the past, but
if those continue let me know here or off list, and I think I should
be able to give you an exact cookbook of what to do to get started.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to