// NewDirHome creates a new default home based on a particular directory. func NewDirHome(path string, std string) *Home { lang := g8.Lang(false) dirHome := build8.NewDirHome(path, lang) dirHome.AddLang("asm", asm8.Lang()) return NewHome(std, dirHome) }
// MakeMemHome makes a memory home for compiling. // It contains the basic built-in packages. func MakeMemHome(lang build8.Lang) *build8.MemHome { home := build8.NewMemHome(lang) home.AddLang("asm", asm8.Lang()) builtin := home.NewPkg("asm/builtin") builtin.AddFile("", "builtin.s", BuiltInSrc) return home }
func main() { flag.Parse() if *cpuProfile != "" { f, err := os.Create(*cpuProfile) if err != nil { log.Fatal(err) } pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() } checkInitPC() lang := g8.Lang(*golike) home := build8.NewDirHome(*homeDir, lang) home.AddLang("asm", asm8.Lang()) home.AddLang("bare", g8.BareFunc()) b := build8.NewBuilder(home, home) b.Verbose = true b.InitPC = uint32(*initPC) b.RunTests = *runTests b.StaticOnly = *staticOnly var es []*lex8.Error if *pkg == "" { es = b.BuildAll() } else if strings.HasSuffix(*pkg, "...") { prefix := strings.TrimSuffix(*pkg, "...") b.BuildPrefix(prefix) } else { es = b.Build(*pkg) } if es != nil { for _, e := range es { fmt.Println(e) } os.Exit(-1) } }
func main() { flag.Parse() if *cpuProfile != "" { f, err := os.Create(*cpuProfile) if err != nil { log.Fatal(err) } pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() } checkInitPC() var lang build8.Lang if !*golike { lang = g8.Lang() } else { lang = g8.LangGolike() } home := build8.NewDirHome(".", lang) home.AddLang("asm", asm8.Lang()) home.AddLang("bare", g8.BareFunc()) b := build8.NewBuilder(home) b.Verbose = true b.InitPC = uint32(*initPC) b.RunTests = *runTests es := b.BuildAll() if es != nil { for _, e := range es { fmt.Println(e) } os.Exit(-1) } }