Permalink
Browse files

Moving giant imports list from the library to the frontend (opening t…

…he possiblity for goinstall to work)
  • Loading branch information...
1 parent 32638cc commit 2b9882bcca39b7b0c9f84751c5edcf41e76b2b7b @bytbox committed Dec 13, 2011
Showing with 29 additions and 16 deletions.
  1. +1 −1 .gitignore
  2. +13 −2 Makefile
  3. +6 −0 kakapo.go
  4. +1 −12 lisp/Makefile
  5. +7 −0 lisp/compat.go
  6. +1 −1 {lisp → }/scanpkgs/main.go
View
@@ -5,7 +5,7 @@
_obj
kakapo
packages.go
-lisp/scanpkgs/scanpkgs
+scanpkgs/scanpkgs
*.a
repl.go
*.out
View
@@ -1,7 +1,7 @@
include ${GOROOT}/src/Make.inc
TARG = kakapo
-GOFILES = kakapo.go repl.go
+GOFILES = kakapo.go repl.go packages.go
PREREQ = lisp
CLEANFILES = _go_.${O} ${TARG} lisp.a repl.go
TXT2GO = ./txt2go.sh
@@ -15,16 +15,27 @@ _go_.${O}: ${GOFILES} ${PREREQ}
repl.go: repl.lsp
${TXT2GO} repl < repl.lsp > $@
+packages.go: scanpkgs/scanpkgs
+ scanpkgs/scanpkgs > packages.go
+ gofmt -w packages.go
+
lisp:
make -Clisp
cp lisp/_obj/lisp.a .
+scanpkgs/scanpkgs: scanpkgs/scanpkgs.${O}
+ ${LD} -o $@ scanpkgs/scanpkgs.${O}
+
+scanpkgs/scanpkgs.${O}: scanpkgs/main.go
+ ${GC} -o $@ scanpkgs/main.go
+
clean:
rm -f ${CLEANFILES}
+ rm -f scanpkgs/scanpkgs.${O} scanpkgs/scanpkgs
make -Clisp clean
fmt:
- gofmt -w ${GOFILES}
+ gofmt -w kakapo.go
make -Clisp fmt
test: ${TARG}
View
@@ -23,6 +23,12 @@ func main() {
return
}
+ // Expose impots
+ for name, pkg := range _go_imports {
+ ExposeImport(name, pkg)
+ }
+
+ // Expose globals
ExposeGlobal("-interpreter", "Kakapo")
ExposeGlobal("-interpreter-version", VERSION)
View
@@ -3,21 +3,10 @@ include ${GOROOT}/src/Make.inc
TARG = lisp
BUILTINGO = cons.go math.go panic.go bool.go
SRCFILES = parse.go eval.go util.go builtins.go syntax.go compat.go primitives.go scope.go interpret.go ${BUILTINGO}
-GOFILES = ${SRCFILES} packages.go
-CLEANFILES = packages.go
+GOFILES = ${SRCFILES}
include ${GOROOT}/src/Make.pkg
-packages.go: scanpkgs/scanpkgs
- scanpkgs/scanpkgs > packages.go
- gofmt -w packages.go
-
-scanpkgs/scanpkgs: scanpkgs/scanpkgs.${O}
- ${LD} -o $@ scanpkgs/scanpkgs.${O}
-
-scanpkgs/scanpkgs.${O}: scanpkgs/main.go
- ${GC} -o $@ scanpkgs/main.go
-
fmt:
gofmt -w ${SRCFILES}
View
@@ -5,6 +5,13 @@ import (
"reflect"
)
+// The map of available imports
+var _go_imports = map[string]map[string]interface{}{}
+
+func ExposeImport(name string, pkg map[string]interface{}) {
+ _go_imports[name] = pkg
+}
+
func builtinImport(sc *scope, ss []sexpr) sexpr {
if len(ss) != 1 {
panic("Invalid number of arguments")
@@ -33,7 +33,7 @@ type item struct {
}
func main() {
- fmt.Println("package lisp")
+ fmt.Println("package main")
// find AR(1)
findAr()

0 comments on commit 2b9882b

Please sign in to comment.