-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.sh
27 lines (19 loc) · 918 Bytes
/
compile.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
#!/bin/bash
if [ $# != 2 ];
then
printf "Please provide 2 arguments. Sample:\n\tbash compile.sh sample_rules.txt 16.0.\nShould you need more information, please refer to the README file.\n\n"
exit 100
fi
simplec=$1
printf "Producing event description, declarations and dependency graph source... "
swipl -l simplEC.prolog -g "simplEC('$1', $2, false)" -g "halt"
printf "Done.\nExporting dependency graph image... "
dot -o dependency_graph.png -T png dependency_graph.txt
printf "Done.\nProducing compiled event description... "
swipl -l RTEC/RTEC-swi.prolog -g "trace" -g "compileEventDescription('declarations.prolog', 'event_description.prolog', 'tmp.pl')" -g "halt"
printf ":- ['RTEC/RTEC-swi.prolog'].\n:- ['declarations.prolog'].\n\n" > event_description_compiled.prolog
cat tmp.pl >> event_description_compiled.prolog
printf "Done.\nCleaning up temporary files... "
rm -f tmp.pl
printf "Ready."
exit 0