Posted to tcl by mjanssen at Sat May 26 17:34:13 GMT 2007view raw

  1. namespace eval bistd {
  2. namespace ensemble create -map {initialize i watch wa read r write wr finalize f}
  3. proc i {chan mode} {
  4. return {initialize finalize watch read write}
  5. }
  6. proc f {chan} {
  7. return {}
  8. }
  9.  
  10. proc wa {args} {puts $args}
  11.  
  12. proc r {chan count} {puts "read $count" ; return [read stdin $count] }
  13.  
  14. proc wr {chan data} {puts write ;puts -nonewline stdout $data}
  15. }
  16.  
  17. set s [chan create {read write} bistd]
  18.  
  19. package require tls
  20. tls::import $s