On Tuesday 14 August 2007 15:19, Clive Page wrote:
> I don't know whether it is powerful enough for your needs, but the
> graphical package DISLIN http://www.mps.mpg.de/dislin/ has some routines
> which support the construction of a basic Graphical User Interface. It
> is available for many platforms and compilers, including GNU/Linux
I have used DISLIN before an really liked it mostly because of its extensive
functionality and portability. The interface is primitive but functional. One
note of caution from my experience---this may be fixed in newer releases. The
dislin.f90 module giving the interface to dislin, at least for some
compilers, uses assumed-shape dummy arguments for the arrays. The actual
library really only supports traditional contiguous (F77-style) arguments. I
have had the library fail when supplying a strided actual because it cannot
really handle non-contiguous data. So it is best to use more classical
assumed-size or explicit-shape arrays. I used this and it works much better.
> http://www.star.le.ac.uk/~cgp/dislinGUI.html
> Some of this, e.g. on the best way to use callback routines, are likely
> to be applicable to other GUI-building libraries.
I want to comment briefly on this statement:
"The best way to do this in Fortran is to have the call-back routines in a
module, and set up module variables which are accessible to all the module
procedures and contain the information necessary to run the main computation.
In older versions of Fortran it was the practice to use common blocks for
this, but modules storage is much more, well, modular. "
I disagree that this is the "best way". It is a simple way that will work for
some (simple) uses. The problem is that modules are global, so there can be
only one per program. What if you have multiple list widgets that need to
have the same callback but work on different data (different windows for
example). It is ackward to code this using global variables.
In F2003 one can use polymorphism to pass "hidden" data to callbacks. But this
will not work with dislin since it does not pass context to callbacks. One
can however implement some wrapper callbacks that then extract context from a
table and pass it on to the actual callbacks using polymorphism.
In F2008 one will be able (finally!) to use internal procedures as callbacks.
Internal procedures can have access to data in their parent procedure so they
can share the context that way. Sadly, the nesting depth is still limited to
only a single internal procedure (i.e, no internal procs of internal procs).
Maybe in the next revision we'll change that :-)
Best,
Aleks
--
Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ LLNL
High Performance Computational Materials Science and Chemistry
E-mail: [log in to unmask]
Phone: (925) 424-6816 Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cherrypit.princeton.edu/donev
|