From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa1d6d9edff38204 X-Google-Attributes: gid103376,public From: Rex Reges Subject: Re: Ada '83 X widget bindings Date: 1998/04/22 Message-ID: <353E804E.4F15@aol.com>#1/1 X-Deja-AN: 346810741 Content-Transfer-Encoding: 7bit Sender: nntp@news.boeing.com (Boeing NNTP News Access) X-Nntp-Posting-Host: e909023.knt.boeing.com References: <6gignr$m4g@news.man.fs.lmco.com> <6goopv$fv3@newshub.atmnet.net> Content-Type: text/plain; charset=us-ascii Organization: The Boeing Company Mime-Version: 1.0 Reply-To: rexrreges@aol.com Newsgroups: comp.lang.ada Date: 1998-04-22T00:00:00+00:00 List-Id: Christopher Green wrote: > > In article <6gignr$m4g@news.man.fs.lmco.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 > > 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 . For technical information con- > cerning particular compilers and platforms, reply to me . > > -- > 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.