[Kde-bindings] KDE/kdebindings/kalyptus
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Thu Sep 4 15:24:06 UTC 2008
SVN commit 857067 by rdale:
* The code generated for overriden virtual methods with enum return types was incorrect
CCMAIL: kde-bindings at kde.org
M +68 -54 kalyptusCxxToSmoke.pm
--- trunk/KDE/kdebindings/kalyptus/kalyptusCxxToSmoke.pm #857066:857067
@@ -1385,66 +1385,80 @@
return ('', '');
}
- if($flags =~ "p") { # pure virtual
- $methodCode .= "\tthis->_binding->callMethod($idx, (void*)$this, x, true /*pure virtual*/);\n";
+ if ($flags =~ "p") { # pure virtual
+ $methodCode .= "\tthis->_binding->callMethod($idx, (void*)$this, x, true /*pure virtual*/);\n";
} else {
- $methodCode .= "\tif(this->_binding->callMethod($idx, (void*)$this, x)) ";
- }
+ $methodCode .= "\tif(this->_binding->callMethod($idx, (void*)$this, x)) ";
+ }
- $returnType = undef if ($returnType eq 'void');
- if($returnType) {
- my $arg = $returnType;
- my $it = applyTypeDef( $arg );
- my $cast;
- my $v = "x[0]";
- my $indent = ($flags =~ "p") ? "\t" : "";
- if($it and exists $typeunion{$it}) {
- $v .= ".$typeunion{$it}";
- $cast = "($arg)";
- $methodCode .= "${indent}return $cast$v;\n";
+ $returnType = undef if ($returnType eq 'void');
+ if ($returnType) {
+ my $arg = $returnType;
+ my $it = applyTypeDef( $arg );
+ my $cast;
+ my $v = "x[0]";
+ my $indent = ($flags =~ "p") ? "\t" : "";
+if ($returnType =~ /State/) {
+ print("found a state: $className $returnType it: $it isEnum: " . findTypeEntry($returnType)->{isEnum} . "\n");
+}
+ if ($it && exists $typeunion{$it}) {
+ $v .= ".$typeunion{$it}";
+ $cast = "($arg)";
+ $methodCode .= "${indent}return $cast$v;\n";
+ } elsif (findTypeEntry($returnType)->{isEnum}) {
+ $v .= ".s_enum";
+ $cast = "($arg)";
+ $methodCode .= "${indent}return $cast$v;\n";
+# $methodCode .= "${indent}$arg xret = ($arg)x[0].s_enum;\n";
+# $methodCode .= "return xret;\n";
+ } else {
+ $v .= ".s_class";
+ if ($arg =~ s/&//) {
+ $cast = "*($arg *)";
+ $methodCode .= "${indent}return $cast$v;\n";
+ } elsif($arg !~ /\*$/) {
+ unless($flags =~ "p") {
+ $indent = "\t ";
+ $methodCode .= "{\n";
+ }
+ # we assume it's a new thing, and handle it
+ $methodCode .= "${indent}$arg *xptr = ($arg *)$v;\n";
+ $methodCode .= "${indent}$arg xret(*xptr);\n";
+ $methodCode .= "${indent}delete xptr;\n";
+ $methodCode .= "${indent}return xret;\n";
+ $methodCode .= "\t}\n" unless $flags =~ "p";
+ } else {
+ $cast = "($arg)";
+ $methodCode .= "${indent}return $cast$v;\n";
+ }
+ }
} else {
- $v .= ".s_class";
- if($arg =~ s/&//) {
- $cast = "*($arg *)";
- $methodCode .= "${indent}return $cast$v;\n";
- } elsif($arg !~ /\*$/) {
- unless($flags =~ "p") {
- $indent = "\t ";
- $methodCode .= "{\n";
- }
- # we assume it's a new thing, and handle it
- $methodCode .= "${indent}$arg *xptr = ($arg *)$v;\n";
- $methodCode .= "${indent}$arg xret(*xptr);\n";
- $methodCode .= "${indent}delete xptr;\n";
- $methodCode .= "${indent}return xret;\n";
- $methodCode .= "\t}\n" unless $flags =~ "p";
- } else {
- $cast = "($arg)";
- $methodCode .= "${indent}return $cast$v;\n";
- }
+ $methodCode .= "\t" if $flags =~ "p";
+ $methodCode .= "return;\n";
}
- } else {
- $methodCode .= "\t" if $flags =~ "p";
- $methodCode .= "return;\n";
- }
- if($flags =~ "p") {
- $methodCode .= "\t// ABSTRACT\n";
+
+ if ($flags =~ "p") {
+ $methodCode .= "\t// ABSTRACT\n";
+ $methodCode .= " }\n";
+ return ( $methodCode );
+ }
+
+ $methodCode .= "\t";
+
+ if ($returnType) {
+ $methodCode .= "return ";
+ }
+
+ $methodCode .= "$this\->$methodClass->{astNodeName}\::$m->{astNodeName}(";
+ $i = 0;
+ for my $arg (@argList) {
+ $methodCode .= ", " if $i++;
+ $methodCode .= "x$i";
+ }
+
+ $methodCode .= ");\n";
$methodCode .= " }\n";
return ( $methodCode );
- }
- $methodCode .= "\t";
- if($returnType) {
- $methodCode .= "return ";
- }
- $methodCode .= "$this\->$methodClass->{astNodeName}\::$m->{astNodeName}(";
- $i = 0;
- for my $arg (@argList) {
- $methodCode .= ", " if $i++;
- $methodCode .= "x$i";
- }
- $methodCode .= ");\n";
- $methodCode .= " }\n";
- return ( $methodCode );
}
sub generateMethod($$$)
More information about the Kde-bindings
mailing list