single to double quote to embrace strings
[brisk.git] / bin / getdep.sh
1 #!/bin/bash
2 IFS='
3 '
4 for f in `find | grep '\.ph[ph]$'`; do
5     echo "-- file: $f ---------------------------------------"
6     st="out"
7     
8     for l in `egrep '^ *class |^} // end class|^ *function +'  $f`; do
9         if [ $st = "out" ]; then
10             echo "$l" | grep -q '^ *class \+' 
11             if [ $? -eq 0 ]; then
12                 st="in"
13                 class="`echo "$l" | sed 's/^ *class \+//g; s/ *{ *//g'`"
14                 continue
15             fi
16         elif [ $st = "in" ]; then
17             echo "$l" | grep -q '^} // end class' 
18             if [ $? -eq 0 ]; then
19                 st="out"
20                 continue
21             fi
22         fi
23
24         fun="`echo "$l" | sed 's/ *function *//g'`"
25         funame="`echo "$fun" | sed 's/ *(.*//g'`"
26         if [ $st = "out" ]; then
27             echo "ss $f - $fun sssssssssssssssssss" 
28         elif [ $st = "in" ]; then
29             echo "xx $f - $class :: $fun xxxxxxxxxxxxxxxxxxxxxx"
30             if [ "$class" = "$funame" ]; then
31                 # constructor case
32                 egrep "new *$class" `find | grep '\.ph[ph]$'`
33             else
34                 egrep -- "$class::$funame\(|->$funame\(" `find | grep '\.ph[ph]$'`
35             fi
36             echo 
37         fi
38     done
39     echo --------------------------------------------------------
40 done
41
42
43 #grep -r '^ *function \+' 
44 #grep -r '^ *class' `find -name '*.ph*'`
45 #grep -ir '} // end class'