-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (34 loc) · 876 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
"time"
)
var events chan interface{} = make(chan interface{}, 20)
var debug = true
func joinMessage(category string, format string, v ...any) {
message := fmt.Sprintf(format, v...)
events <- debugMsg{message: fmt.Sprintf("%s %s %s", category, time.Now().Format("15:04:05 2006-01-02"), message)}
}
func Info(format string, v ...any) {
joinMessage("INFO", format, v...)
}
func Error(format string, v ...any) {
joinMessage("ERROR", format, v...)
}
func Debug(format string, v ...any) {
if debug {
joinMessage("DEBUG", format, v...)
}
}
var numRegisters = 32
var registers map[string]int8
func main() {
registers = make(map[string]int8)
for i := 0; i < numRegisters; i++ {
nick := fmt.Sprintf("R%d", i)
registers[nick] = 0
}
pipeline := NewPipeline("instrucoes.txt")
pipeline.Start()
RunCmd(pipeline, registers, events)
}