File: lib-uses.sh

package info (click to toggle)
xconq 7.1.0-7
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 7,056 kB
  • ctags: 7,960
  • sloc: ansic: 88,493; perl: 2,057; sh: 1,766; makefile: 1,110; csh: 81; awk: 47; lisp: 39
file content (36 lines) | stat: -rwxr-xr-x 1,032 bytes parent folder | download
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
#!/bin/sh

# This script counts the references to GDL symbols in all Xconq library games.

cd $1/..

/bin/rm -rf /tmp/xc7

mkdir -p /tmp/xc7/lib
mkdir -p /tmp/xc7/test

for libfile in lib/*.g test/*.g ; do
	sed -e 's/"[^"]*"/ /g' $libfile | sed -e 's/;.*$//g' | tr '() ' '\012' >/tmp/xc7/$libfile
done

/bin/rm -f /tmp/raw-uses

# Count uses of keywords.

for file in keyword.def action.def history.def plan.def task.def goal.def ; do
	for sym in `grep DEF_ kernel/${file} | sed -e 's/^[^"]*"\([^, ]*\)".*$/\1/' | grep -v '^zz-'` ; do
		rslt=`fgrep -c -x ${sym} /tmp/xc7/*/*.g | grep -v ':0$' | sed -e 's/:1$//' | sed -e 's,/tmp/xc7/[a-z]*/,,' | tr '\012' ' '`
		echo ${sym} '	' ${rslt}
	done
done

for file in utype.def mtype.def ttype.def table.def gvar.def ; do
	for sym in `grep DEF_ kernel/${file} | sed -e 's/^[^"]*"\([^, ]*\)".*$/\1/' | grep -v '^zz-'` ; do
		rslt=`fgrep -c -x ${sym} /tmp/xc7/*/*.g | grep -v ':0$' | sed -e 's/:1$//' | sed -e 's,/tmp/xc7/[a-z]*/,,' | tr '\012' ' '`
		echo ${sym} '	' ${rslt}
	done
done