|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
|
|
# qtguess.pl : check how Qt was compiled. Issue a list of all defined TQT_NO_* macros, one per line.
|
|
|
|
|
# tqtguess.pl : check how TQt was compiled. Issue a list of all defined TQT_NO_* macros, one per line.
|
|
|
|
|
#
|
|
|
|
|
# author: germain Garand <germain@ebooksfrance.com>
|
|
|
|
|
# licence: GPL v.2
|
|
|
|
|
|
|
|
|
|
# options: -q: be quieter
|
|
|
|
|
# -o file: redirect output to "file". (default: ./qtdefines)
|
|
|
|
|
# -o file: redirect output to "file". (default: ./tqtdefines)
|
|
|
|
|
# -t [0..15]: set the testing threshold (see below)
|
|
|
|
|
# -f "flags": additional compiler flags/parameters
|
|
|
|
|
|
|
|
|
@ -17,7 +17,7 @@ use vars qw/$opt_f $opt_o $opt_p/;
|
|
|
|
|
getopts('qo:f:t:');
|
|
|
|
|
|
|
|
|
|
# Threshold :
|
|
|
|
|
# 0 - test basic Qt types/classes
|
|
|
|
|
# 0 - test basic TQt types/classes
|
|
|
|
|
# 5 - test higher level, non-gui classes
|
|
|
|
|
# 8 - test options of the above (ex: TQT_NO_IMAGE_SMOOTHSCALE)
|
|
|
|
|
# 10 - test basic widgets
|
|
|
|
@ -25,20 +25,20 @@ getopts('qo:f:t:');
|
|
|
|
|
# 13 - test widgets inheriting composite widgets
|
|
|
|
|
# 15 - test goodies (default)
|
|
|
|
|
|
|
|
|
|
my $default_threshold = @qt_test_threshold@;
|
|
|
|
|
my $default_threshold = @tqt_test_threshold@;
|
|
|
|
|
my $cc = "@CXX@";
|
|
|
|
|
my $ccflags = $opt_f || "@CXXFLAGS@";
|
|
|
|
|
|
|
|
|
|
my $nspaces = 50;
|
|
|
|
|
|
|
|
|
|
my %qtdefs=();
|
|
|
|
|
my %qtundefs=();
|
|
|
|
|
my %tqtdefs=();
|
|
|
|
|
my %tqtundefs=();
|
|
|
|
|
|
|
|
|
|
my $tmp = gettmpfile();
|
|
|
|
|
my $qtinc = '@tqt_includes@';
|
|
|
|
|
my $tqtinc = '@tqt_includes@';
|
|
|
|
|
my $allinc = '@all_includes@';
|
|
|
|
|
my $alllib = '@all_libraries@';
|
|
|
|
|
my $qtflags ='@LIB_TQT@';
|
|
|
|
|
my $tqtflags ='@LIB_TQT@';
|
|
|
|
|
my %x;
|
|
|
|
|
$x{'LIBPNG'} = '@LIBPNG@';
|
|
|
|
|
$x{'LIBJPEG'} = '@LIBJPEG@';
|
|
|
|
@ -50,31 +50,31 @@ $x{'LIB_X11'} = '@LIB_X11@';
|
|
|
|
|
$x{'X_PRE_LIBS'} = '@X_PRE_LIBS@';
|
|
|
|
|
$x{'LIB_X11'} =~ s/\$\((.*?)\)/$x{$1}/g;
|
|
|
|
|
|
|
|
|
|
$qtflags =~ s/\$\((.*?)\)/$x{$1}/g;
|
|
|
|
|
$tqtflags =~ s/\$\((.*?)\)/$x{$1}/g;
|
|
|
|
|
|
|
|
|
|
-e "$qtinc/qglobal.h" or die "Invalid Qt directory.\n";
|
|
|
|
|
-e "$tqtinc/qglobal.h" or die "Invalid TQt directory.\n";
|
|
|
|
|
|
|
|
|
|
my $ccmd = "$cc $ccflags $allinc $alllib -o $tmp $tmp.cpp $qtflags";
|
|
|
|
|
my $ccmd = "$cc $ccflags $allinc $alllib -o $tmp $tmp.cpp $tqtflags";
|
|
|
|
|
|
|
|
|
|
my $threshold = defined($opt_t)?$opt_t : $default_threshold;
|
|
|
|
|
$threshold >= 0 or die "invalid testing threshold: $threshold\n";
|
|
|
|
|
|
|
|
|
|
print "Checking how Qt was built... \n";
|
|
|
|
|
print "Checking how TQt was built... \n";
|
|
|
|
|
print "Threshold is set to $threshold\n" unless $opt_q;
|
|
|
|
|
|
|
|
|
|
my($count, $used, $total);
|
|
|
|
|
map{ $tests{$_}->[2]>=$threshold ? ($used++, $total++):$total++ } keys %tests;
|
|
|
|
|
|
|
|
|
|
print "Number of defines to be tested : $used/$total\n\n" unless $opt_q;
|
|
|
|
|
open( TQTDEFS, ">".($opt_o || "qtdefines") ) or die "Can't open output file: $!\n";
|
|
|
|
|
open( TQTDEFS, ">".($opt_o || "tqtdefines") ) or die "Can't open output file: $!\n";
|
|
|
|
|
|
|
|
|
|
grab_qglobal_symbols();
|
|
|
|
|
preliminary_test();
|
|
|
|
|
perform_all_tests();
|
|
|
|
|
|
|
|
|
|
print +scalar(keys %qtdefs) . " defines found.\n";
|
|
|
|
|
print +scalar(keys %tqtdefs) . " defines found.\n";
|
|
|
|
|
|
|
|
|
|
print TQTDEFS join("\n", keys %qtdefs), "\n";
|
|
|
|
|
print TQTDEFS join("\n", keys %tqtdefs), "\n";
|
|
|
|
|
close;
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------#
|
|
|
|
@ -82,7 +82,7 @@ close;
|
|
|
|
|
sub gettmpfile
|
|
|
|
|
{
|
|
|
|
|
my $tmpdir = $ENV{'TMP'} || ".";
|
|
|
|
|
my $tmpname = $$."-qtguess";
|
|
|
|
|
my $tmpname = $$."-tqtguess";
|
|
|
|
|
while( -e "$tmpdir/$tmpname" || -e "$tmpdir/${tmpname}.cpp" )
|
|
|
|
|
{
|
|
|
|
|
$tmpname .= int (rand * 9);
|
|
|
|
@ -94,28 +94,28 @@ sub gettmpfile
|
|
|
|
|
|
|
|
|
|
sub grab_qglobal_symbols
|
|
|
|
|
{
|
|
|
|
|
my $cmd = "$cc -E -D__cplusplus -dM -I$qtinc $qtinc/qglobal.h 2>/dev/null";
|
|
|
|
|
my $cmd = "$cc -E -D__cplusplus -dM -I$tqtinc $tqtinc/qglobal.h 2>/dev/null";
|
|
|
|
|
my $symbols = `$cmd`;
|
|
|
|
|
for(0..1)
|
|
|
|
|
{
|
|
|
|
|
if( check_exit_status($?) )
|
|
|
|
|
{
|
|
|
|
|
while( $symbols =~/^#\s*define\s*(QT_\S+)\s*$/gm )
|
|
|
|
|
while( $symbols =~/^#\s*define\s*(TQT_\S+)\s*$/gm )
|
|
|
|
|
{
|
|
|
|
|
$qtdefs{$1} = 1;
|
|
|
|
|
$tqtdefs{$1} = 1;
|
|
|
|
|
}
|
|
|
|
|
print "Found ". scalar( keys %qtdefs )." predefined symbol".((scalar( keys %qtdefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %qtdefs));
|
|
|
|
|
print "Found ". scalar( keys %tqtdefs )." predefined symbol".((scalar( keys %tqtdefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %tqtdefs));
|
|
|
|
|
while( $symbols =~/^#\s*define\s*TQT_MODULE_(\S+)\s*$/gm )
|
|
|
|
|
{
|
|
|
|
|
$qtundefs{"TQT_NO_$1"} = 1;
|
|
|
|
|
$tqtundefs{"TQT_NO_$1"} = 1;
|
|
|
|
|
}
|
|
|
|
|
print "Found ". scalar( keys %qtundefs )." undefined symbol".((scalar( keys %qtundefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %qtundefs));
|
|
|
|
|
print "Found ". scalar( keys %tqtundefs )." undefined symbol".((scalar( keys %tqtundefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %tqtundefs));
|
|
|
|
|
last;
|
|
|
|
|
}
|
|
|
|
|
elsif(! $_) # first try
|
|
|
|
|
{
|
|
|
|
|
print "Failed to run $cmd.\nTrying without __cplusplus (might be already defined)\n";
|
|
|
|
|
$cmd = "$cc -E -dM -I$qtinc $qtinc/qglobal.h 2>/dev/null";
|
|
|
|
|
$cmd = "$cc -E -dM -I$tqtinc $tqtinc/qglobal.h 2>/dev/null";
|
|
|
|
|
$symbols = `$cmd`;
|
|
|
|
|
next;
|
|
|
|
|
}
|
|
|
|
@ -166,14 +166,14 @@ sub perform_all_tests
|
|
|
|
|
foreach ( sort { $tests{$a}->[2] <=> $tests{$b}->[2]} keys %tests)
|
|
|
|
|
{
|
|
|
|
|
$tests{$_}->[2] < $threshold and next;
|
|
|
|
|
($qtdefs{$_} || $qtundefs{$_}) and do
|
|
|
|
|
($tqtdefs{$_} || $tqtundefs{$_}) and do
|
|
|
|
|
{
|
|
|
|
|
print "\rSkipping $_ (in qglobal.h)".( " " x (($nspaces-16) - length($_)) ).($qtundefs{$_}?"*Undefined*":" [Defined]").($opt_q?"":"\n");
|
|
|
|
|
print "\rSkipping $_ (in qglobal.h)".( " " x (($nspaces-16) - length($_)) ).($tqtundefs{$_}?"*Undefined*":" [Defined]").($opt_q?"":"\n");
|
|
|
|
|
next
|
|
|
|
|
};
|
|
|
|
|
print "\rTesting $_".( " " x ($nspaces - length($_)) );
|
|
|
|
|
open( OUT, ">${tmp}.cpp" ) or die "Failed to open temp file ${tmp}.cpp: $!\n";
|
|
|
|
|
foreach $def(keys %qtdefs)
|
|
|
|
|
foreach $def(keys %tqtdefs)
|
|
|
|
|
{
|
|
|
|
|
print OUT "#define $def\n";
|
|
|
|
|
}
|
|
|
|
@ -198,7 +198,7 @@ sub perform_all_tests
|
|
|
|
|
my $ok = check_exit_status($?);
|
|
|
|
|
if( !$ok )
|
|
|
|
|
{
|
|
|
|
|
$qtdefs{$_} = 1;
|
|
|
|
|
$tqtdefs{$_} = 1;
|
|
|
|
|
}
|
|
|
|
|
print +$opt_q ? ++$count."/$used" : ( $ok ? "*Undefined*\n" : " [Defined]\n" );
|
|
|
|
|
}
|
|
|
|
@ -398,9 +398,9 @@ our %tests = (
|
|
|
|
|
"TQT_NO_PROGRESSDIALOG" => ["qprogressdialog.h", "TQProgressDialog foo;", 13],
|
|
|
|
|
"TQT_NO_PUSHBUTTON" => ["qpushbutton.h", "TQPushButton foo( (TQWidget *) NULL );", 12],
|
|
|
|
|
"TQT_NO_PROPERTIES" => ["qmetaobject.h", "TQMetaProperty foo;", 0],
|
|
|
|
|
# "TQT_NO_QTMULTILINEEDIT" => ["qtmultilineedit.h", "QtMultiLineEdit foo;", 15],
|
|
|
|
|
# "TQT_NO_QTTABLEVIEW" => ["qttableview.h", "TQFoo foo;", 16, q£
|
|
|
|
|
# class TQFoo: public QtTableView
|
|
|
|
|
# "TQT_NO_TQTMULTILINEEDIT" => ["tqtmultilineedit.h", "TQtMultiLineEdit foo;", 15],
|
|
|
|
|
# "TQT_NO_TQTTABLEVIEW" => ["tqttableview.h", "TQFoo foo;", 16, q£
|
|
|
|
|
# class TQFoo: public TQtTableView
|
|
|
|
|
# {
|
|
|
|
|
# public:
|
|
|
|
|
# TQFoo() {};
|
|
|
|
@ -458,13 +458,13 @@ our %tests = (
|
|
|
|
|
# "TQT_NO_STYLE_MOTIFPLUS" => ["qmotifplusstyle.h", "TQMotifPlusStyle foo;", 16],
|
|
|
|
|
# "TQT_NO_STYLE_SGI" => ["qsgistyle.h", "TQSGIStyle foo;", 16],
|
|
|
|
|
# "TQT_NO_STYLE_WINDOWS" => ["qwindowsstyle.h", "TQWindowsStyle foo;", 16],
|
|
|
|
|
"TQT_NO_TABBAR" => ["qtabbar.h", "TQTabBar foo;", 10],
|
|
|
|
|
"TQT_NO_TABDIALOG" => ["qtabdialog.h", "TQTabDialog foo;", 12],
|
|
|
|
|
"TQT_NO_TABLE" => ["qtable.h", "TQTable foo;", 10],
|
|
|
|
|
"TQT_NO_TABWIDGET" => ["qtabwidget.h", "TQTabWidget foo;", 10],
|
|
|
|
|
"TQT_NO_TEXTBROWSER" => ["qtextbrowser.h", "TQTextBrowser foo;", 14],
|
|
|
|
|
"TQT_NO_TEXTCODEC" => ["qtextcodec.h", "TQTextCodec::codecForIndex(1);", 5],
|
|
|
|
|
"TQT_NO_TEXTCODECPLUGIN" => ["qtextcodecplugin.h, qstringlist.h, qvaluelist.h, qtextcodec.h", "TQFoo foo;", 6, q£
|
|
|
|
|
"TQT_NO_TABBAR" => ["tqtabbar.h", "TQTabBar foo;", 10],
|
|
|
|
|
"TQT_NO_TABDIALOG" => ["tqtabdialog.h", "TQTabDialog foo;", 12],
|
|
|
|
|
"TQT_NO_TABLE" => ["tqtable.h", "TQTable foo;", 10],
|
|
|
|
|
"TQT_NO_TABWIDGET" => ["tqtabwidget.h", "TQTabWidget foo;", 10],
|
|
|
|
|
"TQT_NO_TEXTBROWSER" => ["tqtextbrowser.h", "TQTextBrowser foo;", 14],
|
|
|
|
|
"TQT_NO_TEXTCODEC" => ["tqtextcodec.h", "TQTextCodec::codecForIndex(1);", 5],
|
|
|
|
|
"TQT_NO_TEXTCODECPLUGIN" => ["tqtextcodecplugin.h, qstringlist.h, qvaluelist.h, tqtextcodec.h", "TQFoo foo;", 6, q£
|
|
|
|
|
|
|
|
|
|
class TQFoo: public TQTextCodecPlugin
|
|
|
|
|
{
|
|
|
|
@ -478,12 +478,12 @@ our %tests = (
|
|
|
|
|
};
|
|
|
|
|
Q_EXPORT_PLUGIN( TQFoo )
|
|
|
|
|
£],
|
|
|
|
|
"TQT_NO_TEXTEDIT" => ["qtextedit.h", "TQTextEdit foo;", 13],
|
|
|
|
|
"TQT_NO_TEXTSTREAM" => ["qtextstream.h", "TQTextStream foo;", 5],
|
|
|
|
|
"TQT_NO_TEXTVIEW" => ["qtextview.h", "TQTextView foo;", 14], #Obsolete
|
|
|
|
|
"TQT_NO_TOOLBAR" => ["qtoolbar.h", "TQToolBar foo;", 10],
|
|
|
|
|
"TQT_NO_TOOLBUTTON" => ["qtoolbutton.h", "TQToolButton foo((TQWidget *) NULL );", 12],
|
|
|
|
|
"TQT_NO_TOOLTIP" => ["qtooltip.h", "TQToolTip::hide();", 10],
|
|
|
|
|
"TQT_NO_TEXTEDIT" => ["tqtextedit.h", "TQTextEdit foo;", 13],
|
|
|
|
|
"TQT_NO_TEXTSTREAM" => ["tqtextstream.h", "TQTextStream foo;", 5],
|
|
|
|
|
"TQT_NO_TEXTVIEW" => ["tqtextview.h", "TQTextView foo;", 14], #Obsolete
|
|
|
|
|
"TQT_NO_TOOLBAR" => ["tqtoolbar.h", "TQToolBar foo;", 10],
|
|
|
|
|
"TQT_NO_TOOLBUTTON" => ["tqtoolbutton.h", "TQToolButton foo((TQWidget *) NULL );", 12],
|
|
|
|
|
"TQT_NO_TOOLTIP" => ["tqtooltip.h", "TQToolTip::hide();", 10],
|
|
|
|
|
|
|
|
|
|
"TQT_NO_TRANSFORMATIONS" => ["qpainter.h", q£
|
|
|
|
|
TQPainter *foo= new TQPainter();
|