diff options
author | Juerg Billeter <j@bitron.ch> | 2008-04-20 13:09:27 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2008-04-20 13:09:27 +0000 |
commit | 7023590e16ff850522ce554b3eefada503c6b245 (patch) | |
tree | 3bb235823d9feff57f52c448b0ba161f9bb2b4e0 | |
parent | a6f643833c608f61bbca23485851cd42dc2178f1 (diff) | |
download | vala-7023590e16ff850522ce554b3eefada503c6b245.tar.gz |
Replace [Import] attribute by `extern' keyword, rename `is_imported'
2008-04-20 Juerg Billeter <j@bitron.ch>
* vala/valacfgbuilder.vala, vala/valaclass.vala,
vala/valacodecontext.vala, vala/valainterfacewriter.vala,
vala/valamember.vala, vala/valamemorymanager.vala,
vala/valamethod.vala, vala/valanamespace.vala,
vala/valaparser.vala, vala/valascanner.vala,
vala/valasemanticanalyzer.vala, vala/valasourcefile.vala,
vala/valasymbol.vala, vala/valatokentype.vala,
vala/valatypesymbol.vala, gobject/valaccodecompiler.vala,
gobject/valaccodegenerator.vala, gobject/valagidlwriter.vala,
vapigen/valagidlparser.vala, vapi/packages/gnome-keyring-1/,
vapi/packages/gstreamer-0.10/, vapi/packages/gtk+-2.0/,
vapi/packages/libgnome-menu/, vapi/packages/pango/:
Replace [Import] attribute by `extern' keyword, rename
`is_imported' property to `external' and `pkg' property to
`external_package' to harmonize used terms, fixes bug 480253
svn path=/trunk/; revision=1286
25 files changed, 120 insertions, 85 deletions
@@ -1,5 +1,24 @@ 2008-04-20 Jürg Billeter <j@bitron.ch> + * vala/valacfgbuilder.vala, vala/valaclass.vala, + vala/valacodecontext.vala, vala/valainterfacewriter.vala, + vala/valamember.vala, vala/valamemorymanager.vala, + vala/valamethod.vala, vala/valanamespace.vala, + vala/valaparser.vala, vala/valascanner.vala, + vala/valasemanticanalyzer.vala, vala/valasourcefile.vala, + vala/valasymbol.vala, vala/valatokentype.vala, + vala/valatypesymbol.vala, gobject/valaccodecompiler.vala, + gobject/valaccodegenerator.vala, gobject/valagidlwriter.vala, + vapigen/valagidlparser.vala, vapi/packages/gnome-keyring-1/, + vapi/packages/gstreamer-0.10/, vapi/packages/gtk+-2.0/, + vapi/packages/libgnome-menu/, vapi/packages/pango/: + + Replace [Import] attribute by `extern' keyword, rename + `is_imported' property to `external' and `pkg' property to + `external_package' to harmonize used terms, fixes bug 480253 + +2008-04-20 Jürg Billeter <j@bitron.ch> + * vapi/packages/gtk+-2.0/: fix GtkBuilderError binding * vapi/gtk+-2.0.vapi: regenerated diff --git a/gobject/valaccodecompiler.vala b/gobject/valaccodecompiler.vala index a604c07f8..06f4a7380 100644 --- a/gobject/valaccodecompiler.vala +++ b/gobject/valaccodecompiler.vala @@ -59,7 +59,7 @@ public class Vala.CCodeCompiler : Object { pc += " gthread-2.0"; } foreach (string pkg in context.get_packages ()) { - if (package_exists(pkg)) + if (package_exists (pkg)) pc += " " + pkg; } string pkgflags; @@ -106,7 +106,7 @@ public class Vala.CCodeCompiler : Object { /* we're only interested in non-pkg source files */ var source_files = context.get_source_files (); foreach (SourceFile file in source_files) { - if (!file.pkg) { + if (!file.external_package) { cmdline += " " + Shell.quote (file.get_csource_filename ()); } } @@ -126,7 +126,7 @@ public class Vala.CCodeCompiler : Object { /* remove generated C source and header files */ foreach (SourceFile file in source_files) { - if (!file.pkg) { + if (!file.external_package) { if (!context.save_csources) FileUtils.unlink (file.get_csource_filename ()); if (!context.save_cheaders) diff --git a/gobject/valaccodegenerator.vala b/gobject/valaccodegenerator.vala index 21cf4c49a..f24adc0fd 100644 --- a/gobject/valaccodegenerator.vala +++ b/gobject/valaccodegenerator.vala @@ -263,7 +263,7 @@ public class Vala.CCodeGenerator : CodeGenerator { /* we're only interested in non-pkg source files */ var source_files = context.get_source_files (); foreach (SourceFile file in source_files) { - if (!file.pkg) { + if (!file.external_package) { file.accept (this); } } diff --git a/gobject/valagidlwriter.vala b/gobject/valagidlwriter.vala index e0cffff22..1b2d0b833 100644 --- a/gobject/valagidlwriter.vala +++ b/gobject/valagidlwriter.vala @@ -63,7 +63,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_namespace (Namespace ns) { - if (ns.pkg) { + if (ns.external_package) { return; } @@ -85,7 +85,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_class (Class cl) { - if (cl.source_reference != null && cl.source_reference.file.pkg) { + if (cl.external_package) { return; } @@ -143,7 +143,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_struct (Struct st) { - if (st.source_reference != null && st.source_reference.file.pkg) { + if (st.external_package) { return; } @@ -164,7 +164,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_interface (Interface iface) { - if (iface.source_reference != null && iface.source_reference.file.pkg) { + if (iface.external_package) { return; } @@ -211,7 +211,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_enum (Enum en) { - if (en.source_reference != null && en.source_reference.file.pkg) { + if (en.external_package) { return; } @@ -238,7 +238,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_error_domain (ErrorDomain edomain) { - if (edomain.source_reference != null && edomain.source_reference.file.pkg) { + if (edomain.external_package) { return; } @@ -264,7 +264,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_constant (Constant c) { - if (c.source_reference != null && c.source_reference.file.pkg) { + if (c.external_package) { return; } @@ -277,7 +277,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_field (Field f) { - if (f.source_reference != null && f.source_reference.file.pkg) { + if (f.external_package) { return; } @@ -347,7 +347,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_delegate (Delegate cb) { - if (cb.source_reference != null && cb.source_reference.file.pkg) { + if (cb.external_package) { return; } @@ -370,7 +370,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_method (Method m) { - if (m.source_reference != null && m.source_reference.file.pkg) { + if (m.external_package) { return; } @@ -399,7 +399,7 @@ public class Vala.GIdlWriter : CodeVisitor { } public override void visit_creation_method (CreationMethod m) { - if (m.source_reference != null && m.source_reference.file.pkg) { + if (m.external_package) { return; } diff --git a/vala/valacfgbuilder.vala b/vala/valacfgbuilder.vala index d2aff68c9..9fe05e80e 100644 --- a/vala/valacfgbuilder.vala +++ b/vala/valacfgbuilder.vala @@ -88,7 +88,7 @@ public class Vala.CFGBuilder : CodeVisitor { /* we're only interested in non-pkg source files */ var source_files = context.get_source_files (); foreach (SourceFile file in source_files) { - if (!file.pkg) { + if (!file.external_package) { file.accept (this); } } diff --git a/vala/valaclass.vala b/vala/valaclass.vala index 72951bfa9..082cf712d 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -264,7 +264,7 @@ public class Vala.Class : Typesymbol { prop.this_parameter = new FormalParameter ("this", new ClassType (this)); prop.scope.add (prop.this_parameter.name, prop.this_parameter); - if (!no_field && source_reference != null && !source_reference.file.pkg) { + if (!no_field && !external_package) { bool empty_get = (prop.get_accessor != null && prop.get_accessor.body == null); bool empty_set = (prop.set_accessor != null && prop.set_accessor.body == null); diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala index 41253c096..e884aaa4d 100644 --- a/vala/valacodecontext.vala +++ b/vala/valacodecontext.vala @@ -233,7 +233,7 @@ public class Vala.CodeContext : Object { /* find cycles in dependencies between source files */ foreach (SourceFile file in source_files) { /* we're only interested in internal source files */ - if (file.pkg) { + if (file.external_package) { continue; } @@ -255,7 +255,7 @@ public class Vala.CodeContext : Object { */ foreach (SourceFile file2 in source_files) { /* we're only interested in internal source files */ - if (file2.pkg) { + if (file2.external_package) { continue; } diff --git a/vala/valainterfacewriter.vala b/vala/valainterfacewriter.vala index 8e27dda24..1206daa18 100644 --- a/vala/valainterfacewriter.vala +++ b/vala/valainterfacewriter.vala @@ -60,7 +60,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_namespace (Namespace ns) { - if (ns.pkg) { + if (ns.external_package) { return; } @@ -85,7 +85,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_class (Class cl) { - if (cl.source_reference != null && cl.source_reference.file.pkg) { + if (cl.external_package) { return; } @@ -178,7 +178,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_struct (Struct st) { - if (st.source_reference != null && st.source_reference.file.pkg) { + if (st.external_package) { return; } @@ -220,7 +220,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_interface (Interface iface) { - if (iface.source_reference != null && iface.source_reference.file.pkg) { + if (iface.external_package) { return; } @@ -290,7 +290,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_enum (Enum en) { - if (en.source_reference != null && en.source_reference.file.pkg) { + if (en.external_package) { return; } @@ -359,7 +359,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_error_domain (ErrorDomain edomain) { - if (edomain.source_reference != null && edomain.source_reference.file.pkg) { + if (edomain.external_package) { return; } @@ -401,7 +401,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_constant (Constant c) { - if (c.source_reference != null && c.source_reference.file.pkg) { + if (c.external_package) { return; } @@ -422,7 +422,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_field (Field f) { - if (f.source_reference != null && f.source_reference.file.pkg) { + if (f.external_package) { return; } @@ -542,7 +542,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_delegate (Delegate cb) { - if (cb.source_reference != null && cb.source_reference.file.pkg) { + if (cb.external_package) { return; } @@ -587,7 +587,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_method (Method m) { - if (m.source_reference != null && m.source_reference.file.pkg) { + if (m.external_package) { return; } diff --git a/vala/valamember.vala b/vala/valamember.vala index 120ae7e92..f19ccd6c5 100644 --- a/vala/valamember.vala +++ b/vala/valamember.vala @@ -40,7 +40,7 @@ public class Vala.Member : Symbol { add_cheader_filename (filename); } - if (cheader_filenames.size == 0 && source_reference != null && !source_reference.file.pkg) { + if (cheader_filenames.size == 0 && source_reference != null && !external_package) { // don't add default include directives for VAPI files cheader_filenames.add (source_reference.file.get_cinclude_filename ()); } diff --git a/vala/valamemorymanager.vala b/vala/valamemorymanager.vala index 7b2317005..2a4bc9210 100644 --- a/vala/valamemorymanager.vala +++ b/vala/valamemorymanager.vala @@ -58,7 +58,7 @@ public class Vala.MemoryManager : CodeVisitor { } public override void visit_source_file (SourceFile source_file) { - if (!source_file.pkg) { + if (!source_file.external_package) { source_file.accept_children (this); } } diff --git a/vala/valamethod.vala b/vala/valamethod.vala index d976bcc5d..10cd38d57 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -374,8 +374,6 @@ public class Vala.Method : Member { no_array_length = true; } else if (a.name == "PrintfFormat") { printf_format = true; - } else if (a.name == "Import") { - is_imported = true; } } } diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala index 8483fbed8..254684049 100644 --- a/vala/valanamespace.vala +++ b/vala/valanamespace.vala @@ -27,11 +27,6 @@ using Gee; * Represents a namespace declaration in the source code. */ public class Vala.Namespace : Symbol { - /** - * Specifies whether this namespace is only used in a VAPI package file. - */ - public bool pkg { get; set; } - private Gee.List<Class> classes = new ArrayList<Class> (); private Gee.List<Interface> interfaces = new ArrayList<Interface> (); private Gee.List<Struct> structs = new ArrayList<Struct> (); diff --git a/vala/valaparser.vala b/vala/valaparser.vala index 4b0b0c1c8..f17363fe4 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -52,10 +52,11 @@ public class Vala.Parser : CodeVisitor { NONE, ABSTRACT = 1 << 0, CLASS = 1 << 1, - INLINE = 1 << 2, - OVERRIDE = 1 << 3, - STATIC = 1 << 4, - VIRTUAL = 1 << 5 + EXTERN = 1 << 2, + INLINE = 1 << 3, + OVERRIDE = 1 << 4, + STATIC = 1 << 5, + VIRTUAL = 1 << 6 } construct { @@ -186,6 +187,7 @@ public class Vala.Parser : CodeVisitor { case TokenType.ENUM: case TokenType.ENSURES: case TokenType.ERRORDOMAIN: + case TokenType.EXTERN: case TokenType.FALSE: case TokenType.FINALLY: case TokenType.FOR: @@ -1751,6 +1753,7 @@ public class Vala.Parser : CodeVisitor { case TokenType.DELEGATE: case TokenType.ENUM: case TokenType.ERRORDOMAIN: + case TokenType.EXTERN: case TokenType.INLINE: case TokenType.INTERFACE: case TokenType.NAMESPACE: @@ -1792,7 +1795,6 @@ public class Vala.Parser : CodeVisitor { expect (TokenType.NAMESPACE); var sym = parse_symbol_name (); var ns = new Namespace (sym.name, get_src_com (begin)); - ns.pkg = scanner.source_file.pkg; set_attributes (ns, attrs); parse_declarations (ns); return ns; @@ -1805,8 +1807,8 @@ public class Vala.Parser : CodeVisitor { // merge if namespace already exists var old_ns = (Namespace) ns.scope.lookup (sym.name); var new_ns = (Namespace) sym; - if (!new_ns.pkg) { - old_ns.pkg = false; + if (old_ns.external_package && !new_ns.external_package) { + old_ns.source_reference = new_ns.source_reference; } foreach (Class cl in new_ns.get_classes ()) { if (old_ns.scope.lookup (cl.name) is Class) { @@ -1938,7 +1940,7 @@ public class Vala.Parser : CodeVisitor { parse_declarations (cl); // ensure there is always a default construction method - if (!scanner.source_file.pkg + if (!scanner.source_file.external_package && !cl.is_static && cl.default_construction_method == null) { var m = new CreationMethod (cl.name, null, cl.source_reference); @@ -1952,7 +1954,6 @@ public class Vala.Parser : CodeVisitor { while (sym.inner != null) { sym = sym.inner; var ns = new Namespace (sym.name, cl.source_reference); - ns.pkg = scanner.source_file.pkg; if (result is Namespace) { ns.add_namespace ((Namespace) result); } else { @@ -2094,6 +2095,9 @@ public class Vala.Parser : CodeVisitor { if (ModifierFlags.INLINE in flags) { method.is_inline = true; } + if (ModifierFlags.EXTERN in flags) { + method.external = true; + } expect (TokenType.OPEN_PARENS); if (current () != TokenType.CLOSE_PARENS) { do { @@ -2265,7 +2269,6 @@ public class Vala.Parser : CodeVisitor { while (sym.inner != null) { sym = sym.inner; var ns = new Namespace (sym.name, st.source_reference); - ns.pkg = scanner.source_file.pkg; if (result is Namespace) { ns.add_namespace ((Namespace) result); } else { @@ -2317,7 +2320,7 @@ public class Vala.Parser : CodeVisitor { } if (accept (TokenType.SEMICOLON)) { - iface.is_imported = true; + iface.external = true; iface.declaration_only = true; } else { parse_declarations (iface); @@ -2327,7 +2330,6 @@ public class Vala.Parser : CodeVisitor { while (sym.inner != null) { sym = sym.inner; var ns = new Namespace (sym.name, iface.source_reference); - ns.pkg = scanner.source_file.pkg; if (result is Namespace) { ns.add_namespace ((Namespace) result); } else { @@ -2408,7 +2410,6 @@ public class Vala.Parser : CodeVisitor { while (sym.inner != null) { sym = sym.inner; var ns = new Namespace (sym.name, en.source_reference); - ns.pkg = scanner.source_file.pkg; if (result is Namespace) { ns.add_namespace ((Namespace) result); } else { @@ -2463,7 +2464,6 @@ public class Vala.Parser : CodeVisitor { while (sym.inner != null) { sym = sym.inner; var ns = new Namespace (sym.name, ed.source_reference); - ns.pkg = scanner.source_file.pkg; if (result is Namespace) { ns.add_namespace ((Namespace) result); } else { @@ -2499,6 +2499,10 @@ public class Vala.Parser : CodeVisitor { next (); flags |= ModifierFlags.ABSTRACT; break; + case TokenType.EXTERN: + next (); + flags |= ModifierFlags.EXTERN; + break; case TokenType.STATIC: next (); flags |= ModifierFlags.STATIC; @@ -2522,6 +2526,10 @@ public class Vala.Parser : CodeVisitor { next (); flags |= ModifierFlags.CLASS; break; + case TokenType.EXTERN: + next (); + flags |= ModifierFlags.EXTERN; + break; case TokenType.INLINE: next (); flags |= ModifierFlags.INLINE; @@ -2659,7 +2667,6 @@ public class Vala.Parser : CodeVisitor { while (sym.inner != null) { sym = sym.inner; var ns = new Namespace (sym.name, d.source_reference); - ns.pkg = scanner.source_file.pkg; if (result is Namespace) { ns.add_namespace ((Namespace) result); } else { @@ -2769,6 +2776,7 @@ public class Vala.Parser : CodeVisitor { case TokenType.DELEGATE: case TokenType.ENUM: case TokenType.ERRORDOMAIN: + case TokenType.EXTERN: case TokenType.INLINE: case TokenType.INTERFACE: case TokenType.NAMESPACE: diff --git a/vala/valascanner.vala b/vala/valascanner.vala index 237567b15..62017b7c7 100644 --- a/vala/valascanner.vala +++ b/vala/valascanner.vala @@ -185,6 +185,9 @@ public class Vala.Scanner : Object { case 'd': if (matches (begin, "delete")) return TokenType.DELETE; break; + case 'e': + if (matches (begin, "extern")) return TokenType.EXTERN; + break; case 'i': if (matches (begin, "inline")) return TokenType.INLINE; break; diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 85d893b85..9ed52631e 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -174,7 +174,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } /* VAPI classes don't have to specify overridden methods */ - if (!cl.source_reference.file.pkg) { + if (!cl.external_package) { /* all abstract symbols defined in base types have to be at least defined (or implemented) also in this type */ foreach (DataType base_type in cl.get_base_types ()) { if (base_type.data_type is Interface) { @@ -323,7 +323,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public override void visit_constant (Constant c) { c.type_reference.accept (this); - if (!current_source_file.pkg) { + if (!c.external_package) { if (c.initializer == null) { c.error = true; Report.error (c.source_reference, "A const field requires a initializer to be provided"); @@ -413,7 +413,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (current_symbol is Class) { /* VAPI classes don't specify overridden methods */ - if (!current_symbol.source_reference.file.pkg) { + if (!current_symbol.external_package) { if (!(m is CreationMethod)) { find_base_interface_method (m, (Class) current_symbol); if (m.is_virtual || m.overrides) { @@ -689,7 +689,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { var cl = (Class) prop.parent_symbol; /* VAPI classes don't specify overridden properties */ - if (!cl.source_reference.file.pkg) { + if (!cl.external_package) { find_base_interface_property (prop, cl); if (prop.is_virtual || prop.overrides) { find_base_class_property (prop, cl); @@ -720,7 +720,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_return_type = new VoidType (); } - if (!acc.source_reference.file.pkg) { + if (!acc.prop.external_package) { if (acc.body == null && !acc.prop.interface_only && !acc.prop.is_abstract) { /* no accessor body specified, insert default body */ diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala index e04cf2496..662d8cd70 100644 --- a/vala/valasourcefile.vala +++ b/vala/valasourcefile.vala @@ -40,7 +40,7 @@ public class Vala.SourceFile : Object { /** * Specifies whether this file is a VAPI package file. */ - public bool pkg { get; set; } + public bool external_package { get; set; } /** * Specifies the dependency cycle this source file is member of. If this @@ -98,7 +98,7 @@ public class Vala.SourceFile : Object { */ public SourceFile (CodeContext context, string filename, bool pkg = false) { this.filename = filename; - this.pkg = pkg; + this.external_package = pkg; this.context = context; } @@ -231,7 +231,7 @@ public class Vala.SourceFile : Object { * @param dep_type type of dependency */ public void add_symbol_dependency (Symbol? sym, SourceFileDependencyType dep_type) { - if (pkg) { + if (external_package) { return; } @@ -255,7 +255,7 @@ public class Vala.SourceFile : Object { } if (dep_type == SourceFileDependencyType.SOURCE) { - if (s.source_reference.file.pkg) { + if (s.external_package) { foreach (string fn in s.get_cheader_filenames ()) { source_external_includes.add (fn); } @@ -267,7 +267,7 @@ public class Vala.SourceFile : Object { return; } - if (s.source_reference.file.pkg) { + if (s.external_package) { /* external package */ foreach (string fn in s.get_cheader_filenames ()) { header_external_includes.add (fn); diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala index c10e32b31..07c6cecd6 100644 --- a/vala/valasymbol.vala +++ b/vala/valasymbol.vala @@ -94,16 +94,33 @@ public abstract class Vala.Symbol : CodeNode { public Scope scope { get { return _scope; } } - + + /** + * Specifies whether the implementation is external, for example in + * a separate C source file or in an external library. + */ + public bool external { + get { + return _external || (parent_symbol != null && parent_symbol.external) + || external_package; + } + set { _external = value; } + } + /** - * Specifies whether this is an imported symbol e.g. the Import - * attribute has been set. + * Specifies whether the implementation is in an external library. */ - public bool is_imported { get; set; } + public bool external_package { + get { + return (source_reference != null && source_reference.file.external_package); + } + } private weak Scope _owner; private Scope _scope; + private bool _external; + construct { _scope = new Scope (this); active = true; diff --git a/vala/valatokentype.vala b/vala/valatokentype.vala index 5a508471b..decb2905a 100644 --- a/vala/valatokentype.vala +++ b/vala/valatokentype.vala @@ -65,6 +65,7 @@ public enum Vala.TokenType { ENSURES, ERRORDOMAIN, EOF, + EXTERN, FALSE, FINALLY, FOR, diff --git a/vala/valatypesymbol.vala b/vala/valatypesymbol.vala index f1f342ec3..24901a4ab 100644 --- a/vala/valatypesymbol.vala +++ b/vala/valatypesymbol.vala @@ -198,7 +198,7 @@ public abstract class Vala.Typesymbol : Symbol { add_cheader_filename (filename); } - if (cheader_filenames.size == 0 && source_reference != null && !source_reference.file.pkg) { + if (cheader_filenames.size == 0 && source_reference != null && !external_package) { // don't add default include directives for VAPI files cheader_filenames.add (source_reference.file.get_cinclude_filename ()); } diff --git a/vapi/packages/gnome-keyring-1/gnome-keyring-1-custom.vala b/vapi/packages/gnome-keyring-1/gnome-keyring-1-custom.vala index 9a8f728a3..704f7a32e 100644 --- a/vapi/packages/gnome-keyring-1/gnome-keyring-1-custom.vala +++ b/vapi/packages/gnome-keyring-1/gnome-keyring-1-custom.vala @@ -5,8 +5,7 @@ namespace GnomeKeyring [CCode (free_function = "gnome_keyring_attribute_list_free")] public class AttributeList { - [Import] - public Attribute index (int i); + public extern Attribute index (int i); [NoArrayLength] public Attribute[] data; diff --git a/vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala b/vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala index 7ed882c6a..5003782bb 100644 --- a/vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala +++ b/vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala @@ -21,6 +21,5 @@ */ namespace Gst { - [Import] - public void init ([CCode (array_length_pos = 0.9)] ref string[] args); + public extern void init ([CCode (array_length_pos = 0.9)] ref string[] args); } diff --git a/vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala b/vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala index 144115e5e..22b8ef76c 100644 --- a/vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala +++ b/vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala @@ -29,20 +29,16 @@ namespace Gtk { } public class Widget { - [Import] - public Widget (GLib.Type type, ...); + public extern Widget (GLib.Type type, ...); - [Import] [CCode (cname = "GTK_WIDGET_FLAGS")] - public WidgetFlags get_flags (); + public extern WidgetFlags get_flags (); - [Import] [CCode (cname = "GTK_WIDGET_SET_FLAGS")] - public void set_flags (WidgetFlags flags); + public extern void set_flags (WidgetFlags flags); - [Import] [CCode (cname = "GTK_WIDGET_UNSET_FLAGS")] - public void unset_flags (WidgetFlags flags); + public extern void unset_flags (WidgetFlags flags); } public interface FileChooserEmbed { diff --git a/vapi/packages/libgnome-menu/libgnome-menu-custom.vala b/vapi/packages/libgnome-menu/libgnome-menu-custom.vala index 810a6aab4..1cb1811cb 100644 --- a/vapi/packages/libgnome-menu/libgnome-menu-custom.vala +++ b/vapi/packages/libgnome-menu/libgnome-menu-custom.vala @@ -22,8 +22,7 @@ namespace GMenu { public class TreeItem { - [Import] - public TreeItemType get_type (); + public extern TreeItemType get_type (); } } diff --git a/vapi/packages/pango/pango-custom.vala b/vapi/packages/pango/pango-custom.vala index 067a100d8..b7df1ba13 100644 --- a/vapi/packages/pango/pango-custom.vala +++ b/vapi/packages/pango/pango-custom.vala @@ -22,7 +22,6 @@ namespace Pango { public class Language { - [Import] - public weak string to_string (); + public extern weak string to_string (); } } diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index d991073f5..36d66a4ab 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -193,7 +193,9 @@ public class Vala.GIdlParser : CodeVisitor { Namespace ns; if (sym is Namespace) { ns = (Namespace) sym; - ns.pkg = false; + if (ns.external_package) { + ns.source_reference = current_source_reference; + } } else { ns = new Namespace (module.name, current_source_reference); } |