[Kde-bindings] branches/work/kdebindings-smoke2

Arno Rehn kde at arnorehn.de
Sun Jan 20 21:59:43 UTC 2008


SVN commit 764058 by arnorehn:

* Fixed: Virtual methods of base classes that were in another module
  weren't correctly added to their descendants in the x_*.cpp files.
  (Fixes problem with KPageModel)

CCMAIL: kde-bindings at kde.org



 M  +2 -0      ChangeLog  
 M  +17 -5     kalyptus/kalyptusCxxToSmoke.pm  


--- branches/work/kdebindings-smoke2/ChangeLog #764057:764058
@@ -6,6 +6,8 @@
 	  fail. If you remove KPageModel from the classlist, it builds all fine.
 	  Still investigating, what that is, but it seems like an error in kalyptus
 	  itself, not in the smoke generator.
+          Edit: Fixed. Virtual methods of base classes that were in another module
+          weren't correctly added to their descendants in the x_*.cpp files.
 	* Added kalyptusCxxToClasslist module for classlist generation. Might come
 	  in handy when writing classlists for new modules.
 	* Added kde_smoke.h
--- branches/work/kdebindings-smoke2/kalyptus/kalyptusCxxToSmoke.pm #764057:764058
@@ -2259,17 +2259,16 @@
     Iter::LocalCompounds( $rootnode, sub {
 	my $classNode = shift;
 	my $className = join( "::", kdocAstUtil::heritage($classNode) );
-	return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	print STDERR "writeSmokeDataFile: arglist: looking at $className\n" if ($debug);
 
 	Iter::MembersByType ( $classNode, undef,
 		sub {	my ($classNode, $m ) = @_;
 
 	my $methName = $m->{astNodeName};
-	print "method: $methName\n" if $className eq "KPageModel";
 	# For destructors, get a proper signature that includes the '~'
 	if ( $m->{ReturnType} eq '~' )
 	{
+	    return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	    $methName = '~' . $methName ;
 	    # Let's even store that change, otherwise we have to do it many times
 	    $m->{astNodeName} = $methName;
@@ -2277,15 +2276,21 @@
 	
 	if( $m->{NodeType} eq "enum" ) {
 
+	    return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	    foreach my $enum ( @{$m->{ParamList}} ) {
 		my $enumName = $enum->{ArgName};
 	        $methods{$enumName}++;
 	    }
 
 	} elsif ( $m->{NodeType} eq 'var' ) {
+		return if defined($excludeClasses{$className}); # return if the class is handled in another module
 		$methods{$m->{astNodeName}}++;
 	} elsif( $m->{NodeType} eq "method" ) {
 
+	    return if (defined($excludeClasses{$className}) && !isAncestorOfModuleClass($className));
+	    if (defined($excludeClasses{$className}) && isAncestorOfModuleClass($className)) {
+		return if (!($m->{Flags} =~ "v" || $m->{Flags} =~ "p"));
+	    }
 	    $methods{$methName}++;
 	    my @protos;
 	    makeprotos(\%classidx, $m, \@protos);
@@ -2372,7 +2377,6 @@
     Iter::LocalCompounds( $rootnode, sub {
 	my $classNode = shift;
 	my $className = join( "::", kdocAstUtil::heritage($classNode) );
-	return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	
 	my $classIndex = $moduleclassidx{$className};
 	print STDERR "writeSmokeDataFile: methods: looking at $className\n" if ($debug);
@@ -2382,6 +2386,7 @@
 
 	if( $m->{NodeType} eq "enum" ) {
 
+	    return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	    foreach my $enum ( @{$m->{ParamList}} ) {
 		my $enumName = $enum->{ArgName};
 		my $fullEnumName = "$className\::$enumName";
@@ -2406,6 +2411,7 @@
 
 	} elsif( $m->{NodeType} eq 'var' ) {
 
+	    return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	    my $name = $m->{astNodeName};
 	    my $fullName = "$className\::$name";
 	    my $sig = "$fullName\()";
@@ -2445,10 +2451,16 @@
 	    # No switch code for destructors if we didn't derive from the class (e.g. it has private ctors only)
     	    return if ( $m->{ReturnType} eq '~' && ! ( $classNode->{BindingDerives} and $classNode->{HasPublicDestructor}) );
 
+
+	    my $methName = $m->{astNodeName};
+	    return if (defined($excludeClasses{$className}) && !isAncestorOfModuleClass($className));
+	    if (defined($excludeClasses{$className}) && isAncestorOfModuleClass($className)) {
+	    	# only process (pure) virtual methods, not constructors, of ancestor classes, if this class is in another module
+		return if (!($m->{Flags} =~ "v" || $m->{Flags} =~ "p") || $methName eq $className);
+	    }
             # Is this sorting really important?
 	    #for my $m (sort {$a->{name} cmp $b->{name}} @{ $self->{$c}{method} }) {
 
-	    my $methName = $m->{astNodeName};
 	    my $def = $m->{FirstDefaultParam};
 	    $def = scalar(@{ $m->{ParamList} }) unless defined $def;
 	    my $last = scalar(@{ $m->{ParamList} }) - 1;
@@ -2464,7 +2476,7 @@
 		#die "$methodSig" if !defined $methodIndex;
 
 		my $methodIndex = $methodidx{$methName};
-		die "$methName" if !defined $methodIndex;
+		die "$className :: $methName" if !defined $methodIndex;
 		my $case = $classNode->{case}{$sig};
 		my $typeEntry = findTypeEntry( $m->{ReturnType} );
 		my $retTypeIndex = defined $typeEntry ? $typeEntry->{index} : 0;



More information about the Kde-bindings mailing list