Summary: | [GTK] Add support for constants in GObject DOM bindings | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Carlos Garcia Campos <cgarcia> | ||||||
Component: | Bindings | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cdumez, commit-queue, gustavo | ||||||
Priority: | P2 | Keywords: | Gtk | ||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Carlos Garcia Campos
2014-06-17 08:16:40 PDT
Created attachment 233230 [details] Patch The support for constants in .symbols files and the docs is added in bug #93002, I'll update this patch once that bug is fixed. Created attachment 233415 [details] Updated patch Patch updated now that both bug #133726 and #93002 are fixed. Comment on attachment 233415 [details] Updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=233415&action=review > Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm:896 > + push(@hBody, $implContent); > + > + if ($isStableClass) { > + push(@symbols, "GType ${lowerCaseIfaceName}_get_type(void)\n"); > + } > + > + if (@{$interface->constants}) { > + my @constants = @{$interface->constants}; > + foreach my $constant (@constants) { > + my $conditionalString = $codeGenerator->GenerateConditionalString($constant); > + my $constantName = "WEBKIT_DOM_${clsCaps}_" . $constant->name; > + my $constantValue = $constant->value; > + my $isStableSymbol = grep {$_ eq $constantName} @stableSymbols; > + if ($isStableSymbol) { > + push(@symbols, "$constantName\n"); > + } > + > + my @constantHeader = (); > + push(@constantHeader, "#if ${conditionalString}") if $conditionalString; > + push(@constantHeader, "/**"); > + push(@constantHeader, " * ${constantName}:"); > + push(@constantHeader, " */"); > + push(@constantHeader, "#define $constantName $constantValue"); > + push(@constantHeader, "#endif /* ${conditionalString} */") if $conditionalString; > + push(@constantHeader, "\n"); > + > + if ($isStableSymbol or !$isStableClass) { > + push(@hBody, join("\n", @constantHeader)); > + } else { > + push(@hBodyUnstable, join("\n", @constantHeader)); > + } > + } > + } > + I think it makes sense to move this to a helper. We don't do that a lot, but these files need serious cleanup. Committed r170475: <http://trac.webkit.org/changeset/170475> |