Exemple #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)
}
Exemple #2
0
func quitFn(label string, cmd *Command) {
	if !commandRunning {
		bug.Note("quit")
		os.Exit(0)
	} else {
		toggleRunningColor()
	}
}
Exemple #3
0
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
		}
	}
}
Exemple #4
0
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
		}
	}
}
Exemple #5
0
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)
}
Exemple #6
0
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
}
Exemple #7
0
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
			}
		}
	}
}
Exemple #8
0
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
			}
		}
	}
}