-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtimbuk_wrapper.sh
executable file
·60 lines (45 loc) · 1.07 KB
/
timbuk_wrapper.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
#!/bin/bash
################################# CONSTANTS ##################################
OPERATION=$1
FILE_LHS=`readlink -f $2`
FILE_RHS=`readlink -f $3`
# path to the Timbuk directory
TIMBUK_PATH=/home/ondra/timbuk
# TAML executable
TAML=./taml
################################# FUNCTIONS ##################################
# Function that terminates the script with a message
function die {
echo "$1";
exit -1;
}
################################## PROGRAM ###################################
if [ "$#" -ne 3 ]; then
die "usage: $0 <method> <file1> <file2>"
fi
case "${OPERATION}" in
isect)
command=inter
;;
union)
command=union
;;
*) die "Invalid command ${OPERATION}"
;;
esac
cd ${TIMBUK_PATH}
${TAML} > /dev/null << END
let _time = ref 0.;;
let reset (x : unit) = (
_time := Sys.time ()
);;
let eval (x : unit) = (
Printf.eprintf "%.9f\n" (Sys.time () -. !_time);
flush_all ()
);;
let a1 = List.hd (read_automaton_list "${FILE_LHS}") ;;
let a2 = List.hd (read_automaton_list "${FILE_RHS}") ;;
reset () ;;
${command} a1 a2 ;;
eval () ;;
END