Pārlūkot izejas kodu

c++

that compiler is probably installed anyway already.
Lucas Stadler 11 gadi atpakaļ
vecāks
revīzija
05ae4919b3

+ 1 - 0
go/linguaevalia/README.md

@ -31,6 +31,7 @@ to have them installed as well.
31 31
- `c`
32 32
- `bash`
33 33
- `lua`
34
- `c++`
34 35
35 36
Adding more is relatively simple: If there is a command that runs code in
36 37
a language given a file, just add [the appropriate line](./linguaevalia.go#L40-L47)

+ 5 - 0
go/linguaevalia/bin/run-c++

@ -0,0 +1,5 @@
1
#!/bin/sh
2
3
result=/tmp/`basename $1 .cpp`
4
c++ $1 -o $result && $result
5
rm -f $result

+ 3 - 0
go/linguaevalia/linguaevalia.go

@ -54,6 +54,7 @@ var Pixie = LanguageGeneral{"Pixie", "pxi", "pixie-vm", []string{}}
54 54
var C = LanguageGeneral{"C", "c", "./bin/run-c", []string{}}
55 55
var Bash = LanguageGeneral{"Bash", "bash", "bash", []string{}}
56 56
var Lua = LanguageGeneral{"Lua", "lua", "lua", []string{}}
57
var CPlusPlus = LanguageGeneral{"C++", "cpp", "./bin/run-c++", []string{}}
57 58
58 59
var languageMappings = map[string]Language{
59 60
	"go":         Go,
@ -67,6 +68,7 @@ var languageMappings = map[string]Language{
67 68
	"c":          C,
68 69
	"bash":       Bash,
69 70
	"lua":        Lua,
71
	"cpp":        CPlusPlus,
70 72
}
71 73
72 74
func writeCode(code string, extension string) (*os.File, error) {
@ -371,6 +373,7 @@ func main() {
371 373
        case "bash": return "shell";
372 374
        case "pixie": return "clojure";
373 375
        case "c": return "text/x-csrc";
376
        case "cpp": return "text/x-c++src";
374 377
        default: return language;
375 378
        }
376 379
      }