ycl

Check-in [6f0d94bf2b]
Login

Check-in [6f0d94bf2b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:refeactor package
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6f0d94bf2b484279b27f1012dc1ff16d5e048fd7
User & Date: pooryorick 2018-02-19 20:06:01.078
Context
2018-02-22
12:23
ycl struct env

further development

all tests pass check-in: b4b73e46b3 user: pooryorick tags: trunk

2018-02-19
20:06
refeactor package check-in: 6f0d94bf2b user: pooryorick tags: trunk
20:02
ypkg env

further development

all tests pass check-in: 9d0119ea7f user: pooryorick tags: trunk

Changes
Unified Diff Ignore Whitespace Patch
Added packages/chan/lib/prototype.test.












>
>
>
>
>
>
1
2
3
4
5
6
#! /bin/env tclsh

package require {ycl chan prototype test}
[yclprefix] test main $argv0 $argv {
	[yclprefix]::chan::prototype::test::suite_main
}
Added packages/chan/lib/prototype.test.tcl.






























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/env tclsh

package require {ycl test}

proc suite_main {} {
	package require {ycl dir}
	namespace import [yclprefix]::dir
	package require {ycl list}
	namespace import [yclprefix]::list::sl
	package require {ycl chan prototype} 
	namespace import [yclprefix]::chan::prototype

	namespace import [yclprefix]::test::cleanup1
	[yclprefix]::test::init

	set setup1 {
		set chan [file tempfile]
	}

	test close_on_delete {} -setup $setup1 -body {
		[prototype .spawn chan1] init chan $chan
		lappend res [expr {$chan in [chan names]}]
		rename chan1 {}
		lappend res [expr {$chan in [chan names]}]
	} -cleanup [cleanup1] -result [sl {
		1 0
	}]


	cleanupTests
}
Changes to packages/chan/lib/tplex.tcl.
1
2
3
4
5
6
7
8
9




10
11
12
13
14
15
16
#! /bin/env tclsh

package require Thread

package require {ycl proc}
namespace import [yclprefix]::proc::checkargs

variable doc::tplex {
	description {




		Returns a list containing a new channel and a thread id.  The  new
		channel has all the attributes of $chan . The new channel is a pipe
		whose other end is in a separate thread which buffers the output of
		$chan , allowing the new channel to act as a synchronous channel , with
		the asynchronous event queue activity confined to the separate thread .

		The buffer uses an additive-increase/multiplicative-decrease strategy









>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /bin/env tclsh

package require Thread

package require {ycl proc}
namespace import [yclprefix]::proc::checkargs

variable doc::tplex {
	description {

		Connect the outputs of one channel to the inputs of zero or more
		channels.
		
		Returns a list containing a new channel and a thread id.  The  new
		channel has all the attributes of $chan . The new channel is a pipe
		whose other end is in a separate thread which buffers the output of
		$chan , allowing the new channel to act as a synchronous channel , with
		the asynchronous event queue activity confined to the separate thread .

		The buffer uses an additive-increase/multiplicative-decrease strategy
Added packages/chan/lib/vso.test.












>
>
>
>
>
>
1
2
3
4
5
6
#! /bin/env tclsh

package require {ycl chan vso test}
[yclprefix] test main $argv0 $argv {
	[yclprefix]::chan::vso::test::suite_main
}
Added packages/chan/lib/vso.test.tcl.
















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#! /bin/env tclsh

package require {ycl test}

proc suite_main {} {
	package require {ycl chan vso}
	namespace import [yclprefix]::chan::vso
	package require {ycl chan}
	namespace import [yclprefix]::chan
	package require {ycl chan test}
	rename chan yclchan
	namespace import [yclprefix]::chan::write
	package require {ycl chan prototype} 
	namespace import [yclprefix]::chan::prototype
	package require {ycl dir}
	namespace import [yclprefix]::dir
	package require {ycl file}
	namespace import [yclprefix]::file::puts
	rename puts fputs
	#package require {ycl iter}
	package require {ycl list}
	namespace import [yclprefix]::list::sl
	package require {ycl ns}
	namespace import [yclprefix]::ns::normalize
	package require {ycl string}
	namespace import [yclprefix]::string::dedent
	package require {ycl test data}
	namespace upvar [yclprefix]::test::data turingtest1 turingtest1
	package require {ycl vso vso}
	package require {ycl chan prototype vso}
	namespace import [yclprefix]::vso::universe
	[yclprefix] chan vso populate universe 
	[yclprefix]::test::init
	namespace import [yclprefix]::test::cleanup1

	namespace upvar [yclprefix]::chan::test setup1 setup1

	universe router configure
	universe router iter
	universe router open 
	universe router close 
	universe router iter 
	universe router read 
	universe router seek 
	universe router write 
	universe enshroud

	test chan_vso {} -setup $setup1 -body {
		new chan chan1
		open chan1 $tmpdir/turing1 w
		write chan1 "123hello1\n"
		write chan1 "hello2\n"
		write chan1 "hello3\n"
		close chan1

		new chan chan1
		open chan1 $tmpdir/turing1
		lappend res [read chan1 3]
		[yclprefix] iter iter for line in [iter chan1] {
			lappend res $line
		}
		seek chan1 0
		[yclprefix] iter iter for line in [iter chan1] {
			lappend res $line
		}
		seek chan1 0
		configure chan1 -eof h 
		[yclprefix] iter iter for line in [iter chan1] {
			lappend res $line
		}

		#check for ability to read after [eof]
		configure chan1 -eof {}
		lappend res [read chan1]

		rename chan1 {}
		#puts [myfile $ chan] 
		#rename myfile {}
		set res
	} -cleanup [cleanup1] -result [sl {
		123 hello1 hello2 hello3
		123hello1 hello2 hello3
		123
		"hello1\nhello2\nhello3\n"
	}]

	cleanupTests
}