示例#1
0
文件: home.go 项目: Xslxy/e8vm
// 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)
}
示例#2
0
文件: main.go 项目: 272489711/e8vm
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)
	}
}
示例#3
0
文件: main.go 项目: NickDaison/e8vm
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)
	}
}