3 from xml.etree import ElementTree
8 * This file has been auto-generated from the introspection data available
9 * in the at-spi2-core repository. The D-Bus procol is defined in this
10 * repository, which can be found at:
12 * http://download.gnome.org/sources/at-spi2-core/0.1/
23 * This file has been auto-generated from the introspection data available
24 * in the at-spi2-core repository. The D-Bus procol is defined in this
25 * repository, which can be found at:
27 * http://download.gnome.org/sources/at-spi2-core/0.1/
32 #ifndef SPI_INTROSPECTION_DATA_H_
33 #define SPI_INTROSPECTION_DATA_H_
37 #endif /* SPI_INTROSPECTION_DATA_H_ */
42 extern const char *%s;
53 def convert_name (name):
54 return "spi_" + name.replace (".", "_")
56 def convert_contents (contents):
57 contents = contents.replace ("\"", "\\\"")
58 literals = ["\"%s\"" % (line) for line in contents.split ("\n")]
59 return "\n".join (literals)
62 #Open the XML file and process includes.
63 tree = ElementTree.parse ("Processed.xml")
64 root = tree.getroot ()
66 #Open the output files.
67 cfile = open ("introspection.c", "w")
68 hfile = open ("introspection.h", "w")
73 for itf in root.findall ("node/interface"):
74 #Get and convert the name of the interface.
75 name = convert_name (itf.attrib["name"])
77 #Create the introspection string with version information.
78 itf.attrib["version"] = VERSION
79 contents = convert_contents (ElementTree.tostring (itf))
81 hcontents += DECTEMPLATE % (name)
82 ccontents += DEFTEMPLATE % (name, contents)
84 cfile.write (CTEMPLATE % (ccontents))
85 hfile.write (HTEMPLATE % (hcontents))
90 if __name__ == "__main__":
91 sys.exit(main(sys.argv))