comp.lang.ada
 help / color / mirror / Atom feed
From: "W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM>
Subject: Re: Ada/Motif problem
Date: 1996/08/28
Date: 1996-08-28T00:00:00+00:00	[thread overview]
Message-ID: <9608281459.AA06806@most> (raw)


If the Motif libs were compiled with gcc then the following should work
with GNAT:

   HW : constant String := "Hello World" & ASCII.NUL;

   begin

      Xt.Intrinsic.XtAddCallback ( pb,
                                   Motif.et_cetera,
                                   hello.et_cetera'access,
                                   HW'Address             );

as long as you ensure that HW is ALWAYS in scope.

I've obviously never tried it with Ada-83, but that method for
sending a string to C works with several C compilers and Ada-83 compilers.

OOPS, I just realized you're trying to send it BACK to Ada.  Yes, you lose
bounds info, but you can sort of get them back as follows:

in callback:

   Local_HW : contant String := String_From_C ( the_thing_that_came_from_C );

where String_From_C is provided (with a different name) by most vendors,
but is basically

   Temp : String ( 1 .. some_arbitrary_limit );
   for Temp'Address use the_thing_that_came_from_C;

...

   for I in Temp'Range loop
      if Temp(I) = ASCII.NULL then
         return Temp ( Temp'First .. I-1 );
      end if;
   end loop;

---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Hughes Defense Communications (MS 10-40)                 Home: 219-471-7206
Fort Wayne,  IN   46808                  (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




             reply	other threads:[~1996-08-28  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-28  0:00 W. Wesley Groleau (Wes) [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-08-28  0:00 Ada/Motif problem G. Vincent Castellano
1996-08-27  0:00 Dale Stanbrough
1996-08-27  0:00 ` Dale Stanbrough
1996-08-27  0:00   ` Michael K Rohan
1996-08-28  0:00     ` Larry Kilgallen
1996-08-29  0:00       ` Paul Hussein
1996-08-27  0:00 ` Larry Kilgallen
1996-08-28  0:00 ` David C. Hoos, Sr.
1996-08-28  0:00 ` Jon S Anthony
1996-08-29  0:00 ` Jon S Anthony
1996-08-29  0:00   ` Dale Stanbrough
1996-09-02  0:00     ` Sandy McPherson
replies disabled

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