Reviewed by Darin.
* DerivedSources.make:
Conditionally generate the SVG and XPath related files based on the value of
FEATURE_DEFINES. Also, pass FEATURE_DEFINES TO THE BINDINGS GENERATOR.
* WebCore.xcodeproj/project.pbxproj:
Add FEATURE_DEFINES as a toplevel build setting and set it to "SVG_SUPPORT XPATH_SUPPORT"
to keep SVG and XPath support turned on. Add FEATURE_DEFINES to the CPP defines.
* bindings/js/kjs_binding.cpp:
(KJS::setDOMException):
Add #ifdefs around the XPath code.
* bindings/scripts/CodeGeneratorJS.pm:
Add "Conditional" extended attribute for interfaces. If this is set, the generated code will be
surrounded by an #if.
* bindings/scripts/IDLParser.pm:
Pass the define flags on to the preprocessor.
* bindings/scripts/generate-bindings.pl:
Add a --defines property and pass it on to the parser.
* css/cssstyleselector.h:
Add DeprecatedString.h include.
* dom/Document.idl:
Put back #if around the XPath functions
* page/DOMWindow.idl:
Put #if around the XPath constructors
* xpath/XPathEvaluator.idl:
* xpath/XPathExpression.idl:
* xpath/XPathNSResolver.cpp:
* xpath/XPathNSResolver.idl:
* xpath/XPathNamespace.cpp:
* xpath/XPathResult.idl:
Add "Conditional=XPATH" to all interfaces.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14423
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-05-17 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ * DerivedSources.make:
+ Conditionally generate the SVG and XPath related files based on the value of
+ FEATURE_DEFINES. Also, pass FEATURE_DEFINES TO THE BINDINGS GENERATOR.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Add FEATURE_DEFINES as a toplevel build setting and set it to "SVG_SUPPORT XPATH_SUPPORT"
+ to keep SVG and XPath support turned on. Add FEATURE_DEFINES to the CPP defines.
+
+ * bindings/js/kjs_binding.cpp:
+ (KJS::setDOMException):
+ Add #ifdefs around the XPath code.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ Add "Conditional" extended attribute for interfaces. If this is set, the generated code will be
+ surrounded by an #if.
+
+ * bindings/scripts/IDLParser.pm:
+ Pass the define flags on to the preprocessor.
+
+ * bindings/scripts/generate-bindings.pl:
+ Add a --defines property and pass it on to the parser.
+
+ * css/cssstyleselector.h:
+ Add DeprecatedString.h include.
+
+ * dom/Document.idl:
+ Put back #if around the XPath functions
+
+ * page/DOMWindow.idl:
+ Put #if around the XPath constructors
+
+ * xpath/XPathEvaluator.idl:
+ * xpath/XPathExpression.idl:
+ * xpath/XPathNSResolver.cpp:
+ * xpath/XPathNSResolver.idl:
+ * xpath/XPathNamespace.cpp:
+ * xpath/XPathResult.idl:
+ Add "Conditional=XPATH" to all interfaces.
+
2006-05-16 Darin Adler <darin@apple.com>
Reviewed by Anders.
rm -f CSSGrammar.cpp.h CSSGrammar.hpp
# XPath grammar
-
-XPathGrammar.cpp : xpath/impl/XPathGrammar.y
+ifeq ($(findstring XPATH_SUPPORT,$(FEATURE_DEFINES)), XPATH_SUPPORT)
+XPathGrammar.cpp : xpath/impl/XPathGrammar.y $(PROJECT_FILE)
bison -d -p xpathyy $< -o $@
touch XPathGrammar.cpp.h
touch XPathGrammar.hpp
cat XPathGrammar.cpp.h XPathGrammar.hpp > XPathGrammar.h
rm -f XPathGrammar.cpp.h XPathGrammar.hpp
+else
+XPathGrammar.cpp : $(PROJECT_FILE)
+ echo > XPathGrammar.cpp
+ echo > XPathGrammar.h
+endif
# user agent style sheets
%Table.cpp: %.cpp $(CREATE_HASH_TABLE)
$(CREATE_HASH_TABLE) $< > $@
-# SVG tag and attribute names
+ifeq ($(findstring SVG_SUPPORT,$(FEATURE_DEFINES)), SVG_SUPPORT)
+# SVG tag and attribute names
SVGNames.cpp : ksvg2/scripts/make_names.pl ksvg2/svg/svgtags.in ksvg2/svg/svgattrs.in
$< --tags $(WebCore)/ksvg2/svg/svgtags.in --attrs $(WebCore)/ksvg2/svg/svgattrs.in \
--namespace SVG --cppNamespace WebCore --namespaceURI "http://www.w3.org/2000/svg" --factory --attrsNullNamespace --output .
perl -ne 'print lc' $(WebCore)/ksvg2/css/CSSValueKeywords.in > ksvgcssvalues.in
$(WebCore)/ksvg2/scripts/cssmakevalues -n SVG -f ksvgcssvalues.in
+else
+
+SVGNames.cpp :
+ echo > SVGNames.cpp
+
+XLinkNames.cpp :
+ echo > XLinkNames.cpp
+
+ksvgcssproperties.h :
+ echo > ksvgcssproperties.h
+
+ksvgcssvalues.h :
+ echo > ksvgcssvalues.h
+
+endif
+
# new-style JavaScript bindings
JS_BINDINGS_SCRIPTS = \
#
JS%.h : %.idl $(JS_BINDINGS_SCRIPTS)
- perl -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --generator JS --include dom --include html --include xpath --outputdir . $<
+ perl -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES)" --generator JS --include dom --include html --include xpath --outputdir . $<
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ \"${BUILD_STYLE}\" = \"Release\" -o \"${BUILD_STYLE}\" = \"Debug\" ] ; then\n export CREATE_HASH_TABLE=\"${BUILT_PRODUCTS_DIR}/JavaScriptCore.framework/PrivateHeaders/create_hash_table\"\nelse\n export CREATE_HASH_TABLE=\"${NEXT_ROOT}${SYSTEM_LIBRARY_DIR}/Frameworks/WebKit.framework/Versions/A/Frameworks/JavaScriptCore.framework/PrivateHeaders/create_hash_table\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\n\nexport WebCore=\"${SRCROOT}\"\n\nexport ENCODINGS_FILE=\"${WebCore}/platform/mac/mac-encodings.txt\"\nexport ENCODINGS_PREFIX=\"kCFStringEncoding\"\n\nmake -f \"$WebCore/DerivedSources.make\"\n";
+ shellScript = "if [ \"${BUILD_STYLE}\" = \"Release\" -o \"${BUILD_STYLE}\" = \"Debug\" ] ; then\n export CREATE_HASH_TABLE=\"${BUILT_PRODUCTS_DIR}/JavaScriptCore.framework/PrivateHeaders/create_hash_table\"\nelse\n export CREATE_HASH_TABLE=\"${NEXT_ROOT}${SYSTEM_LIBRARY_DIR}/Frameworks/WebKit.framework/Versions/A/Frameworks/JavaScriptCore.framework/PrivateHeaders/create_hash_table\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\n\nexport WebCore=\"${SRCROOT}\"\n\nexport ENCODINGS_FILE=\"${WebCore}/platform/mac/mac-encodings.txt\"\nexport ENCODINGS_PREFIX=\"kCFStringEncoding\"\n\nif [ \"${ACTION}\" = \"build\" ]; then\n\tmake -f \"$WebCore/DerivedSources.make\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */
GCC_PREFIX_HEADER = WebCorePrefix.h;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(DEBUG_DEFINES)",
- SVG_SUPPORT,
- XPATH_SUPPORT,
+ "$(FEATURE_DEFINES)",
);
HEADER_SEARCH_PATHS = (
ForwardingHeaders,
GCC_PREFIX_HEADER = WebCorePrefix.h;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(DEBUG_DEFINES)",
- SVG_SUPPORT,
- XPATH_SUPPORT,
+ "$(FEATURE_DEFINES)",
);
HEADER_SEARCH_PATHS = (
ForwardingHeaders,
GCC_PREFIX_HEADER = WebCorePrefix.h;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(DEBUG_DEFINES)",
- SVG_SUPPORT,
- XPATH_SUPPORT,
+ "$(FEATURE_DEFINES)",
);
HEADER_SEARCH_PATHS = (
ForwardingHeaders,
149C284408902B11008A9EFC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
149C284508902B11008A9EFC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
149C284708902B11008A9EFC /* Production */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
"UNSPECIFIED_EVENT_TYPE_ERR"
};
+#if XPATH_SUPPORT
static const char * const xpathExceptionNames[] = {
"INVALID_EXPRESSION_ERR",
"TYPE_ERR"
};
+#endif
void setDOMException(ExecState* exec, ExceptionCode ec)
{
nameIndex = code;
nameTable = eventExceptionNames;
nameTableSize = sizeof(eventExceptionNames) / sizeof(eventExceptionNames[0]);
+#if XPATH_SUPPORT
} else if (code >= XPathExceptionOffset && code <= XPathExceptionMax) {
type = "DOM XPath";
// XPath exception codes start with 51 and we don't want 51 empty elements in the name array
code -= XPathExceptionOffset;
nameTable = xpathExceptionNames;
nameTableSize = sizeof(xpathExceptionNames) / sizeof(xpathExceptionNames[0]);
+#endif
} else {
nameIndex = code;
nameTable = exceptionNames;
my $hasRealParent = @{$dataNode->parents} > 0;
my $hasParent = $hasLegacyParent || $hasRealParent;
my $parentClassName = GetParentClassName($dataNode);
+ my $conditional = $dataNode->extendedAttributes->{"Conditional"};
# - Add default header template
@headerContent = split("\r", $headerTemplate);
push(@headerContent, "\n#ifndef $className" . "_H");
push(@headerContent, "\n#define $className" . "_H\n\n");
+ push(@headerContent, "#if ${conditional}_SUPPORT\n\n") if $conditional;
+
if (exists $dataNode->extendedAttributes->{"LegacyParent"}) {
push(@headerContent, GetLegacyHeaderIncludes($dataNode->extendedAttributes->{"LegacyParent"}));
} else {
}
push(@headerContent, "};\n\n");
- push(@headerContent, "}\n\n#endif\n");
+ push(@headerContent, "}\n\n");
+
+ push(@headerContent, "#endif // ${conditional}_SUPPORT\n\n") if $conditional;
+
+ push(@headerContent, "#endif\n");
}
sub GenerateImplementation
my $hasRealParent = @{$dataNode->parents} > 0;
my $hasParent = $hasLegacyParent || $hasRealParent;
my $parentClassName = GetParentClassName($dataNode);
+ my $conditional = $dataNode->extendedAttributes->{"Conditional"};
# - Add default header template
@implContentHeader = split("\r", $headerTemplate);
push(@implContentHeader, "\n");
- push(@implContentHeader,, "#include \"config.h\"\n");
+ push(@implContentHeader,, "#include \"config.h\"\n\n");
+
+ push(@implContentHeader, "#if ${conditional}_SUPPORT\n\n") if $conditional;
+
push(@implContentHeader, "#include \"$className.h\"\n\n");
-
AddIncludesForType($interfaceName);
@implContent = ();
}
push(@implContent, "\n}\n");
+
+ push(@implContent, "\n#endif // ${conditional}_SUPPORT\n") if $conditional;
}
sub GetNativeType
{
my $object = shift;
my $fileName = shift;
-
+ my $defines = shift;
+
print " | *** Starting to parse $fileName...\n |\n" if(!$beQuiet);
- open FILE, "-|", "/usr/bin/gcc", "-E", "-P", "-x", "c++", $fileName or die "Could not open $fileName";
+
+ open FILE, "-|", "/usr/bin/gcc", "-E", "-P", "-x", "c++",
+ (map { "-D$_" } split(/ /, $defines)), $fileName or die "Could not open $fileName";
my @documentContent = <FILE>;
close FILE;
my @idlDirectories;
my $outputDirectory;
my $generator;
+my $defines;
GetOptions('include=s@' => \@idlDirectories,
'outputdir=s' => \$outputDirectory,
- 'generator=s' => \$generator);
+ 'generator=s' => \$generator,
+ 'defines=s' => \$defines);
my $idlFile = $ARGV[0];
die('Must specify generator') unless defined($generator);
die('Must specify input file.') unless defined($idlFile);
die('Must specify output directory.') unless defined($outputDirectory);
+die('Must specify defines') unless defined($defines);
# Parse the given IDL file.
my $parser = IDLParser->new(1);
-
-my $document = $parser->Parse($idlFile);
+my $document = $parser->Parse($idlFile, $defines);
# Generate desired output for given IDL file.
my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory);
#ifndef CSS_cssstyleselector_h_
#define CSS_cssstyleselector_h_
+#include "DeprecatedString.h"
#include "render_style.h"
class KHTMLSettings;
Node adoptNode(in Node source)
raises (DOMException);
+#if XPATH_SUPPORT
// DOM Level 3 XPath (XPathEvaluator interface)
XPathExpression createExpression(in DOMString expression,
in XPathNSResolver resolver)
in unsigned short type,
in XPathResult inResult)
raises(DOMException);
+#endif
// Common extensions
// Mozilla has a separate XMLDocument object for XML documents.
// We just use Document for this.
attribute DocumentConstructor XMLDocument;
-
+
+#if XPATH_SUPPORT
attribute XPathEvaluatorConstructor XPathEvaluator;
attribute XPathResultConstructor XPathResult;
+#endif
};
}
*/
module xpath {
-
- interface [GenerateConstructor, CanBeConstructed] XPathEvaluator {
+ interface [GenerateConstructor, CanBeConstructed, Conditional=XPATH] XPathEvaluator {
XPathExpression createExpression(in DOMString expression,
in XPathNSResolver resolver)
raises(core::DOMException);
module xpath {
- interface XPathExpression {
+ interface [Conditional=XPATH] XPathExpression {
XPathResult evaluate(in Node contextNode,
in unsigned short type,
in XPathResult inResult)
return m_node ? m_node->lookupNamespaceURI(prefix) : String();
}
-#endif // XPATH_SUPPORT
-
}
+#endif // XPATH_SUPPORT
module xpath {
- interface XPathNSResolver {
+ interface [Conditional=XPATH] XPathNSResolver {
DOMString lookupNamespaceURI(in DOMString prefix);
};
}
return Node::XPATH_NAMESPACE_NODE;
}
-#endif // XPATH_SUPPORT
-
}
+#endif // XPATH_SUPPORT
+
module xpath {
- interface [GenerateConstructor] XPathResult {
+ interface [GenerateConstructor, Conditional=XPATH] XPathResult {
const unsigned short ANY_TYPE = 0;
const unsigned short NUMBER_TYPE = 1;
const unsigned short STRING_TYPE = 2;