summaryrefslogtreecommitdiff
path: root/gwic.go
diff options
context:
space:
mode:
Diffstat (limited to 'gwic.go')
-rw-r--r--gwic.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/gwic.go b/gwic.go
index 2a28f43..a01ac45 100644
--- a/gwic.go
+++ b/gwic.go
@@ -52,12 +52,10 @@ func feedworkers(wlist []*work, w string) []*work {
ret = make([]*work, len(wlist))
copy(ret, wlist)
- //fmt.Fprintf(os.Stderr, "wlist not empty: %v ret: %v\n", wlist, ret)
for _, wc := range wlist {
if wc.left == 0 {
wc.finish()
- //fmt.Fprintf(os.Stderr, "Closed wc: %s\n", wc)
// TODO: remove the right one?
if len(wlist) >= 1 {
ret = wlist[1:]
@@ -65,7 +63,6 @@ func feedworkers(wlist []*work, w string) []*work {
} else {
wc.c <- w
wc.left -= 1
- //fmt.Fprintf(os.Stderr, "diminished wc: %v\n", wc)
}
}
@@ -85,19 +82,15 @@ func printqueue(q *queue, words chan string, left int, out chan string) {
q.insert(fmt.Sprintf("%q", w))
- //fmt.Fprintf(os.Stdout, "%q totally matched %q\n", w, kw)
- //fmt.Fprintf(os.Stdout, "queue was %v\n", q.q)
-
wc := &work{c: make(chan string, 10), left: 5, done: make(chan struct{})}
hungryhippos = feedworkers(hungryhippos, w)
sl := make([]string, MAX)
- //n := copy(sl, q.q[6:])
copy(sl, q.q[6:])
- //fmt.Fprintf(os.Stdout, "copied %d : %v\n", n, sl)
+
hungryhippos = append(hungryhippos, wc)
- //fmt.Fprintf(os.Stderr, "appended hungryhippos: %v %d\n", hungryhippos, len(hungryhippos))
+
go wc.print_kwic(sl, out)
}
for _, wc := range hungryhippos {