comp.lang.ada
 help / color / mirror / Atom feed
* Ada '83 X widget bindings
@ 1998-04-09  0:00 Jack Ottofaro
  1998-04-09  0:00 ` Thomas Hood
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jack Ottofaro @ 1998-04-09  0:00 UTC (permalink / raw)




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 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada '83 X widget bindings
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Hood @ 1998-04-09  0:00 UTC (permalink / raw)



Look to your own SBIS program's code for re-usable X/Motif bindings and
toolkits.  Although the program was effectively canned, the code should
still be available.  The folks who wrote the majority of the interfaces
are available for comment. E-mail me for more information if you need
it.

Tom Hood
thomas@ifn.com

Jack Ottofaro 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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada '83 X widget bindings
  1998-04-10  0:00 ` vonhend
@ 1998-04-10  0:00   ` Larry Kilgallen
  0 siblings, 0 replies; 8+ messages in thread
From: Larry Kilgallen @ 1998-04-10  0:00 UTC (permalink / raw)



In article <352e40d5.0@news1.ibm.net>, vonhend@ibm.net writes:
> The fact that Ada 83 doesn't support function pointers doesn't mean that you
> can't use conventional Xt and Motif bindings.  We use the Verdix-supplied bindings
> from the Free Software Foundation (originally developed by DEC) and they work just
> fine.  We do have to instantiate an unfortunate number of unchecked conversion 
> functions (something I personally don't like, as unchecked conversion defeats
> the purpose and value of strong type checking.)

Although theoretically strong type checking is important,
these bindings are for the purpose of accessing a whole
lot of code which does not use strong type checking, so
a little more around the edges isn't quite so bad.

Larry Kilgallen




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada '83 X widget bindings
  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-17  0:00 ` Jean-Claude MAHIEUX
  3 siblings, 1 reply; 8+ messages in thread
From: vonhend @ 1998-04-10  0:00 UTC (permalink / raw)



The fact that Ada 83 doesn't support function pointers doesn't mean that you
can't use conventional Xt and Motif bindings.  We use the Verdix-supplied bindings
from the Free Software Foundation (originally developed by DEC) and they work just
fine.  We do have to instantiate an unfortunate number of unchecked conversion 
functions (something I personally don't like, as unchecked conversion defeats
the purpose and value of strong type checking.)

The following code fragment, extracted from a working procedure, demonstrates
one way to create a button and register a callback.  The code which sets the
resources for the button has been omitted.


with Xt;
with Xm_Push_Button;
with Xm_String_Defs;

procedure Create_Some_Dialog is

    function  Create_Playback_Control_Form(Parent : in Xt.Widget) return Xt.Widget;

    ClosePushButton : Xt.Xt_Widget := Xt.Null_Widget;
    PlaybackControlForm : Xt.Xt_Widget := Xt.Null_Widget;
    Args : Xt.Xt_Ancillary_Types.Xt_Arg_List(1..256);

begin


      ClosePushButton := Xm_Push_Button.Xm_Create_Push_Button(Parent => PlaybackControlForm,
                                                              Name => "closePushButton",
                                                              An_Arg_List => args(1..ac-1));
      Xt.Xt_Callbacks.Xt_Add_Callback(Object => ClosePushButton,
                                      Callback_Name => Xm_String_Defs.Xm_N_Activate_Callback, 
                                      Callback => Xt.Xt_Callback_Proc(Close_Dialog_CB'Address),
                                      Client_Data => Xt.Xt_Utilities.To_Xt_Pointer (PlaybackControlForm));
      Xt.Xt_Composite_Management.Xt_Manage_Child(ClosePushButton);

end;

So you really do not need function pointers in Ada.

Mark Von Hendy
Lockheed Martin Technical Operations

In <6gignr$m4g@news.man.fs.lmco.com>, jack.ottofaro@lmco.com (Jack Ottofaro) writes:
>
>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 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada '83 X widget bindings
  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-11  0:00 ` Christopher Green
  1998-04-22  0:00   ` Rex Reges
  1998-04-17  0:00 ` Jean-Claude MAHIEUX
  3 siblings, 1 reply; 8+ messages in thread
From: Christopher Green @ 1998-04-11  0:00 UTC (permalink / raw)



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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada '83 X widget bindings
  1998-04-09  0:00 Ada '83 X widget bindings Jack Ottofaro
                   ` (2 preceding siblings ...)
  1998-04-11  0:00 ` Christopher Green
@ 1998-04-17  0:00 ` Jean-Claude MAHIEUX
  3 siblings, 0 replies; 8+ messages in thread
From: Jean-Claude MAHIEUX @ 1998-04-17  0:00 UTC (permalink / raw)



My company has developped a full Ada 83 implementation of Xlib Xt 
and Motif libraries. This is called XInAda.
Callbacks are implemented through generic instantiations.
You may use TeleUSE or Uim/X to develop your application.
XInAda is supported on most native (and some others) development 
environments.
We also have a full Ada95 implementation that takes a real 
advantage of Ada95 features.
\x01
Please have a lokk at http://www.topgraphx.com for more 
information or ask by email to sales@topgraphx.com
\x01
Jean-Claude Mahieux, Top Graph'X

-- 
Jean-Claude Mahieux -Top Graph'X - FRANCE 
Tel : (33 1) 69 26 97 88 Fax : (33 1) 69 26 97 89                
Email : 100071.45@compuserve.com                              
HTTP://ourworld.compuserve.com/homepages/topgraphx 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada '83 X widget bindings
  1998-04-11  0:00 ` Christopher Green
@ 1998-04-22  0:00   ` Rex Reges
  1998-04-23  0:00     ` Larry Kilgallen
  0 siblings, 1 reply; 8+ messages in thread
From: Rex Reges @ 1998-04-22  0:00 UTC (permalink / raw)



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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada '83 X widget bindings
  1998-04-22  0:00   ` Rex Reges
@ 1998-04-23  0:00     ` Larry Kilgallen
  0 siblings, 0 replies; 8+ messages in thread
From: Larry Kilgallen @ 1998-04-23  0:00 UTC (permalink / raw)



In article <353E804E.4F15@aol.com>, Rex Reges <rexrreges@aol.com> writes:

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

I am under the impression there was a modification to the Ada83
specification about 1987 or so allowing full 8 bit characters.
If the exception cited was fully due to the compiler, later
DEC Ada compilers should not have this problem.

Thanks for the useful report of actual experience.

Larry Kilgallen




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1998-04-23  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
1998-04-23  0:00     ` Larry Kilgallen
1998-04-17  0:00 ` Jean-Claude MAHIEUX

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