> From: adw@reading.ac.uk
>
> I am trying to intergrate SUNs ToolTalk library into pop11. This should allow
> pop11 and other process to talk to each other without having to know too much
> about each other.
As Julian mentioned in another message.... sockets are coming! Yay!
Everybody give John Gibson a round of applause :-)
> When you open a ToolTalk conection you get back a file descriptor which is used
> for passing messages. This is okay because the library contains all the code
> for sending a receiving messages. But the one thing you need to do is setup
> an async alerting method so you know when to receive a message. The recomended
> version of application using the Xtoolkit is :-
[snip]
> The problem is that the pop11 version of XtAppAddInput (XptAppAddInout) expects
> a device and not a file descriptor.
>
> So I thought I would use XtAddInput from xt_r2compat as this uses a file descriptor
> instead of a device. However when pop11 is sent a message my input handler does
> not get called. If I call tt_message_receive by hand then I recieve the message.
In the next version Poplog we will be able to import file-descriptors as
devices which would solve this (and many other) problems.... but until
then...
> What im I doing wrong or is ther another way of calling a pop11 procedure
> when data arrives on a file descriptor?
You're not doing anything wrong..... the events are not getting
processed. All most of the R2 compatability functions do is call the
appropriate modern function with an appcontext. So XtAddInput calls
XtAppAddInput... unfortunately this application context is private to
the Xt libraries, so we cannot get hold of it to make it asyc with
XptAsyncAppContext. So if you use XtAddInput et al you will have to
process the events yourself with XtNextEvent etc.
Another solution would be to call the external XtAppAddInput directly
from Poplog, eg:
exload 'test' ['-lXt' '-lX11']
(language C, prefix 'raw_')
XtAddInput(fd, mask, cbk, data):int;
endexload;
vars i = exacc raw_XtAddInput(
fd,
XtInputReadMask,
XptExportInputCached(pop_receive_tt_message, false,data)
);
The problems with this are:
1) It's won't work under VMS since XtAppAddInput is fouled up under
that OS for various reasons. There's no polite way you can fix this
one (actually... I lie... I suppose you could call the Poplog
XtAppAddInput with a dummy file descriptor to get them added... but
this is still messy)
2) Things won't get added to the various internal lists Poplog uses
to ensure that the callbacks etc do not become garbage while the
appcontext is live. You'll have to do this yourself.
> (I know I could write some C code to do this but that would be cheating).
Indeed. The above is so much cleaner :-) :-)
> Anthony.Worrall@Reading.ac.uk
Adrian
aids (adrianh@cogs.susx.ac.uk) ObDisclamer: Poplog used to pay my wages
Phone: +44 (0)1273 678367 URL: http://www.cogs.susx.ac.uk/users/adrianh/
|