-
Notifications
You must be signed in to change notification settings - Fork 15
/
xbgfi
executable file
·41 lines (39 loc) · 1.2 KB
/
xbgfi
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
#!/bin/sh
# wiki: XBGFinfo
# Get our hands on basedir
LOCAL1=${PWD}
cd `dirname $0`
cd ../..
SLPS=${PWD}
cd ${LOCAL1}
if [ $# -ne 1 ]; then
echo "This tool runs some metrics on a XBGF document"
echo "Usage: xbgfi <BGF-input>"
exit 1
elif [ ! -r $1 ]; then
echo "Oops: $1 not found or not readable."
exit 1
else
/bin/echo -n "Number of lines: "
wc -l $1 | awk '{print $1}'
/bin/echo -n "Number of transformations: "
if [ `uname` == "Linux" ] ; then
xpath -e `cat ${SLPS}/topics/presentation/metrics/transformations.xpath` $1 2> /dev/null
else
xpath $1 `cat ${SLPS}/topics/presentation/metrics/transformations.xpath` 2> /dev/null
fi
/bin/echo -n "Number of unsafe optimizations: "
grep -c BREFACTOR $1
/bin/echo -n "Number of issues (1): "
grep -c ISSUE $1
/bin/echo -n "Number of issues (2): "
expr `grep -c EXTRACTERROR $1` + `grep -c CORRECT $1` + `grep -c EXTEND $1` + `grep -c PERMISSIVENESS $1`
/bin/echo -n " post-extraction: "
grep -c EXTRACTERROR $1
/bin/echo -n " correction: "
grep -c CORRECT $1
/bin/echo -n " extending: "
grep -c EXTEND $1
/bin/echo -n " permissiveness: "
grep -c PERMISSIVENESS $1
fi