-rwxr-xr-x | scripts/fixincludes | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/scripts/fixincludes b/scripts/fixincludes index 95fc129..da8613c 100755 --- a/scripts/fixincludes +++ b/scripts/fixincludes | |||
@@ -43,94 +43,94 @@ while (defined ($ARGV[0])) | |||
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", | 58 | 'qapp.h' => "qapplication.h", |
59 | 'qarray.h' => "qmemarray.h", | 59 | #'qarray.h' => "qmemarray.h", |
60 | 'qbitarry.h' => "qbitarray.h", | 60 | #'qbitarry.h' => "qbitarray.h", |
61 | 'qbttngrp.h' => "qbuttongroup.h", | 61 | 'qbttngrp.h' => "qbuttongroup.h", |
62 | 'qchkbox.h' => "qcheckbox.h", | 62 | #'qchkbox.h' => "qcheckbox.h", |
63 | 'qclipbrd.h' => "qclipboard.h", | 63 | 'qclipbrd.h' => "qclipboard.h", |
64 | 'qcollect.h' => "qptrcollection.h", | 64 | #'qcollect.h' => "qptrcollection.h", |
65 | 'qcollection.h' => "qptrcollection.h", | 65 | #'qcollection.h' => "qptrcollection.h", |
66 | 'qcombo.h' => "qcombobox.h", | 66 | 'qcombo.h' => "qcombobox.h", |
67 | 'qconnect.h' => "qconnection.h", | 67 | 'qconnect.h' => "qconnection.h", |
68 | 'qdatetm.h' => "qdatetime.h", | 68 | 'qdatetm.h' => "qdatetime.h", |
69 | 'qdrawutl.h' => "qdrawutil.h", | 69 | 'qdrawutl.h' => "qdrawutil.h", |
70 | 'qdstream.h' => "qdatastream.h", | 70 | 'qdstream.h' => "qdatastream.h", |
71 | 'qfiledef.h' => "private/qfiledefs_p.h", | 71 | #'qfiledef.h' => "private/qfiledefs_p.h", |
72 | 'qfiledlg.h' => "qfiledialog.h", | 72 | 'qfiledlg.h' => "qfiledialog.h", |
73 | 'qfileinf.h' => "qfileinfo.h", | 73 | 'qfileinf.h' => "qfileinfo.h", |
74 | 'qfontdta.h' => "qfontdata.h", | 74 | 'qfontdta.h' => "qfontdata.h", |
75 | 'qfontinf.h' => "qfontinfo.h", | 75 | 'qfontinf.h' => "qfontinfo.h", |
76 | 'qfontmet.h' => "qfontmetrics.h", | 76 | 'qfontmet.h' => "qfontmetrics.h", |
77 | 'qgrpbox.h' => "qgroupbox.h", | 77 | 'qgrpbox.h' => "qgroupbox.h", |
78 | 'qintcach.h' => "qintcache.h", | 78 | 'qintcach.h' => "qintcache.h", |
79 | 'qiodev.h' => "qiodevice.h", | 79 | 'qiodev.h' => "qiodevice.h", |
80 | 'qlcdnum.h' => "qlcdnumber.h", | 80 | 'qlcdnum.h' => "qlcdnumber.h", |
81 | 'qlined.h' => "qlineedit.h", | 81 | 'qlined.h' => "qlineedit.h", |
82 | 'qlist.h' => "qptrlist.h", | 82 | #'qlist.h' => "qptrlist.h", |
83 | 'qmenudta.h' => "qmenudata.h", | 83 | 'qmenudta.h' => "qmenudata.h", |
84 | 'qmetaobj.h' => "qmetaobject.h", | 84 | 'qmetaobj.h' => "qmetaobject.h", |
85 | 'qmlined.h' => "qtmultilineedit.h", | 85 | 'qmlined.h' => "qtmultilineedit.h", |
86 | 'qmsgbox.h' => "qmessagebox.h", | 86 | 'qmsgbox.h' => "qmessagebox.h", |
87 | 'qmultilinedit.h' => "qmultilineedit.h", | 87 | 'qmultilinedit.h' => "qmultilineedit.h", |
88 | 'qobjcoll.h' => "qobjectlist.h>\n\#include <qobjectdict.h", | 88 | 'qobjcoll.h' => "qobjectlist.h>\n\#include <qobjectdict.h", |
89 | 'qobjdefs.h' => "qobjectdefs.h", | 89 | 'qobjdefs.h' => "qobjectdefs.h", |
90 | 'qpaintd.h' => "qpaintdevice.h", | 90 | 'qpaintd.h' => "qpaintdevice.h", |
91 | 'qpaintdc.h' => "qpaintdevicedefs.h", | 91 | 'qpaintdc.h' => "qpaintdevicedefs.h", |
92 | 'qpdevmet.h' => "qpaintdevicemetrics.h", | 92 | 'qpdevmet.h' => "qpaintdevicemetrics.h", |
93 | 'qpmcache.h' => "qpixmapcache.h", | 93 | 'qpmcache.h' => "qpixmapcache.h", |
94 | 'qpntarry.h' => "qpointarray.h", | 94 | 'qpntarry.h' => "qpointarray.h", |
95 | 'qpopmenu.h' => "qpopupmenu.h", | 95 | 'qpopmenu.h' => "qpopupmenu.h", |
96 | 'qprndlg.h' => "qprintdialog.h", | 96 | 'qprndlg.h' => "qprintdialog.h", |
97 | 'qprogbar.h' => "qprogressbar.h", | 97 | 'qprogbar.h' => "qprogressbar.h", |
98 | 'qprogdlg.h' => "qprogressdialog.h", | 98 | 'qprogdlg.h' => "qprogressdialog.h", |
99 | 'qpsprn.h' => "<private/qpsprinter_p.h>", | 99 | 'qpsprn.h' => "<private/qpsprinter_p.h>", |
100 | 'qpushbt.h' => "qpushbutton.h", | 100 | 'qpushbt.h' => "qpushbutton.h", |
101 | 'qqueue.h' => "qptrqueue.h", | 101 | 'qqueue.h' => "qptrqueue.h", |
102 | 'qradiobt.h' => "qradiobutton.h", | 102 | 'qradiobt.h' => "qradiobutton.h", |
103 | 'qrangect.h' => "qrangecontrol.h", | 103 | 'qrangect.h' => "qrangecontrol.h", |
104 | 'qscrbar.h' => "qscrollbar.h", | 104 | 'qscrbar.h' => "qscrollbar.h", |
105 | 'qsocknot.h' => "qsocketnotifier.h", | 105 | 'qsocknot.h' => "qsocketnotifier.h", |
106 | 'qstack.h' => "qptrstack.h", | 106 | # 'qstack.h' => "qptrstack.h", |
107 | 'qtabdlg.h' => "qtabdialog.h", | 107 | 'qtabdlg.h' => "qtabdialog.h", |
108 | 'qtstream.h' => "qtextstream.h", | 108 | 'qtstream.h' => "qtextstream.h", |
109 | 'qvector.h' => "qptrvector.h", | 109 | # 'qvector.h' => "qptrvector.h", |
110 | 'qwidcoll.h' => "qwidgetlist.h\n\#include <qwidgetintdict.h", | 110 | 'qwidcoll.h' => "qwidgetlist.h\n\#include <qwidgetintdict.h", |
111 | 'qwindefs.h' => "qwindowdefs.h", | 111 | 'qwindefs.h' => "qwindowdefs.h", |
112 | 112 | ||
113 | # and now the KDE specific compat includes | 113 | # and now the KDE specific compat includes |
114 | 'kapp.h' => "kapplication.h", | 114 | # 'kapp.h' => "kapplication.h", |
115 | 'kstddirs.h' => "kstandarddirs.h", | 115 | # 'kstddirs.h' => "kstandarddirs.h", |
116 | 'kuniqueapp.h' => "kuniqueapplication.h", | 116 | # 'kuniqueapp.h' => "kuniqueapplication.h", |
117 | 'ktmainwindow.h'=> "kmainwindow.h", | 117 | # 'ktmainwindow.h'=> "kmainwindow.h", |
118 | 'kcolorbtn.h' => "kcolorbutton.h", | 118 | # 'kcolorbtn.h' => "kcolorbutton.h", |
119 | 'kcolordlg.h' => "kcolordialog.h", | 119 | # 'kcolordlg.h' => "kcolordialog.h", |
120 | 'kxmlgui.h' => "kxmlguifactory.h", | 120 | # 'kxmlgui.h' => "kxmlguifactory.h", |
121 | ); | 121 | ); |
122 | 122 | ||
123 | 123 | ||
124 | # now it starts to get interesting again | 124 | # now it starts to get interesting again |
125 | 125 | ||
126 | # Look for source files in the given directory ($dir, first parameter) | 126 | # Look for source files in the given directory ($dir, first parameter) |
127 | sub find_fixable_sources ($) | 127 | sub find_fixable_sources ($) |
128 | { | 128 | { |
129 | # for now I grep the directory (requires srcdir==builddir) | 129 | # for now I grep the directory (requires srcdir==builddir) |
130 | # actually it should read the Makefile and | 130 | # actually it should read the Makefile and |
131 | # find the _SOURCES / _OBJECTS tags that are put there by | 131 | # find the _SOURCES / _OBJECTS tags that are put there by |
132 | # automake and am_edit, but thats an excercise to the reader ;-) | 132 | # automake and am_edit, but thats an excercise to the reader ;-) |
133 | 133 | ||
134 | my ( $dir ) = @_; | 134 | my ( $dir ) = @_; |
135 | 135 | ||
136 | opendir (DIR, "$dir") || die "Couldn't read '$dir'\n"; | 136 | opendir (DIR, "$dir") || die "Couldn't read '$dir'\n"; |
@@ -449,33 +449,33 @@ sub fix_unnecessary($) | |||
449 | 449 | ||
450 | # now try to drop some includes | 450 | # now try to drop some includes |
451 | foreach $include (@includes) { | 451 | foreach $include (@includes) { |
452 | # kdatastream is special because | 452 | # kdatastream is special because |
453 | # it will break the application if removed even | 453 | # it will break the application if removed even |
454 | # if it continues to compile | 454 | # if it continues to compile |
455 | next if( $include eq "kdatastream.h"); | 455 | next if( $include eq "kdatastream.h"); |
456 | # I also like to have kdebug.h still in | 456 | # I also like to have kdebug.h still in |
457 | # so that it's easy to add kdDebug calls | 457 | # so that it's easy to add kdDebug calls |
458 | next if( $include eq "kdebug.h"); | 458 | next if( $include eq "kdebug.h"); |
459 | # avoid this one as it might cause | 459 | # avoid this one as it might cause |
460 | # certain code parts to be disabled from compilation | 460 | # certain code parts to be disabled from compilation |
461 | next if( $include eq "qmodules.h"); | 461 | next if( $include eq "qmodules.h"); |
462 | # check if it is its own header file | 462 | # check if it is its own header file |
463 | my $blankhdr = $include; | 463 | my $blankhdr = $include; |
464 | $blankhdr =~ s/(.*)\.[^\.]+/$1/; | 464 | $blankhdr =~ s/(.*)\.[^\.]+/$1/; |
465 | next if ($blankhdr eq $blanksrc); | 465 | next if ($blankhdr eq $blanksrc); |
466 | 466 | ||
467 | chdir($srcdir); | 467 | chdir($srcdir); |
468 | 468 | ||
469 | local $localbackup = $srcfile . "#fixincludes"; | 469 | local $localbackup = $srcfile . "#fixincludes"; |
470 | 470 | ||
471 | # preserve timestamp if possible for CVS | 471 | # preserve timestamp if possible for CVS |
472 | unlink $localbackup; | 472 | unlink $localbackup; |
473 | rename $srcfile, $localbackup; | 473 | rename $srcfile, $localbackup; |
474 | copy_file($localbackup, $srcfile); | 474 | copy_file($localbackup, $srcfile); |
475 | 475 | ||
476 | # revert to backup in case of interrupt (Ctrl+C) | 476 | # revert to backup in case of interrupt (Ctrl+C) |
477 | $SIG{'INT'} = \&sighandler_fix_unnecessary; | 477 | $SIG{'INT'} = \&sighandler_fix_unnecessary; |
478 | 478 | ||
479 | # check if it still compiles | 479 | # check if it still compiles |
480 | if($verbose) { | 480 | if($verbose) { |
481 | chdir($builddir); | 481 | chdir($builddir); |