-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·100 lines (76 loc) · 1.95 KB
/
setup.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# script to build the FPL interpreter and manual
# this will create bin/ && manual.pdf in current directory
# # doesn't seem to work, copy paste into terminal
# shopt -s expand_aliases
# alias fpl='rlwrap bin/fplr'
# alias build_fpl='./setup.sh -c && ./setup.sh && clear && rlwrap bin/fplr'
#----------------------------------------
function main()
{
if [ "$1" = "-c" ] ; then
wiper
exit 0
fi
# build_manual
build_interp
tester
# clear
}
#----------------------------------------
# build interpreter
function build_interp()
{
echo; echo "building interpreter"; echo
cd code
make debug
mv bin ..
make clean > /dev/null 2>&1
cd ..
}
#----------------------------------------
# build pdf manual from postscript
function build_manual()
{
echo; echo "building manual"; echo
# code to pdf
a2ps -R -1 code/main.cpp -o main.ps
a2ps -R -1 code/header/* -o hed.ps
a2ps -R -1 code/source/* -o src.ps
ps2pdf main.ps main.pdf
ps2pdf hed.ps hed.pdf
ps2pdf src.ps src.pdf
# documents to pdf (only the numbered ones matter)
a2ps -R -1 docs/[0-9]* -o docs.ps
ps2pdf docs.ps docs.pdf
# join pdfs into manual
pdfunite docs.pdf main.pdf hed.pdf src.pdf manual.pdf
# cleanup extras
rm *.ps docs.pdf main.pdf hed.pdf src.pdf > /dev/null 2>&1
}
#----------------------------------------
function wiper()
{
echo; echo "wiping"; echo
rm -rf bin > /dev/null 2>&1
rm -rf output* > /dev/null 2>&1
rm manual.pdf > /dev/null 2>&1
cd code
make clean > /dev/null 2>&1
cd ..
}
#----------------------------------------
function tester()
{
echo; echo "testing"; echo
for file in $(ls user/tests) ; do
echo $file; echo
if ! bin/fplr "user/tests/$file" ; then # error info for segfaults
dmesg | tail -1
fi
echo
done
}
#----------------------------------------
# call script driver
main "$@"