diff options
author | Jürg Billeter <j@bitron.ch> | 2008-06-20 19:43:49 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2008-06-20 19:43:49 +0000 |
commit | 202c2f2222047b89c5daf16e206961b250695f70 (patch) | |
tree | 8a50b1f6f704a0b6f76bc55bf569123d9876be4c /vapigen | |
parent | 3d5392b2f267e2753574e6da1530f9d0afcc3925 (diff) | |
download | vala-202c2f2222047b89c5daf16e206961b250695f70.tar.gz |
Support 'cheader_filename' attribute for constants and errordomains, based
2008-06-20 Jürg Billeter <j@bitron.ch>
* vapigen/valagidlparser.vala:
Support 'cheader_filename' attribute for constants and
errordomains, based on patch by Michael Lawrence, fixes bug 533634
svn path=/trunk/; revision=1620
Diffstat (limited to 'vapigen')
-rw-r--r-- | vapigen/valagidlparser.vala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index f7434dfa7..746c514b0 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -770,6 +770,8 @@ public class Vala.GIdlParser : CodeVisitor { bool is_errordomain = false; + var cheader_filenames = new ArrayList<string> (); + var en_attributes = get_attributes (node.name); if (en_attributes != null) { foreach (string attr in en_attributes) { @@ -777,6 +779,7 @@ public class Vala.GIdlParser : CodeVisitor { if (nv[0] == "common_prefix") { common_prefix = eval (nv[1]); } else if (nv[0] == "cheader_filename") { + cheader_filenames.add (eval (nv[1])); en.add_cheader_filename (eval (nv[1])); } else if (nv[0] == "hidden") { if (eval (nv[1]) == "1") { @@ -804,6 +807,10 @@ public class Vala.GIdlParser : CodeVisitor { ed.access = SymbolAccessibility.PUBLIC; ed.set_cprefix (common_prefix); + foreach (string filename in cheader_filenames) { + ed.add_cheader_filename (filename); + } + foreach (EnumValue ev in en.get_values ()) { ed.add_code (new ErrorCode (ev.name)); } @@ -1625,11 +1632,15 @@ public class Vala.GIdlParser : CodeVisitor { return null; } + var c = new Constant (node.name, type, null, current_source_reference); + string[] attributes = get_attributes (node.name); if (attributes != null) { foreach (string attr in attributes) { var nv = attr.split ("=", 2); - if (nv[0] == "hidden") { + if (nv[0] == "cheader_filename") { + c.add_cheader_filename (eval (nv[1])); + } else if (nv[0] == "hidden") { if (eval (nv[1]) == "1") { return null; } @@ -1637,7 +1648,6 @@ public class Vala.GIdlParser : CodeVisitor { } } - var c = new Constant (node.name, type, null, current_source_reference); c.access = SymbolAccessibility.PUBLIC; return c; |