Lisp HUG Maillist Archive

Telling the editor that something else is a paren?

Does anyone know how you can tell the editor that something other than
"(" is a paren?  I would like something like character syntax in
Emacs, but perhaps slightly more general, because my delimiter is more
than one character.

To be really specific, I have things like

   #["format-control" arg ...]

which expand at read time to docstrings (and do various other things),
and I'd like it to know that #[ is an open paren (or maybe just [ is
an open paren) & ] is a closed one)

Thanks

--tim



Re: Telling the editor that something else is a paren?

Unable to parse email body. Email id is 364

Waiting for input on a CAPI interactive pane

Unable to parse email body. Email id is 376

Re: Waiting for input on a CAPI interactive pane

* Marco Antoniotti wrote:
> Hi

> does anybody know how to implement a "wait for input" function on an
> interactive pane?

> I.e. something like

>     (defun repl (interface interactive-pane i/o-stream)
>         (loop (wait-until-something-on i/o-stream)
>               (read i/o-stream)))

> Of course the rest of the application should not hang.

Can you not just start a thread to do this?  If you need to
synchronize with someone else you can then use the normal thread
synchronization stuff (mailboxes?).

--tim


Re: Waiting for input on a CAPI interactive pane

Unable to parse email body. Email id is 381

Re: Waiting for input on a CAPI interactive pane

Unable to parse email body. Email id is 385

Re: Waiting for input on a CAPI interactive pane

At 01:31 PM 03/06/2002 -0400, Marco Antoniotti wrote:

What about mp:notice-fd?  Doesn't it do exactly what you want?


Here's the reply I was composing before I noticed notice-fd :-).  If the above isn't what you want, read on...

You might need to describe the problem in more detail.

As far as I can tell, Nick suggested something like:

<stream 1> --- <process 1>---->> function1

<stream 2> --- <process 2>---->> function2
....

The only difference between this and my decades-old recollection of what Unix select does is that Unix select waits for an input event from one-of-many-possible sources, and, that at most one of these sources is processed at a time (i.e. the process containing the select is a "server").  The suggestion above allows more than one stream to be processed "at the same time", each thread is a separate server.

In general, to convert a bunch of parallel events into a time-ordered sequence, you need one "server" and a queue, something like:

<stream 1> --- <process 1> ->> function 1 ----+
                                              |
<stream 2> --- <process 2> ->> function 2 ----+---> queue, <process 0>
                                              |
....                                       ----+

I haven't tried this in Xanalys Lisp, but a quick look at the MP reference section suggests that the queue should be a mailbox, process 0 (the "serializing" server) should be a mailbox-reader and that functions 1-N simply drop the corresponding stream objects into the queue (mailbox) and go back to waiting for new activity on the stream.

So, process 0, the server, is a loop that waits for a stream to appear in the mailbox, then runs the appropriate application code with that stream.  If any of the other streams fire while the first stream is being processed, their stream-objects will be dropped into the mailbox queue.  When process 0 finishes working on the 1st stream, it comes around and reads the mailbox  - if some stream object is queued up, it gets processed immediately, if the queue is empty, the server waits until something arrives (implicit in the fact that mailbox-read is a blocking read).

pt

Re: Waiting for input on a CAPI interactive pane

Unable to parse email body. Email id is 393

Re: Waiting for input on a CAPI interactive pane

Marco Antoniotti <marcoxa@cs.nyu.edu> writes:

> Nope.  I need something working on a STREAM.  Not a file descriptor.
> Unless you can get to the file descriptor from the listener pane.

Maybe not what you want, but this little hack was quite useful for me
once (on Solaris LW 4.1):

(defmethod get-unix-fd-from-stream ((x stream))
  (slot-value x 'stream::file-handle))

(defmethod get-unix-fd-from-stream ((x comm:socket-stream))
  (slot-value x 'comm::socket))
-- 
  (espen)


Re: Waiting for input on a CAPI interactive pane

Unable to parse email body. Email id is 395

Re: Waiting for input on a CAPI interactive pane

Unable to parse email body. Email id is 388

Updated at: 2020-12-10 09:02 UTC