comp.lang.ada
 help / color / mirror / Atom feed
From: Rex Reges <rexrreges@aol.com>
Subject: Re: Ada '83 X widget bindings
Date: 1998/04/22
Date: 1998-04-22T00:00:00+00:00	[thread overview]
Message-ID: <353E804E.4F15@aol.com> (raw)
In-Reply-To: 6goopv$fv3@newshub.atmnet.net


Christopher Green wrote:
> 
> In article <6gignr$m4g@news.man.fs.lmco.com>,
> Jack Ottofaro <jack.ottofaro@lmco.com> wrote:
> >
> >We currently have Ada '83 software which uses an X11 bindings package. We'd like
> >to enhance our GUI with buttons, menu pulldowns, etc. Any suggestions on a good
> >set of X11 widget bindings, for example bindings to Motif, compatable with Ada
> >'83. My understanding is that since I'm using Ada '83 I cannot use the Motif
> >callbacks since the language does not support function pointers but a package
> >that provides routines for drawing widgets would be great.
> >
> >Thanks in advance,
> >Jack Ottofaro
> 
> We sell the AXI bindings to Xlib, Xt, and Motif.  We have ports for most
> AdaWorld and VADS Ada83 compilers.  Callbacks are fully supported on any
> compiler where subprogram'Address returns the entry point of the subpro-
> gram or an address from which the entry point can be computed; this in-
> cludes just about all the last-generation Ada83 compilers.  We also sup-
> port many of the current Ada95 compilers.  For price and availability,
> write to Tom Masada <tmasada@atc.com>.  For technical information con-
> cerning particular compilers and platforms, reply to me <cgreen@atc.com>.
> 
> --
> Chris Green                                  Email cgreen@atc.com
> Advanced Technology Center                   Phone (714) 583-9119
> 22982 Mill Creek Drive                                   ext. 220
> Laguna Hills, CA 92653                       Fax   (714) 583-9213


I used the AXI bindings a few years ago with great success. The
problem with callbacks depends on the compiler. The Harris
Nighthawk I used had Harris's version of the Verdix compiler
which let me use the 'address of functions for the callbacks.

Typing on the callbacks was not checked, so it was important
to be careful on the callback that 32 bit arguments were 
used.  It is usually best to send pointers to variables
as C would do.

I easily converted code samples from O'Reilly Volume 6 to 
Ada 83 with the AXI bindings.

Some limitations:

  - cannot use 8 bit characters (like the degree symbol), Ada
    causes an exception since only 7 bit ASCII is in range.

  - to use a variable number of arguments on the widget calls, 
    I created a function that calls the AXI set arg routine for
    each element of the unconstrained array of arguments passed
    in.  The routine returned an array of arguments which could
    be catenated ("&") with other arguments.  Note: the compiler
    had a few bugs in the catenation of unconstrained arrays, be
    careful.

  - When converting to the VAX bindings, found that callbacks had
    to be functions appearing in a spec.  This was troublesome 
    because you usually want to hide the callbacks.

  - I used the AXI names for the formal arguments which followed 
    the C prototypes closely.  When converting to the VAX, I 
    found DEC had spelled the names out making major substitutions
    necessary.

  - Only one task can make the X calls, they are not reentrant.
    Other tasks can run, but you must pass all data in and out
    of the X task by some passive means. I used pickup and
    dropoff queues. The X task would poll the dropoff queue
    a few times a second for any inputs and another task would 
    poll the pickup queue for any outputs (actions based on 
    user inputs).

  - Be careful not to collide with the X signals. Other system
    calls and some Ada tasking calls may be using the same
    signal.  When a signal is lost, the X task hangs. Tie the
    X task to the Unix scheduler as it's own light weight process
    so it has separate signals.

  - I would suggest to have separate programs for each X terminal
    to be connected to. I used a single Ada program to stay 
    within the Ada runtime system, but the single X task would
    bog down when several users were doing requests to draw
    complicated screens.




  reply	other threads:[~1998-04-22  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-09  0:00 Ada '83 X widget bindings Jack Ottofaro
1998-04-09  0:00 ` Thomas Hood
1998-04-10  0:00 ` vonhend
1998-04-10  0:00   ` Larry Kilgallen
1998-04-11  0:00 ` Christopher Green
1998-04-22  0:00   ` Rex Reges [this message]
1998-04-23  0:00     ` Larry Kilgallen
1998-04-17  0:00 ` Jean-Claude MAHIEUX
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox