[Kde-bindings] KDE/kdebindings/kalyptus

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Oct 9 11:49:21 UTC 2007


SVN commit 723345 by rdale:

* Remove the eval'd code in kalyptus in case it was causing the problem with the 
  dashboard build. Replace with a non-eval'd version which should behave exactly 
  the same.

CCMAIL: kde-bindings at kde.org


 M  +23 -31    kalyptus  


--- trunk/KDE/kdebindings/kalyptus/kalyptus #723344:723345
@@ -21,7 +21,7 @@
 use kdocParseDoc;
 
 use vars qw/ %rootNodes $declNodeType @includes_list %options @formats_wanted $allow_k_dcop_accessors
-        @includeclasses $includeclasses $skipInternal %defines $defines $match_qt_defines
+        @includeclasses $includeclasses $skipInternal %defines $defines
 	$libdir $libname $outputdir @libs $parse_global_space $qt_embedded $qt4 $striphpath $doPrivate $readstdin
 	$Version $quiet $debug $debuggen $parseonly $currentfile $cSourceNode $exe
 	%formats %flagnames @allowed_k_dcop_accesors $allowed_k_dcop_accesors_re $rootNode 
@@ -213,35 +213,6 @@
     }
 }
 
-# Check the %defines hash for QT_* symbols and compile the corresponding RE
-# Otherwise, compile the default ones. Used for filtering in readCxxLine.
-if ( my @qt_defines = map { ($_=~m/^QT_(.*)/)[0] } keys %defines)
-{
-    my $regexp = "m/^#\\s*if\\s*[n!]?\\s*def(ined\\()?\\s*QT_(?:" . join('|', map { "${qt_defines[$_]}" } 0..$#qt_defines).")/o";
-    $match_qt_defines = eval "sub { my \$s=shift;
-                                   \$s=~/^#\\s*if\\s*([n!])?\s*def(ined\\()?\\s*QT_/ || return 0;
-                                   if(!\$1) { return \$s=~$regexp ? 0:1 }
-                                   else { return \$s=~$regexp ? 1:0 }
-                                  }";
-
-    die if $@;
-}
-else
-{
-    $match_qt_defines = eval q{
-    sub
-    {
-        my $s = shift;
-        $s =~ m/^\#\s*ifndef\s+QT_NO_(?:REMOTE| # not in the default compile options
-                                        NIS|    #  ...
-                                        XINERAMA|
-                                        IMAGEIO_(?:MNG|JPEG)|
-                                        STYLE_(?:MAC|INTERLACE|COMPACT)
-                                     )/x;
-    }
-    };
-    die if $@;
-}
 # Check if there any files to process.
 # We do it here to prevent the libraries being loaded up first.
 
@@ -415,6 +386,27 @@
 	return <INPUT>;
 }
 
+# Check the %defines hash for QT_* symbols. Used for filtering in readCxxLine.
+sub matchQtDefines($)
+{
+	my $s = shift;
+
+	if ( $s !~ m/^#\s*if\s*([n!])?\s*def(ined\()?\s*(QT_[^)\n\s]*)/o ) {
+		return 0;
+	}
+	my $negated = $1;
+	my $target = $3;
+
+	my @qt_defines = map { ($_=~m/^(QT_.*)/)[0] } keys %defines;
+	foreach my $def ( @qt_defines ) {
+		if ($def eq $target) {
+			return (defined $negated ? 1 : 0);
+		}
+	}
+
+	return (defined $negated ? 0 : 1);
+}
+
 =head2 readCxxLine
 
 	Reads a C++ source line, skipping comments, blank lines,
@@ -588,7 +580,7 @@
 				     $p =~ m/^#if\s*!defined\(Q_NO_USING_KEYWORD\)/ or
 				     $p =~ m/^#if\s*defined\(Q_INTERNAL_QAPP_SRC\)/ or
 				     ($p =~ m/^#if\s*QT_VERSION\s*<\s*0x040000/ and $qt4) or
-				     &$match_qt_defines( $p ) or
+				     matchQtDefines( $p ) or
 				     $p =~ m/^#\s*if\s+0\s+/ ) {
 				     my $if_depth = 1;
 				     while ( defined $p && $if_depth > 0 ) {



More information about the Kde-bindings mailing list