[Kde-bindings] KDE/kdebindings/kalyptus

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Oct 9 13:14:08 UTC 2007


SVN commit 723369 by rdale:

* Revert the change to remove an eval call from kalyptus code, as Germain Garand had already
  fixed it another way 

CCMAIL: kde-bindings at kde.org
CCMAIL: germain at ebooksfrance.org

 M  +31 -23    kalyptus  


--- trunk/KDE/kdebindings/kalyptus/kalyptus #723368:723369
@@ -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
+        @includeclasses $includeclasses $skipInternal %defines $defines $match_qt_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,6 +213,35 @@
     }
 }
 
+# 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.
 
@@ -386,27 +415,6 @@
 	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,
@@ -580,7 +588,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
-				     matchQtDefines( $p ) or
+				     &$match_qt_defines( $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