Sophie

Sophie

distrib > Fedora > 15 > x86_64 > by-pkgid > c521da20bd4948864cf5bcbab78d30e5 > files > 9

memchan-2.2.1-8.fc15.x86_64.rpm

<! -- -*- tcl -*- doctools
   -->
<html><head><title>memchan - Memory channels </title></head>
<! -- Generated from file 'memchan.man' by tcllib/doctools with format 'html'
   -->
<! -- Copyright (c) 1996-2003 Andreas Kupries &lt;andreas_kupries@users.sourceforge.net&gt;
   -->
<! -- CVS: $Id$ memchan.n
   -->

<h1> memchan(n) 2.2  &quot;Memory channels&quot;</h1>
<a name="name"><h2>NAME</h2>
<p> memchan - Create and manipulate memory channels





<a name="synopsis"><h2>SYNOPSIS</h2>
package require <b>Tcl</b><br>
package require <b>memchan</b><br>
<br><table border=1 width=100% cellspacing=0 cellpadding=0><tr            bgcolor=lightyellow><td bgcolor=lightyellow><table 0 width=100% cellspacing=0 cellpadding=0><tr valign=top ><td ><b class='cmd'>memchan</b> ?-initial-size <i class='arg'>len</i>?</td></tr>
</table></td></tr></table>
<a name="description"><h2>DESCRIPTION</h2>

This manpage documents both the overall package and the command
<b class='cmd'>memchan</b>. The package itself provides a number of in-memory
channels which can utilized to

<ul>

	<li>
	capture stream-like information in a natural way instead of using
	<b class='cmd'>set</b> and <b class='cmd'>append</b> to manipulate strings

	<br><br>
<li>
	or to transfer data between interpreters, in the same thread or not.

</ul>

<a name="command"><h2>COMMAND</h2>
<p>
<dl>

<dt><b class='cmd'>memchan</b> ?-initial-size <i class='arg'>len</i>?<dd>


creates a chunk-oriented in-memory channel and returns its handle. If
an initial size is specified the system will pre-allocate <i class='arg'>len</i>
bytes of buffer space for the contents. This is no restriction on the
ultimate size of the channel, it will always grow as much as is
necessary to accomodate the data written into it.
<br><br>
The channels created here can be transfered between interpreters in
the same thread and between threads, but only as a whole. It is not
possible to use them to create a bi- or unidirectional connection
between two interpreters.

</dl>
<p>
Memory channels created by <b class='cmd'>memchan</b> provide two read-only options
which can be queried via the standard <b class='cmd'>fconfigure</b> command. These
are

<dl>
	<dt>-length<dd>

	The value of this option is the number of bytes currently
	stored in the queried memory channel.

	<br><br>
<dt>-allocated<dd>
	The value of this option is the number of bytes currently
	allocated by the queried memory channel. This number is at
	least as big as the value of <em>-length</em>.
	
</dl>
<p>
As the channels generated by <b class='cmd'>memchan</b> grow as necessary they are
always writable. This means that a writable <b class='cmd'>fileevent</b>-handler
will fire continuously.

<p>
The channels are also readable if they contain more than zero bytes
and the seek location is not and the end of the channel. Under these
conditions a readable <b class='cmd'>fileevent</b>-handler will fire continuously.

<p>
Note that writing to such a channel usually occurs at the end, thus
supressing readable events. This also means that users have to take
care to <b class='cmd'>seek</b> the channel to a location before the end before
trying to read data back.

<a name="seealso"><h2>SEE ALSO</h2>
fifo, fifo2, null, zero, random
<a name="keywords"><h2>KEYWORDS</h2>
memchan, chunk, in-memory channel, channel, i/o
<a name="copyright"><h2>COPYRIGHT</h2>
Copyright (c) 1996-2003 Andreas Kupries &lt;andreas_kupries@users.sourceforge.net&gt;<br>
</body></html>