Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into release
Browse files Browse the repository at this point in the history
* origin/master:
  Added toplevel Makefile for goinstall
  added LICENSE files
  fixed LICENSE
  • Loading branch information
zot committed Nov 10, 2010
2 parents 9b335bf + 51b7a15 commit df41243
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 36 deletions.
9 changes: 9 additions & 0 deletions LICENSE
@@ -0,0 +1,9 @@
Copyright (c) 2010, TEAM CTHULHU
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the TEAM CTHULHU nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 5 additions & 0 deletions Makefile
@@ -0,0 +1,5 @@
all:
cd seq && gomake

install:
cd seq && gomake install
27 changes: 7 additions & 20 deletions calc/LICENSE
@@ -1,22 +1,9 @@
version 1.2.2, October 3rd, 2004
Copyright (c) 2010, TEAM CTHULHU
All rights reserved.

Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly jloup@gzip.org
Mark Adler madler@alumni.caltech.edu
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the TEAM CTHULHU nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 changes: 13 additions & 3 deletions calc/calcgo
Expand Up @@ -26,15 +26,25 @@ while (line=`{read}) {
cat <<here > $script
package main
import . "fmt"
here
if (grep '//BODY' $file > /dev/null) {
awk '/\/\/BODY/{exit}skipped{print}!skipped{skipped=1}' < $file >> $script
}
cat <<here >> $script
func main() {
here
while (! ~ $#* 0) {
echo (' '$1^' := float64('$2')') >> $script
shift 2
}
<$file{
read>/dev/null
cat >> $script
if (grep '//BODY' $file > /dev/null) {
awk 'yes{print}/\/\/BODY/{yes=1}' < $file >> $script
}
if not {
<$file{
read>/dev/null
cat >> $script
}
}
cat<<here >> $script
func() {
Expand Down
9 changes: 9 additions & 0 deletions seq/LICENSE
@@ -0,0 +1,9 @@
Copyright (c) 2010, TEAM CTHULHU
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the TEAM CTHULHU nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 changes: 13 additions & 13 deletions seq/seq.go
Expand Up @@ -103,7 +103,7 @@ func IsEmpty(s Seq) bool {
return empty
}

//returns the first item in a sequence for which f returns true
//returns the first item in a sequence for which f returns true or nil if none is found
func Find(s Seq, f func(el El) bool) El {return s.Find(f)}

//applies f to each item in the sequence until f returns false
Expand All @@ -117,9 +117,9 @@ func Do(s Seq, f func(el El)) {
})
}

//applies f concurrently to each element of s, in no particular order
func CDo(s Seq, f func(el El)) {
c := CMap(s, func(el El)El{f(el); return nil})()
//applies f concurrently to each element of s, in no particular order; sizePowerOpt will default to {6} and CMap will allow up to 1 << sizePowerOpt[0] outstanding concurrent instances of f at any time
func CDo(s Seq, f func(el El), sizePowerOpt... uint) {
c := CMap(s, func(el El)El{f(el); return nil}, sizePowerOpt...)()
for <- c; !closed(c); <- c {}
}

Expand Down Expand Up @@ -177,10 +177,10 @@ func SFilter(s Seq, filter func(e El)bool) *SequentialSeq {
return (*SequentialSeq)(&vec)
}

//returns a new ConcurrentSeq consisting of the elements of s for which filter returns true
func CFilter(s Seq, filter func(e El)bool) ConcurrentSeq {
//returns a new ConcurrentSeq consisting of the elements of s for which filter returns true; sizePowerOpt will default to {6} and CMap will allow up to 1 << sizePowerOpt[0] outstanding concurrent instances of f at any time
func CFilter(s Seq, filter func(e El)bool, sizePowerOpt... uint) ConcurrentSeq {
return Gen(func(c SeqChan){
Do(s, ifFunc(filter, func(el El){c <- el}))
Do(s, ifFunc(filter, func(el El){c <- el}), sizePowerOpt...)
})
}

Expand Down Expand Up @@ -253,7 +253,7 @@ func (r *SlidingWindow) Set(index int, value interface{}) bool {
return true
}

//returns a new ConcurrentSeq consisting of the results of appying f to the elements of s
//returns a new ConcurrentSeq consisting of the results of appying f to the elements of s; sizePowerOpt will default to {6} and CMap will allow up to 1 << sizePowerOpt[0] outstanding concurrent instances of f at any time
func CMap(s Seq, f func(el El) El, sizePowerOpt... uint) ConcurrentSeq {
// spawn a goroutine that does the following for each value, with up to size pending at a time:
// spawn a goroutine to apply f to the value and send the result back in a channel
Expand Down Expand Up @@ -309,10 +309,10 @@ func SFlatMap(s Seq, f func(i El) Seq) *SequentialSeq {
return (*SequentialSeq)(&vec)
}

//returns a new ConcurrentSeq consisting of the concatenation of the sequences f returns when applied to all of the elements of s
func CFlatMap(s Seq, f func(i El) Seq, sizeOpt... uint) ConcurrentSeq {
//returns a new ConcurrentSeq consisting of the concatenation of the sequences f returns when applied to all of the elements of s; sizePowerOpt will default to {6} and CMap will allow up to 1 << sizePowerOpt[0] outstanding concurrent instances of f at any time
func CFlatMap(s Seq, f func(i El) Seq, sizePowerOpt... uint) ConcurrentSeq {
return Gen(func(c SeqChan){
Do(CMap(s, func(e El)El{return f(e)}, sizeOpt...), func(sub El){
Do(CMap(s, func(e El)El{return f(e)}, sizePowerOpt...), func(sub El){
Output(sub.(Seq), c)
})
})
Expand Down Expand Up @@ -432,7 +432,7 @@ func CUpto(limit int) ConcurrentSeq {
})
}

//returns the first item in a sequence for which f returns true
//returns the first item in a sequence for which f returns true or nil if none is found
func (s ConcurrentSeq) Find(f func(el El)bool) El {
c := s()
defer close(c)
Expand Down Expand Up @@ -500,7 +500,7 @@ func AUpto(limit int) *SequentialSeq {
return (*SequentialSeq)(&a)
}

//returns the first item in a sequence for which f returns true
//returns the first item in a sequence for which f returns true or nil if none is found
func (s *SequentialSeq) Find(f func(el El)bool) El {
for i := 0; i < len(*s); i++ {
if f((*s)[i]) {return (*s)[i]}
Expand Down

0 comments on commit df41243

Please sign in to comment.