Artifact a742671ef71bf325a280c9ec5ed1dc5215f1a007:
- File
packages/chan/lib/prototype.tcl
— part of check-in
[6842ef1911]
at
2015-11-03 13:10:04
on branch trunk
— Rename various packages in list format .
First commit of sql .
Early version of entity-attribute-value model in test/lib/data.tcl . It has a context column , but the idea of using an events and attributes in the "what" colun comes in the next changeset . (user: pooryorick size: 2465)
#! /bin/env tclsh package require ycl::chan::vso package require ycl::iter package require {ycl ns} namespace import [yclprefix]::ns package require {ycl shelf} namespace import [yclprefix]::shelf shelf new [namespace current] package require ycl::chan::methods foreach name [info vars [yclprefix]::chan::methods::*] { [namespace current] method [namespace tail $name] [list ::apply [ [namespace current] asmethod [set $name]] [namespace current]] } variable doc::new { description { a chan object } args { name { description { name of object to adopt/create } process { uplevel list [[namespace current]::shelf eval new [namespace current] $name] } } chan { description { name of a channel adopt } process { $name $ chan $chan } default {} } open { description { whether to open the file } default {lindex true} } } } proc new {name args} { if {![string match ::* $name]} { set name [uplevel [list [namespace current]::ns normalize $name]] } checkargs doc::new if {[namespace which $name] eq {}} { shelf eval new [namespace current] $name } return $name } apply [list {} { proc ~ {*}[[yclprefix]::chan::methods::~ _ {$_ close}] [namespace current] method ~ proc close {*}[[yclprefix]::chan::methods::close _ {::close [$_ $ chan]}] [namespace current] method close proc configure {*}[[yclprefix]::chan::methods::configure _ {::chan configure [$_ $ chan]}] [namespace current] method configure proc eof {*}[[yclprefix]::chan::methods::eof _ {::eof [$_ $ chan]}] [namespace current] method eof namespace upvar [yclprefix]::chan::methods::doc iter doc::iter dict set doc::iter args _ { description { the channel object } } proc iter {*}[[yclprefix]::chan::methods::iter _ {$_ more} {$_ eof}] [namespace current] method iter proc more {*}[[yclprefix]::chan::methods::more _ {::gets [$_ $ chan]}] [namespace current] method more proc open {*}[[yclprefix]::chan::methods::open _ {::open $fname} {$_ $ chan $chan}] [namespace current] method open proc read {*}[[yclprefix]::chan::methods::read _ {::read [$_ $ chan]}] [namespace current] method read proc seek {*}[[yclprefix]::chan::methods::seek _ {::seek [$_ $ chan]}] [namespace current] method seek } [namespace current]] [namespace current] ondeath ~ #this must come last because prototype::vso uses functionality from this namespace package require ycl::chan::prototype::vso