forked from booniepepper/mirth-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval
executable file
·52 lines (43 loc) · 833 Bytes
/
eval
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
#!/bin/sh
set -eu
mkdir -p temp
echo "\
module(temp.eval)
import(std.buffer)
import(std.byte)
import(std.either)
import(std.lazy)
import(std.list)
import(std.map)
import(std.maybe)
import(std.path)
import(std.prelude)
import(std.set)
import(std.stack)
import(std.str)
import(posix.file)
import(posix.posix)
def(main, +World -- +World,
$*
??
0 prim-posix-exit)
" >temp/eval.mth
compile() {
mirth temp/eval.mth \
-p temp:temp \
-p mirth:/opt/mirth/src/mirth \
-p posix:/opt/mirth/src/posix \
-p std:/opt/mirth/src/std \
-o temp/eval.c
mkdir -p bin
cc temp/eval.c \
-o bin/temp
}
# stderr redirection and exits are temporary until discord bots handle them properly.
if ! compile >>compile.log 2>>compile.log
then
echo '=== ERRORS ==='
cat compile.log
exit 0
fi
2>&1 bin/temp || exit 0