summaryrefslogtreecommitdiff
path: root/scripts/fixincludes
authorllornkcor <llornkcor>2003-07-17 13:56:40 (UTC)
committer llornkcor <llornkcor>2003-07-17 13:56:40 (UTC)
commit53237dd02577d118e1ad19a18819f86f1a4ea207 (patch) (unidiff)
tree3cefb1a56862646a3f7bc3587b707599925012c9 /scripts/fixincludes
parentc72b7e02defdbcc1f2b6b4ff38f256486cfaeec7 (diff)
downloadopie-53237dd02577d118e1ad19a18819f86f1a4ea207.zip
opie-53237dd02577d118e1ad19a18819f86f1a4ea207.tar.gz
opie-53237dd02577d118e1ad19a18819f86f1a4ea207.tar.bz2
dont need to change compat qt3 header. add cvscheck from kdesdk
Diffstat (limited to 'scripts/fixincludes') (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/fixincludes61
1 files changed, 3 insertions, 58 deletions
diff --git a/scripts/fixincludes b/scripts/fixincludes
index da8613c..f07965e 100755
--- a/scripts/fixincludes
+++ b/scripts/fixincludes
@@ -1,160 +1,105 @@
1#!/usr/bin/perl -w 1#!/usr/bin/perl -w
2# tries to reduce the number of includes in KDE source files 2# tries to reduce the number of includes in KDE source files
3# (c) 2001 Dirk Mueller <mueller@kde.org> 3# (c) 2001 Dirk Mueller <mueller@kde.org>
4 4
5use File::Basename; 5use File::Basename;
6use Cwd; 6use Cwd;
7 7
8# declaration of useful subroutines 8# declaration of useful subroutines
9sub find_fixable_sources ($); 9sub find_fixable_sources ($);
10sub find_fixable_headers($); 10sub find_fixable_headers($);
11sub find_removable_includes ($); 11sub find_removable_includes ($);
12sub warn_before_modifying ($); 12sub warn_before_modifying ($);
13sub remove_include ($$$); 13sub remove_include ($$$);
14sub replace_include ($$$); 14sub replace_include ($$$);
15sub fix_duplicates($); 15sub fix_duplicates($);
16sub fix_compat_includes($); 16sub fix_compat_includes($);
17sub fix_unnecessary($); 17sub fix_unnecessary($);
18sub copy_file($$); 18sub copy_file($$);
19sub process_source_file($); 19sub process_source_file($);
20 20
21# some global variables 21# some global variables
22$verbose = 0; # turns on debugging 22$verbose = 1; # turns on debugging
23$modify = 0; # if 1 it should try to fix the files as well 23$modify = 1; # if 1 it should try to fix the files as well
24$experimental = 0; # try&error if an include is obsolete (slow!!) 24$experimental = 1; # try&error if an include is obsolete (slow!!)
25@explicitfiles = (); # filled in if passing files on the command line 25@explicitfiles = (); # filled in if passing files on the command line
26 26
27# statistic variables 27# statistic variables
28$exp_success = 0; 28$exp_success = 0;
29$exp_failure = 0; 29$exp_failure = 0;
30 30
31while (defined ($ARGV[0])) 31while (defined ($ARGV[0]))
32{ 32{
33 $_ = shift; 33 $_ = shift;
34 if (/^--help$|^-h$/) { 34 if (/^--help$|^-h$/) {
35 print "Usage: fixincludes [--verbose | -v] [--experimental | -e ] [--modify | -m ]\n"; 35 print "Usage: fixincludes [--verbose | -v] [--experimental | -e ] [--modify | -m ]\n";
36 exit 0; 36 exit 0;
37 } 37 }
38 elsif (/^--verbose$|^-v$/) { 38 elsif (/^--verbose$|^-v$/) {
39 $verbose = 1; # Oh is there a problem...? 39 $verbose = 1; # Oh is there a problem...?
40 } 40 }
41 elsif (/^--modify$|^-m$/) { 41 elsif (/^--modify$|^-m$/) {
42 $modify = 1; 42 $modify = 1;
43 } 43 }
44 elsif (/^--experimental$|^-e$/) { 44 elsif (/^--experimental$|^-e$/) {
45 $modify = 1; 45 $modify = 1;
46 $experimental = 1; 46 $experimental = 1;
47 } 47 }
48 elsif (!/^-/) { 48 elsif (!/^-/) {
49 push @explicitfiles, $_; 49 push @explicitfiles, $_;
50 } 50 }
51} 51}
52 52
53$cppExt = "(cpp|cc|cxx|C|c\\+\\+)"; 53$cppExt = "(cpp|cc|cxx|C|c\\+\\+)";
54$hExt = "(h|H|hh|hxx|hpp|h\\+\\+)"; 54$hExt = "(h|H|hh|hxx|hpp|h\\+\\+)";
55 55
56# list of compat headers. scroll down ... much of boring stuff here.. 56# list of compat headers. scroll down ... much of boring stuff here..
57%compatmap = ( 57%compatmap = (
58 'qapp.h' => "qapplication.h",
59 #'qarray.h' => "qmemarray.h",
60 #'qbitarry.h' => "qbitarray.h",
61 'qbttngrp.h' => "qbuttongroup.h",
62 #'qchkbox.h' => "qcheckbox.h",
63 'qclipbrd.h' => "qclipboard.h",
64 #'qcollect.h' => "qptrcollection.h",
65 #'qcollection.h' => "qptrcollection.h",
66 'qcombo.h' => "qcombobox.h",
67 'qconnect.h' => "qconnection.h",
68 'qdatetm.h' => "qdatetime.h",
69 'qdrawutl.h' => "qdrawutil.h",
70 'qdstream.h' => "qdatastream.h",
71 #'qfiledef.h' => "private/qfiledefs_p.h",
72 'qfiledlg.h' => "qfiledialog.h",
73 'qfileinf.h' => "qfileinfo.h",
74 'qfontdta.h' => "qfontdata.h",
75 'qfontinf.h' => "qfontinfo.h",
76 'qfontmet.h' => "qfontmetrics.h",
77 'qgrpbox.h' => "qgroupbox.h",
78 'qintcach.h' => "qintcache.h",
79 'qiodev.h' => "qiodevice.h",
80 'qlcdnum.h' => "qlcdnumber.h",
81 'qlined.h' => "qlineedit.h",
82 #'qlist.h' => "qptrlist.h",
83 'qmenudta.h' => "qmenudata.h",
84 'qmetaobj.h' => "qmetaobject.h",
85 'qmlined.h' => "qtmultilineedit.h",
86 'qmsgbox.h' => "qmessagebox.h",
87 'qmultilinedit.h' => "qmultilineedit.h",
88 'qobjcoll.h' => "qobjectlist.h>\n\#include <qobjectdict.h",
89 'qobjdefs.h' => "qobjectdefs.h",
90 'qpaintd.h' => "qpaintdevice.h",
91 'qpaintdc.h' => "qpaintdevicedefs.h",
92 'qpdevmet.h' => "qpaintdevicemetrics.h",
93 'qpmcache.h' => "qpixmapcache.h",
94 'qpntarry.h' => "qpointarray.h",
95 'qpopmenu.h' => "qpopupmenu.h",
96 'qprndlg.h' => "qprintdialog.h",
97 'qprogbar.h' => "qprogressbar.h",
98 'qprogdlg.h' => "qprogressdialog.h",
99 'qpsprn.h' => "<private/qpsprinter_p.h>",
100 'qpushbt.h' => "qpushbutton.h",
101 'qqueue.h' => "qptrqueue.h",
102 'qradiobt.h' => "qradiobutton.h",
103 'qrangect.h' => "qrangecontrol.h",
104 'qscrbar.h' => "qscrollbar.h",
105 'qsocknot.h' => "qsocketnotifier.h",
106# 'qstack.h' => "qptrstack.h",
107 'qtabdlg.h' => "qtabdialog.h",
108 'qtstream.h' => "qtextstream.h",
109# 'qvector.h' => "qptrvector.h",
110 'qwidcoll.h' => "qwidgetlist.h\n\#include <qwidgetintdict.h",
111 'qwindefs.h' => "qwindowdefs.h",
112
113# and now the KDE specific compat includes 58# and now the KDE specific compat includes
114# 'kapp.h' => "kapplication.h", 59# 'kapp.h' => "kapplication.h",
115# 'kstddirs.h' => "kstandarddirs.h", 60# 'kstddirs.h' => "kstandarddirs.h",
116# 'kuniqueapp.h' => "kuniqueapplication.h", 61# 'kuniqueapp.h' => "kuniqueapplication.h",
117# 'ktmainwindow.h'=> "kmainwindow.h", 62# 'ktmainwindow.h'=> "kmainwindow.h",
118# 'kcolorbtn.h' => "kcolorbutton.h", 63# 'kcolorbtn.h' => "kcolorbutton.h",
119# 'kcolordlg.h' => "kcolordialog.h", 64# 'kcolordlg.h' => "kcolordialog.h",
120# 'kxmlgui.h' => "kxmlguifactory.h", 65# 'kxmlgui.h' => "kxmlguifactory.h",
121); 66);
122 67
123 68
124# now it starts to get interesting again 69# now it starts to get interesting again
125 70
126# Look for source files in the given directory ($dir, first parameter) 71# Look for source files in the given directory ($dir, first parameter)
127sub find_fixable_sources ($) 72sub find_fixable_sources ($)
128{ 73{
129 # for now I grep the directory (requires srcdir==builddir) 74 # for now I grep the directory (requires srcdir==builddir)
130 # actually it should read the Makefile and 75 # actually it should read the Makefile and
131 # find the _SOURCES / _OBJECTS tags that are put there by 76 # find the _SOURCES / _OBJECTS tags that are put there by
132 # automake and am_edit, but thats an excercise to the reader ;-) 77 # automake and am_edit, but thats an excercise to the reader ;-)
133 78
134 my ( $dir ) = @_; 79 my ( $dir ) = @_;
135 80
136 opendir (DIR, "$dir") || die "Couldn't read '$dir'\n"; 81 opendir (DIR, "$dir") || die "Couldn't read '$dir'\n";
137 my @sources = grep { /^.*\.$cppExt$/o } readdir(DIR); 82 my @sources = grep { /^.*\.$cppExt$/o } readdir(DIR);
138 closedir(DIR); 83 closedir(DIR);
139 84
140 print "found sources: [ " . join(' ', @sources) . " ] in $dir\n" if ($verbose); 85 print "found sources: [ " . join(' ', @sources) . " ] in $dir\n" if ($verbose);
141 86
142 # prefix them with $dir 87 # prefix them with $dir
143 my @retsources = (); 88 my @retsources = ();
144 foreach $source(@sources) { 89 foreach $source(@sources) {
145 push @retsources, "$dir/$source"; 90 push @retsources, "$dir/$source";
146 } 91 }
147 92
148 return @retsources; 93 return @retsources;
149} 94}
150 95
151# Look for header files in the given directory ($dir, first parameter) 96# Look for header files in the given directory ($dir, first parameter)
152sub find_fixable_headers ($) 97sub find_fixable_headers ($)
153{ 98{
154 # for now I grep the directory (requires srcdir==builddir) 99 # for now I grep the directory (requires srcdir==builddir)
155 # actually it should read the Makefile and 100 # actually it should read the Makefile and
156 # find the _HEADERS tags that are put there by 101 # find the _HEADERS tags that are put there by
157 # automake and am_edit, but thats an excercise to the reader ;-) 102 # automake and am_edit, but thats an excercise to the reader ;-)
158 103
159 my ( $dir ) = @_; 104 my ( $dir ) = @_;
160 105