[Prev][Next][Index][Thread]

Re: Deuce gadgets and streams



Take a look at dylan/sources/deuce/streams.dylan, and you'll
see that you can create a stream over buffers or regions within
a buffer.

The following will make an interval stream pointing to the location
BP within BP's buffer.  You can get the buffer by calling 'window-buffer'
on the Deuce gadget.

  make(<interval-stream>, direction: #"output", interval: make(<interval>,
start-bp: BP, end-bp: BP))

You can then call operations such as 'write' or 'write-line' on the
resulting stream.

Chris Double wrote in message ...
>Is it possible to treat a deuce gadget as a stream in some manner? For
>example, if I have a deuce gadget:
>
>  pane my-pane (frame)
>    make(<deuce-gadget>);
>
>And somewhere else in the application I want to stream text to that
>gadget in an easy manner:
>
>  define method log-message(frame :: <my-frame>, msg :: <string>)
>    frame.deuce-gadget.somehow-stream-text(msg);
>  end;
>
>I can do:
>
>  frame.deuce-gadget.gadget-value :=
>    concatenate(frame.deuce-gadget.gadget-value, msg);
>
>But was looking for something not involving so much copying. Anyone
>able to provide hints towards a better way?
>
>Chris.
>--
>http://www.double.co.nz/dylan
>





Follow-Ups: