diff --git a/go/slices.go b/go/slices.go new file mode 100644 index 0000000..d6051e7 --- /dev/null +++ b/go/slices.go @@ -0,0 +1,18 @@ +package main + +import ("fmt") + +func sum(arr []int) int { + total := 0 + + for i := 0; i < len(arr); i++ { + total += arr[i] + } + + return total +} + +func main() { + total := sum([]int{105, 4, 3, 2, 1}) + fmt.Printf("Total = %d\n", total); +} diff --git a/go/wscript b/go/wscript index 16cec35..50b8cce 100644 --- a/go/wscript +++ b/go/wscript @@ -8,15 +8,32 @@ def configure(ctx): ctx.env.GOC = "6g" ctx.env.GOL = "6l" -def go(ctx, source, target): - go_compile = "${GOC} -o ${TGT} ${SRC}" - go_link = "${GOL} -o ${TGT} ${SRC}" +def build(ctx): + sources = ["echo.go", "hello.go", "slices.go"] - object_file = target + ".6" + for file in sources: + # Files with ".go" extensions are automatically compiled and linked + ctx(source=file) - ctx(rule=go_compile, source=source, target=object_file) - ctx(rule=go_link, source=object_file, target=target) + # Remove .bin extension from file + binary = file.replace(".go", "") + ctx(rule="mv ${SRC} ${TGT}", source=(binary + ".bin"), target=binary) -def build(ctx): - go(ctx, "hello.go", "hello") - go(ctx, "echo.go", "echo") +""" +Code to automatically compile and link files with ".go" as their extension. +""" + +from waflib import TaskGen + +TaskGen.declare_chain( + name = "goc", + rule = "${GOC} -o ${TGT} ${SRC}", + ext_in = ".go", + ext_out = ".6") + +TaskGen.declare_chain( + name = "gol", + rule = "${GOL} -o ${TGT} ${SRC}", + ext_in = ".6", + ext_out = ".bin", + reentrant = False) diff --git a/www/audio.html b/www/audio.html new file mode 100644 index 0000000..042e6c1 --- /dev/null +++ b/www/audio.html @@ -0,0 +1,43 @@ + +
+ + + + + + +