Warning, file /sdk/kde-dev-scripts/fix-include.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/bin/sh
0002 # fix-include.sh 
0003 #
0004 # By Laurent Montel <montel@kde.org>  (2007)
0005 # Licenced under the LGPL
0006 
0007 # How to test it ? 
0008 # go into <kde4_install_dir>/include/KDE/
0009 # sh fix-include.sh
0010 
0011 test_include() {
0012   for file in $path/* ;
0013   do
0014         if test -d $file ; then
0015                 echo "Check include into directory : $file";
0016                 path=$file;
0017         else
0018                 # Search file which have  "#include" 
0019                 include=`echo "$file" | xargs grep "#include"`;
0020                 # Get include file
0021                 new=`echo "$include" |perl -pi -e 's!#include !!'`;
0022                 new=`echo "$new" |perl -pi -e 's!\\"!!g'`;
0023                 # Get absolute include
0024                 headerfile=$PWD/$new;
0025                 # Test error
0026                 if test ! -f "$headerfile" ; then
0027                         echo "Header <$file> is not correct it try to load <$new>";
0028                  else
0029                         oldpath=$PWD;
0030                         # remove path from file => we can get class name.
0031                         classname=`echo "$file" | perl -pi -e "s!$oldpath/!!"`;
0032                         classexist=`grep -l $classname $headerfile`;
0033                         if test -z "$classexist" ; then
0034                                 echo "Header <$file> which try to load  <$new> doesn't have $classname into this file. Fix it please";
0035                                 currentpath=`echo "$headerfile" | perl -pi -e "s!$new!!"`;
0036                                 #remove KDE
0037                                 currentpath=`echo "$currentpath" | perl -pi -e "s!KDE!!"`;
0038                                 classexist=`grep -lr $classname $currentpath/*`;
0039                                 if test ! -z "$classexist" ; then
0040                                         echo "This class <$classname> is defined into other header <$classexist>";
0041                                 fi
0042                         fi
0043                 fi
0044         fi
0045   done 
0046 }
0047 
0048 path=$PWD;
0049 test_include
0050