[vala] Generate <c:include/> tags
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Generate <c:include/> tags
- Date: Thu, 26 Mar 2009 04:07:58 -0400 (EDT)
commit 40c913a452f3c95e8808f2715cb5680f42cbaebd
Author: Didier 'Ptitjes <ptitjes free fr>
Date: Fri Mar 20 15:47:03 2009 +0100
Generate <c:include/> tags
Signed-off-by: Didier 'Ptitjes <ptitjes free fr>
---
gobject/valagirwriter.vala | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/gobject/valagirwriter.vala b/gobject/valagirwriter.vala
index ad7582c..0c13c3e 100644
--- a/gobject/valagirwriter.vala
+++ b/gobject/valagirwriter.vala
@@ -68,6 +68,29 @@ public class Vala.GIRWriter : CodeVisitor {
stream = null;
}
+ private void write_c_includes (Namespace ns) {
+ // Collect C header filenames
+ Gee.Set<string> header_filenames = new Gee.HashSet<string> (str_hash, str_equal);
+ foreach (string c_header_filename in ns.get_cheader_filenames ()) {
+ header_filenames.add (c_header_filename);
+ }
+ foreach (Symbol symbol in ns.scope.get_symbol_table ().get_values ()) {
+ foreach (string c_header_filename in symbol.get_cheader_filenames ()) {
+ header_filenames.add (c_header_filename);
+ }
+ }
+
+ // Generate c:include tags
+ foreach (string c_header_filename in header_filenames) {
+ write_c_include (c_header_filename);
+ }
+ }
+
+ private void write_c_include (string name) {
+ write_indent ();
+ stream.printf ("<c:include name=\"%s\"/>\n", name);
+ }
+
public override void visit_namespace (Namespace ns) {
if (ns.external_package) {
return;
@@ -85,6 +108,8 @@ public class Vala.GIRWriter : CodeVisitor {
return;
}
+ write_c_includes (ns);
+
write_indent ();
stream.printf ("<namespace name=\"%s\" version=\"1.0\">\n", ns.name);
indent++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]