2006-08-20 Aaron Bockover <abockover@novell.com>
[mono.git] / eglib / test / whats-implemented
1 #!/bin/bash
2
3 # Author: Aaron Bockover
4 # Licensed under MIT/X11
5 # (C) 2006 Novell
6
7 if [ "x$1" = "x--help" ]; then
8         echo "Usage: $0 [--show-only-mono]"
9         echo ""
10         echo "This script prints a sorted list of GLib functions used in Mono"
11         echo "that have not yet been implemented in EGlib."
12         echo ""
13         echo "If --show-only-mono is passed, then the script will print all"
14         echo "GLib functions used in Mono, whether or not they have been"
15         echo "implemented in EGlib yet."
16         echo ""
17         echo "This script relies on the MONO_CHECKOUT environment variable."
18         echo "MONO_CHECKOUT should be set to the location of a mono checkout."
19         echo ""
20         exit 1
21 fi
22
23 if [ -z $MONO_CHECKOUT ]; then
24         MONO_CHECKOUT=~/cvs/mono/mono
25 fi
26
27 if [ ! -d $MONO_CHECKOUT ]; then 
28         echo "Cannot find mono checkout; set MONO_CHECKOUT"
29         exit 1
30 fi
31
32 MONO_CHECKOUT="$MONO_CHECKOUT/mono"
33 RESULTS_FILE=.results
34
35 (for i in `find $MONO_CHECKOUT -iregex \.*.c$`; do 
36         grep -oP "[ \t\(\)]+g_[a-z_]+[ ]{0,1}\([A-Za-z_\&\*\,\(\) ]+\)" $i | 
37                 awk 'BEGIN { FS="(" } { print $1 }' |
38                 sed -e 's/[^A-Za-z_]//g' 
39         done
40 ) > $RESULTS_FILE
41
42 if [ ! "x$1" = "x--show-only-mono" ]; then
43         IMPLEMENTED_FUNCTIONS=`grep -oP "g_[a-z_]+[ ]{0,1}" ../src/glib.h | awk 'BEGIN { FS="(" } { print $1 }'`
44
45         rm -f $RESULTS_FILE.tmp
46
47         for mono_function in `cat $RESULTS_FILE`; do
48                 matched="no"
49                 for implemented_function in $IMPLEMENTED_FUNCTIONS; do
50                         if [ "x$mono_function" = "x$implemented_function" ]; then
51                                 matched="yes"
52                                 break
53                         fi
54                 done
55
56                 if [ "x$matched" = "xno" ]; then
57                         echo $mono_function >> $RESULTS_FILE.tmp
58                 fi
59         done
60
61         mv $RESULTS_FILE.tmp $RESULTS_FILE
62 fi
63
64 (for i in `cat $RESULTS_FILE | sort -u`; do 
65                 echo "`grep -c $i $RESULTS_FILE` $i"; 
66         done;
67 ) | sort -nr
68
69 rm $RESULTS_FILE
70