Beispiel #1
0
func (b *Branch) Insert(key int, val int) {
	bug.Where()
	node := b.node[b.index(key)]
	if node.IsFull() {
		bug.Note("Node is full")
	}
	node.Insert(key, val)
}
Beispiel #2
0
Datei: main.go Projekt: taysom/va
func quitFn(label string, cmd *Command) {
	if !commandRunning {
		bug.Note("quit")
		os.Exit(0)
	} else {
		toggleRunningColor()
	}
}
Beispiel #3
0
Datei: main.go Projekt: taysom/va
func git(label string, cmd *Command) {
	if gitRunning {
		bug.Note("Git running")
		toggleRunningColor()
		return
	}
	gitRunning = true
	defer clear(&gitRunning)

	cmd.state = running
	defer setIdle(cmd)
	for _, arg := range cmd.args {
		err := run("git " + arg)
		if err != nil {
			return
		}
	}
}
Beispiel #4
0
Datei: main.go Projekt: taysom/va
func runList(label string, cmd *Command) {
	bug.Where()
	if commandRunning {
		bug.Note("Command is running")
		toggleRunningColor()
		return
	}
	commandRunning = true
	defer clear(&commandRunning)

	cmd.state = running
	defer setIdle(cmd)
	for _, arg := range cmd.args {
		err := run(arg)
		if err != nil {
			return
		}
	}
}
Beispiel #5
0
Datei: main.go Projekt: taysom/va
func main() {
	flag.Parse()
	if bug.Debug {
		command["debug"].state = active
	} else {
		command["debug"].state = idle
	}
	bug.Note("Debugging is on")
	bug.Pr("dirPrefix", dirPrefix)
	fmt.Println("IP and Port:", ip+port)

	cmd := command[current.wd]
	cmd.fn(current.wd, cmd)
	fmt.Printf("%d: ", commandInstance)
	commandInstance++

	http.HandleFunc("/", commandHandler)
	http.HandleFunc("/favicon.ico", favicon)
	http.ListenAndServe(":62832", nil)
}
Beispiel #6
0
Datei: main.go Projekt: taysom/va
func run(cmdLine string) error {
	bug.Note("run(\"" + cmdLine + "\")")
	args := strings.Split(cmdLine, " ")
	cmdArgs := exec.Command(args[0], args[1:]...)
	cmdArgs.Stdin = os.Stdin
	cmdArgs.Stdout = os.Stdout
	cmdArgs.Stderr = os.Stderr
	t := time.Now()
	err := cmdArgs.Run()
	if err != nil {
		fmt.Println("????????????????????????????????????????????????")
		fmt.Println("?", cmdArgs.Path, cmdArgs.Args)
		fmt.Println("? Error:", err)
		fmt.Println("????????????????????????????????????????????????")
	} else {
		fmt.Println("@", cmdLine, "#", time.Since(t).String())
	}
	fmt.Printf("%d: ", commandInstance)
	commandInstance++
	return err
}
Beispiel #7
0
Datei: main.go Projekt: taysom/va
func test(label string, cmd *Command) {
	if testRunning {
		bug.Note("Test running")
		toggleRunningColor()
		return
	}
	testRunning = true
	defer clear(&testRunning)

	cmd.state = running
	defer setIdle(cmd)
	err := run("make test-clean")
	if err == nil {
		for _, arg := range cmd.args {
			err := run("make -j4 " + arg) // Spaces are significant
			if err != nil {
				break
			}
		}
	}
}
Beispiel #8
0
Datei: main.go Projekt: taysom/va
func goCmd(label string, cmd *Command) {
	bug.Where()
	if goRunning {
		bug.Note("go is running")
		toggleRunningColor()
		return
	}
	goRunning = true
	defer clear(&goRunning)

	cmd.state = running
	defer setIdle(cmd)
	for _, arg := range cmd.args {
		if goDebug {
			if run("go "+arg+" -debug") != nil {
				return
			}
		} else {
			if run("go "+arg) != nil {
				return
			}
		}
	}
}