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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!aurora!labrea!jade!ucbvax!software.ORG!blakemor From: blakemor@software.ORG (Alex Blakemore) Newsgroups: comp.lang.ada Subject: (none) Message-ID: <8709152214.AA00945@ucbvax.Berkeley.EDU> Date: Tue, 15-Sep-87 15:39:18 EDT Article-I.D.: ucbvax.8709152214.AA00945 Posted: Tue Sep 15 15:39:18 1987 Date-Received: Thu, 17-Sep-87 06:38:23 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: Paul Attermier at Sandia National Labs wanted to know about using Ada with X windows. You can pass a callback array easily in Ada, assuming your compiler supports the most basic features from Chapter 13 of the LRM. (Most do). An example follows : with system; procedure main is type call_back_arrays is array (1 .. 2) of system.address; call_back_array : call_back_arrays; procedure X_routine (call_back : system.address); -- passed as system.address pragma interface (C, X_routine); -- due to Verdix limitation procedure user_routine_1 is begin ... procedure user_routine_2 is begin ... begin call_back_array (1) := user_routine_1'address; call_back_array (2) := user_routine_2'address; X_routine (call_back_array'address); end main; We've successfully used this technique to bind Ada programs to our Apollo X substitutes. I don't believe this violates the spirit of Ada, but like most Chapt 13 stuff, it should be well isolated. What IS difficult in Ada is to call a routine from an address known only at run time (ie. make a callback). However, that doesn't appear quite as often and you can always use a layer of C. Or maybe try some unchecked conversion and generics with subprogram formal parameters ... ? Alex Blakemore Software Productivity Consortium Reston, VA