Tcl Library Source Code

Changes On Branch bug-3608240
Login

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

Changes In Branch bug-3608240 Excluding Merge-Ins

This is equivalent to a diff from 685ad6ce10 to f42362cde9

2013-03-19
05:47
Merged fix for bug 3608240. Updated documentation. check-in: 97d8e58276 user: aku tags: trunk
05:42
[Bug 3608240]: Fixed get/peek not taking the amount of already delivered elements into account. Extended testsuite. Bumped version to 1.4.5 Closed-Leaf check-in: f42362cde9 user: aku tags: bug-3608240
04:39
Test case for bug, bug confirmed. check-in: da76ec6c84 user: aku tags: bug-3608240
2013-03-13
03:41
Regenerated the embedded documentation. check-in: 685ad6ce10 user: aku tags: trunk
00:18
Fixed package index, forgot to update for string::token::shell check-in: 98bda0ec26 user: andreask tags: trunk

Changes to modules/struct/ChangeLog.








1
2
3
4
5
6
7







2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2013-01-21  Andreas Kupries  <[email protected]>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
2013-03-18  Andreas Kupries  <[email protected]>

	* queue.testsuite: [Bug 3608240]: Fixed get/peek not taking
	* queue_oo.tcl: the amount of already delivered elements
	* queue_tcl.tcl: into account. Extended testsuite. Bumped version
	  to 1.4.5

2013-02-01  Andreas Kupries  <[email protected]>

	*
	* Released and tagged Tcllib 1.15 ========================
	* 

2013-01-21  Andreas Kupries  <[email protected]>

Changes to modules/struct/queue.tcl.

180
181
182
183
184
185
186
187
## Ready

namespace eval ::struct {
    # Export the constructor command.
    namespace export queue
}

package provide struct::queue 1.4.4







|
180
181
182
183
184
185
186
187
## Ready

namespace eval ::struct {
    # Export the constructor command.
    namespace export queue
}

package provide struct::queue 1.4.5

Changes to modules/struct/queue.testsuite.

334
335
336
337
338
339
340






























341
342
    myqueue put a b c d e f
    myqueue get 3
    myqueue unget foo
    set res [myqueue peek [myqueue size]]
    myqueue destroy
    set res
} {foo d e f}































#----------------------------------------------------------------------







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
    myqueue put a b c d e f
    myqueue get 3
    myqueue unget foo
    set res [myqueue peek [myqueue size]]
    myqueue destroy
    set res
} {foo d e f}

#----------------------------------------------------------------------

test queue-${impl}-sf-3608240-a {} {
    struct::queue qp
    qp put 1 2 3
    set r {}
    lappend r [qp peek [qp size]]
    lappend r [qp get]
    lappend r [qp peek [qp size]]
    qp put 4 5
    lappend r [qp peek [qp size]]
    qp destroy
    set r
} {{1 2 3} 1 {2 3} {2 3 4 5}}
catch { unset r }

test queue-${impl}-sf-3608240-b {} {
    struct::queue qp
    qp put 1 2 3
    set r {}
    lappend r [qp peek [qp size]]
    lappend r [qp get]
    lappend r [qp peek [qp size]]
    qp put 4 5
    lappend r [qp get [qp size]]
    qp destroy
    set r
} {{1 2 3} 1 {2 3} {2 3 4 5}}
catch { unset r }

#----------------------------------------------------------------------

Changes to modules/struct/queue_oo.tcl.

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	    my Shift?
	    return $item
	}

	# Otherwise, return a list of items

	if {$count > ([llength $qret] - $qat)} {
	    # Need all of qret and parts of qadd, maybe all.
	    set max    [expr {$qat + $count - 1 - [llength $qret]}]
	    set result [concat $qret [lrange $qadd 0 $max]]
	    my Shift
	    set qat $max
	} else {
	    # Request can be satisified from qret alone.
	    set max    [expr {$qat + $count - 1}]
	    set result [lrange $qret $qat $max]
	    set qat $max







|

|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	    my Shift?
	    return $item
	}

	# Otherwise, return a list of items

	if {$count > ([llength $qret] - $qat)} {
	    # Need all of qret (from qat on) and parts of qadd, maybe all.
	    set max    [expr {$qat + $count - 1 - [llength $qret]}]
	    set result [concat [lrange $qret $qat end] [lrange $qadd 0 $max]]
	    my Shift
	    set qat $max
	} else {
	    # Request can be satisified from qret alone.
	    set max    [expr {$qat + $count - 1}]
	    set result [lrange $qret $qat $max]
	    set qat $max
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
	    # listified
	    return [lindex $qret $qat]
	}

	# Otherwise, return a list of items

	if {$count > [llength $qret] - $qat} {
	    # Need all of qret and parts of qadd, maybe all.
	    set over [expr {$qat + $count - 1 - [llength $qret]}]
	    return [concat $qret [lrange $qadd 0 $over]]
	} else {
	    # Request can be satisified from qret alone.
	    return [lrange $qret $qat [expr {$qat + $count - 1}]]
	}
    }

    # put --







|

|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
	    # listified
	    return [lindex $qret $qat]
	}

	# Otherwise, return a list of items

	if {$count > [llength $qret] - $qat} {
	    # Need all of qret (from qat on) and parts of qadd, maybe all.
	    set over [expr {$qat + $count - 1 - [llength $qret]}]
	    return [concat [lrange $qret $qat end] [lrange $qadd 0 $over]]
	} else {
	    # Request can be satisified from qret alone.
	    return [lrange $qret $qat [expr {$qat + $count - 1}]]
	}
    }

    # put --

Changes to modules/struct/queue_tcl.tcl.

217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
	Shift? $name
	return $item
    }

    # Otherwise, return a list of items

    if {$count > ([llength $RET] - $AT)} {
	# Need all of RET and parts of ADD, maybe all.
	set max    [expr {$count - ([llength $RET] - $AT) - 1}]
	set result [concat $RET [lrange $ADD 0 $max]]
	Shift $name
	set AT $max
    } else {
	# Request can be satisified from RET alone.
	set max    [expr {$AT + $count - 1}]
	set result [lrange $RET $AT $max]
	set AT $max







|

|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
	Shift? $name
	return $item
    }

    # Otherwise, return a list of items

    if {$count > ([llength $RET] - $AT)} {
	# Need all of RET (from AT on) and parts of ADD, maybe all.
	set max    [expr {$count - ([llength $RET] - $AT) - 1}]
	set result [concat [lrange $RET $AT end] [lrange $ADD 0 $max]]
	Shift $name
	set AT $max
    } else {
	# Request can be satisified from RET alone.
	set max    [expr {$AT + $count - 1}]
	set result [lrange $RET $AT $max]
	set AT $max
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	# listified
	return [lindex $RET $AT]
    }

    # Otherwise, return a list of items

    if {$count > [llength $RET] - $AT} {
	# Need all of RET and parts of ADD, maybe all.
	set over [expr {$count - ([llength $RET] - $AT) - 1}]
	return [concat $RET [lrange $ADD 0 $over]]
    } else {
	# Request can be satisified from RET alone.
	return [lrange $RET $AT [expr {$AT + $count - 1}]]
    }
}

# ::struct::queue::I::put --







|

|







269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	# listified
	return [lindex $RET $AT]
    }

    # Otherwise, return a list of items

    if {$count > [llength $RET] - $AT} {
	# Need all of RET (from AT on) and parts of ADD, maybe all.
	set over [expr {$count - ([llength $RET] - $AT) - 1}]
	return [concat [lrange $RET $AT end] [lrange $ADD 0 $over]]
    } else {
	# Request can be satisified from RET alone.
	return [lrange $RET $AT [expr {$AT + $count - 1}]]
    }
}

# ::struct::queue::I::put --