6 f
= open("svgtags.in", "r")
7 for i
in f
.xreadlines():
10 if i
.startswith("#"): continue
14 f
= open("svgattrs.in", "r")
15 for i
in f
.xreadlines():
18 if i
.startswith("#"): continue
22 f
= open("SVGNames.h", "w")
23 f
.write("#ifndef SVGNAMES_H\n")
24 f
.write("#define SVGNAMES_H\n")
26 f
.write("#include \"misc/htmlnames.h\"\n")
27 f
.write("#include \"dom/QualifiedName.h\"\n")
28 f
.write("#include \"xml/Document.h\"\n")
30 f
.write("#define idAttr ATTR_ID\n")
32 f
.write("namespace WebCore {\n")
33 f
.write(" namespace SVGNames {\n")
34 f
.write(" void init();\n");
40 f
.write(" " * 8 + "extern DOM::QualifiedName %sTag;\n" % (i
.replace("-", "_")))
41 definition
= definition
+ (" " * 8 + "DOM::QualifiedName %sTag;\n" % (i
.replace("-", "_")))
42 # ID_TEXT is hidden, we need to use ATTR_TEXT instead
44 initString
= initString
+ (" %sTag = DOM::QualifiedName(makeId(DOM::svgNamespace, localNamePart(ATTR_%s)), DOM::emptyPrefixName);\n" % (i
.replace("-", "_"), i
.upper().replace("-", "_")))
46 initString
= initString
+ (" %sTag = DOM::QualifiedName(makeId(DOM::svgNamespace, ID_%s), DOM::emptyPrefixName);\n" % (i
.replace("-", "_"), i
.upper().replace("-", "_")))
48 f
.write(" " * 8 + "extern DOM::QualifiedName %sAttr;\n" % (i
.replace("-", "_")))
49 definition
= definition
+ (" " * 8 + "DOM::QualifiedName %sAttr;\n" % (i
.replace("-", "_")))
50 initString
= initString
+ (" %sAttr = DOM::QualifiedName(ATTR_%s, DOM::emptyPrefixName);\n" % (i
.replace("-", "_"), i
.upper().replace("-", "_")))
52 f
.write(" namespace HTMLNames {\n")
53 f
.write(" " * 8 + "extern DOM::QualifiedName classAttr;\n")
54 definitionHtml
= definitionHtml
+ (" " * 8 + "DOM::QualifiedName classAttr;\n")
55 initString
= initString
+ (" WebCore::HTMLNames::classAttr = DOM::QualifiedName(ATTR_CLASS, DOM::emptyPrefixName);\n")
62 ############################################################
64 ############################################################
68 f
= open("xlinkattrs.in", "r")
69 for i
in f
.xreadlines():
72 if i
.startswith("#"): continue
76 f
= open("XLinkNames.h", "w")
77 f
.write("#ifndef XLinkNames_H\n")
78 f
.write("#define XLinkNames_H\n")
80 f
.write("#include \"misc/htmlnames.h\"\n")
81 f
.write("#include \"dom/QualifiedName.h\"\n")
82 f
.write("#include \"xml/Document.h\"\n")
84 f
.write("namespace WebCore {\n")
85 f
.write(" namespace XLinkNames {\n")
87 f
.write(" " * 8 + "extern DOM::QualifiedName %sAttr;\n" % (i
.replace("-", "_")))
88 definitionXLink
= definitionXLink
+ (" " * 8 + "DOM::QualifiedName %sAttr;\n" % (i
.replace("-", "_")))
89 initString
= initString
+ (" WebCore::XLinkNames::%sAttr = DOM::QualifiedName(ATTR_%s, DOM::emptyPrefixName);\n" % (i
.replace("-", "_"), i
.upper().replace("-", "_")))
96 ############################
97 # generate init function
98 ############################
100 f
= open("SVGNames.cpp", "w")
101 f
.write("#include \"svg/SVGNames.h\"\n\n")
102 f
.write("#include \"svg/XLinkNames.h\"\n\n")
103 f
.write("namespace WebCore {")
105 namespace HTMLNames {
108 namespace XLinkNames {
117 }\n""" % (definitionHtml
, definitionXLink
, definition
, initString
))