TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Hans-Frieder Vogt <[log in to unmask]>
Wed, 25 Jun 1997 11:51:52 -0600
text/plain; charset=us-ascii
Hans-Frieder Vogt <[log in to unmask]>
text/plain (90 lines)
Hello Ada-Teamers,

I just like to tell you that i made my third release of Ada-Bindings to Motif
and X window publicly available.
It can be found on:

Developed with GNAT on linux, I tested it as well with GNAT on IRIX 5.2 and
Solaris 2.4!

I include here the README for this binding:

          Ada->Motif/X Binding Version 0.3

This is a binding of Ada to the C-Libraries of the X Window system and the
Motif(tm) widget set. Nearly all of the Motif(tm) routines are included, with
a steadily growing number of Intrinsics and basic Xlib functions.
For a future version 1.0, it is planned to incorporate most of the calls to
the Intrinsics and Xlib.
This will take its time, of course.

There is much discussion on how to build a binding to routines originally
written in C. Some people prefer a "thin" binding, trying to convert C
as direct as possible to Ada. The advantage of such a kind of binding is, that
the programmer who already knows the C routine names easily uses the Ada
pendants, and that the binding produces only little overhead. Disadvantages
that the control functions of Ada don't work and that Ada programming style
isn't supported.
Others use a "thick" binding to enable the use of C library functions in Ada.
They try to use as much as possible of the specific Ada advantages, giving the
Ada programmer a total Ada view of the routines, but producing a large
therefore increasing file size and reducing runtime speed.

I tried to create a "medium" binding: On the one hand the names of the routines
were nearly left untouched (just some "_"s added), on the other hand it was
tried to only use Ada types in the specification part of the packages
(i.e. no Ada.Interface.* type) wherever possible.
The binding was completely hand-written, therefore needed a huge amount of my
spare time (several, because my main task is not computing, but analysing
fluid flows in turbines), but seems to me now complete and stable enough to be
widely used and experimented with (at least I hope so).

The binding was tested to run on (the examples run there):

    o Linux on i86 (Linux 2.*, where it was mainly developed)
    o Solaris 2.4 / Sun OS 5.4
    o IRIX 5.2

using the GNAT-3.09-Compiler. Earlier versions of GNAT might or might not work.
I hope I didn't use any GNAT-specific functions, so that the binding should be
usable with every Ada95 compiler. But the Makefiles are for GNAT!
Motif Versions 1.2* and 2.0 and X11 releases 5 and 6 are supported. Please
read INSTALL for choosing Motif and X releases to adapt the binding to your
computing environment.

Please send me not only bug reports, but also comments on my approach to
the problem.

As X-Windows is only in some releases thread-safe, it has to be accounted for.
To ensure that only one single task is used for X Window routines to block
or release tasks are included in a package named X_lib.Tasking which I took
from the Intermetrics Ada-Binding (named there X.Tasking).
See the copyright-notice and notes for usage directly in this package.
The use of the Tasking-package is shown e.g. in the example programs "xmclock"
and "show_screen_saver".
If your X Window release supports multithread programming, you can use the
task blocking which is provided by X wherever necessary.

Hans-Frieder Vogt
Burgfelder Str. 6
D-70567 Stuttgart
e-mail: [log in to unmask]

Read the copyright notice!

Hans-Frieder Vogt                 e-mail: [log in to unmask]
Institut f"ur Luftfahrtantriebe   tel   : +49 (711) 685-3522
Universit"at Stuttgart            tel. privat: +49 (711) 717671
Pfaffenwaldring 6
D-70569 Stuttgart, Germany