X11Ada
X11Ada is an Ada 95 binding to X11R5, to the Xlib, Xt, and
Motif programming API's. It is a direct binding. The Ada 95 features it uses
heavily are general access types and child packages, but there are no tagged
types. The mapping is direct in the sense that there is mostly a 1-1 mapping
between:
- C header file
- Ada package
- C type
- Ada type
- C function
- Ada function or procedure
- C variable or constant
- Ada variable or constant
Downloading
Extracting and building X11Ada takes about 20 megabytes of
disk space. Building the software takes around an hour on a Sun-4.
In this release, the X11 and Xt components are available directly on the Web
from two sites:
The Motif component is available from here.
Building the installation
The software is in tar, gzip format. To
extract it:
- Fetch the X11 file off the Web, into a file named x11ada.tar.gz
gzip -d x11ada.tar.gz
tar xvf x11ada.tar
If you also want the Motif
component,
- Fetch the Motif file off the Web, into a file named motif.tar.gz
gzip -d motif.tar.gz
tar xvf motif.tar
Then to build the binding on Sun-4,
type:
To build it on another platform, see the
section Building
X11Ada on other platforms below.
Latest changes
X11Ada works with GNAT 3.01 on Sun-4.
The documentation files are now available in Microsoft Word (*.doc) format
and Postscript format (*.ps).
The MRM functions are added to the Motif binding.
The Stdarg package has been ported to Sparc, Intel, HP, MIPS, PowerPC, and
Alpha.
The copyright notices have been revised.
Online files
The "doc" directory contains online documentation files.
The "ada" directory contains source files for X11Ada.
The "c" directory contains the C header files from which the Ada was derived.
These could be needed because the tool we used to translate the C headers to Ada
left out the comments. If you want to take a look at the original comments that
were in the C headers, the Ada files contain references like:
PointerMotionHintMask : constant := 128; -- X.h:108
which says that this Ada declaration corresponds to line 108 of the C header
file X.h.
The "test" directory contains a few small test programs.
Documentation
The documentation files in the "doc" directory are:
- x11ada.html
- this file
- roadmap
- a map of the correspondence between Ada package names, Ada source files,
and C header files
- xbind.*
- xbind.ps is the Postscript version of a technical report and overview of
X11Ada; xbind.doc is the Microsoft Word version.
- interf4.*
- interf4.ps is the Postscript version of a paper about a Windows NT binding
that was recently completed. The sections of the paper about variable-length
argument lists and variable-length arrays are also relevant to the X binding.
(Also, the section on treatment of C unions should be relevant, except the
support for pragma Unchecked_Union is not yet implemented in GNAT 3.01 on
Sparc.) Interf4.doc is the Microsoft Word version. This paper was published in
the 1995 TriAda conference proceedings.
- stdarg.*
- stdarg.ps is the Postscript version of a paper about the Stdarg package of
X11Ada; stdarg.doc is the Microsoft Word version.
Building X11Ada on other platforms
This release of X11Ada has been
tested with GNAT 3.01 on Sun-4. The Stdarg family of packages are known to be
machine-dependent. Versions are provided for the
- Sun-4 Sparc
- Intel 386-486-Pentium
- Hewlett-Packard HP-9000 series 700 and 800
- MIPS/Silicon Graphics
- PowerPC
- DEC Alpha
machine architectures. Here is how to build it for one
of these platforms:
- If you are building X11Ada on Sparc, do nothing special.
- If you are building X11Ada on Intel, HP, or SGI edit the file
stdarg-machine.ads and set the constant This_Arch to the correct value for
your machine.
- On Intel, there is a warning message about record alignment in the file
stdarg-machine.ads. This message can be ignored.
- If you are building on HP, the line
#define STACK_GROWS_UP
in
the file var.c must be commented out. Also the rep clause for ArgBlock in
stdarg.ads must be un-commented.
- If you are building for the Alpha, the type Resource must be commented out
of x.ads and x.adb.
- If you are using another hardware platform, some rewriting of the Stdarg
packages will be needed. To get started, see the stdarg.doc documentation
file.
In the "test" directory, the "testvar" program tests that the
Stdarg mechanism is working, and has been built correctly for the current
machine platform.
As new releases of GNAT come out, and other Ada 95 compilers become
available, small changes to X11Ada may be needed.
Test programs
Currently there are 5 small test programs:
- testvar tests the Stdarg mechanism, as mentioned above, and gives examples
of how to use this mechanism from an application program.
- testexten tests the extensible array mechanism , and gives examples of how
to use this mechanism from an application program.
- basicwin is a simple Xlib program
- xrowcolumn is a simple Xt program
- hello_motif is a simple Motif program
The last three are
translated from examples in the O'Reilly X programming manuals. Here is what
these three are supposed to look like when run: basicwin,
xrowcolumn,
and hello_motif.
There may be slight differences on your system.
NOTE: These bindings are no longer actively supported by AverStar
These
bindings are no longer actively supported by AverStar. However, they are in use
throughout the Ada community, so you should be able to get help by posting
questions to the newsgroup comp.lang.ada.
Also, there is a set of slightly updated sources (to make them compilable on
the latest GNAT) and Linux binaries on the AdaPower site at:
If you have trouble downloading any of these files, please contact:
S. Tucker Taft
AverStar
23
Fourth Avenue
Burlington, MA, 01803, USA
stt@averstar.com (email)
781-221-6990
(voice)
781-221-6991 (Fax)
X11Ada programming examples
For information on X11Ada programming see
The Free X11/Ada 95 Programmer's Home
Page as well as the AdaPower web page mentioned above, http://www.adapower.com/lab/adax.html.
Some programs have been contributed by users of the binding, see the contributions
directory.
Changes
Updates to this file:
July 28, 1999 -- added direct link to Motif binding.
May 1999 -- changed references to "stt" from "mg".
March 8, 1996 -- described last software update.
Software updates:
March 4, 1996: upgrade to GNAT 3.03.
Feb 29, 1996: various small bug fixes. Add null_widget and other declarations
for private types. Move Resource to package X.Tasking so the binding can be used
on machines where tasking is not supported. Added contributions directory and
Mandelbrot program. Fix AdaMagic compilation errors.
Dec 19, 1995: release that changes access subprograms to all have pragma
Convention (C), and other small changes to make the binding work with the OCS
compiler.