[runtime] Move eglib into mono/eglib so it becomes a convenience library similar...
[mono.git] / mono / 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 IGNORE_FUNCTIONS="g_hash_table_lookup_node g_hash_table_foreach_remove_or_steal  g_hash_table_resize"
24
25 if [ -z $MONO_CHECKOUT ]; then
26         if [ -e ../../mono.pc.in ]; then
27                 MONO_CHECKOUT=../..
28         else
29                 MONO_CHECKOUT=~/cvs/mono/mono
30         fi
31 fi
32
33 if [ ! -d $MONO_CHECKOUT ]; then 
34         echo "Cannot find mono checkout; set MONO_CHECKOUT"
35         exit 1
36 fi
37
38 MONO_CHECKOUT="$MONO_CHECKOUT/mono"
39 RESULTS_FILE=.results
40
41 (for i in `find $MONO_CHECKOUT -iregex \.*.c$`; do 
42         grep -oP "[ \t\(\)]+g_[a-z_]+[ ]{0,1}\([A-Za-z_\&\*\,\(\) ]+\)" $i | 
43                 awk 'BEGIN { FS="(" } { print $1 }' |
44                 sed -e 's/[^A-Za-z_]//g' 
45         done
46 ) > $RESULTS_FILE
47
48 if [ ! "x$1" = "x--show-only-mono" ]; then
49         IMPLEMENTED_FUNCTIONS=`grep -oP "g_[a-z_]+[ ]{0,1}" ../src/glib.h | awk 'BEGIN { FS="(" } { print $1 }'`
50
51         rm -f $RESULTS_FILE.tmp
52
53         for mono_function in `cat $RESULTS_FILE`; do
54                 matched="no"
55                 for implemented_function in $IMPLEMENTED_FUNCTIONS; do
56                         if [ "x$mono_function" = "x$implemented_function" ]; then
57                                 matched="yes"
58                                 break
59                         fi
60                 done
61
62                 for ignore_function in $IGNORE_FUNCTIONS; do
63                         if [ "x$ignore_function" = "x$mono_function" ]; then
64                                 matched="yes"
65                                 break
66                         fi
67                 done
68
69                 if [ "x$matched" = "xno" ]; then
70                         echo $mono_function >> $RESULTS_FILE.tmp
71                 fi
72         done
73
74         mv $RESULTS_FILE.tmp $RESULTS_FILE
75 fi
76
77 (for i in `cat $RESULTS_FILE | sort -u`; do 
78                 echo "`grep -c $i $RESULTS_FILE` $i"; 
79         done;
80 ) | sort -nr
81
82 rm $RESULTS_FILE
83