File: src-uses.sh

package info (click to toggle)
xconq 7.2.2-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 8,296 kB
  • ctags: 9,199
  • sloc: ansic: 107,849; sh: 2,108; perl: 2,057; makefile: 1,177; sed: 161; csh: 50; awk: 49; lisp: 39
file content (29 lines) | stat: -rwxr-xr-x 982 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

# This script counts the references to GDL-related symbols in all
# Xconq sources.

# Unlike the GDL keywords, there are no C symbols/functions to confuse
# the shell's wildcard expansion process.

cd $1/..

# 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/^[^,]*, \([a-zA-Z0-9_]*\)[,)].*$/\1/'` ; do
		rslt=`grep -c "${sym}[^A-Za-z_]" */*.[hc] | grep -v ':0$' | sed -e 's/:1$//' | tr '\012' ' '`
		# Symbol name says what kind of thing it is.
		echo ${sym} '	' ${rslt}
	done
done

# Count uses of function-based symbols.

for file in utype.def mtype.def ttype.def table.def gvar.def ; do
	for fun in `grep '^DEF_' kernel/${file} | sed -e 's/^[^,]*, \([a-zA-Z0-9_]*\),.*$/\1/'` ; do
		rslt=`grep -c "${fun}[^A-Za-z_]" */*.[hc] | grep -v ':0$' | sed -e 's/:1$//' | tr '\012' ' '`
		# Symbol name says what kind of thing it is.
		echo ${fun} '	' ${rslt}
	done
done