- Subject: Re: Interprocess communication
- From: Jörg Sommer <joerg@xxxxxxxxxxxx>
- Date: Sun, 21 May 2006 17:59:07 +0000 (UTC)
Hello John,
"John E. Davis" <davis@xxxxxxxxxxxxx> wrote:
> Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
>>I would like to use source specials with xdvi, e.g. you can hit somewhere
>>in the document and xdvi opens an editor and places the cursor at the
>>line that refers to the position in the document.
>
> What interface does xdvi use for IPC?
None. Xdvi calls a command. You get this process chain:
User -invokes-> Jed -invokes-> Xdvi -invokes-> commad
This command must somehow contact Jed and tell him what Xdvi wants. The
problem is not really the interprocess communication. The problem is
jed can not react on events (at least I found no way).
The classical idea:
view()
{
create(fifo);
fork();
if (parent)
start(viewer);
else
{
open(fifo, "r");
while ( read(fifo, line) )
do_something_with(line);
close(fifo);
}
}
and viewer writes to the fifo. But SLang has no fork().
My next idea: signals
sig_handler(sig)
{
while ( read(fifo, line) )
do_something_with(line);
}
view()
{
create(fifo);
open(fifo, "r"); % non-blocking
signal(SIGHUP, &sig_handler);
start(viewer);
}
and viewer writes to the fifo and sends a SIGHUP. But Jed has no
signal().
My next idea: open_process
process_sig_handler(pid, line)
{
do_something_with(line);
}
view()
{
open_process("jed", "--script", "latex_xdvi_comm.sl", "watch");
set_process("output", &process_sig_handler);
start(viewer);
}
and latex_xdvi_comm.sl opens an fifo and writes all input to standard
output. viewer sends its commands to latex_xdvi_comm.sl.
Do you have a better idea?
Jörg.
--
Wenn Du jedesmal stehen bleibst, wenn ein Hund bellt, wirst du Deine Reise
nie beenden. (Arabisches Sprichwort)
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]