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

Arno Rehn kde at arnorehn.de
Wed Jul 18 17:19:38 UTC 2007


SVN commit 689611 by arnorehn:

* Fixed findMethod().
* Fixed classIds being wrongly generated.

CCMAIL: kde-bindings at kde.org



 M  +2 -0      ChangeLog  
 M  +11 -10    kalyptus/kalyptusCxxToSmoke.pm  
 M  +2 -13     smoke/smoke.h  


--- branches/work/kdebindings-smoke2/ChangeLog #689610:689611
@@ -8,6 +8,8 @@
 	* The code generation for smoke modules with parents currently relies on
 	  a text file generated together with each module. Use a smoke
 	  introspection tool like the one proposed by Thomas Moenicke instead.
+	* Fixed findMethod().
+	* Fixed classIds being wrongly generated.
 
 2007-07-17  Arno Rehn  <arno at arnorehn.de>
 
--- branches/work/kdebindings-smoke2/kalyptus/kalyptusCxxToSmoke.pm #689610:689611
@@ -2262,6 +2262,7 @@
     my @classlist;
     my @moduleclasslist;
     push @classlist, ""; # Prepend empty item for "no class"
+    push @moduleclasslist, "";
     my %enumclasslist;
 
     Iter::LocalCompounds( $rootnode, sub {
@@ -2427,7 +2428,7 @@
 			if (defined $excludeClasses{$superClass}) { # is class defined in a parent module?
 				print OUT "{ $excludeClasses{$superClass}{'moduleId'}, $excludeClasses{$superClass}{'classId'} }, ";
 			} else {
-				print OUT "{ 0, $classidx{$superClass} }, ";
+				print OUT "{ 0, $moduleclassidx{$superClass} }, ";
 			}
 			$inheritlistsize++;
 		    }
@@ -2494,7 +2495,7 @@
 	$xClassFlags .= "|Smoke::cf_virtual" if hasVirtualDestructor($classNode) == 1;
 	# $xClassFlags .= "|Smoke::cf_undefined" if ...;
 	$xClassFlags =~ s/0\|//; # beautify
-	print OUT "\t{ \"$className\", $classinherit{$className}, $xcallFunc, $xenumFunc, $xClassFlags }, \t//$classidx{$className}\n";
+	print OUT "\t{ \"$className\", $classinherit{$className}, $xcallFunc, $xenumFunc, $xClassFlags }, \t//$moduleclassidx{$className}\n";
     } );
     print OUT "};\n\n";
 
@@ -2528,7 +2529,7 @@
 	    if (defined $excludeClasses{$realType}) { # is class defined in a parent module?
 		print OUT "{ $excludeClasses{$realType}{'moduleId'}, $excludeClasses{$realType}{'classId'} }, ";
 	    } else {
-		print OUT "{ 0, $classidx{$realType} }, ";
+		print OUT "{ 0, $moduleclassidx{$realType} }, ";
 	    }
 	}
 	elsif($type =~ /&$/ || $type =~ /\*$/) {
@@ -2543,7 +2544,7 @@
 		    if (defined $excludeClasses{$c}) { # is class defined in a parent module?
 			print OUT "{ $excludeClasses{$c}{'moduleId'}, $excludeClasses{$c}{'classId'} }, ";
 		    } else {
-			print OUT "{ 0, $classidx{$c} }, ";
+			print OUT "{ 0, $moduleclassidx{$c} }, ";
 		    }
 		} else {
 		    print OUT "{ 0, 0 } /* unknown class $c */, ";
@@ -2703,7 +2704,7 @@
 	my $className = join( "::", kdocAstUtil::heritage($classNode) );
 	return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	
-	my $classIndex = $classidx{$className};
+	my $classIndex = $moduleclassidx{$className};
 	print STDERR "writeSmokeDataFile: methods: looking at $className\n" if ($debug);
 
 	Iter::MembersByType ( $classNode, undef,
@@ -2853,7 +2854,7 @@
 	my $className = join( "::", kdocAstUtil::heritage($classNode) );
 	return if defined($excludeClasses{$className}); # return if the class is handled in another module
 	
-	my $classIndex = $classidx{$className};
+	my $classIndex = $moduleclassidx{$className};
 	print STDERR "writeSmokeDataFile: protos: looking at $className\n" if ($debug);
 
 	Iter::MembersByType ( $classNode, undef,
@@ -2919,7 +2920,7 @@
 		#print STDERR "Overload: $p (@{[keys %$scratch]})\n" if ($debug);
 	    #}
 	    my $xmethIndex = $methodidx{$p};
-	    my $classIndex = $classidx{$className};
+	    my $classIndex = $moduleclassidx{$className};
 	    for my $sig (keys %$scratch) {
 		#my $xsig = $scratch->{$sig}{class} . "::" . $sig;
 		my $xsig = $className . "::" . $sig;
@@ -2949,7 +2950,7 @@
     print OUT "\t{ 0, 0, 0 },\t//0 (no method)\n";
     for my $cur (@protolist) {
 	if(scalar keys %{ $cur->{over} } > 1) {
-	    print OUT "\t{$cur->{c}, $cur->{methIndex}, -@{[1+scalar @resolve]}},\t//$methodMapCount $classlist[$cur->{c}]\::$methodlist[$cur->{methIndex}]\n";
+	    print OUT "\t{$cur->{c}, $cur->{methIndex}, -@{[1+scalar @resolve]}},\t//$methodMapCount $moduleclasslist[$cur->{c}]\::$methodlist[$cur->{methIndex}]\n";
 	    $methodMapCount++;
 	    for my $k (keys %{ $cur->{over} }) {
 	        my $p = $cur->{over}{$k};
@@ -2961,7 +2962,7 @@
 	    for my $k (keys %{ $cur->{over} }) {
 	        my $p = $cur->{over}{$k};
 	        my $xsig = $p->{class} ? "$p->{class}\::$k" : $p->{sig};
-	        print OUT "\t{$cur->{c}, $cur->{methIndex}, $allMethods{$xsig}},\t//$methodMapCount $classlist[$cur->{c}]\::$methodlist[$cur->{methIndex}]\n";
+	        print OUT "\t{$cur->{c}, $cur->{methIndex}, $allMethods{$xsig}},\t//$methodMapCount $moduleclasslist[$cur->{c}]\::$methodlist[$cur->{methIndex}]\n";
 	        $methodMapCount++;
 	    }
 	}
@@ -3007,7 +3008,7 @@
     print OUT "    ${libname}_Smoke = new Smoke(\n";
     print OUT "        \"${libname}\",\n";
     print OUT "        ${libname}_parentModules, ". int($#modules+1) .",\n";
-    print OUT "        ${libname}_classes, ".$#moduleclasslist.",\n";
+    print OUT "        ${libname}_classes, ".int($#moduleclasslist+1).",\n";
     print OUT "        ${libname}_methods, $methodCount,\n";
     print OUT "        ${libname}_methodMaps, $methodMapCount,\n";
     print OUT "        ${libname}_methodNames, $methodNameCount,\n";
--- branches/work/kdebindings-smoke2/smoke/smoke.h #689610:689611
@@ -456,26 +456,15 @@
     inline ModuleIndex findMethod(ModuleIndex c, ModuleIndex name) {
 	// Index is invalid
 	if(!c.index || !name.index) return NullModuleIndex;
-	
-	// Method is in another module since the munged name is there.
-	// Call findMethod in this parent module.
-	if (name.smoke != this)
-		return name.smoke->findMethod(c, name);
-	
 	// Is the method a direct member of the specified class?
 	ModuleIndex mid = idMethod(c.index, name.index);
 	if(mid.index) return mid;
-	
 	// No, it isn't... Search in the parent classes for it
 	if(!classes[c.index].parents) return NullModuleIndex;
 	for(int p = classes[c.index].parents; inheritanceList[p].index ; p++) {
 	    ModuleIndex si = moduleIndexFromParentIndex(inheritanceList[p]);
-	    // only search in the current module, it has to be somewhere in here
-	    if (inheritanceList[p].parent == 0) {
-		// do the whole thing again for the parent class
-		mid = findMethod(si, name);
-		if(mid.index) return mid;
-	    }
+	    mid = si.smoke->findMethod(si, name);
+	    if(mid.index) return mid;
 	}
 	return NullModuleIndex;
     }



More information about the Kde-bindings mailing list