Version 3 of word.tcl

Updated 2016-02-15 18:08:33 by dbohdan

word.tcl is an implementation of word channels found in ycl.

Download

You can download word.tcl for use outside of ycl (under the namespace ::wordchan rather than yclprefix::chan::word) with the following POSIX shell command:

(echo "namespace eval ::wordchan {\nnamespace export *\nnamespace ensemble create\n"; curl -s 'https://chiselapp.com/user/pooryorick/repository/ycl/raw/packages/chan/lib/word.tcl?name=024541bdf04b7a9e637add29ac2cd75df2543e74 '; echo "\n}") > wordchan.tcl

Use example

#!/usr/bin/env tclsh
source wordchan.tcl

proc main {} {
    set ch [chan create {read write} ::wordchan]
    chan configure $ch -buffering none
    chan event $ch readable [list puts --$ch]
    puts -nonewline $ch HELLO
    puts -nonewline $ch WORLD
    puts [read $ch] ;# Prints "HELLO".
    puts [read $ch] ;# Prints "WORLD".
}

main