-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
64 lines (46 loc) · 1017 Bytes
/
config.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package goforth
import (
_ "embed"
"log"
"os"
)
// The core words dictionary
//
//go:embed core.fs
var Core string
// Colored output
var Colored bool
// The prompt in StartREPL
var Repl = Magenta("forth> ")
// Show byte code in StartREPL
var ShowByteCode bool
// Show execution time in vm.Run
var ShowExecutionTime bool
// The name of the C compiler
var CCompiler = "cc"
// The optimization flag of the C compiler
var COptimization = "-O2"
// Compile automatically after C code generation
var CAutoCompile = true
// Automatically execute the binary after compiling
var CAutoExecute = true
// The name of the C code file
var CCodeName = "main.c"
// The name of the binary
var CBinaryName = "main"
// The vm in C
//
//go:embed lib/vm.c
var CVM []byte
var cachedConfigPath string
func ConfigPath() string {
if cachedConfigPath != "" {
return cachedConfigPath
}
dir, err := os.UserConfigDir()
if err != nil {
log.Fatal(err)
}
cachedConfigPath = dir + "/goforth/"
return cachedConfigPath
}