diff options
83 files changed, 2088 insertions, 2464 deletions
@@ -1,3 +1,51 @@ +2007-07-21 Jürg Billeter <j@bitron.ch> + + * vala/Makefile.am, vala/parser.y, vala/scanner.l, vala/vala.h, + vala/valaarray.vala, vala/valaarraylengthfield.vala, + vala/valaarrayresizemethod.vala, vala/valaattributeprocessor.vala, + vala/valablock.vala, vala/valabreakstatement.vala, + vala/valacallback.vala, vala/valaclass.vala, + vala/valacodecontext.vala, vala/valacodenode.vala, + vala/valacodevisitor.vala, vala/valaconstant.vala, + vala/valaconstructor.vala, vala/valacontinuestatement.vala, + vala/valacreationmethod.vala, vala/valadatatype.vala, + vala/valadeclarationstatement.vala, vala/valadestructor.vala, + vala/valadostatement.vala, vala/valaemptystatement.vala, + vala/valaenum.vala, vala/valaenumvalue.vala, + vala/valaexpressionstatement.vala, vala/valafield.vala, + vala/valaflags.vala, vala/valaflagsvalue.vala, + vala/valaforeachstatement.vala, vala/valaformalparameter.vala, + vala/valaforstatement.vala, vala/valaifstatement.vala, + vala/valainterface.vala, vala/valainterfacewriter.vala, + vala/valalockstatement.vala, vala/valamember.vala, + vala/valamemorymanager.vala, vala/valamethod.vala, + vala/valanamespace.vala, vala/valaproperty.vala, + vala/valapropertyaccessor.vala, vala/valareturnstatement.vala, + vala/valascope.vala, vala/valasemanticanalyzer.vala, + vala/valasignal.vala, vala/valasourcefile.vala, + vala/valastatement.vala, vala/valastruct.vala, + vala/valaswitchstatement.vala, vala/valasymbol.vala, + vala/valasymbolbuilder.vala, vala/valasymbolresolver.vala, + vala/valathrowstatement.vala, vala/valatrystatement.vala, + vala/valatypeparameter.vala, vala/valatypereference.vala, + vala/valavariabledeclarator.vala, vala/valawhilestatement.vala, + gobject/valacodegenerator.vala, + gobject/valacodegeneratorassignment.vala, + gobject/valacodegeneratorclass.vala, + gobject/valacodegeneratorinterface.vala, + gobject/valacodegeneratorinvocationexpression.vala, + gobject/valacodegeneratormemberaccess.vala, + gobject/valacodegeneratormethod.vala, + gobject/valacodegeneratorsignal.vala, + gobject/valacodegeneratorstruct.vala, compiler/valacompiler.vala, + vapi/atk.vala, vapi/gdk-2.0.vala, vapi/gio-standalone.vala, + vapi/glib-2.0.vala, vapi/gstreamer-0.10.vala, vapi/gtk+-2.0.vala, + vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala, + vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala, vapi/pango.vala, + vapi/vte.vala, vapigen/valagidlparser.vala, vapigen/valavapigen.vala: + derive from Symbol class where appropriate and move symbol table into + separate Scope class + 2007-07-21 Raffaele Sandrini <raffaele@sandrini.ch> * vapi/zlib.vala: add basic zlib support diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala index 7ac07ff54..e824f0e20 100644 --- a/compiler/valacompiler.vala +++ b/compiler/valacompiler.vala @@ -199,13 +199,6 @@ class Vala.Compiler { return quit (); } - var builder = new SymbolBuilder (); - builder.build (context); - - if (Report.get_errors () > 0) { - return quit (); - } - var attributeprocessor = new AttributeProcessor (); attributeprocessor.process (context); diff --git a/gobject/valacodegenerator.vala b/gobject/valacodegenerator.vala index 81ae1f5b1..426389000 100644 --- a/gobject/valacodegenerator.vala +++ b/gobject/valacodegenerator.vala @@ -190,57 +190,57 @@ public class Vala.CodeGenerator : CodeVisitor { root_symbol = context.root; bool_type = new TypeReference (); - bool_type.data_type = (DataType) root_symbol.lookup ("bool").node; + bool_type.data_type = (DataType) root_symbol.scope.lookup ("bool"); char_type = new TypeReference (); - char_type.data_type = (DataType) root_symbol.lookup ("char").node; + char_type.data_type = (DataType) root_symbol.scope.lookup ("char"); unichar_type = new TypeReference (); - unichar_type.data_type = (DataType) root_symbol.lookup ("unichar").node; + unichar_type.data_type = (DataType) root_symbol.scope.lookup ("unichar"); short_type = new TypeReference (); - short_type.data_type = (DataType) root_symbol.lookup ("short").node; + short_type.data_type = (DataType) root_symbol.scope.lookup ("short"); ushort_type = new TypeReference (); - ushort_type.data_type = (DataType) root_symbol.lookup ("ushort").node; + ushort_type.data_type = (DataType) root_symbol.scope.lookup ("ushort"); int_type = new TypeReference (); - int_type.data_type = (DataType) root_symbol.lookup ("int").node; + int_type.data_type = (DataType) root_symbol.scope.lookup ("int"); uint_type = new TypeReference (); - uint_type.data_type = (DataType) root_symbol.lookup ("uint").node; + uint_type.data_type = (DataType) root_symbol.scope.lookup ("uint"); long_type = new TypeReference (); - long_type.data_type = (DataType) root_symbol.lookup ("long").node; + long_type.data_type = (DataType) root_symbol.scope.lookup ("long"); ulong_type = new TypeReference (); - ulong_type.data_type = (DataType) root_symbol.lookup ("ulong").node; + ulong_type.data_type = (DataType) root_symbol.scope.lookup ("ulong"); int64_type = new TypeReference (); - int64_type.data_type = (DataType) root_symbol.lookup ("int64").node; + int64_type.data_type = (DataType) root_symbol.scope.lookup ("int64"); uint64_type = new TypeReference (); - uint64_type.data_type = (DataType) root_symbol.lookup ("uint64").node; + uint64_type.data_type = (DataType) root_symbol.scope.lookup ("uint64"); float_type = new TypeReference (); - float_type.data_type = (DataType) root_symbol.lookup ("float").node; + float_type.data_type = (DataType) root_symbol.scope.lookup ("float"); double_type = new TypeReference (); - double_type.data_type = (DataType) root_symbol.lookup ("double").node; + double_type.data_type = (DataType) root_symbol.scope.lookup ("double"); string_type = new TypeReference (); - string_type.data_type = (DataType) root_symbol.lookup ("string").node; - substring_method = (Method) string_type.data_type.symbol.lookup ("substring").node; + string_type.data_type = (DataType) root_symbol.scope.lookup ("string"); + substring_method = (Method) string_type.data_type.scope.lookup ("substring"); - var glib_ns = root_symbol.lookup ("GLib"); + var glib_ns = root_symbol.scope.lookup ("GLib"); - list_type = (DataType) glib_ns.lookup ("List").node; - slist_type = (DataType) glib_ns.lookup ("SList").node; + list_type = (DataType) glib_ns.scope.lookup ("List"); + slist_type = (DataType) glib_ns.scope.lookup ("SList"); mutex_type = new TypeReference (); - mutex_type.data_type = (DataType) glib_ns.lookup ("Mutex").node; + mutex_type.data_type = (DataType) glib_ns.scope.lookup ("Mutex"); - type_module_type = (DataType) glib_ns.lookup ("TypeModule").node; + type_module_type = (DataType) glib_ns.scope.lookup ("TypeModule"); if (context.module_init_method != null) { module_init_fragment = new CCodeFragment (); @@ -304,28 +304,6 @@ public class Vala.CodeGenerator : CodeVisitor { cenum.add_value (ev.get_cname (), val); } - public override void visit_flags (Flags! fl) { - cenum = new CCodeEnum (fl.get_cname ()); - - if (fl.source_reference.comment != null) { - header_type_definition.append (new CCodeComment (fl.source_reference.comment)); - } - header_type_definition.append (cenum); - - fl.accept_children (this); - } - - public override void visit_flags_value (FlagsValue! fv) { - string val; - if (fv.value is LiteralExpression) { - var lit = ((LiteralExpression) fv.value).literal; - if (lit is IntegerLiteral) { - val = ((IntegerLiteral) lit).value; - } - } - cenum.add_value (fv.get_cname (), val); - } - public override void visit_callback (Callback! cb) { cb.accept_children (this); @@ -346,21 +324,21 @@ public class Vala.CodeGenerator : CodeVisitor { public override void visit_member (Member! m) { /* stuff meant for all lockable members */ if (m is Lockable && ((Lockable)m).get_lock_used ()) { - instance_priv_struct.add_field (mutex_type.get_cname (), get_symbol_lock_name (m.symbol)); + instance_priv_struct.add_field (mutex_type.get_cname (), get_symbol_lock_name (m)); instance_init_fragment.append ( new CCodeExpressionStatement ( new CCodeAssignment ( new CCodeMemberAccess.pointer ( new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), - get_symbol_lock_name (m.symbol)), + get_symbol_lock_name (m)), new CCodeFunctionCall (new CCodeIdentifier (((Struct)mutex_type.data_type).default_construction_method.get_cname ()))))); var fc = new CCodeFunctionCall (new CCodeIdentifier ("VALA_FREE_CHECKED")); fc.add_argument ( new CCodeMemberAccess.pointer ( new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), - get_symbol_lock_name (m.symbol))); + get_symbol_lock_name (m))); fc.add_argument (new CCodeIdentifier (mutex_type.data_type.get_free_function ())); if (instance_dispose_fragment != null) { instance_dispose_fragment.append (new CCodeExpressionStatement (fc)); @@ -371,8 +349,8 @@ public class Vala.CodeGenerator : CodeVisitor { public override void visit_constant (Constant! c) { c.accept_children (this); - if (c.symbol.parent_symbol.node is DataType) { - var t = (DataType) c.symbol.parent_symbol.node; + if (c.parent_symbol is DataType) { + var t = (DataType) c.parent_symbol; var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ()); var arr = ""; if (c.type_reference.data_type is Array) { @@ -405,8 +383,8 @@ public class Vala.CodeGenerator : CodeVisitor { st = instance_priv_struct; lhs = new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), f.get_cname ()); } else { - if (f.symbol.parent_symbol.node is DataType) { - var t = (DataType) f.symbol.parent_symbol.node; + if (f.parent_symbol is DataType) { + var t = (DataType) f.parent_symbol; var cdecl = new CCodeDeclaration (f.type_reference.get_cname ()); var var_decl = new CCodeVariableDeclarator (f.get_cname ()); if (f.initializer != null) { @@ -439,7 +417,7 @@ public class Vala.CodeGenerator : CodeVisitor { if (f.type_reference.data_type is Array && !f.no_array_length && f.initializer is ArrayCreationExpression) { var ma = new MemberAccess.simple (f.name); - ma.symbol_reference = f.symbol; + ma.symbol_reference = f; var array_len_lhs = get_array_length_cexpression (ma, 1); var sizes = ((ArrayCreationExpression) f.initializer).get_sizes (); @@ -465,11 +443,13 @@ public class Vala.CodeGenerator : CodeVisitor { public override void visit_property (Property! prop) { prop.accept_children (this); - prop_enum.add_value (prop.get_upper_case_cname (), null); + if (prop.parent_symbol is Class) { + prop_enum.add_value (prop.get_upper_case_cname (), null); + } } public override void visit_property_accessor (PropertyAccessor! acc) { - var prop = (Property) acc.symbol.parent_symbol.node; + var prop = (Property) acc.prop; if (acc.readable) { current_return_type = prop.type_reference; @@ -482,7 +462,7 @@ public class Vala.CodeGenerator : CodeVisitor { current_return_type = null; - var t = (DataType) prop.symbol.parent_symbol.node; + var t = (DataType) prop.parent_symbol; var this_type = new TypeReference (); this_type.data_type = t; @@ -585,7 +565,7 @@ public class Vala.CodeGenerator : CodeVisitor { c.accept_children (this); - var cl = (Class) c.symbol.parent_symbol.node; + var cl = (Class) c.parent_symbol; function = new CCodeFunction ("%s_constructor".printf (cl.get_lower_case_cname (null)), "GObject *"); function.modifiers = CCodeModifiers.STATIC; @@ -666,11 +646,11 @@ public class Vala.CodeGenerator : CodeVisitor { } public override void visit_begin_block (Block! b) { - current_symbol = b.symbol; + current_symbol = b; } private void add_object_creation (CCodeBlock! b) { - var cl = (Class) current_type_symbol.node; + var cl = (Class) current_type_symbol; var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_newv")); ccall.add_argument (new CCodeConstant (cl.get_type_id ())); @@ -689,12 +669,12 @@ public class Vala.CodeGenerator : CodeVisitor { public override void visit_end_block (Block! b) { var local_vars = b.get_local_variables (); foreach (VariableDeclarator decl in local_vars) { - decl.symbol.active = false; + decl.active = false; } var cblock = new CCodeBlock (); - foreach (Statement stmt in b.get_statements ()) { + foreach (CodeNode stmt in b.get_statements ()) { var src = stmt.source_reference; if (src != null && src.comment != null) { cblock.add_statement (new CCodeComment (src.comment)); @@ -773,7 +753,7 @@ public class Vala.CodeGenerator : CodeVisitor { cfrag.append (new CCodeExpressionStatement (czero)); } else { - Report.warning (decl.source_reference, "unable to initialize a variable of type `%s'".printf (decl.type_reference.data_type.symbol.get_full_name ())); + Report.warning (decl.source_reference, "unable to initialize a variable of type `%s'".printf (decl.type_reference.data_type.get_full_name ())); } } } @@ -849,7 +829,7 @@ public class Vala.CodeGenerator : CodeVisitor { decl.ccodenode = new CCodeVariableDeclarator.with_initializer (get_variable_cname (decl.name), rhs); - decl.symbol.active = true; + decl.active = true; } public override void visit_end_initializer_list (InitializerList! list) { @@ -885,7 +865,7 @@ public class Vala.CodeGenerator : CodeVisitor { unref_function = type.data_type.get_free_function (); } return new CCodeIdentifier (unref_function); - } else if (type.type_parameter != null && current_class != null) { + } else if (type.type_parameter != null && current_type_symbol is Class) { string func_name = "%s_destroy_func".printf (type.type_parameter.name.down ()); return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), func_name); } else { @@ -907,7 +887,7 @@ public class Vala.CodeGenerator : CodeVisitor { var cisnull = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, cvar, new CCodeConstant ("NULL")); if (type.data_type == null) { - if (current_class == null) { + if (!(current_type_symbol is Class)) { return new CCodeConstant ("NULL"); } @@ -1150,9 +1130,10 @@ public class Vala.CodeGenerator : CodeVisitor { var cfrag = new CCodeFragment (); append_temp_decl (cfrag, temp_vars); - cfrag.append (stmt.ccodenode); + // FIXME cast to CodeNode shouldn't be necessary as Statement requires CodeNode + cfrag.append (((CodeNode) stmt).ccodenode); - stmt.ccodenode = cfrag; + ((CodeNode) stmt).ccodenode = cfrag; } public override void visit_if_statement (IfStatement! stmt) { @@ -1200,7 +1181,7 @@ public class Vala.CodeGenerator : CodeVisitor { } var cblock = new CCodeBlock (); - foreach (Statement body_stmt in section.get_statements ()) { + foreach (CodeNode body_stmt in section.get_statements ()) { if (body_stmt.ccodenode is CCodeFragment) { foreach (CCodeStatement cstmt in ((CCodeFragment) body_stmt.ccodenode).get_children ()) { cblock.add_statement (cstmt); @@ -1224,7 +1205,7 @@ public class Vala.CodeGenerator : CodeVisitor { if (default_statements != null) { var cblock = new CCodeBlock (); - foreach (Statement body_stmt in default_statements) { + foreach (CodeNode body_stmt in default_statements) { cblock.add_statement ((CCodeStatement) body_stmt.ccodenode); } @@ -1411,21 +1392,21 @@ public class Vala.CodeGenerator : CodeVisitor { } private void append_local_free (Symbol sym, CCodeFragment cfrag, bool stop_at_loop) { - var b = (Block) sym.node; + var b = (Block) sym; var local_vars = b.get_local_variables (); foreach (VariableDeclarator decl in local_vars) { - if (decl.symbol.active && decl.type_reference.data_type.is_reference_type () && decl.type_reference.takes_ownership) { + if (decl.active && decl.type_reference.data_type.is_reference_type () && decl.type_reference.takes_ownership) { cfrag.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (get_variable_cname (decl.name)), decl.type_reference))); } } - if (sym.parent_symbol.node is Block) { + if (sym.parent_symbol is Block) { append_local_free (sym.parent_symbol, cfrag, stop_at_loop); } } - private void create_local_free (Statement stmt) { + private void create_local_free (CodeNode stmt) { if (!memory_management) { return; } @@ -1441,17 +1422,17 @@ public class Vala.CodeGenerator : CodeVisitor { private bool append_local_free_expr (Symbol sym, CCodeCommaExpression ccomma, bool stop_at_loop) { var found = false; - var b = (Block) sym.node; + var b = (Block) sym; var local_vars = b.get_local_variables (); foreach (VariableDeclarator decl in local_vars) { - if (decl.symbol.active && decl.type_reference.data_type.is_reference_type () && decl.type_reference.takes_ownership) { + if (decl.active && decl.type_reference.data_type.is_reference_type () && decl.type_reference.takes_ownership) { found = true; ccomma.append_expression (get_unref_expression (new CCodeIdentifier (get_variable_cname (decl.name)), decl.type_reference)); } } - if (sym.parent_symbol.node is Block) { + if (sym.parent_symbol is Block) { found = found || append_local_free_expr (sym.parent_symbol, ccomma, stop_at_loop); } @@ -1483,9 +1464,8 @@ public class Vala.CodeGenerator : CodeVisitor { if (stmt.return_expression != null) { // avoid unnecessary ref/unref pair if (stmt.return_expression.ref_missing && - stmt.return_expression.symbol_reference != null && - stmt.return_expression.symbol_reference.node is VariableDeclarator) { - var decl = (VariableDeclarator) stmt.return_expression.symbol_reference.node; + stmt.return_expression.symbol_reference is VariableDeclarator) { + var decl = (VariableDeclarator) stmt.return_expression.symbol_reference; if (decl.type_reference.takes_ownership) { /* return expression is local variable taking ownership and * current method is transferring ownership */ @@ -1509,15 +1489,14 @@ public class Vala.CodeGenerator : CodeVisitor { // avoid unnecessary ref/unref pair if (stmt.return_expression.ref_sink && - stmt.return_expression.symbol_reference != null && - stmt.return_expression.symbol_reference.node is VariableDeclarator) { - var decl = (VariableDeclarator) stmt.return_expression.symbol_reference.node; + stmt.return_expression.symbol_reference is VariableDeclarator) { + var decl = (VariableDeclarator) stmt.return_expression.symbol_reference; if (decl.type_reference.takes_ownership) { /* return expression is local variable taking ownership and * current method is transferring ownership */ // don't unref expression - return_expression_symbol = decl.symbol; + return_expression_symbol = decl; return_expression_symbol.active = false; } } @@ -1647,21 +1626,21 @@ public class Vala.CodeGenerator : CodeVisitor { if (inner_node == null) { l = new CCodeIdentifier ("self"); - } else if (stmt.resource.symbol_reference.parent_symbol.node != current_class) { - l = new CCodeFunctionCall (new CCodeIdentifier (((DataType) stmt.resource.symbol_reference.parent_symbol.node).get_upper_case_cname ())); + } else if (stmt.resource.symbol_reference.parent_symbol != current_type_symbol) { + l = new CCodeFunctionCall (new CCodeIdentifier (((DataType) stmt.resource.symbol_reference.parent_symbol).get_upper_case_cname ())); ((CCodeFunctionCall) l).add_argument ((CCodeExpression)inner_node.ccodenode); } else { l = (CCodeExpression)inner_node.ccodenode; } l = new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (l, "priv"), get_symbol_lock_name (stmt.resource.symbol_reference)); - fc = new CCodeFunctionCall (new CCodeIdentifier (((Method)mutex_type.data_type.symbol.lookup ("lock").node).get_cname ())); + fc = new CCodeFunctionCall (new CCodeIdentifier (((Method) mutex_type.data_type.scope.lookup ("lock")).get_cname ())); fc.add_argument (l); cn.append (new CCodeExpressionStatement (fc)); cn.append (stmt.body.ccodenode); - fc = new CCodeFunctionCall (new CCodeIdentifier (((Method)mutex_type.data_type.symbol.lookup ("unlock").node).get_cname ())); + fc = new CCodeFunctionCall (new CCodeIdentifier (((Method) mutex_type.data_type.scope.lookup ("unlock")).get_cname ())); fc.add_argument (l); cn.append (new CCodeExpressionStatement (fc)); @@ -1777,8 +1756,8 @@ public class Vala.CodeGenerator : CodeVisitor { List<weak CCodeExpression> size = invocation_expr.get_array_sizes (); return size.nth_data (dim - 1); } else if (array_expr.symbol_reference != null) { - if (array_expr.symbol_reference.node is FormalParameter) { - var param = (FormalParameter) array_expr.symbol_reference.node; + if (array_expr.symbol_reference is FormalParameter) { + var param = (FormalParameter) array_expr.symbol_reference; if (!param.no_array_length) { var length_expr = new CCodeIdentifier (get_array_length_cname (param.name, dim)); if (is_out) { @@ -1787,16 +1766,16 @@ public class Vala.CodeGenerator : CodeVisitor { return length_expr; } } - } else if (array_expr.symbol_reference.node is VariableDeclarator) { - var decl = (VariableDeclarator) array_expr.symbol_reference.node; + } else if (array_expr.symbol_reference is VariableDeclarator) { + var decl = (VariableDeclarator) array_expr.symbol_reference; var length_expr = new CCodeIdentifier (get_array_length_cname (decl.name, dim)); if (is_out) { return new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, length_expr); } else { return length_expr; } - } else if (array_expr.symbol_reference.node is Field) { - var field = (Field) array_expr.symbol_reference.node; + } else if (array_expr.symbol_reference is Field) { + var field = (Field) array_expr.symbol_reference; if (!field.no_array_length) { var length_cname = get_array_length_cname (field.name, dim); @@ -1811,7 +1790,7 @@ public class Vala.CodeGenerator : CodeVisitor { if (current_type_symbol != null) { /* base type is available if this is a type method */ - base_type = (DataType) current_type_symbol.node; + base_type = (DataType) current_type_symbol; } } else { pub_inst = (CCodeExpression) ma.inner.ccodenode; @@ -1823,9 +1802,9 @@ public class Vala.CodeGenerator : CodeVisitor { if (field.instance) { CCodeExpression typed_inst; - if (field.symbol.parent_symbol.node != base_type) { + if (field.parent_symbol != base_type) { // FIXME: use C cast if debugging disabled - typed_inst = new CCodeFunctionCall (new CCodeIdentifier (((DataType) field.symbol.parent_symbol.node).get_upper_case_cname (null))); + typed_inst = new CCodeFunctionCall (new CCodeIdentifier (((DataType) field.parent_symbol).get_upper_case_cname (null))); ((CCodeFunctionCall) typed_inst).add_argument (pub_inst); } else { typed_inst = pub_inst; @@ -1836,7 +1815,7 @@ public class Vala.CodeGenerator : CodeVisitor { } else { inst = typed_inst; } - if (((DataType) field.symbol.parent_symbol.node).is_reference_type ()) { + if (((DataType) field.parent_symbol).is_reference_type ()) { length_expr = new CCodeMemberAccess.pointer (inst, length_cname); } else { length_expr = new CCodeMemberAccess (inst, length_cname); @@ -1904,7 +1883,7 @@ public class Vala.CodeGenerator : CodeVisitor { MemberAccess ma = find_property_access (expr.inner); if (ma != null) { // property postfix expression - var prop = (Property) ma.symbol_reference.node; + var prop = (Property) ma.symbol_reference; var ccomma = new CCodeCommaExpression (); @@ -1944,7 +1923,7 @@ public class Vala.CodeGenerator : CodeVisitor { } var ma = (MemberAccess) expr; - if (ma.symbol_reference.node is Property) { + if (ma.symbol_reference is Property) { return ma; } @@ -2070,9 +2049,9 @@ public class Vala.CodeGenerator : CodeVisitor { expr.ccodenode = ccall; } - } else if (expr.symbol_reference.node is Method) { + } else if (expr.symbol_reference is Method) { // use creation method - var m = (Method) expr.symbol_reference.node; + var m = (Method) expr.symbol_reference; var params = m.get_parameters (); var ccall = new CCodeFunctionCall (new CCodeIdentifier (m.get_cname ())); @@ -2154,10 +2133,10 @@ public class Vala.CodeGenerator : CodeVisitor { } expr.ccodenode = ccall; - } else if (expr.symbol_reference.node is EnumValue) { + } else if (expr.symbol_reference is EnumValue) { // error code - var ev = (EnumValue) expr.symbol_reference.node; - var en = (Enum) ev.symbol.parent_symbol.node; + var ev = (EnumValue) expr.symbol_reference; + var en = (Enum) ev.parent_symbol; var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error")); ccall.add_argument (new CCodeIdentifier ("error")); diff --git a/gobject/valacodegeneratorassignment.vala b/gobject/valacodegeneratorassignment.vala index 56307cd6b..6b70064ea 100644 --- a/gobject/valacodegeneratorassignment.vala +++ b/gobject/valacodegeneratorassignment.vala @@ -31,10 +31,10 @@ public class Vala.CodeGenerator { ma = (MemberAccess)a.left; } - if (a.left.symbol_reference != null && a.left.symbol_reference.node is Property) { - var prop = (Property) a.left.symbol_reference.node; + if (a.left.symbol_reference is Property) { + var prop = (Property) a.left.symbol_reference; - if (current_class != null && ma.inner == null && in_creation_method) { + if (current_type_symbol is Class && ma.inner == null && in_creation_method) { // this property is used as a construction parameter var cpointer = new CCodeIdentifier ("__params_it"); @@ -111,10 +111,10 @@ public class Vala.CodeGenerator { a.ccodenode = ccomma; } - } else if (a.left.symbol_reference != null && a.left.symbol_reference.node is Signal) { - var sig = (Signal) a.left.symbol_reference.node; + } else if (a.left.symbol_reference is Signal) { + var sig = (Signal) a.left.symbol_reference; - var m = (Method) a.right.symbol_reference.node; + var m = (Method) a.right.symbol_reference; string connect_func; bool disconnect = false; @@ -152,7 +152,7 @@ public class Vala.CodeGenerator { temp_vars.prepend (temp_decl); var parse_call = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_parse_name")); parse_call.add_argument (sig.get_canonical_cconstant ()); - var decl_type = (DataType) sig.symbol.parent_symbol.node; + var decl_type = (DataType) sig.parent_symbol; parse_call.add_argument (new CCodeIdentifier (decl_type.get_type_id ())); parse_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (temp_decl.name))); parse_call.add_argument (new CCodeConstant ("NULL")); @@ -258,7 +258,7 @@ public class Vala.CodeGenerator { } private CCodeFunctionCall get_property_set_call (Property! prop, MemberAccess! ma, CCodeExpression! cexpr) { - var cl = (Class) prop.symbol.parent_symbol.node; + var cl = (Class) prop.parent_symbol; var set_func = "g_object_set"; var base_property = prop; @@ -268,7 +268,7 @@ public class Vala.CodeGenerator { } else if (prop.base_interface_property != null) { base_property = prop.base_interface_property; } - var base_property_type = (DataType) base_property.symbol.parent_symbol.node; + var base_property_type = (DataType) base_property.parent_symbol; set_func = "%s_set_%s".printf (base_property_type.get_lower_case_cname (null), base_property.name); } @@ -281,16 +281,16 @@ public class Vala.CodeGenerator { if (ma.inner == null) { instance = new CCodeIdentifier ("self"); /* require casts for inherited properties */ - req_cast = (base_property.symbol.parent_symbol != current_type_symbol); + req_cast = (base_property.parent_symbol != current_type_symbol); } else { instance = (CCodeExpression) ma.inner.ccodenode; /* require casts if the type of the used instance is * different than the type which declared the property */ - req_cast = base_property.symbol.parent_symbol.node != ma.inner.static_type.data_type; + req_cast = base_property.parent_symbol != ma.inner.static_type.data_type; } - if (req_cast && ((DataType) prop.symbol.parent_symbol.node).is_reference_type ()) { - var ccast = new CCodeFunctionCall (new CCodeIdentifier (((DataType) base_property.symbol.parent_symbol.node).get_upper_case_cname (null))); + if (req_cast && ((DataType) prop.parent_symbol).is_reference_type ()) { + var ccast = new CCodeFunctionCall (new CCodeIdentifier (((DataType) base_property.parent_symbol).get_upper_case_cname (null))); ccast.add_argument (instance); instance = ccast; } diff --git a/gobject/valacodegeneratorclass.vala b/gobject/valacodegeneratorclass.vala index fef05ec20..10e24bd85 100644 --- a/gobject/valacodegeneratorclass.vala +++ b/gobject/valacodegeneratorclass.vala @@ -25,8 +25,17 @@ using GLib; public class Vala.CodeGenerator { public override void visit_class (Class! cl) { - current_symbol = cl.symbol; - current_type_symbol = cl.symbol; + var old_symbol = current_symbol; + var old_type_symbol = current_type_symbol; + var old_class = current_class; + var old_instance_struct = instance_struct; + var old_type_struct = type_struct; + var old_instance_priv_struct = instance_priv_struct; + var old_prop_enum = prop_enum; + var old_instance_init_fragment = instance_init_fragment; + var old_instance_dispose_fragment = instance_dispose_fragment; + current_symbol = cl; + current_type_symbol = cl; current_class = cl; if (cl.is_static) { @@ -121,9 +130,15 @@ public class Vala.CodeGenerator { } } - current_type_symbol = null; - current_class = null; - instance_dispose_fragment = null; + current_type_symbol = old_type_symbol; + current_class = old_class; + instance_dispose_fragment = old_instance_dispose_fragment; + instance_struct = old_instance_struct; + type_struct = old_type_struct; + instance_priv_struct = old_instance_priv_struct; + prop_enum = old_prop_enum; + instance_init_fragment = old_instance_init_fragment; + instance_dispose_fragment = old_instance_dispose_fragment; } private void add_class_init_function (Class! cl) { @@ -186,7 +201,7 @@ public class Vala.CodeGenerator { if (m.base_method == null) { continue; } - var base_type = m.base_method.symbol.parent_symbol.node; + var base_type = m.base_method.parent_symbol; var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (((Class) base_type).get_upper_case_cname (null)))); ccast.add_argument (new CCodeIdentifier ("klass")); @@ -270,7 +285,7 @@ public class Vala.CodeGenerator { continue; } - var base_type = m.base_interface_method.symbol.parent_symbol.node; + var base_type = m.base_interface_method.parent_symbol; if (base_type != iface) { continue; } @@ -298,9 +313,9 @@ public class Vala.CodeGenerator { init_block.add_statement (instance_init_fragment); - var init_sym = cl.symbol.lookup ("init"); + var init_sym = cl.scope.lookup ("init"); if (init_sym != null) { - var init_fun = (Method) init_sym.node; + var init_fun = (Method) init_sym; init_block.add_statement (init_fun.body.ccodenode); } diff --git a/gobject/valacodegeneratorinterface.vala b/gobject/valacodegeneratorinterface.vala index f07715d98..29253dd5f 100644 --- a/gobject/valacodegeneratorinterface.vala +++ b/gobject/valacodegeneratorinterface.vala @@ -25,8 +25,8 @@ using GLib; public class Vala.CodeGenerator { public override void visit_interface (Interface! iface) { - current_symbol = iface.symbol; - current_type_symbol = iface.symbol; + current_symbol = iface; + current_type_symbol = iface; if (!iface.is_static) { type_struct = new CCodeStruct ("_%s".printf (iface.get_type_cname ())); diff --git a/gobject/valacodegeneratorinvocationexpression.vala b/gobject/valacodegeneratorinvocationexpression.vala index 617323b89..7cdc76518 100644 --- a/gobject/valacodegeneratorinvocationexpression.vala +++ b/gobject/valacodegeneratorinvocationexpression.vala @@ -38,8 +38,8 @@ public class Vala.CodeGenerator { var ma = (MemberAccess) expr.call; - if (expr.call.symbol_reference.node is Invokable) { - var i = (Invokable) expr.call.symbol_reference.node; + if (expr.call.symbol_reference is Invokable) { + var i = (Invokable) expr.call.symbol_reference; params = i.get_parameters (); if (i is Method) { @@ -50,7 +50,7 @@ public class Vala.CodeGenerator { } if (m is ArrayResizeMethod) { - var array = (Array) m.symbol.parent_symbol.node; + var array = (Array) m.parent_symbol; ccall.add_argument (new CCodeIdentifier (array.get_cname ())); } @@ -70,21 +70,21 @@ public class Vala.CodeGenerator { if (ma.inner == null) { instance = new CCodeIdentifier ("self"); /* require casts for overriden and inherited methods */ - req_cast = m.overrides || m.base_interface_method != null || (m.symbol.parent_symbol != current_type_symbol); + req_cast = m.overrides || m.base_interface_method != null || (m.parent_symbol != current_type_symbol); } else { instance = (CCodeExpression) ma.inner.ccodenode; /* reqiure casts if the type of the used instance is * different than the type which declared the method */ - req_cast = base_method.symbol.parent_symbol.node != ma.inner.static_type.data_type; + req_cast = base_method.parent_symbol != ma.inner.static_type.data_type; } - if (m.instance_by_reference && (ma.inner != null || m.symbol.parent_symbol != current_type_symbol)) { + if (m.instance_by_reference && (ma.inner != null || m.parent_symbol != current_type_symbol)) { instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance); } - if (req_cast && ((DataType) m.symbol.parent_symbol.node).is_reference_type ()) { + if (req_cast && ((DataType) m.parent_symbol).is_reference_type ()) { // FIXME: use C cast if debugging disabled - var ccall = new CCodeFunctionCall (new CCodeIdentifier (((DataType) base_method.symbol.parent_symbol.node).get_upper_case_cname (null))); + var ccall = new CCodeFunctionCall (new CCodeIdentifier (((DataType) base_method.parent_symbol).get_upper_case_cname (null))); ccall.add_argument (instance); instance = ccall; } diff --git a/gobject/valacodegeneratormemberaccess.vala b/gobject/valacodegeneratormemberaccess.vala index b6c1876d7..3e2b8c5dd 100644 --- a/gobject/valacodegeneratormemberaccess.vala +++ b/gobject/valacodegeneratormemberaccess.vala @@ -25,18 +25,18 @@ using GLib; public class Vala.CodeGenerator { private void process_cmember (MemberAccess! expr, CCodeExpression pub_inst, DataType base_type) { - if (expr.symbol_reference.node is Method) { - var m = (Method) expr.symbol_reference.node; + if (expr.symbol_reference is Method) { + var m = (Method) expr.symbol_reference; if (expr.inner is BaseAccess) { if (m.base_interface_method != null) { - var base_iface = (Interface) m.base_interface_method.symbol.parent_symbol.node; + var base_iface = (Interface) m.base_interface_method.parent_symbol; string parent_iface_var = "%s_%s_parent_iface".printf (current_class.get_lower_case_cname (null), base_iface.get_lower_case_cname (null)); expr.ccodenode = new CCodeMemberAccess.pointer (new CCodeIdentifier (parent_iface_var), m.name); return; } else if (m.base_method != null) { - var base_class = (Class) m.base_method.symbol.parent_symbol.node; + var base_class = (Class) m.base_method.parent_symbol; var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (base_class.get_upper_case_cname (null)))); vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (current_class.get_lower_case_cname (null)))); @@ -52,15 +52,15 @@ public class Vala.CodeGenerator { } else { expr.ccodenode = new CCodeIdentifier (m.get_cname ()); } - } else if (expr.symbol_reference.node is ArrayLengthField) { + } else if (expr.symbol_reference is ArrayLengthField) { expr.ccodenode = get_array_length_cexpression (expr.inner, 1); - } else if (expr.symbol_reference.node is Field) { - var f = (Field) expr.symbol_reference.node; + } else if (expr.symbol_reference is Field) { + var f = (Field) expr.symbol_reference; if (f.instance) { CCodeExpression typed_inst; - if (f.symbol.parent_symbol.node != base_type) { + if (f.parent_symbol != base_type) { // FIXME: use C cast if debugging disabled - typed_inst = new CCodeFunctionCall (new CCodeIdentifier (((DataType) f.symbol.parent_symbol.node).get_upper_case_cname (null))); + typed_inst = new CCodeFunctionCall (new CCodeIdentifier (((DataType) f.parent_symbol).get_upper_case_cname (null))); ((CCodeFunctionCall) typed_inst).add_argument (pub_inst); } else { typed_inst = pub_inst; @@ -71,7 +71,7 @@ public class Vala.CodeGenerator { } else { inst = typed_inst; } - if (((DataType) f.symbol.parent_symbol.node).is_reference_type ()) { + if (((DataType) f.parent_symbol).is_reference_type ()) { expr.ccodenode = new CCodeMemberAccess.pointer (inst, f.get_cname ()); } else { expr.ccodenode = new CCodeMemberAccess (inst, f.get_cname ()); @@ -79,11 +79,11 @@ public class Vala.CodeGenerator { } else { expr.ccodenode = new CCodeIdentifier (f.get_cname ()); } - } else if (expr.symbol_reference.node is Constant) { - var c = (Constant) expr.symbol_reference.node; + } else if (expr.symbol_reference is Constant) { + var c = (Constant) expr.symbol_reference; expr.ccodenode = new CCodeIdentifier (c.get_cname ()); - } else if (expr.symbol_reference.node is Property) { - var prop = (Property) expr.symbol_reference.node; + } else if (expr.symbol_reference is Property) { + var prop = (Property) expr.symbol_reference; if (!prop.no_accessor_method) { var base_property = prop; @@ -92,7 +92,7 @@ public class Vala.CodeGenerator { } else if (prop.base_interface_property != null) { base_property = prop.base_interface_property; } - var base_property_type = (DataType) base_property.symbol.parent_symbol.node; + var base_property_type = (DataType) base_property.parent_symbol; var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_get_%s".printf (base_property_type.get_lower_case_cname (null), base_property.name))); CCodeExpression typed_pub_inst = pub_inst; @@ -133,14 +133,14 @@ public class Vala.CodeGenerator { ccomma.append_expression (ctemp); expr.ccodenode = ccomma; } - } else if (expr.symbol_reference.node is EnumValue) { - var ev = (EnumValue) expr.symbol_reference.node; + } else if (expr.symbol_reference is EnumValue) { + var ev = (EnumValue) expr.symbol_reference; expr.ccodenode = new CCodeConstant (ev.get_cname ()); - } else if (expr.symbol_reference.node is VariableDeclarator) { - var decl = (VariableDeclarator) expr.symbol_reference.node; + } else if (expr.symbol_reference is VariableDeclarator) { + var decl = (VariableDeclarator) expr.symbol_reference; expr.ccodenode = new CCodeIdentifier (get_variable_cname (decl.name)); - } else if (expr.symbol_reference.node is FormalParameter) { - var p = (FormalParameter) expr.symbol_reference.node; + } else if (expr.symbol_reference is FormalParameter) { + var p = (FormalParameter) expr.symbol_reference; if (p.name == "this") { expr.ccodenode = pub_inst; } else { @@ -150,9 +150,9 @@ public class Vala.CodeGenerator { expr.ccodenode = new CCodeIdentifier (p.name); } } - } else if (expr.symbol_reference.node is Signal) { - var sig = (Signal) expr.symbol_reference.node; - var cl = (DataType) sig.symbol.parent_symbol.node; + } else if (expr.symbol_reference is Signal) { + var sig = (Signal) expr.symbol_reference; + var cl = (DataType) sig.parent_symbol; if (sig.has_emitter) { var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_%s".printf (cl.get_lower_case_cname (null), sig.name))); @@ -196,7 +196,7 @@ public class Vala.CodeGenerator { if (current_type_symbol != null) { /* base type is available if this is a type method */ - base_type = (DataType) current_type_symbol.node; + base_type = (DataType) current_type_symbol; if (!base_type.is_reference_type ()) { pub_inst = new CCodeIdentifier ("(*self)"); diff --git a/gobject/valacodegeneratormethod.vala b/gobject/valacodegeneratormethod.vala index 62e95ffe6..678826f0f 100644 --- a/gobject/valacodegeneratormethod.vala +++ b/gobject/valacodegeneratormethod.vala @@ -28,7 +28,7 @@ public class Vala.CodeGenerator { Method old_method = current_method; TypeReference old_return_type = current_return_type; bool old_method_inner_error = current_method_inner_error; - current_symbol = m.symbol; + current_symbol = m; current_method = m; current_return_type = m.return_type; current_method_inner_error = false; @@ -40,7 +40,7 @@ public class Vala.CodeGenerator { m.accept_children (this); if (m is CreationMethod) { - if (current_class != null && m.body != null) { + if (current_type_symbol is Class && m.body != null) { add_object_creation ((CCodeBlock) m.body.ccodenode); } @@ -54,8 +54,8 @@ public class Vala.CodeGenerator { current_return_type = old_return_type; current_method_inner_error = old_method_inner_error; - if (current_type_symbol != null && current_type_symbol.node is Interface) { - var iface = (Interface) current_type_symbol.node; + if (current_type_symbol != null && current_type_symbol is Interface) { + var iface = (Interface) current_type_symbol; if (iface.is_static) { return; } @@ -71,11 +71,11 @@ public class Vala.CodeGenerator { this_type.data_type = find_parent_type (m); if (m.base_interface_method != null) { var base_type = new TypeReference (); - base_type.data_type = (DataType) m.base_interface_method.symbol.parent_symbol.node; + base_type.data_type = (DataType) m.base_interface_method.parent_symbol; instance_param = new CCodeFormalParameter ("base", base_type.get_cname ()); } else if (m.overrides) { var base_type = new TypeReference (); - base_type.data_type = (DataType) m.base_method.symbol.parent_symbol.node; + base_type.data_type = (DataType) m.base_method.parent_symbol; instance_param = new CCodeFormalParameter ("base", base_type.get_cname ()); } else { if (m.instance_by_reference) { @@ -98,7 +98,7 @@ public class Vala.CodeGenerator { } } - if (m is CreationMethod && current_class != null) { + if (m is CreationMethod && current_type_symbol is Class) { // memory management for generic types foreach (TypeParameter type_param in current_class.get_type_parameters ()) { var cparam = new CCodeFormalParameter ("%s_destroy_func".printf (type_param.name.down ()), "GDestroyNotify"); @@ -178,8 +178,8 @@ public class Vala.CodeGenerator { var cinit = new CCodeFragment (); function.block.prepend_statement (cinit); - if (m.symbol.parent_symbol.node is Class) { - var cl = (Class) m.symbol.parent_symbol.node; + if (m.parent_symbol is Class) { + var cl = (Class) m.parent_symbol; if (m.overrides || m.base_interface_method != null) { var ccall = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null))); ccall.add_argument (new CCodeIdentifier ("base")); @@ -217,7 +217,7 @@ public class Vala.CodeGenerator { source_type_member_definition.append (function); if (m is CreationMethod) { - if (current_class != null) { + if (current_type_symbol is Class) { int n_params = ((CreationMethod) m).n_construction_params; n_params += (int) current_class.get_type_parameters ().length (); @@ -266,7 +266,7 @@ public class Vala.CodeGenerator { cinit.append (new CCodeExpressionStatement (ccomma)); } } else { - var st = (Struct) m.symbol.parent_symbol.node; + var st = (Struct) m.parent_symbol; var cdecl = new CCodeDeclaration (st.get_cname () + "*"); var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_new0")); ccall.add_argument (new CCodeConstant (st.get_cname ())); @@ -287,7 +287,7 @@ public class Vala.CodeGenerator { var vfunc = new CCodeFunction (m.get_cname (), m.return_type.get_cname ()); var this_type = new TypeReference (); - this_type.data_type = (DataType) m.symbol.parent_symbol.node; + this_type.data_type = (DataType) m.parent_symbol; var cparam = new CCodeFormalParameter ("self", this_type.get_cname ()); vfunc.add_parameter (cparam); @@ -295,12 +295,12 @@ public class Vala.CodeGenerator { var vblock = new CCodeBlock (); CCodeFunctionCall vcast = null; - if (m.symbol.parent_symbol.node is Interface) { - var iface = (Interface) m.symbol.parent_symbol.node; + if (m.parent_symbol is Interface) { + var iface = (Interface) m.parent_symbol; vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (iface.get_upper_case_cname (null)))); } else { - var cl = (Class) m.symbol.parent_symbol.node; + var cl = (Class) m.parent_symbol; vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (cl.get_upper_case_cname (null)))); } @@ -428,11 +428,10 @@ public class Vala.CodeGenerator { return null; } - private DataType find_parent_type (CodeNode node) { - var sym = node.symbol; + private DataType find_parent_type (Symbol sym) { while (sym != null) { - if (sym.node is DataType) { - return (DataType) sym.node; + if (sym is DataType) { + return (DataType) sym; } sym = sym.parent_symbol; } diff --git a/gobject/valacodegeneratorsignal.vala b/gobject/valacodegeneratorsignal.vala index 0fbf3dd66..393171a8c 100644 --- a/gobject/valacodegeneratorsignal.vala +++ b/gobject/valacodegeneratorsignal.vala @@ -76,8 +76,6 @@ public class Vala.CodeGenerator { } } else if (t.data_type is Enum) { return "gint"; - } else if (t.data_type is Flags) { - return "guint"; } else if (t.data_type is Array) { return "gpointer"; } diff --git a/gobject/valacodegeneratorstruct.vala b/gobject/valacodegeneratorstruct.vala index 65e565753..590bca86c 100644 --- a/gobject/valacodegeneratorstruct.vala +++ b/gobject/valacodegeneratorstruct.vala @@ -25,9 +25,12 @@ using GLib; public class Vala.CodeGenerator { public override void visit_struct (Struct! st) { - current_type_symbol = st.symbol; - + var old_type_symbol = current_type_symbol; + var old_instance_struct = instance_struct; + var old_instance_dispose_fragment = instance_dispose_fragment; + current_type_symbol = st; instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ())); + instance_dispose_fragment = null; if (st.source_reference.file.cycle == null) { header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (st.get_cname ()), new CCodeVariableDeclarator (st.get_cname ()))); @@ -40,6 +43,8 @@ public class Vala.CodeGenerator { st.accept_children (this); - current_type_symbol = null; + current_type_symbol = old_type_symbol; + instance_struct = old_instance_struct; + instance_dispose_fragment = old_instance_dispose_fragment; } } diff --git a/vala/Makefile.am b/vala/Makefile.am index 7ce1baee1..fe04e51bf 100644 --- a/vala/Makefile.am +++ b/vala/Makefile.am @@ -127,12 +127,6 @@ libvalacore_la_SOURCES = \ valafield.c \ valafield.h \ valafield.vala \ - valaflags.c \ - valaflags.h \ - valaflags.vala \ - valaflagsvalue.c \ - valaflagsvalue.h \ - valaflagsvalue.vala \ valaforeachstatement.c \ valaforeachstatement.h \ valaforeachstatement.vala \ @@ -247,6 +241,9 @@ libvalacore_la_SOURCES = \ valareturnstatement.c \ valareturnstatement.h \ valareturnstatement.vala \ + valascope.c \ + valascope.h \ + valascope.vala \ valasemanticanalyzer.c \ valasemanticanalyzer.h \ valasemanticanalyzer.vala \ @@ -283,9 +280,6 @@ libvalacore_la_SOURCES = \ valaswitchstatement.c \ valaswitchstatement.h \ valaswitchstatement.vala \ - valasymbolbuilder.c \ - valasymbolbuilder.h \ - valasymbolbuilder.vala \ valasymbol.c \ valasymbol.h \ valasymbol.vala \ @@ -360,8 +354,6 @@ valainclude_HEADERS = \ valaexpression.h \ valaexpressionstatement.h \ valafield.h \ - valaflags.h \ - valaflagsvalue.h \ valaforeachstatement.h \ valaformalparameter.h \ valaforstatement.h \ @@ -400,6 +392,7 @@ valainclude_HEADERS = \ valareferencetransferexpression.h \ valareport.h \ valareturnstatement.h \ + valascope.h \ valasemanticanalyzer.h \ valasignal.h \ valasizeofexpression.h \ @@ -412,7 +405,6 @@ valainclude_HEADERS = \ valaswitchlabel.h \ valaswitchsection.h \ valaswitchstatement.h \ - valasymbolbuilder.h \ valasymbol.h \ valasymbolresolver.h \ valathrowstatement.h \ diff --git a/vala/parser.y b/vala/parser.y index 79042d6ea..58a6c5f43 100644 --- a/vala/parser.y +++ b/vala/parser.y @@ -36,12 +36,8 @@ #define src_com(l,c) (vala_source_reference_new_with_comment (current_source_file, l.first_line, l.first_column, l.last_line, l.last_column, c)) static ValaSourceFile *current_source_file; -static ValaNamespace *current_namespace; -static gboolean current_namespace_implicit; -static ValaClass *current_class; -static ValaStruct *current_struct; -static ValaInterface *current_interface; -static ValaEnum *current_enum; +static GList *symbol_stack; +static GList *scope_stack; typedef enum { VALA_MODIFIER_NONE, @@ -53,6 +49,12 @@ typedef enum { int yylex (YYSTYPE *yylval_param, YYLTYPE *yylloc_param, ValaParser *parser); static void yyerror (YYLTYPE *locp, ValaParser *parser, const char *msg); + +static void push_symbol (ValaSymbol *symbol); +static ValaSymbol *pop_symbol (void); + +static gboolean check_is_namespace (ValaSymbol *symbol, ValaSourceReference *src); +static gboolean check_is_class (ValaSymbol *symbol, ValaSourceReference *src); %} %defines @@ -69,15 +71,10 @@ static void yyerror (YYLTYPE *locp, ValaParser *parser, const char *msg); ValaTypeReference *type_reference; ValaExpression *expression; ValaStatement *statement; - ValaNamespace *namespace; - ValaClass *class; + ValaBlock *block; ValaStruct *struct_; ValaInterface *interface; - ValaEnum *enum_; ValaEnumValue *enum_value; - ValaFlags *flags; - ValaFlagsValue *flags_value; - ValaCallback *callback; ValaConstant *constant; ValaField *field; ValaMethod *method; @@ -167,7 +164,6 @@ static void yyerror (YYLTYPE *locp, ValaParser *parser, const char *msg); %token ENUM "enum" %token VALA_FALSE "false" %token FINALLY "finally" -%token FLAGS "flags" %token FOR "for" %token FOREACH "foreach" %token GET "get" @@ -269,8 +265,8 @@ static void yyerror (YYLTYPE *locp, ValaParser *parser, const char *msg); %type <expression> opt_expression %type <expression> expression %type <statement> statement -%type <statement> embedded_statement -%type <statement> block +%type <block> embedded_statement +%type <block> block %type <list> opt_statement_list %type <list> statement_list %type <statement> empty_statement @@ -307,13 +303,11 @@ static void yyerror (YYLTYPE *locp, ValaParser *parser, const char *msg); %type <catch_clause> specific_catch_clause %type <catch_clause> opt_general_catch_clause %type <catch_clause> general_catch_clause -%type <statement> opt_finally_clause -%type <statement> finally_clause +%type <block> opt_finally_clause +%type <block> finally_clause %type <statement> lock_statement -%type <namespace> namespace_declaration %type <str> opt_name_specifier %type <str> name_specifier -%type <class> class_declaration %type <num> opt_access_modifier %type <num> access_modifier %type <num> opt_modifiers @@ -326,16 +320,7 @@ static void yyerror (YYLTYPE *locp, ValaParser *parser, const char *msg); %type <property_accessor> get_accessor_declaration %type <property_accessor> opt_set_accessor_declaration %type <property_accessor> set_accessor_declaration -%type <struct_> struct_declaration %type <struct_> struct_header -%type <interface> interface_declaration -%type <enum_> enum_declaration -%type <flags> flags_declaration -%type <list> flags_body -%type <list> opt_flags_member_declarations -%type <list> flags_member_declarations -%type <flags_value> flags_member_declaration -%type <callback> callback_declaration %type <constant> constant_declaration %type <field> field_declaration %type <list> variable_declarators @@ -346,7 +331,7 @@ static void yyerror (YYLTYPE *locp, ValaParser *parser, const char *msg); %type <expression> variable_initializer %type <method> method_declaration %type <method> method_header -%type <statement> method_body +%type <block> method_body %type <list> opt_formal_parameter_list %type <list> formal_parameter_list %type <num> opt_construct @@ -1051,7 +1036,7 @@ shift_expression g_object_unref ($1); g_object_unref ($3); } - /* don't use two OP_GT due to resolve parse conflicts + /* don't use two OP_GT to resolve parse conflicts * stacked generics won't be that common in vala */ | shift_expression OP_SHIFT_RIGHT additive_expression { @@ -1350,6 +1335,9 @@ expression statement : declaration_statement | block + { + $$ = VALA_STATEMENT ($1); + } | empty_statement | expression_statement | selection_statement @@ -1364,56 +1352,56 @@ embedded_statement | empty_statement { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); - vala_block_add_statement (VALA_BLOCK ($$), $1); + $$ = vala_block_new (src); + vala_block_add_statement ($$, $1); g_object_unref ($1); g_object_unref (src); } | expression_statement { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); - vala_block_add_statement (VALA_BLOCK ($$), $1); + $$ = vala_block_new (src); + vala_block_add_statement ($$, $1); g_object_unref ($1); g_object_unref (src); } | selection_statement { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); - vala_block_add_statement (VALA_BLOCK ($$), $1); + $$ = vala_block_new (src); + vala_block_add_statement ($$, $1); g_object_unref ($1); g_object_unref (src); } | iteration_statement { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); - vala_block_add_statement (VALA_BLOCK ($$), $1); + $$ = vala_block_new (src); + vala_block_add_statement ($$, $1); g_object_unref ($1); g_object_unref (src); } | jump_statement { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); - vala_block_add_statement (VALA_BLOCK ($$), $1); + $$ = vala_block_new (src); + vala_block_add_statement ($$, $1); g_object_unref ($1); g_object_unref (src); } | try_statement { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); - vala_block_add_statement (VALA_BLOCK ($$), $1); + $$ = vala_block_new (src); + vala_block_add_statement ($$, $1); g_object_unref ($1); g_object_unref (src); } | lock_statement { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); - vala_block_add_statement (VALA_BLOCK ($$), $1); + $$ = vala_block_new (src); + vala_block_add_statement ($$, $1); g_object_unref ($1); g_object_unref (src); } @@ -1423,11 +1411,11 @@ block : OPEN_BRACE opt_statement_list CLOSE_BRACE { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new (src)); + $$ = vala_block_new (src); if ($2 != NULL) { GList *l; for (l = $2; l != NULL; l = l->next) { - vala_block_add_statement (VALA_BLOCK ($$), l->data); + vala_block_add_statement ($$, l->data); g_object_unref (l->data); } g_list_free ($2); @@ -1580,51 +1568,24 @@ selection_statement if_statement : comment IF open_parens expression CLOSE_PARENS embedded_statement { - ValaBlock *true_block; ValaSourceReference *src; - if (VALA_IS_BLOCK ($6)) { - true_block = VALA_BLOCK ($6); - } else { - true_block = vala_block_new (vala_code_node_get_source_reference (VALA_CODE_NODE ($6))); - vala_block_add_statement (true_block, $6); - g_object_unref ($6); - } - src = src_com(@4, $1); - $$ = VALA_STATEMENT (vala_if_statement_new ($4, true_block, NULL, src)); + $$ = VALA_STATEMENT (vala_if_statement_new ($4, $6, NULL, src)); g_object_unref (src); g_object_unref ($4); - g_object_unref (true_block); + g_object_unref ($6); } | comment IF open_parens expression CLOSE_PARENS embedded_statement ELSE embedded_statement { - ValaBlock *true_block; - ValaBlock *false_block; ValaSourceReference *src; - if (VALA_IS_BLOCK ($6)) { - true_block = VALA_BLOCK ($6); - } else { - true_block = vala_block_new (vala_code_node_get_source_reference (VALA_CODE_NODE ($6))); - vala_block_add_statement (true_block, $6); - g_object_unref ($6); - } - - if (VALA_IS_BLOCK ($8)) { - false_block = VALA_BLOCK ($8); - } else { - false_block = vala_block_new (vala_code_node_get_source_reference (VALA_CODE_NODE ($8))); - vala_block_add_statement (false_block, $8); - g_object_unref ($8); - } - src = src_com(@4, $1); - $$ = VALA_STATEMENT (vala_if_statement_new ($4, true_block, false_block, src)); + $$ = VALA_STATEMENT (vala_if_statement_new ($4, $6, $8, src)); g_object_unref (src); g_object_unref ($4); - g_object_unref (true_block); - g_object_unref (false_block); + g_object_unref ($6); + g_object_unref ($8); } ; @@ -1802,7 +1763,7 @@ for_statement if (init != NULL) { ValaSourceReference *decl_src = vala_code_node_get_source_reference (VALA_CODE_NODE (decl)); - ValaMemberAccess *lhs = vala_member_access_new (NULL, vala_variable_declarator_get_name (decl), decl_src); + ValaMemberAccess *lhs = vala_member_access_new (NULL, vala_symbol_get_name (VALA_SYMBOL (decl)), decl_src); ValaAssignment *assign = vala_assignment_new (VALA_EXPRESSION (lhs), init, VALA_ASSIGNMENT_OPERATOR_SIMPLE, decl_src); g_object_unref (lhs); vala_for_statement_add_initializer (for_statement, VALA_EXPRESSION (assign)); @@ -1919,7 +1880,7 @@ try_statement { GList *l; ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_try_statement_new (VALA_BLOCK ($2), VALA_BLOCK ($4), src)); + $$ = VALA_STATEMENT (vala_try_statement_new ($2, $4, src)); g_object_unref ($2); if ($4 != NULL) { g_object_unref ($4); @@ -1935,7 +1896,7 @@ try_statement | TRY block finally_clause { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_try_statement_new (VALA_BLOCK ($2), VALA_BLOCK ($3), src)); + $$ = VALA_STATEMENT (vala_try_statement_new ($2, $3, src)); g_object_unref ($2); g_object_unref ($3); g_object_unref (src); @@ -2027,15 +1988,29 @@ namespace_declaration : comment opt_attributes NAMESPACE identifier { ValaSourceReference *src = src_com(@4, $1); - current_namespace = vala_namespace_new ($4, src); + ValaSymbol *current_symbol = vala_scope_lookup (scope_stack->data, $4); + if (current_symbol != NULL) { + if (check_is_namespace (current_symbol, src)) { + // merge namespace declarations + if (!vala_source_file_get_pkg (current_source_file)) { + vala_namespace_set_pkg (VALA_NAMESPACE (current_symbol), FALSE); + } + VALA_CODE_NODE (current_symbol)->attributes = $2; + } + } else { + current_symbol = VALA_SYMBOL (vala_namespace_new ($4, src)); + vala_namespace_set_pkg (VALA_NAMESPACE (current_symbol), vala_source_file_get_pkg (current_source_file)); + VALA_CODE_NODE (current_symbol)->attributes = g_list_concat (VALA_CODE_NODE (current_symbol)->attributes, $2); + vala_namespace_add_namespace (VALA_NAMESPACE (symbol_stack->data), VALA_NAMESPACE (current_symbol)); + } g_object_unref (src); - VALA_CODE_NODE(current_namespace)->attributes = $2; g_free ($4); + + push_symbol (current_symbol); } namespace_body { - $$ = current_namespace; - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); + g_object_unref (pop_symbol ()); } ; @@ -2093,10 +2068,6 @@ outer_declarations outer_declaration : namespace_declaration - { - vala_code_context_add_namespace (vala_source_file_get_context (current_source_file), $1); - g_object_unref ($1); - } | namespace_member_declaration ; @@ -2112,100 +2083,15 @@ namespace_member_declarations namespace_member_declaration : class_declaration - { - /* skip declarations with errors */ - if ($1 != NULL) { - vala_namespace_add_class (current_namespace, $1); - vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); - g_object_unref ($1); - } - - if (current_namespace_implicit) { - /* current namespace has been declared implicitly */ - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); - current_namespace_implicit = FALSE; - } - } | struct_declaration - { - /* skip declarations with errors */ - if ($1 != NULL) { - vala_namespace_add_struct (current_namespace, $1); - vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); - g_object_unref ($1); - } - - if (current_namespace_implicit) { - /* current namespace has been declared implicitly */ - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); - current_namespace_implicit = FALSE; - } - } | interface_declaration - { - /* skip declarations with errors */ - if ($1 != NULL) { - vala_namespace_add_interface (current_namespace, $1); - vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); - g_object_unref ($1); - } - - if (current_namespace_implicit) { - /* current namespace has been declared implicitly */ - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); - current_namespace_implicit = FALSE; - } - } | enum_declaration - { - /* skip declarations with errors */ - if ($1 != NULL) { - vala_namespace_add_enum (current_namespace, $1); - vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); - g_object_unref ($1); - } - - if (current_namespace_implicit) { - /* current namespace has been declared implicitly */ - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); - current_namespace_implicit = FALSE; - } - } - | flags_declaration - { - /* skip declarations with errors */ - if ($1 != NULL) { - vala_namespace_add_flags (current_namespace, $1); - vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); - g_object_unref ($1); - } - - if (current_namespace_implicit) { - /* current namespace has been declared implicitly */ - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); - current_namespace_implicit = FALSE; - } - } | callback_declaration - { - /* skip declarations with errors */ - if ($1 != NULL) { - vala_namespace_add_callback (current_namespace, $1); - vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); - g_object_unref ($1); - } - - if (current_namespace_implicit) { - /* current namespace has been declared implicitly */ - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); - current_namespace_implicit = FALSE; - } - } | constant_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_namespace_add_constant (current_namespace, $1); + vala_namespace_add_constant (VALA_NAMESPACE (symbol_stack->data), $1); vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); g_object_unref ($1); } @@ -2218,7 +2104,7 @@ namespace_member_declaration * to explicitly state it */ vala_field_set_instance ($1, FALSE); - vala_namespace_add_field (current_namespace, $1); + vala_namespace_add_field (VALA_NAMESPACE (symbol_stack->data), $1); vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); g_object_unref ($1); } @@ -2231,7 +2117,7 @@ namespace_member_declaration * to explicitly state it */ vala_method_set_instance ($1, FALSE); - vala_namespace_add_method (current_namespace, $1); + vala_namespace_add_method (VALA_NAMESPACE (symbol_stack->data), $1); vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($1)); g_object_unref ($1); } @@ -2245,54 +2131,84 @@ class_declaration ValaSourceReference *src; char *name = $6; - + + ValaSymbol *parent_symbol = VALA_SYMBOL (g_object_ref (symbol_stack->data)); + ValaScope *parent_scope = VALA_SCOPE (scope_stack->data); + if ($7 != NULL) { ValaSourceReference *ns_src = src(@6); - current_namespace = vala_namespace_new ($6, ns_src); + parent_symbol = vala_scope_lookup (parent_scope, $6); + if (parent_symbol != NULL) { + if (check_is_namespace (parent_symbol, src)) { + if (!vala_source_file_get_pkg (current_source_file)) { + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), FALSE); + } + } + } else { + parent_symbol = VALA_SYMBOL (vala_namespace_new ($6, ns_src)); + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), vala_source_file_get_pkg (current_source_file)); + vala_namespace_add_namespace (VALA_NAMESPACE (symbol_stack->data), VALA_NAMESPACE (parent_symbol)); + } + parent_scope = vala_symbol_get_scope (parent_symbol); g_free ($6); g_object_unref (ns_src); - current_namespace_implicit = TRUE; - - vala_code_context_add_namespace (vala_source_file_get_context (current_source_file), current_namespace); - g_object_unref (current_namespace); name = $7; } - + src = src_com(@6, $1); - current_class = vala_class_new (name, src); - g_free (name); - g_object_unref (src); - - VALA_CODE_NODE(current_class)->attributes = $2; - if ($3 != 0) { - VALA_DATA_TYPE(current_class)->access = $3; - } - if (($4 & VALA_MODIFIER_ABSTRACT) == VALA_MODIFIER_ABSTRACT) { - vala_class_set_is_abstract (current_class, TRUE); - } - if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) { - vala_class_set_is_static (current_class, TRUE); - } - if ($8 != NULL) { - for (l = $8; l != NULL; l = l->next) { - vala_class_add_type_parameter (current_class, l->data); - g_object_unref (l->data); + ValaSymbol *current_symbol = vala_scope_lookup (parent_scope, name); + if (current_symbol != NULL) { + if (check_is_class (current_symbol, src)) { + // merge class declarations } - g_list_free ($8); - } - if ($9 != NULL) { - for (l = $9; l != NULL; l = l->next) { - vala_class_add_base_type (current_class, l->data); - g_object_unref (l->data); + } else { + current_symbol = VALA_SYMBOL (vala_class_new (name, src)); + g_free (name); + g_object_unref (src); + + if (VALA_IS_CLASS (parent_symbol)) { + vala_class_add_class (VALA_CLASS (parent_symbol), VALA_CLASS (current_symbol)); + } else if (VALA_IS_NAMESPACE (parent_symbol)) { + vala_namespace_add_class (VALA_NAMESPACE (parent_symbol), VALA_CLASS (current_symbol)); + vala_source_file_add_node (current_source_file, VALA_CODE_NODE (current_symbol)); + } else { + g_assert_not_reached (); + } + + VALA_CODE_NODE (current_symbol)->attributes = $2; + if ($3 != 0) { + VALA_DATA_TYPE (current_symbol)->access = $3; + } + if (($4 & VALA_MODIFIER_ABSTRACT) == VALA_MODIFIER_ABSTRACT) { + vala_class_set_is_abstract (VALA_CLASS (current_symbol), TRUE); + } + if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) { + vala_class_set_is_static (VALA_CLASS (current_symbol), TRUE); + } + if ($8 != NULL) { + for (l = $8; l != NULL; l = l->next) { + vala_class_add_type_parameter (VALA_CLASS (current_symbol), l->data); + g_object_unref (l->data); + } + g_list_free ($8); + } + if ($9 != NULL) { + for (l = $9; l != NULL; l = l->next) { + vala_class_add_base_type (VALA_CLASS (current_symbol), l->data); + g_object_unref (l->data); + } + g_list_free ($9); } - g_list_free ($9); } + + g_object_unref (parent_symbol); + + push_symbol (current_symbol); } class_body { - $$ = current_class; - current_class = NULL; + g_object_unref (pop_symbol ()); } ; @@ -2404,7 +2320,7 @@ class_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_class_add_constant (current_class, $1); + vala_class_add_constant (VALA_CLASS (symbol_stack->data), $1); g_object_unref ($1); } } @@ -2412,7 +2328,7 @@ class_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_class_add_field (current_class, $1); + vala_class_add_field (VALA_CLASS (symbol_stack->data), $1); g_object_unref ($1); } } @@ -2420,7 +2336,7 @@ class_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_class_add_method (current_class, $1); + vala_class_add_method (VALA_CLASS (symbol_stack->data), $1); g_object_unref ($1); } } @@ -2428,7 +2344,7 @@ class_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_class_add_property (current_class, $1, FALSE); + vala_class_add_property (VALA_CLASS (symbol_stack->data), $1, FALSE); g_object_unref ($1); } } @@ -2436,7 +2352,7 @@ class_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_class_add_signal (current_class, $1); + vala_class_add_signal (VALA_CLASS (symbol_stack->data), $1); g_object_unref ($1); } } @@ -2444,7 +2360,7 @@ class_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_class_set_constructor (current_class, $1); + vala_class_set_constructor (VALA_CLASS (symbol_stack->data), $1); g_object_unref ($1); } } @@ -2452,17 +2368,19 @@ class_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_class_set_destructor (current_class, $1); + vala_class_set_destructor (VALA_CLASS (symbol_stack->data), $1); g_object_unref ($1); } } + | class_declaration + | struct_declaration ; constant_declaration : comment opt_attributes opt_access_modifier CONST type variable_declarator SEMICOLON { ValaSourceReference *src = src_com(@5, $1); - $$ = vala_constant_new (vala_variable_declarator_get_name ($6), $5, vala_variable_declarator_get_initializer ($6), src); + $$ = vala_constant_new (vala_symbol_get_name (VALA_SYMBOL ($6)), $5, vala_variable_declarator_get_initializer ($6), src); g_object_unref (src); g_object_unref ($5); g_object_unref ($6); @@ -2486,7 +2404,7 @@ field_declaration vala_type_reference_set_takes_ownership ($5, TRUE); } - $$ = vala_field_new (vala_variable_declarator_get_name ($6), $5, vala_variable_declarator_get_initializer ($6), src); + $$ = vala_field_new (vala_symbol_get_name (VALA_SYMBOL ($6)), $5, vala_variable_declarator_get_initializer ($6), src); g_object_unref (src); if ($3 != 0) { $$->access = $3; @@ -2581,7 +2499,7 @@ method_declaration : method_header method_body { $$ = $1; - vala_method_set_body ($$, VALA_BLOCK($2)); + vala_method_set_body ($$, $2); if ($2 != NULL) { g_object_unref ($2); } @@ -2944,12 +2862,11 @@ destructor_declaration struct_declaration : struct_header { - current_struct = $1; + push_symbol (VALA_SYMBOL ($1)); } struct_body { - $$ = current_struct; - current_struct = NULL; + g_object_unref (pop_symbol ()); } ; @@ -2961,15 +2878,26 @@ struct_header char *name = $5; + ValaSymbol *parent_symbol = VALA_SYMBOL (g_object_ref (symbol_stack->data)); + ValaScope *parent_scope = VALA_SCOPE (scope_stack->data); + if ($6 != NULL) { ValaSourceReference *ns_src = src(@5); - current_namespace = vala_namespace_new ($5, ns_src); + parent_symbol = vala_scope_lookup (parent_scope, $5); + if (parent_symbol != NULL) { + if (check_is_namespace (parent_symbol, src)) { + if (!vala_source_file_get_pkg (current_source_file)) { + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), FALSE); + } + } + } else { + parent_symbol = VALA_SYMBOL (vala_namespace_new ($5, ns_src)); + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), vala_source_file_get_pkg (current_source_file)); + vala_namespace_add_namespace (VALA_NAMESPACE (symbol_stack->data), VALA_NAMESPACE (parent_symbol)); + } + parent_scope = vala_symbol_get_scope (parent_symbol); g_free ($5); g_object_unref (ns_src); - current_namespace_implicit = TRUE; - - vala_code_context_add_namespace (vala_source_file_get_context (current_source_file), current_namespace); - g_object_unref (current_namespace); name = $6; } @@ -2978,6 +2906,16 @@ struct_header $$ = vala_struct_new (name, src); g_free (name); g_object_unref (src); + + if (VALA_IS_CLASS (parent_symbol)) { + vala_class_add_struct (VALA_CLASS (parent_symbol), $$); + } else if (VALA_IS_NAMESPACE (parent_symbol)) { + vala_namespace_add_struct (VALA_NAMESPACE (parent_symbol), $$); + vala_source_file_add_node (current_source_file, VALA_CODE_NODE ($$)); + } else { + g_assert_not_reached (); + } + for (l = $7; l != NULL; l = l->next) { vala_struct_add_type_parameter ($$, l->data); } @@ -3014,7 +2952,7 @@ struct_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_struct_add_field (current_struct, $1); + vala_struct_add_field (VALA_STRUCT (symbol_stack->data), $1); g_object_unref ($1); } } @@ -3022,7 +2960,7 @@ struct_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_struct_add_method (current_struct, $1); + vala_struct_add_method (VALA_STRUCT (symbol_stack->data), $1); g_object_unref ($1); } } @@ -3034,35 +2972,50 @@ interface_declaration ValaSourceReference *src; char *name = $6; + ValaSymbol *parent_symbol = VALA_SYMBOL (g_object_ref (symbol_stack->data)); + ValaScope *parent_scope = VALA_SCOPE (scope_stack->data); + if ($7 != NULL) { ValaSourceReference *ns_src = src(@6); - current_namespace = vala_namespace_new ($6, ns_src); + parent_symbol = vala_scope_lookup (parent_scope, $6); + if (parent_symbol != NULL) { + if (check_is_namespace (parent_symbol, src)) { + if (!vala_source_file_get_pkg (current_source_file)) { + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), FALSE); + } + } + } else { + parent_symbol = VALA_SYMBOL (vala_namespace_new ($6, ns_src)); + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), vala_source_file_get_pkg (current_source_file)); + vala_namespace_add_namespace (VALA_NAMESPACE (symbol_stack->data), VALA_NAMESPACE (parent_symbol)); + } + parent_scope = vala_symbol_get_scope (parent_symbol); g_free ($6); g_object_unref (ns_src); - current_namespace_implicit = TRUE; - - vala_code_context_add_namespace (vala_source_file_get_context (current_source_file), current_namespace); - g_object_unref (current_namespace); name = $7; } src = src_com(@6, $1); - current_interface = vala_interface_new (name, src); + ValaInterface *iface = vala_interface_new (name, src); g_free (name); g_object_unref (src); - VALA_CODE_NODE(current_interface)->attributes = $2; + vala_namespace_add_interface (VALA_NAMESPACE (parent_symbol), iface); + vala_source_file_add_node (current_source_file, VALA_CODE_NODE (iface)); + g_object_unref (parent_symbol); + + VALA_CODE_NODE (iface)->attributes = $2; if ($3 != 0) { - VALA_DATA_TYPE(current_interface)->access = $3; + VALA_DATA_TYPE (iface)->access = $3; } if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) { - vala_interface_set_is_static (current_interface, TRUE); + vala_interface_set_is_static (iface, TRUE); } if ($8 != NULL) { GList *l; for (l = $8; l != NULL; l = l->next) { - vala_interface_add_type_parameter (current_interface, l->data); + vala_interface_add_type_parameter (iface, l->data); g_object_unref (l->data); } g_list_free ($8); @@ -3070,15 +3023,17 @@ interface_declaration if ($9 != NULL) { GList *l; for (l = $9; l != NULL; l = l->next) { - vala_interface_add_prerequisite (current_interface, l->data); + vala_interface_add_prerequisite (iface, l->data); g_object_unref (l->data); } g_list_free ($9); } + + push_symbol (VALA_SYMBOL (iface)); } interface_body { - $$ = current_interface; + g_object_unref (pop_symbol ()); } ; @@ -3101,7 +3056,7 @@ interface_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_interface_add_method (current_interface, $1); + vala_interface_add_method (VALA_INTERFACE (symbol_stack->data), $1); g_object_unref ($1); } } @@ -3109,7 +3064,7 @@ interface_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_interface_add_property (current_interface, $1); + vala_interface_add_property (VALA_INTERFACE (symbol_stack->data), $1); g_object_unref ($1); } } @@ -3117,7 +3072,7 @@ interface_member_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_interface_add_signal (current_interface, $1); + vala_interface_add_signal (VALA_INTERFACE (symbol_stack->data), $1); g_object_unref ($1); } } @@ -3130,34 +3085,50 @@ enum_declaration char *name = $5; + ValaSymbol *parent_symbol = VALA_SYMBOL (g_object_ref (symbol_stack->data)); + ValaScope *parent_scope = VALA_SCOPE (scope_stack->data); + if ($6 != NULL) { ValaSourceReference *ns_src = src(@5); - current_namespace = vala_namespace_new ($5, ns_src); + parent_symbol = vala_scope_lookup (parent_scope, $5); + if (parent_symbol != NULL) { + if (check_is_namespace (parent_symbol, src)) { + if (!vala_source_file_get_pkg (current_source_file)) { + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), FALSE); + } + } + } else { + parent_symbol = VALA_SYMBOL (vala_namespace_new ($5, ns_src)); + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), vala_source_file_get_pkg (current_source_file)); + vala_namespace_add_namespace (VALA_NAMESPACE (symbol_stack->data), VALA_NAMESPACE (parent_symbol)); + } + parent_scope = vala_symbol_get_scope (parent_symbol); g_free ($5); g_object_unref (ns_src); - current_namespace_implicit = TRUE; - - vala_code_context_add_namespace (vala_source_file_get_context (current_source_file), current_namespace); - g_object_unref (current_namespace); name = $6; } src = src_com(@5, $1); - current_enum = vala_enum_new (name, src); + ValaEnum *en = vala_enum_new (name, src); g_free (name); g_object_unref (src); - VALA_CODE_NODE(current_enum)->attributes = $2; + vala_namespace_add_enum (VALA_NAMESPACE (parent_symbol), en); + vala_source_file_add_node (current_source_file, VALA_CODE_NODE (en)); + g_object_unref (parent_symbol); + + VALA_CODE_NODE (en)->attributes = $2; if ($3 != 0) { - VALA_DATA_TYPE(current_enum)->access = $3; + VALA_DATA_TYPE (en)->access = $3; } + + push_symbol (VALA_SYMBOL (en)); } enum_body { - $$ = current_enum; - current_enum = NULL; + g_object_unref (pop_symbol ()); } ; @@ -3180,7 +3151,7 @@ enum_member_declaration { ValaEnumValue *ev = vala_enum_value_new ($2); g_free ($2); - vala_enum_add_value (current_enum, ev); + vala_enum_add_value (VALA_ENUM (symbol_stack->data), ev); g_object_unref (ev); } | opt_attributes identifier ASSIGN expression @@ -3188,7 +3159,7 @@ enum_member_declaration ValaEnumValue *ev = vala_enum_value_new_with_value ($2, $4); g_free ($2); g_object_unref ($4); - vala_enum_add_value (current_enum, ev); + vala_enum_add_value (VALA_ENUM (symbol_stack->data), ev); g_object_unref (ev); } ; @@ -3208,90 +3179,12 @@ enum_method_declaration { /* skip declarations with errors */ if ($1 != NULL) { - vala_enum_add_method (current_enum, $1); + vala_enum_add_method (VALA_ENUM (symbol_stack->data), $1); g_object_unref ($1); } } ; -flags_declaration - : comment opt_attributes opt_access_modifier FLAGS identifier opt_name_specifier flags_body - { - GList *l; - ValaSourceReference *src; - - char *name = $5; - - if ($6 != NULL) { - ValaSourceReference *ns_src = src(@5); - current_namespace = vala_namespace_new ($5, ns_src); - g_free ($5); - g_object_unref (ns_src); - current_namespace_implicit = TRUE; - - vala_code_context_add_namespace (vala_source_file_get_context (current_source_file), current_namespace); - g_object_unref (current_namespace); - - name = $6; - } - - src = src_com(@5, $1); - $$ = vala_flags_new (name, src); - g_free (name); - g_object_unref (src); - - VALA_CODE_NODE($$)->attributes = $2; - - if ($3 != 0) { - VALA_DATA_TYPE($$)->access = $3; - } - for (l = $7; l != NULL; l = l->next) { - vala_flags_add_value ($$, l->data); - g_object_unref (l->data); - } - } - ; - -flags_body - : OPEN_BRACE opt_flags_member_declarations CLOSE_BRACE - { - $$ = $2; - } - ; - -opt_flags_member_declarations - : /* empty */ - { - $$ = NULL; - } - | flags_member_declarations opt_comma - ; - -flags_member_declarations - : flags_member_declaration - { - $$ = g_list_append (NULL, $1); - } - | flags_member_declarations COMMA flags_member_declaration - { - $$ = g_list_append ($1, $3); - } - ; - -flags_member_declaration - : opt_attributes identifier - { - $$ = vala_flags_value_new ($2); - g_free ($2); - } - | opt_attributes identifier ASSIGN expression - { - $$ = vala_flags_value_new_with_value ($2, $4); - g_free ($2); - g_object_unref ($4); - } - ; - callback_declaration : comment opt_attributes opt_access_modifier opt_modifiers DELEGATE type identifier opt_name_specifier opt_type_parameter_list OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS opt_throws_declaration SEMICOLON { @@ -3299,43 +3192,61 @@ callback_declaration GList *l; char *name = $7; + ValaSymbol *parent_symbol = VALA_SYMBOL (g_object_ref (symbol_stack->data)); + ValaScope *parent_scope = VALA_SCOPE (scope_stack->data); + if ($8 != NULL) { ValaSourceReference *ns_src = src(@7); - current_namespace = vala_namespace_new ($7, ns_src); + parent_symbol = vala_scope_lookup (parent_scope, $7); + if (parent_symbol != NULL) { + if (check_is_namespace (parent_symbol, src)) { + if (!vala_source_file_get_pkg (current_source_file)) { + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), FALSE); + } + } + } else { + parent_symbol = VALA_SYMBOL (vala_namespace_new ($7, ns_src)); + vala_namespace_set_pkg (VALA_NAMESPACE (parent_symbol), vala_source_file_get_pkg (current_source_file)); + vala_namespace_add_namespace (VALA_NAMESPACE (symbol_stack->data), VALA_NAMESPACE (parent_symbol)); + } + parent_scope = vala_symbol_get_scope (parent_symbol); g_free ($7); g_object_unref (ns_src); - current_namespace_implicit = TRUE; - - vala_code_context_add_namespace (vala_source_file_get_context (current_source_file), current_namespace); - g_object_unref (current_namespace); name = $8; } src = src_com(@7, $1); - $$ = vala_callback_new (name, $6, src); + ValaCallback *cb = vala_callback_new (name, $6, src); g_free (name); g_object_unref ($6); g_object_unref (src); + + vala_namespace_add_callback (VALA_NAMESPACE (parent_symbol), cb); + vala_source_file_add_node (current_source_file, VALA_CODE_NODE (cb)); + g_object_unref (parent_symbol); + if ($3 != 0) { - VALA_DATA_TYPE($$)->access = $3; + VALA_DATA_TYPE (cb)->access = $3; } - VALA_CODE_NODE($$)->attributes = $2; + VALA_CODE_NODE (cb)->attributes = $2; if ($9 != NULL) { for (l = $9; l != NULL; l = l->next) { - vala_callback_add_type_parameter ($$, l->data); + vala_callback_add_type_parameter (cb, l->data); g_object_unref (l->data); } g_list_free ($9); } if ($11 != NULL) { for (l = $11; l != NULL; l = l->next) { - vala_callback_add_parameter ($$, l->data); + vala_callback_add_parameter (cb, l->data); g_object_unref (l->data); } g_list_free ($11); } + + g_object_unref (cb); } ; @@ -3573,7 +3484,7 @@ void vala_parser_parse_file (ValaParser *parser, ValaSourceFile *source_file) { current_source_file = source_file; - current_namespace = vala_code_context_get_global_namespace (vala_source_file_get_context (current_source_file)); + push_symbol (VALA_SYMBOL (vala_code_context_get_root (vala_source_file_get_context (source_file)))); yyin = fopen (vala_source_file_get_filename (current_source_file), "r"); if (yyin == NULL) { printf ("Couldn't open source file: %s.\n", vala_source_file_get_filename (current_source_file)); @@ -3587,3 +3498,40 @@ vala_parser_parse_file (ValaParser *parser, ValaSourceFile *source_file) fclose (yyin); yyin = NULL; } + +static void push_symbol (ValaSymbol *symbol) { + symbol_stack = g_list_prepend (symbol_stack, symbol); + scope_stack = g_list_prepend (scope_stack, vala_symbol_get_scope (symbol)); +} + +static ValaSymbol *pop_symbol (void) { + ValaSymbol *sym = VALA_SYMBOL (symbol_stack->data); + symbol_stack = g_list_delete_link (symbol_stack, symbol_stack); + scope_stack = g_list_delete_link (scope_stack, scope_stack); + return sym; +} + +static gboolean check_is_namespace (ValaSymbol *symbol, ValaSourceReference *src) { + if (!VALA_IS_NAMESPACE (symbol)) { + char *sym_name = vala_symbol_get_full_name (symbol); + char *error_msg = g_strdup_printf ("`%s` already exists but is not a namespace", sym_name); + g_free (sym_name); + vala_report_error (src, error_msg); + g_free (error_msg); + return FALSE; + } + return TRUE; +} + +static gboolean check_is_class (ValaSymbol *symbol, ValaSourceReference *src) { + if (!VALA_IS_CLASS (symbol)) { + char *sym_name = vala_symbol_get_full_name (symbol); + char *error_msg = g_strdup_printf ("`%s` already exists but is not a class", sym_name); + g_free (sym_name); + vala_report_error (src, error_msg); + g_free (error_msg); + return FALSE; + } + return TRUE; +} + diff --git a/vala/scanner.l b/vala/scanner.l index a7c608c97..a85de62b0 100644 --- a/vala/scanner.l +++ b/vala/scanner.l @@ -143,7 +143,6 @@ literal ({integer_literal}|{real_literal}|{character_literal}|{string_literal "enum" { uploc; return ENUM; } "false" { uploc; return VALA_FALSE; } "finally" { uploc; return FINALLY; } -"flags" { uploc; return FLAGS; } "for" { uploc; return FOR; } "foreach" { uploc; return FOREACH; } "get" { uploc; return GET; } diff --git a/vala/vala.h b/vala/vala.h index ab5830e0f..bc016b899 100644 --- a/vala/vala.h +++ b/vala/vala.h @@ -28,8 +28,6 @@ #include <vala/valaexpression.h> #include <vala/valaexpressionstatement.h> #include <vala/valafield.h> -#include <vala/valaflags.h> -#include <vala/valaflagsvalue.h> #include <vala/valaforeachstatement.h> #include <vala/valaformalparameter.h> #include <vala/valaforstatement.h> @@ -60,6 +58,7 @@ #include <vala/valareferencetransferexpression.h> #include <vala/valareport.h> #include <vala/valareturnstatement.h> +#include <vala/valascope.h> #include <vala/valasignal.h> #include <vala/valasizeofexpression.h> #include <vala/valasourcefile.h> diff --git a/vala/valaarray.vala b/vala/valaarray.vala index 100e7a6b5..5cf51ed97 100644 --- a/vala/valaarray.vala +++ b/vala/valaarray.vala @@ -90,10 +90,8 @@ public class Vala.Array : DataType { name = "%s]".printf (name); length_field = new ArrayLengthField (source_reference); - length_field.symbol = new Symbol (length_field); resize_method = new ArrayResizeMethod (source_reference); - resize_method.symbol = new Symbol (resize_method); } /** diff --git a/vala/valaarraylengthfield.vala b/vala/valaarraylengthfield.vala index 8cbf17139..9dc6ee278 100644 --- a/vala/valaarraylengthfield.vala +++ b/vala/valaarraylengthfield.vala @@ -30,7 +30,7 @@ public class Vala.ArrayLengthField : Field { access = MemberAccessibility.PUBLIC; var root_symbol = source_reference.file.context.root; - type_reference.data_type = (DataType) root_symbol.lookup ("int").node; + type_reference.data_type = (DataType) root_symbol.scope.lookup ("int"); } /** diff --git a/vala/valaarrayresizemethod.vala b/vala/valaarrayresizemethod.vala index e8b1eac1a..7a1b0c627 100644 --- a/vala/valaarrayresizemethod.vala +++ b/vala/valaarrayresizemethod.vala @@ -33,7 +33,7 @@ public class Vala.ArrayResizeMethod : Method { var root_symbol = source_reference.file.context.root; var int_type = new TypeReference (); - int_type.data_type = (DataType) root_symbol.lookup ("int").node; + int_type.data_type = (DataType) root_symbol.scope.lookup ("int"); add_parameter (new FormalParameter ("length", int_type)); diff --git a/vala/valaattributeprocessor.vala b/vala/valaattributeprocessor.vala index e78b5e321..525ff2855 100644 --- a/vala/valaattributeprocessor.vala +++ b/vala/valaattributeprocessor.vala @@ -42,6 +42,10 @@ public class Vala.AttributeProcessor : CodeVisitor { public override void visit_namespace (Namespace! ns) { ns.process_attributes (); + + foreach (Namespace ns in ns.get_namespaces ()) { + ns.accept (this); + } } public override void visit_class (Class! cl) { @@ -66,10 +70,6 @@ public class Vala.AttributeProcessor : CodeVisitor { en.process_attributes (); } - public override void visit_flags (Flags! fl) { - fl.process_attributes (); - } - public override void visit_method (Method! m) { m.process_attributes (); } diff --git a/vala/valablock.vala b/vala/valablock.vala index 3f73c4b60..94830a608 100644 --- a/vala/valablock.vala +++ b/vala/valablock.vala @@ -25,7 +25,7 @@ using GLib; /** * Represents a source code block. */ -public class Vala.Block : Statement { +public class Vala.Block : Symbol, Statement { /** * Specifies whether this block contains a jump statement. This * information can be used to remove unreachable block cleanup code. @@ -40,8 +40,7 @@ public class Vala.Block : Statement { * * @param source reference to source code */ - public Block (SourceReference source = null) { - source_reference = source; + public Block (construct SourceReference source_reference = null) { } /** diff --git a/vala/valabreakstatement.vala b/vala/valabreakstatement.vala index 25f91b837..3180fd5a4 100644 --- a/vala/valabreakstatement.vala +++ b/vala/valabreakstatement.vala @@ -1,6 +1,6 @@ /* valabreakstatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * Represents a break statement in the source code. */ -public class Vala.BreakStatement : Statement { +public class Vala.BreakStatement : CodeNode, Statement { /** * Creates a new break statement. * diff --git a/vala/valacallback.vala b/vala/valacallback.vala index c1ad58874..a959fb198 100644 --- a/vala/valacallback.vala +++ b/vala/valacallback.vala @@ -51,10 +51,7 @@ public class Vala.Callback : DataType { * @param source reference to source code * @return newly created callback */ - public Callback (string _name, TypeReference _return_type, SourceReference source = null) { - name = _name; - return_type = _return_type; - source_reference = source; + public Callback (construct string name, construct TypeReference return_type, construct SourceReference source_reference = null) { } /** @@ -65,6 +62,7 @@ public class Vala.Callback : DataType { public void add_type_parameter (TypeParameter! p) { type_parameters.append (p); p.type = this; + scope.add (p.name, p); } /** @@ -74,6 +72,7 @@ public class Vala.Callback : DataType { */ public void add_parameter (FormalParameter! param) { parameters.append (param); + scope.add (param.name, param); } /** @@ -149,7 +148,7 @@ public class Vala.Callback : DataType { public override string get_cname (bool const_type = false) { if (cname == null) { - cname = "%s%s".printf (@namespace.get_cprefix (), name); + cname = "%s%s".printf (parent_symbol.get_cprefix (), name); } return cname; } diff --git a/vala/valaclass.vala b/vala/valaclass.vala index 66389cb9f..2786aba86 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -67,6 +67,10 @@ public class Vala.Class : DataType { private List<Method> methods; private List<Property> properties; private List<Signal> signals; + + // inner types + private List<Class> classes; + private List<Struct> structs; /** * Specifies the default construction method. @@ -122,6 +126,7 @@ public class Vala.Class : DataType { public void add_type_parameter (TypeParameter! p) { type_parameters.append (p); p.type = this; + scope.add (p.name, p); } /** @@ -140,6 +145,7 @@ public class Vala.Class : DataType { */ public void add_constant (Constant! c) { constants.append (c); + scope.add (c.name, c); } /** @@ -154,6 +160,7 @@ public class Vala.Class : DataType { if (f.access == MemberAccessibility.PRIVATE && f.instance) { _has_private_fields = true; } + scope.add (f.name, f); } /** @@ -171,7 +178,17 @@ public class Vala.Class : DataType { * @param m a method */ public void add_method (Method! m) { + if (m.instance) { + m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter.type_reference.data_type = this; + m.scope.add (m.this_parameter.name, m.this_parameter); + } + if (m is CreationMethod && m.name == null) { + default_construction_method = m; + } + methods.append (m); + scope.add (m.name, m); } /** @@ -190,6 +207,11 @@ public class Vala.Class : DataType { */ public void add_property (Property! prop, bool no_field = false) { properties.append (prop); + scope.add (prop.name, prop); + + prop.this_parameter = new FormalParameter ("this", new TypeReference ()); + prop.this_parameter.type_reference.data_type = this; + prop.scope.add (prop.this_parameter.name, prop.this_parameter); if (!no_field && prop.set_accessor != null && prop.set_accessor.body == null && source_reference != null && !source_reference.file.pkg) { @@ -219,6 +241,7 @@ public class Vala.Class : DataType { */ public void add_signal (Signal! sig) { signals.append (sig); + scope.add (sig.name, sig); } /** @@ -230,6 +253,26 @@ public class Vala.Class : DataType { return signals.copy (); } + /** + * Adds the specified class as an inner class. + * + * @param cl a class + */ + public void add_class (Class! cl) { + classes.append (cl); + scope.add (cl.name, cl); + } + + /** + * Adds the specified struct as an inner struct. + * + * @param st a struct + */ + public void add_struct (Struct! st) { + structs.append (st); + scope.add (st.name, st); + } + public override void accept (CodeVisitor! visitor) { visitor.visit_class (this); } @@ -270,11 +313,23 @@ public class Vala.Class : DataType { if (destructor != null) { destructor.accept (visitor); } + + foreach (Class cl in classes) { + cl.accept (visitor); + } + + foreach (Struct st in structs) { + st.accept (visitor); + } + } + + public override string! get_cprefix () { + return get_cname (); } public override string get_cname (bool const_type = false) { if (cname == null) { - cname = "%s%s".printf (@namespace.get_cprefix (), name); + cname = "%s%s".printf (parent_symbol.get_cprefix (), name); } return cname; } @@ -290,7 +345,7 @@ public class Vala.Class : DataType { private string get_lower_case_csuffix () { if (lower_case_csuffix == null) { - lower_case_csuffix = Namespace.camel_case_to_lower_case (name); + lower_case_csuffix = camel_case_to_lower_case (name); } return lower_case_csuffix; } @@ -299,10 +354,10 @@ public class Vala.Class : DataType { if (infix == null) { infix = ""; } - return "%s%s%s".printf (@namespace.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); + return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); } - public override string get_lower_case_cprefix () { + public override string! get_lower_case_cprefix () { return "%s_".printf (get_lower_case_cname (null)); } diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala index 118fb67d8..4ae5d3f26 100644 --- a/vala/valacodecontext.vala +++ b/vala/valacodecontext.vala @@ -85,49 +85,19 @@ public class Vala.CodeContext { public Method module_init_method { get; set; } List<SourceFile> source_files; - private Symbol! _root = new Symbol (); - - private Namespace global_namespace = new Namespace (null); - private List<Namespace> namespaces; + private Namespace! _root = new Namespace (null); List<SourceFileCycle> cycles; private List<string> packages; /** - * The root symbol of the code tree. - * - * @return root symbol - */ - public Symbol! root { - get { return _root; } - } - - /** - * Adds the specified namespace. - * - * @param ns a namespace - */ - public void add_namespace (Namespace! ns) { - namespaces.append (ns); - } - - /** - * Returns the implicitly declared root namespace. + * The root namespace of the symbol tree. * * @return root namespace */ - public Namespace! get_global_namespace () { - return global_namespace; - } - - /** - * Returns a copy of the list of namespaces. - * - * @return namespace list - */ - public List<weak Namespace> get_namespaces () { - return namespaces.copy (); + public Namespace! root { + get { return _root; } } /** @@ -182,11 +152,7 @@ public class Vala.CodeContext { * @param visitor the visitor to be called when traversing */ public void accept (CodeVisitor! visitor) { - global_namespace.accept (visitor); - - foreach (Namespace ns in namespaces) { - ns.accept (visitor); - } + root.accept (visitor); foreach (SourceFile file in source_files) { file.accept (visitor); diff --git a/vala/valacodenode.vala b/vala/valacodenode.vala index 696ad1453..5fc2bcb19 100644 --- a/vala/valacodenode.vala +++ b/vala/valacodenode.vala @@ -33,12 +33,7 @@ public abstract class Vala.CodeNode { * Parent of this code node. */ public CodeNode parent_node { get; set; } - - /** - * Symbol that corresponds to this code node. - */ - public Symbol symbol { get; set; } - + /** * References the location in the source file where this code node has * been written. diff --git a/vala/valacodevisitor.vala b/vala/valacodevisitor.vala index b4b702e44..9a92c4d45 100644 --- a/vala/valacodevisitor.vala +++ b/vala/valacodevisitor.vala @@ -84,22 +84,6 @@ public abstract class Vala.CodeVisitor { } /** - * Visit operation called for flags. - * - * @param fl a flags - */ - public virtual void visit_flags (Flags! fl) { - } - - /** - * Visit operation called for flags values. - * - * @param fv an flags value - */ - public virtual void visit_flags_value (FlagsValue! fv) { - } - - /** * Visit operation called for callbacks. * * @param cb a callback diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala index 13ebe0fff..16b30ca7b 100644 --- a/vala/valaconstant.vala +++ b/vala/valaconstant.vala @@ -27,11 +27,6 @@ using GLib; */ public class Vala.Constant : Member, Lockable { /** - * The symbol name of this constant. - */ - public string! name { get; set construct; } - - /** * The data type of this constant. */ public TypeReference! type_reference { get; set construct; } @@ -90,17 +85,11 @@ public class Vala.Constant : Member, Lockable { */ public string! get_cname () { if (cname == null) { - if (symbol.parent_symbol.node is DataType) { - var t = (DataType) symbol.parent_symbol.node; - cname = "%s%s".printf (t.get_lower_case_cprefix ().up (), name); + if (parent_symbol == null) { + // global constant + cname = name; } else { - var ns = (Namespace) symbol.parent_symbol.node; - if (ns == null) { - // global constant - cname = name; - } else { - cname = "%s%s".printf (ns.get_lower_case_cprefix ().up (), name); - } + cname = "%s%s".printf (parent_symbol.get_lower_case_cprefix ().up (), name); } } return cname; diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala index 28b72e96f..0aea35128 100644 --- a/vala/valaconstructor.vala +++ b/vala/valaconstructor.vala @@ -25,11 +25,16 @@ using GLib; /** * Represents a class or instance constructor. */ -public class Vala.Constructor : CodeNode { +public class Vala.Constructor : Symbol { /** * The body of this constructor. */ - public Statement body { get; set; } + public Block body { get; set; } + + /** + * Specifies the generated `this' parameter for instance methods. + */ + public FormalParameter this_parameter { get; set; } private bool _instance = true; diff --git a/vala/valacontinuestatement.vala b/vala/valacontinuestatement.vala index da0f0d502..509f4e6d9 100644 --- a/vala/valacontinuestatement.vala +++ b/vala/valacontinuestatement.vala @@ -1,6 +1,6 @@ /* valacontinuestatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * Represents a continue statement in the source code. */ -public class Vala.ContinueStatement : Statement { +public class Vala.ContinueStatement : CodeNode, Statement { /** * Creates a new continue statement. * diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala index 85e1075c3..dd86699a3 100644 --- a/vala/valacreationmethod.vala +++ b/vala/valacreationmethod.vala @@ -56,7 +56,7 @@ public class Vala.CreationMethod : Method { } public override string! get_default_cname () { - var parent = symbol.parent_symbol.node; + var parent = parent_symbol; assert (parent is DataType); if (name == null) { return "%snew".printf (((DataType) parent).get_lower_case_cprefix ()); diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala index cd55bceea..85299666a 100644 --- a/vala/valadatatype.vala +++ b/vala/valadatatype.vala @@ -27,12 +27,7 @@ using GLib; * Represents a runtime data type. This data type may be defined in Vala source * code or imported from an external library with a Vala API file. */ -public abstract class Vala.DataType : CodeNode { - /** - * The symbol name of this data type. - */ - public string name { get; set; } - +public abstract class Vala.DataType : Symbol { /** * Specifies the accessibility of the class. Public accessibility * doesn't limit access. Default accessibility limits access to this @@ -41,11 +36,6 @@ public abstract class Vala.DataType : CodeNode { */ public MemberAccessibility access; - /** - * The namespace containing this data type. - */ - public weak Namespace @namespace; - private List<string> cheader_filenames; private Pointer pointer_type; @@ -178,29 +168,6 @@ public abstract class Vala.DataType : CodeNode { public virtual string get_upper_case_cname (string infix = null) { return null; } - - /** - * Returns the C name of this data type in lower case. Words are - * separated by underscores. The lower case C name of the namespace is - * prefix of the result. - * - * @param infix a string to be placed between namespace and data type - * name or null - * @return the lower case name to be used in C code - */ - public virtual string get_lower_case_cname (string infix = null) { - return null; - } - - /** - * Returns the string to be prefixed to members of this data type in - * lower case when used in C code. - * - * @return the lower case prefix to be used in C code - */ - public virtual string get_lower_case_cprefix () { - return null; - } /** * Returns the default value for the given type. Returning null means @@ -221,7 +188,7 @@ public abstract class Vala.DataType : CodeNode { public virtual List<weak string> get_cheader_filenames () { if (cheader_filenames == null) { /* default to header filenames of the namespace */ - foreach (string filename in @namespace.get_cheader_filenames ()) { + foreach (string filename in parent_symbol.get_cheader_filenames ()) { add_cheader_filename (filename); } @@ -252,11 +219,10 @@ public abstract class Vala.DataType : CodeNode { if (pointer_type == null) { pointer_type = new Pointer (this, source_reference); /* create a new Symbol */ - pointer_type.symbol = new Symbol (pointer_type); - this.symbol.parent_symbol.add (pointer_type.name, pointer_type.symbol); + parent_symbol.scope.add (pointer_type.name, pointer_type); /* link the namespace */ - pointer_type.@namespace = this.@namespace; + pointer_type.owner = parent_symbol.scope; } return pointer_type; @@ -273,19 +239,15 @@ public abstract class Vala.DataType : CodeNode { if (array_type == null) { var new_array_type = new Array (this, rank, source_reference); - /* create a new Symbol */ - new_array_type.symbol = new Symbol (new_array_type); - this.symbol.parent_symbol.add (new_array_type.name, new_array_type.symbol); + parent_symbol.scope.add (new_array_type.name, new_array_type); /* add internal length field */ - new_array_type.symbol.add (new_array_type.get_length_field ().name, new_array_type.get_length_field ().symbol); + new_array_type.scope.add (new_array_type.get_length_field ().name, new_array_type.get_length_field ()); /* add internal resize method */ - new_array_type.symbol.add (new_array_type.get_resize_method ().name, new_array_type.get_resize_method ().symbol); + new_array_type.scope.add (new_array_type.get_resize_method ().name, new_array_type.get_resize_method ()); /* link the array type to the same source as the container type */ new_array_type.source_reference = this.source_reference; - /* link the namespace */ - new_array_type.@namespace = this.@namespace; array_types.insert (rank.to_string (), new_array_type); diff --git a/vala/valadeclarationstatement.vala b/vala/valadeclarationstatement.vala index 44b5172d6..f045b9eb8 100644 --- a/vala/valadeclarationstatement.vala +++ b/vala/valadeclarationstatement.vala @@ -1,6 +1,6 @@ /* valadeclarationstatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * Represents a local variable declaration statement in the source code. */ -public class Vala.DeclarationStatement : Statement { +public class Vala.DeclarationStatement : CodeNode, Statement { /** * The local variable declaration. */ diff --git a/vala/valadestructor.vala b/vala/valadestructor.vala index a169e1b79..85ea47a40 100644 --- a/vala/valadestructor.vala +++ b/vala/valadestructor.vala @@ -25,11 +25,11 @@ using GLib; /** * Represents a class or instance destructor. */ -public class Vala.Destructor : CodeNode { +public class Vala.Destructor : Symbol { /** * The body of this constructor. */ - public Statement body { get; set; } + public Block body { get; set; } private bool _instance = true; @@ -37,22 +37,17 @@ public class Vala.Destructor : CodeNode { * Specifies whether this is an instance or a class destructor. */ public bool instance { - get { - return _instance; - } - set { - _instance = value; - } + get { return _instance; } + set { _instance = value; } } /** * Creates a new destructor. * - * @param source reference to source code - * @return newly created destructor + * @param source_reference reference to source code + * @return newly created destructor */ - public Destructor (SourceReference source) { - source_reference = source; + public Destructor (construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valadostatement.vala b/vala/valadostatement.vala index 92ea9e99b..f54a9167e 100644 --- a/vala/valadostatement.vala +++ b/vala/valadostatement.vala @@ -1,6 +1,6 @@ /* valadostatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,11 +25,11 @@ using GLib; /** * Represents a do iteration statement in the source code. */ -public class Vala.DoStatement : Statement { +public class Vala.DoStatement : CodeNode, Statement { /** * Specifies the loop body. */ - public Statement body { get; set; } + public Block body { get; set; } /** * Specifies the loop condition. @@ -54,10 +54,7 @@ public class Vala.DoStatement : Statement { * @param source reference to source code * @return newly created do statement */ - public DoStatement (Statement! _body, Expression! cond, SourceReference source) { - body = _body; - condition = cond; - source_reference = source; + public DoStatement (construct Block! body, construct Expression! condition, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valaemptystatement.vala b/vala/valaemptystatement.vala index 9dd75fe1b..6ca047db8 100644 --- a/vala/valaemptystatement.vala +++ b/vala/valaemptystatement.vala @@ -1,6 +1,6 @@ /* valaemptystatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * An empty statement. */ -public class Vala.EmptyStatement : Statement { +public class Vala.EmptyStatement : CodeNode, Statement { /** * Creates a new empty statement. * diff --git a/vala/valaenum.vala b/vala/valaenum.vala index 2f9e4f01b..fd7c520f2 100644 --- a/vala/valaenum.vala +++ b/vala/valaenum.vala @@ -55,6 +55,7 @@ public class Vala.Enum : DataType { */ public void add_value (EnumValue! value) { values.append (value); + scope.add (value.name, value); } /** @@ -63,7 +64,20 @@ public class Vala.Enum : DataType { * @param m a method */ public void add_method (Method! m) { + if (m is CreationMethod) { + Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); + + m.error = true; + return; + } + if (m.instance) { + m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter.type_reference.data_type = this; + m.scope.add (m.this_parameter.name, m.this_parameter); + } + methods.append (m); + scope.add (m.name, m); } /** @@ -91,12 +105,12 @@ public class Vala.Enum : DataType { public override string get_cname (bool const_type = false) { if (cname == null) { - cname = "%s%s".printf (@namespace.get_cprefix (), name); + cname = "%s%s".printf (parent_symbol.get_cprefix (), name); } return cname; } - public override string get_lower_case_cprefix () { + public override string! get_lower_case_cprefix () { if (lower_case_cprefix == null) { lower_case_cprefix = "%s_".printf (get_lower_case_cname (null)); } @@ -105,7 +119,7 @@ public class Vala.Enum : DataType { private string get_lower_case_csuffix () { if (lower_case_csuffix == null) { - lower_case_csuffix = Namespace.camel_case_to_lower_case (name); + lower_case_csuffix = camel_case_to_lower_case (name); } return lower_case_csuffix; } @@ -114,11 +128,11 @@ public class Vala.Enum : DataType { if (infix == null) { infix = ""; } - return "%s%s%s".printf (@namespace.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); + return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); } public override string get_upper_case_cname (string infix) { - return "%s%s".printf (@namespace.get_lower_case_cprefix (), Namespace.camel_case_to_lower_case (name)).up (); + return "%s%s".printf (parent_symbol.get_lower_case_cprefix (), camel_case_to_lower_case (name)).up (); } public override bool is_reference_type () { diff --git a/vala/valaenumvalue.vala b/vala/valaenumvalue.vala index 740983ef2..a95a29c2d 100644 --- a/vala/valaenumvalue.vala +++ b/vala/valaenumvalue.vala @@ -25,12 +25,7 @@ using GLib; /** * Represents an enum member in the source code. */ -public class Vala.EnumValue : CodeNode { - /** - * The symbol name of this enum value. - */ - public string! name { get; set construct; } - +public class Vala.EnumValue : Symbol { /** * Specifies the numerical representation of this enum value. */ @@ -44,8 +39,7 @@ public class Vala.EnumValue : CodeNode { * @param name enum value name * @return newly created enum value */ - public EnumValue (string! _name) { - name = _name; + public EnumValue (construct string! name) { } /** @@ -55,9 +49,7 @@ public class Vala.EnumValue : CodeNode { * @param value numerical representation * @return newly created enum value */ - public EnumValue.with_value (string! _name, Expression _value) { - name = _name; - value = _value; + public EnumValue.with_value (construct string! name, construct Expression value) { } public override void accept (CodeVisitor! visitor) { @@ -71,7 +63,7 @@ public class Vala.EnumValue : CodeNode { */ public string! get_cname () { if (cname == null) { - var en = (Enum) symbol.parent_symbol.node; + var en = (Enum) parent_symbol; cname = "%s%s".printf (en.get_cprefix (), name); } return cname; diff --git a/vala/valaexpressionstatement.vala b/vala/valaexpressionstatement.vala index 472ec195f..58925b6d9 100644 --- a/vala/valaexpressionstatement.vala +++ b/vala/valaexpressionstatement.vala @@ -1,6 +1,6 @@ /* valaexpressionstatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,7 +26,7 @@ using GLib; * A code statement that evaluates a given expression. The value computed by the * expression, if any, is discarded. */ -public class Vala.ExpressionStatement : Statement { +public class Vala.ExpressionStatement : CodeNode, Statement { /** * Specifies the expression to evaluate. */ @@ -49,9 +49,7 @@ public class Vala.ExpressionStatement : Statement { * @param source reference to source code * @return newly created expression statement */ - public ExpressionStatement (Expression! expr, SourceReference source = null) { - expression = expr; - source_reference = source; + public ExpressionStatement (construct Expression! expression, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { @@ -66,20 +64,20 @@ public class Vala.ExpressionStatement : Statement { } } - public override int get_number_of_set_construction_parameters () { + /** + * Returns whether this statement sets a property. + * + * @return true if this statement sets a property, false otherwise + */ + public bool sets_property () { if (expression is Assignment) { var assign = (Assignment) expression; if (assign.left is MemberAccess) { var ma = (MemberAccess) assign.left; - if (ma.symbol_reference != null) { - if (ma.symbol_reference.node is Property) { - var prop = (Property) ma.symbol_reference.node; - return 1; - } - } + return (ma.symbol_reference is Property); } } - return -1; + return false; } } diff --git a/vala/valafield.vala b/vala/valafield.vala index 3ccd10c8a..576ea8c0e 100644 --- a/vala/valafield.vala +++ b/vala/valafield.vala @@ -27,11 +27,6 @@ using GLib; */ public class Vala.Field : Member, Invokable, Lockable { /** - * The symbol name of this field. - */ - public string! name { get; set construct; } - - /** * The data type of this field. */ public TypeReference! type_reference { get; set construct; } @@ -54,12 +49,8 @@ public class Vala.Field : Member, Invokable, Lockable { * the contained type. */ public bool instance { - get { - return _instance; - } - set { - _instance = value; - } + get { return _instance; } + set { _instance = value; } } /** @@ -82,11 +73,7 @@ public class Vala.Field : Member, Invokable, Lockable { * @param source reference to source code * @return newly created field */ - public Field (string! _name, TypeReference! type, Expression init, SourceReference source) { - name = _name; - type_reference = type; - initializer = init; - source_reference = source; + public Field (construct string! name, construct TypeReference! type_reference, construct Expression initializer, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { @@ -110,9 +97,8 @@ public class Vala.Field : Member, Invokable, Lockable { */ public string! get_cname () { if (cname == null) { - if (!instance && symbol.parent_symbol.node is DataType) { - var t = (DataType) symbol.parent_symbol.node; - cname = "%s_%s".printf (t.get_lower_case_cname (null), name); + if (!instance) { + cname = "%s_%s".printf (parent_symbol.get_lower_case_cname (null), name); } else { cname = name; } diff --git a/vala/valaflags.vala b/vala/valaflags.vala deleted file mode 100644 index fb5f2b598..000000000 --- a/vala/valaflags.vala +++ /dev/null @@ -1,150 +0,0 @@ -/* valaflags.vala - * - * Copyright (C) 2006-2007 Jürg Billeter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jürg Billeter <j@bitron.ch> - */ - -using GLib; - -/** - * Represents a flags declaration in the source code. - */ -public class Vala.Flags : DataType { - private List<FlagsValue> values; - private string cname; - private string cprefix; - - /** - * Creates a new flags. - * - * @param name type name - * @param source reference to source code - * @return newly created flags - */ - public Flags (construct string! name, construct SourceReference source_reference = null) { - } - - /** - * Appends the specified flags value to the list of values. - * - * @param value a flags value - */ - public void add_value (FlagsValue! value) { - values.append (value); - } - - public override void accept (CodeVisitor! visitor) { - visitor.visit_flags (this); - } - - public override void accept_children (CodeVisitor! visitor) { - foreach (FlagsValue value in values) { - value.accept (visitor); - } - } - - public override string get_cname (bool const_type = false) { - if (cname == null) { - cname = "%s%s".printf (@namespace.get_cprefix (), name); - } - return cname; - } - - public override string get_upper_case_cname (string infix) { - return "%s%s".printf (@namespace.get_lower_case_cprefix (), Namespace.camel_case_to_lower_case (name)).up (); - } - - public override bool is_reference_type () { - return false; - } - - private void set_cname (string! cname) { - this.cname = cname; - } - - /** - * Returns the string to be prepended to the name of members of this - * enum when used in C code. - * - * @return the prefix to be used in C code - */ - public string! get_cprefix () { - if (cprefix == null) { - cprefix = "%s_".printf (get_upper_case_cname (null)); - } - return cprefix; - } - - /** - * Sets the string to be prepended to the name of members of this enum - * when used in C code. - * - * @param cprefix the prefix to be used in C code - */ - public void set_cprefix (string! cprefix) { - this.cprefix = cprefix; - } - - private void process_ccode_attribute (Attribute! a) { - if (a.has_argument ("cname")) { - set_cname (a.get_string ("cname")); - } - if (a.has_argument ("cprefix")) { - set_cprefix (a.get_string ("cprefix")); - } - if (a.has_argument ("cheader_filename")) { - var val = a.get_string ("cheader_filename"); - foreach (string filename in val.split (",")) { - add_cheader_filename (filename); - } - } - } - - /** - * Process all associated attributes. - */ - public void process_attributes () { - foreach (Attribute a in attributes) { - if (a.name == "CCode") { - process_ccode_attribute (a); - } - } - } - - public override string get_type_id () { - // FIXME: use GType-registered flags - return "G_TYPE_INT"; - } - - public override string get_marshaller_type_name () { - return "FLAGS"; - } - - public override string get_get_value_function () { - return "g_value_get_flags"; - } - - public override string get_set_value_function () { - return "g_value_set_flags"; - } - - public override string get_default_value () { - return "0"; - } -} diff --git a/vala/valaflagsvalue.vala b/vala/valaflagsvalue.vala deleted file mode 100644 index 232bc322d..000000000 --- a/vala/valaflagsvalue.vala +++ /dev/null @@ -1,80 +0,0 @@ -/* valaflagsvalue.vala - * - * Copyright (C) 2006 Jürg Billeter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jürg Billeter <j@bitron.ch> - */ - -using GLib; - -/** - * Represents a flags member in the source code. - */ -public class Vala.FlagsValue : CodeNode { - /** - * The symbol name of this flags value. - */ - public string! name { get; set construct; } - - /** - * Specifies the numerical representation of this flags value. - */ - public Expression value { get; set; } - - private string cname; - - /** - * Creates a new flags value. - * - * @param name flags value name - * @return newly created flags value - */ - public FlagsValue (string! _name) { - name = _name; - } - - /** - * Creates a new flags value with the specified numerical - * representation. - * - * @param name flags value name - * @param value numerical representation - * @return newly created flags value - */ - public FlagsValue.with_value (string! _name, Expression _value) { - name = _name; - value = _value; - } - - public override void accept (CodeVisitor! visitor) { - visitor.visit_flags_value (this); - } - - /** - * Returns the name of this flags value as it is used in C code. - * - * @return the name to be used in C code - */ - public string! get_cname () { - if (cname == null) { - var fl = (Flags) symbol.parent_symbol.node; - cname = "%s_%s".printf (fl.get_upper_case_cname (null), name); - } - return cname; - } -} diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala index 7c0055b77..c97302430 100644 --- a/vala/valaforeachstatement.vala +++ b/vala/valaforeachstatement.vala @@ -26,7 +26,7 @@ using GLib; * Represents a foreach statement in the source code. Foreach statements iterate * over the elements of a collection. */ -public class Vala.ForeachStatement : Statement { +public class Vala.ForeachStatement : CodeNode, Statement { /** * Specifies the element type. */ @@ -53,7 +53,7 @@ public class Vala.ForeachStatement : Statement { /** * Specifies the loop body. */ - public Statement body { get; set; } + public Block body { get; set; } /** * Specifies the declarator for the generated element variable. @@ -71,12 +71,7 @@ public class Vala.ForeachStatement : Statement { * @param source reference to source code * @return newly created foreach statement */ - public ForeachStatement (TypeReference! type, string! id, Expression! col, Statement _body, SourceReference source) { - type_reference = type; - variable_name = id; - collection = col; - body = _body; - source_reference = source; + public ForeachStatement (construct TypeReference! type_reference, construct string! variable_name, construct Expression! collection, construct Block body, construct SourceReference source_reference) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valaformalparameter.vala b/vala/valaformalparameter.vala index 1ee8d38af..363e26ac7 100644 --- a/vala/valaformalparameter.vala +++ b/vala/valaformalparameter.vala @@ -26,12 +26,7 @@ using GLib; /** * Represents a formal parameter in method and callback signatures. */ -public class Vala.FormalParameter : CodeNode, Invokable { - /** - * The parameter name. - */ - public string! name { get; set construct; } - +public class Vala.FormalParameter : Symbol, Invokable { /** * The parameter type. */ diff --git a/vala/valaforstatement.vala b/vala/valaforstatement.vala index 6017482be..37bbd62bb 100644 --- a/vala/valaforstatement.vala +++ b/vala/valaforstatement.vala @@ -25,7 +25,7 @@ using GLib; /** * Represents a for iteration statement in the source code. */ -public class Vala.ForStatement : Statement { +public class Vala.ForStatement : CodeNode, Statement { /** * Specifies the loop condition. */ @@ -42,7 +42,7 @@ public class Vala.ForStatement : Statement { /** * Specifies the loop body. */ - public Statement body { get; set; } + public Block body { get; set; } private List<Expression> initializer; private List<Expression> iterator; @@ -57,10 +57,7 @@ public class Vala.ForStatement : Statement { * @param source reference to source code * @return newly created for statement */ - public ForStatement (Expression cond, Statement _body, SourceReference source) { - condition = cond; - body = _body; - source_reference = source; + public ForStatement (construct Expression condition, construct Block body, construct SourceReference source_reference = null) { } /** diff --git a/vala/valaifstatement.vala b/vala/valaifstatement.vala index 2912db849..5af3ca5a6 100644 --- a/vala/valaifstatement.vala +++ b/vala/valaifstatement.vala @@ -1,6 +1,6 @@ /* valaifstatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * Represents an if selection statement in the source code. */ -public class Vala.IfStatement : Statement { +public class Vala.IfStatement : CodeNode, Statement { /** * The boolean condition to evaluate. */ diff --git a/vala/valainterface.vala b/vala/valainterface.vala index 5534bbe74..4655f364a 100644 --- a/vala/valainterface.vala +++ b/vala/valainterface.vala @@ -52,9 +52,7 @@ public class Vala.Interface : DataType { * @param source reference to source code * @return newly created interface */ - public Interface (string! _name, SourceReference source = null) { - name = _name; - source_reference = source; + public Interface (construct string! name, construct SourceReference source_reference = null) { } /** @@ -65,6 +63,7 @@ public class Vala.Interface : DataType { public void add_type_parameter (TypeParameter! p) { type_parameters.append (p); p.type = this; + scope.add (p.name, p); } /** @@ -92,7 +91,20 @@ public class Vala.Interface : DataType { * @param m a method */ public void add_method (Method! m) { + if (m is CreationMethod) { + Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); + + m.error = true; + return; + } + if (m.instance) { + m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter.type_reference.data_type = this; + m.scope.add (m.this_parameter.name, m.this_parameter); + } + methods.append (m); + scope.add (m.name, m); } /** @@ -111,6 +123,7 @@ public class Vala.Interface : DataType { */ public void add_property (Property! prop) { properties.append (prop); + scope.add (prop.name, prop); } /** @@ -129,6 +142,7 @@ public class Vala.Interface : DataType { */ public void add_signal (Signal! sig) { signals.append (sig); + scope.add (sig.name, sig); } /** @@ -142,7 +156,7 @@ public class Vala.Interface : DataType { public override string get_cname (bool const_type = false) { if (cname == null) { - cname = "%s%s".printf (@namespace.get_cprefix (), name); + cname = "%s%s".printf (parent_symbol.get_cprefix (), name); } return cname; } @@ -155,7 +169,7 @@ public class Vala.Interface : DataType { */ public string! get_lower_case_csuffix () { if (lower_case_csuffix == null) { - lower_case_csuffix = Namespace.camel_case_to_lower_case (name); + lower_case_csuffix = camel_case_to_lower_case (name); } return lower_case_csuffix; } @@ -174,10 +188,10 @@ public class Vala.Interface : DataType { if (infix == null) { infix = ""; } - return "%s%s%s".printf (@namespace.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); + return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); } - public override string get_lower_case_cprefix () { + public override string! get_lower_case_cprefix () { return "%s_".printf (get_lower_case_cname (null)); } diff --git a/vala/valainterfacewriter.vala b/vala/valainterfacewriter.vala index 58d0af279..a011a42f1 100644 --- a/vala/valainterfacewriter.vala +++ b/vala/valainterfacewriter.vala @@ -55,7 +55,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_namespace (Namespace! ns) { - if (ns.source_reference != null && ns.source_reference.file.pkg) { + if (ns.pkg) { return; } @@ -64,10 +64,8 @@ public class Vala.InterfaceWriter : CodeVisitor { return; } - current_cheader_filename = ns.get_cheader_filename (); - write_indent (); - write_string ("[CCode (cprefix = \"%s\", lower_case_cprefix = \"%s\", cheader_filename = \"%s\")]".printf (ns.get_cprefix (), ns.get_lower_case_cprefix (), current_cheader_filename)); + write_string ("[CCode (cprefix = \"%s\", lower_case_cprefix = \"%s\")]".printf (ns.get_cprefix (), ns.get_lower_case_cprefix ())); write_newline (); write_indent (); @@ -124,7 +122,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } else { first = false; } - write_string (base_type.data_type.symbol.get_full_name ()); + write_string (base_type.data_type.get_full_name ()); } } write_begin_block (); @@ -150,6 +148,21 @@ public class Vala.InterfaceWriter : CodeVisitor { } write_indent (); + + var first = true; + string cheaders; + foreach (string cheader in st.get_cheader_filenames ()) { + if (first) { + cheaders = cheader; + first = false; + } else { + cheaders = "%s, %s".printf (cheaders, cheader); + } + } + write_string ("[CCode (cheader_filename = \"%s\")]".printf (cheaders)); + write_newline (); + + write_indent (); write_string ("public struct "); write_identifier (st.name); write_begin_block (); @@ -207,7 +220,18 @@ public class Vala.InterfaceWriter : CodeVisitor { } write_indent (); - write_string ("[CCode (cprefix = \"%s\")]".printf (en.get_cprefix ())); + + var first = true; + string cheaders; + foreach (string cheader in en.get_cheader_filenames ()) { + if (first) { + cheaders = cheader; + first = false; + } else { + cheaders = "%s, %s".printf (cheaders, cheader); + } + } + write_string ("[CCode (cprefix = \"%s\", cheader_filename = \"%s\")]".printf (en.get_cprefix (), cheaders)); write_indent (); write_string ("public enum "); @@ -227,36 +251,6 @@ public class Vala.InterfaceWriter : CodeVisitor { write_newline (); } - public override void visit_flags (Flags! fl) { - if (fl.source_reference != null && fl.source_reference.file.pkg) { - return; - } - - if (fl.access == MemberAccessibility.PRIVATE) { - return; - } - - write_indent (); - write_string ("[CCode (cprefix = \"%s\")]".printf (fl.get_cprefix ())); - - write_indent (); - write_string ("public flags "); - write_identifier (fl.name); - write_begin_block (); - - fl.accept_children (this); - - write_end_block (); - write_newline (); - } - - public override void visit_flags_value (FlagsValue! fv) { - write_indent (); - write_identifier (fv.name); - write_string (","); - write_newline (); - } - public override void visit_constant (Constant! c) { if (c.source_reference != null && c.source_reference.file.pkg) { return; @@ -264,7 +258,7 @@ public class Vala.InterfaceWriter : CodeVisitor { write_indent (); write_string ("public const "); - write_string (c.type_reference.data_type.symbol.get_full_name ()); + write_string (c.type_reference.data_type.get_full_name ()); write_string (" "); write_identifier (c.name); @@ -288,7 +282,7 @@ public class Vala.InterfaceWriter : CodeVisitor { !f.type_reference.takes_ownership) { write_string ("weak "); } - write_string (f.type_reference.data_type.symbol.get_full_name ()); + write_string (f.type_reference.data_type.get_full_name ()); var type_args = f.type_reference.get_type_arguments (); if (!(f.type_reference.data_type is Array) && type_args != null) { @@ -297,7 +291,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (!type_arg.takes_ownership) { write_string ("weak "); } - write_string (type_arg.data_type.symbol.get_full_name ()); + write_string (type_arg.data_type.get_full_name ()); } write_string (">"); } @@ -329,7 +323,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } else if (param.type_reference.is_out) { write_string ("out "); } - write_string (param.type_reference.data_type.symbol.get_full_name ()); + write_string (param.type_reference.data_type.get_full_name ()); var type_args = param.type_reference.get_type_arguments (); if (!(param.type_reference.data_type is Array) && type_args != null) { @@ -338,7 +332,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (!type_arg.takes_ownership) { write_string ("weak "); } - write_string (type_arg.data_type.symbol.get_full_name ()); + write_string (type_arg.data_type.get_full_name ()); } write_string (">"); } @@ -382,7 +376,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (cb.return_type.transfers_ownership) { write_string ("ref "); } - write_string (cb.return_type.data_type.symbol.get_full_name ()); + write_string (cb.return_type.data_type.get_full_name ()); } write_string (" "); @@ -398,6 +392,10 @@ public class Vala.InterfaceWriter : CodeVisitor { } public override void visit_method (Method! m) { + if (m.source_reference != null && m.source_reference.file.pkg) { + return; + } + if (m.access == MemberAccessibility.PRIVATE || m.overrides) { return; } @@ -433,7 +431,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (m is CreationMethod) { write_string (" "); - var datatype = (DataType) m.symbol.parent_symbol.node; + var datatype = (DataType) m.parent_symbol; write_identifier (datatype.name); if (m.name != null) { @@ -459,7 +457,7 @@ public class Vala.InterfaceWriter : CodeVisitor { } else if ((m.return_type.data_type != null && m.return_type.data_type.is_reference_type ()) || m.return_type.type_parameter != null) { write_string ("weak "); } - write_string (m.return_type.data_type.symbol.get_full_name ()); + write_string (m.return_type.data_type.get_full_name ()); if (m.return_type.non_null) { write_string ("!"); } @@ -493,7 +491,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (!prop.type_reference.takes_ownership) { write_string ("weak "); } - write_string (prop.type_reference.data_type.symbol.get_full_name ()); + write_string (prop.type_reference.data_type.get_full_name ()); var type_args = prop.type_reference.get_type_arguments (); if (!(prop.type_reference.data_type is Array) && type_args != null) { @@ -502,7 +500,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (!type_arg.takes_ownership) { write_string ("weak "); } - write_string (type_arg.data_type.symbol.get_full_name ()); + write_string (type_arg.data_type.get_full_name ()); } write_string (">"); } @@ -546,7 +544,7 @@ public class Vala.InterfaceWriter : CodeVisitor { if (sig.return_type.transfers_ownership) { write_string ("ref "); } - write_string (sig.return_type.data_type.symbol.get_full_name ()); + write_string (sig.return_type.data_type.get_full_name ()); if (sig.return_type.non_null) { write_string ("!"); } @@ -579,8 +577,8 @@ public class Vala.InterfaceWriter : CodeVisitor { } private void write_identifier (string! s) { - if (s == "base" || s == "callback" || s == "class" || - s == "construct" || s == "flags" || s == "foreach" || + if (s == "base" || s == "class" || + s == "construct" || s == "delegate" || s == "foreach" || s == "in" || s == "interface" || s == "lock" || s == "namespace" || s == "out" || s == "ref") { stream.putc ('@'); diff --git a/vala/valalockstatement.vala b/vala/valalockstatement.vala index 775725e08..9243c9a6b 100644 --- a/vala/valalockstatement.vala +++ b/vala/valalockstatement.vala @@ -1,6 +1,6 @@ /* valalockstatement.vala * - * Copyright (C) 2006 Raffaele Sandrini + * Copyright (C) 2006-2007 Raffaele Sandrini, Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * Represents a lock statement e.g. "lock (a) { f(a) }". */ -public class Vala.LockStatement : Statement { +public class Vala.LockStatement : CodeNode, Statement { /** * Expression representing the resource to be locked. */ @@ -34,12 +34,9 @@ public class Vala.LockStatement : Statement { /** * The statement during its execution the resource is locked. */ - public Statement! body { get; set construct; } + public Block! body { get; set construct; } - public LockStatement (Expression _resource, Statement _body, SourceReference source) { - resource = _resource; - body = _body; - source_reference = source; + public LockStatement (construct Expression resource, construct Block body, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valamember.vala b/vala/valamember.vala index 651a98b1e..de4014df9 100644 --- a/vala/valamember.vala +++ b/vala/valamember.vala @@ -1,6 +1,6 @@ /* valamember.vala * - * Copyright (C) 2006 Raffaele Sandrini + * Copyright (C) 2006-2007 Raffaele Sandrini, Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,7 +23,7 @@ /** * Represents a general class member. */ -public class Vala.Member : CodeNode { +public class Vala.Member : Symbol { public override void accept (CodeVisitor! visitor) { visitor.visit_member (this); } diff --git a/vala/valamemorymanager.vala b/vala/valamemorymanager.vala index 28e4b5e65..b580ce2b9 100644 --- a/vala/valamemorymanager.vala +++ b/vala/valamemorymanager.vala @@ -88,7 +88,7 @@ public class Vala.MemoryManager : CodeVisitor { } public override void visit_method (Method! m) { - current_symbol = m.symbol; + current_symbol = m; m.accept_children (this); } @@ -98,7 +98,7 @@ public class Vala.MemoryManager : CodeVisitor { } public override void visit_property (Property! prop) { - current_symbol = prop.symbol; + current_symbol = prop; prop.accept_children (this); } @@ -135,8 +135,8 @@ public class Vala.MemoryManager : CodeVisitor { public override void visit_end_return_statement (ReturnStatement! stmt) { if (stmt.return_expression != null) { - if (current_symbol.node is Method) { - var m = (Method) current_symbol.node; + if (current_symbol is Method) { + var m = (Method) current_symbol; if (m.return_type.transfers_ownership) { visit_possibly_missing_copy_expression (stmt.return_expression); @@ -172,23 +172,23 @@ public class Vala.MemoryManager : CodeVisitor { List<weak FormalParameter> params; var msym = expr.call.symbol_reference; - if (msym.node is VariableDeclarator) { - var decl = (VariableDeclarator) msym.node; + if (msym is VariableDeclarator) { + var decl = (VariableDeclarator) msym; var cb = (Callback) decl.type_reference.data_type; params = cb.get_parameters (); - } else if (msym.node is FormalParameter) { - var param = (FormalParameter) msym.node; + } else if (msym is FormalParameter) { + var param = (FormalParameter) msym; var cb = (Callback) param.type_reference.data_type; params = cb.get_parameters (); - } else if (msym.node is Field) { - var f = (Field) msym.node; + } else if (msym is Field) { + var f = (Field) msym; var cb = (Callback) f.type_reference.data_type; params = cb.get_parameters (); - } else if (msym.node is Method) { - var m = (Method) msym.node; + } else if (msym is Method) { + var m = (Method) msym; params = m.get_parameters (); - } else if (msym.node is Signal) { - var sig = (Signal) msym.node; + } else if (msym is Signal) { + var sig = (Signal) msym; params = sig.get_parameters (); } weak List<weak FormalParameter> params_it = params; @@ -206,7 +206,7 @@ public class Vala.MemoryManager : CodeVisitor { var ma = (MemberAccess) expr.call; TypeReference instance_type = ma.inner.static_type; // trace type arguments back to the datatype where the method has been declared - while (instance_type.data_type != msym.parent_symbol.node) { + while (instance_type.data_type != msym.parent_symbol) { List<weak TypeReference> base_types = null; if (instance_type.data_type is Class) { var cl = (Class) instance_type.data_type; @@ -220,7 +220,7 @@ public class Vala.MemoryManager : CodeVisitor { return; } foreach (TypeReference base_type in base_types) { - if (SemanticAnalyzer.symbol_lookup_inherited (base_type.data_type.symbol, msym.name) != null) { + if (SemanticAnalyzer.symbol_lookup_inherited (base_type.data_type, msym.name) != null) { // construct a new type reference for the base type with correctly linked type arguments var instance_base_type = new TypeReference (); instance_base_type.data_type = base_type.data_type; @@ -241,7 +241,7 @@ public class Vala.MemoryManager : CodeVisitor { } } } - if (instance_type.data_type != msym.parent_symbol.node) { + if (instance_type.data_type != msym.parent_symbol) { Report.error (expr.source_reference, "internal error: generic type parameter tracing not supported yet"); expr.error = true; return; @@ -284,7 +284,7 @@ public class Vala.MemoryManager : CodeVisitor { } public override void visit_end_assignment (Assignment! a) { - if (a.left is PointerIndirection || (a.left.symbol_reference != null && a.left.symbol_reference.node is Signal)) { + if (a.left is PointerIndirection || a.left.symbol_reference is Signal) { } else { if (a.left.static_type.takes_ownership) { visit_possibly_missing_copy_expression (a.right); diff --git a/vala/valamethod.vala b/vala/valamethod.vala index c6c85abcd..16ad70637 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -28,11 +28,6 @@ using GLib; */ public class Vala.Method : Member, Invokable { /** - * The symbol name of this method. - */ - public string name { get; set; } - - /** * The return type of this method. */ public TypeReference return_type { get; set; } @@ -150,10 +145,7 @@ public class Vala.Method : Member, Invokable { * @param source reference to source code * @return newly created method */ - public Method (string _name, TypeReference _return_type, SourceReference source = null) { - name = _name; - return_type = _return_type; - source_reference = source; + public Method (construct string name, construct TypeReference return_type, construct SourceReference source_reference = null) { } /** @@ -167,6 +159,9 @@ public class Vala.Method : Member, Invokable { } parameters.append (param); + if (!param.ellipsis) { + scope.add (param.name, param); + } } public List<weak FormalParameter> get_parameters () { @@ -222,17 +217,10 @@ public class Vala.Method : Member, Invokable { * @return the name to be used in C code by default */ public virtual string! get_default_cname () { - var parent = symbol.parent_symbol.node; - if (parent is DataType) { - if (name.has_prefix ("_")) { - return "_%s%s".printf (((DataType) parent).get_lower_case_cprefix (), name.offset (1)); - } else { - return "%s%s".printf (((DataType) parent).get_lower_case_cprefix (), name); - } - } else if (parent is Namespace) { - return "%s%s".printf (((Namespace) parent).get_lower_case_cprefix (), name); + if (name.has_prefix ("_")) { + return "_%s%s".printf (parent_symbol.get_lower_case_cprefix (), name.offset (1)); } else { - return name; + return "%s%s".printf (parent_symbol.get_lower_case_cprefix (), name); } } @@ -244,8 +232,7 @@ public class Vala.Method : Member, Invokable { */ public string! get_real_cname () { if (base_method != null || base_interface_method != null) { - var parent = (Class) symbol.parent_symbol.node; - return "%s_real_%s".printf (parent.get_lower_case_cname (null), name); + return "%s_real_%s".printf (parent_symbol.get_lower_case_cname (null), name); } else { return get_cname (); } diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala index b76d52d66..25c235047 100644 --- a/vala/valanamespace.vala +++ b/vala/valanamespace.vala @@ -25,17 +25,16 @@ using GLib; /** * Represents a namespace declaration in the source code. */ -public class Vala.Namespace : CodeNode { +public class Vala.Namespace : Symbol { /** - * The name of this namespace. + * Specifies whether this namespace is only used in a VAPI package file. */ - public string name { get; set; } + public bool pkg { get; set; } private List<Class> classes; private List<Interface> interfaces; private List<Struct> structs; private List<Enum> enums; - private List<Flags> flags_; private List<Callback> callbacks; private List<Constant> constants; private List<Field> fields; @@ -45,7 +44,9 @@ public class Vala.Namespace : CodeNode { private string lower_case_cprefix; private List<string> cheader_filenames; - + + private List<Namespace> namespaces; + /** * Creates a new namespace. * @@ -53,29 +54,36 @@ public class Vala.Namespace : CodeNode { * @param source reference to source code * @return newly created namespace */ - public Namespace (string _name, SourceReference source = null) { - name = _name; - source_reference = source; + public Namespace (construct string name, construct SourceReference source_reference = null) { } /** - * Adds the specified class to this namespace. + * Adds the specified namespace to this source file. * - * @param cl a class + * @param ns a namespace */ - public void add_class (Class! cl) { - classes.append (cl); - cl.@namespace = this; + public void add_namespace (Namespace! ns) { + namespaces.append (ns); + scope.add (ns.name, ns); } - + /** - * Removes the specified class from this namespace. + * Returns a copy of the list of namespaces. + * + * @return namespace list + */ + public List<weak Namespace> get_namespaces () { + return namespaces.copy (); + } + + /** + * Adds the specified class to this namespace. * * @param cl a class */ - public void remove_class (Class! cl) { - cl.@namespace = null; - classes.remove (cl); + public void add_class (Class! cl) { + classes.append (cl); + scope.add (cl.name, cl); } /** @@ -85,7 +93,7 @@ public class Vala.Namespace : CodeNode { */ public void add_interface (Interface! iface) { interfaces.append (iface); - iface.@namespace = this; + scope.add (iface.name, iface); } /** @@ -95,7 +103,7 @@ public class Vala.Namespace : CodeNode { */ public void add_struct (Struct! st) { structs.append (st); - st.@namespace = this; + scope.add (st.name, st); } /** @@ -105,27 +113,17 @@ public class Vala.Namespace : CodeNode { */ public void add_enum (Enum! en) { enums.append (en); - en.@namespace = this; + scope.add (en.name, en); } /** - * Adds the specified flags to this namespace. - * - * @param fl a flags - */ - public void add_flags (Flags! fl) { - flags_.append (fl); - fl.@namespace = this; - } - - /** * Adds the specified callback to this namespace. * * @param cb a callback */ public void add_callback (Callback! cb) { callbacks.append (cb); - cb.@namespace = this; + scope.add (cb.name, cb); } /** @@ -162,6 +160,7 @@ public class Vala.Namespace : CodeNode { */ public void add_constant (Constant! constant) { constants.append (constant); + scope.add (constant.name, constant); } /** @@ -171,6 +170,7 @@ public class Vala.Namespace : CodeNode { */ public void add_field (Field! f) { fields.append (f); + scope.add (f.name, f); } /** @@ -179,7 +179,21 @@ public class Vala.Namespace : CodeNode { * @param m a method */ public void add_method (Method! m) { + if (m is CreationMethod) { + Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); + + m.error = true; + return; + } + if (m.instance) { + Report.error (m.source_reference, "instance methods not allowed outside of data types"); + + m.error = true; + return; + } + methods.append (m); + scope.add (m.name, m); } public override void accept (CodeVisitor! visitor) { @@ -187,13 +201,13 @@ public class Vala.Namespace : CodeNode { } public override void accept_children (CodeVisitor! visitor) { - /* process enums and flags first to avoid order problems in C code */ - foreach (Enum en in enums) { - en.accept (visitor); + foreach (Namespace ns in namespaces) { + ns.accept (visitor); } - foreach (Flags fl in flags_) { - fl.accept (visitor); + /* process enums first to avoid order problems in C code */ + foreach (Enum en in enums) { + en.accept (visitor); } foreach (Class cl in classes) { @@ -224,55 +238,8 @@ public class Vala.Namespace : CodeNode { m.accept (visitor); } } - - /** - * Converts a string from CamelCase to lower_case. - * - * @param camel_case a string in camel case - * @return the specified string converted to lower case - */ - public static string! camel_case_to_lower_case (string! camel_case) { - String result = new String (""); - - weak string i = camel_case; - - bool first = true; - while (i.len () > 0) { - unichar c = i.get_char (); - if (c.isupper () && !first) { - /* current character is upper case and - * we're not at the beginning */ - weak string t = i.prev_char (); - bool prev_upper = t.get_char ().isupper (); - t = i.next_char (); - bool next_upper = t.get_char ().isupper (); - if (!prev_upper || (i.len () >= 2 && !next_upper)) { - /* previous character wasn't upper case or - * next character isn't upper case*/ - int len = result.str.len (); - if (len != 1 && result.str.offset (len - 2).get_char () != '_') { - /* we're not creating 1 character words */ - result.append_c ('_'); - } - } - } - - result.append_unichar (c.tolower ()); - - first = false; - i = i.next_char (); - } - - return result.str; - } - /** - * Returns the camel case string to be prepended to the name of members - * of this namespace when used in C code. - * - * @return the camel case prefix to be used in C code - */ - public string! get_cprefix () { + public override string! get_cprefix () { if (cprefix == null) { if (name == null) { cprefix = ""; @@ -299,7 +266,7 @@ public class Vala.Namespace : CodeNode { * * @return the lower case prefix to be used in C code */ - public string! get_lower_case_cprefix () { + public override string! get_lower_case_cprefix () { if (lower_case_cprefix == null) { if (name == null) { lower_case_cprefix = ""; @@ -320,19 +287,7 @@ public class Vala.Namespace : CodeNode { this.lower_case_cprefix = cprefix; } - /** - * Returns a list of C header filenames users of this namespace must - * include. - * - * @return list of C header filenames for this namespace - */ - public List<weak string> get_cheader_filenames () { - if (cheader_filenames == null) { - if (source_reference != null && !source_reference.file.pkg) { - // don't add default include directives for VAPI files - cheader_filenames.append (source_reference.file.get_cinclude_filename ()); - } - } + public override List<weak string> get_cheader_filenames () { return cheader_filenames.copy (); } diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala index 0de75331f..3009ad90d 100644 --- a/vala/valaproperty.vala +++ b/vala/valaproperty.vala @@ -27,11 +27,6 @@ using GLib; */ public class Vala.Property : Member, Lockable { /** - * The property name. - */ - public string! name { get; set construct; } - - /** * The property type. */ public TypeReference! type_reference { get; set construct; } @@ -147,7 +142,7 @@ public class Vala.Property : Member, Lockable { * @return the upper case name to be used in C code */ public string! get_upper_case_cname () { - return "%s_%s".printf (((DataType) symbol.parent_symbol.node).get_lower_case_cname (null), Namespace.camel_case_to_lower_case (name)).up (); + return "%s_%s".printf (parent_symbol.get_lower_case_cname (null), camel_case_to_lower_case (name)).up (); } /** diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala index 1dd0ab8c9..7bd3a15d9 100644 --- a/vala/valapropertyaccessor.vala +++ b/vala/valapropertyaccessor.vala @@ -27,6 +27,11 @@ using GLib; */ public class Vala.PropertyAccessor : CodeNode { /** + * The corresponding property. + */ + public weak Property prop { get; set; } + + /** * Specifies whether this accessor may be used to get the property. */ public bool readable { get; set; } @@ -45,7 +50,7 @@ public class Vala.PropertyAccessor : CodeNode { /** * The accessor body. */ - public Statement body { get; set; } + public Block body { get; set; } /** * Represents the generated value parameter in a set accessor. @@ -62,12 +67,7 @@ public class Vala.PropertyAccessor : CodeNode { * @param source reference to source code * @return newly created property accessor */ - public PropertyAccessor (bool _readable, bool _writable, bool _construction, Statement _body, SourceReference source) { - readable = _readable; - writable = _writable; - construction = _construction; - body = _body; - source_reference = source; + public PropertyAccessor (construct bool readable, construct bool writable, construct bool construction, construct Block body, construct SourceReference source_reference) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala index 52e7b0841..3ec1ab720 100644 --- a/vala/valareturnstatement.vala +++ b/vala/valareturnstatement.vala @@ -1,6 +1,6 @@ /* valareturnstatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * Represents a return statement in the source code. */ -public class Vala.ReturnStatement : Statement { +public class Vala.ReturnStatement : CodeNode, Statement { /** * The optional expression to return. */ diff --git a/vala/valascope.vala b/vala/valascope.vala new file mode 100644 index 000000000..745c8e58a --- /dev/null +++ b/vala/valascope.vala @@ -0,0 +1,89 @@ +/* valascope.vala + * + * Copyright (C) 2006-2007 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + */ + +using GLib; + +/** + * Represents a part of the symbol tree. + */ +public class Vala.Scope { + /** + * The symbol that owns this scope. + */ + public weak Symbol owner { get; set; } + + /** + * The parent of this scope. + */ + public weak Scope parent_scope { get; set; } + + private HashTable<string,Symbol> symbol_table; + + /** + * Creates a new scope. + * + * @return newly created scope + */ + public Scope (construct Symbol owner = null) { + } + + /** + * Adds the specified symbol with the specified name to the symbol table + * of this scope. + * + * @param name name for the specified symbol + * @param sym a symbol + */ + public void add (string name, Symbol! sym) { + if (name != null) { + if (symbol_table == null) { + symbol_table = new HashTable.full (str_hash, str_equal, g_free, g_object_unref); + } else if (lookup (name) != null) { + owner.error = true; + Report.error (owner.source_reference, "`%s' already contains a definition for `%s'".printf (owner.get_full_name (), name)); + return; + } + + symbol_table.insert (name, sym); + } + sym.owner = this; + } + + /** + * Returns the symbol stored in the symbol table with the specified + * name. + * + * @param name name of the symbol to be returned + * @return found symbol or null + */ + public Symbol lookup (string! name) { + if (symbol_table == null) { + return null; + } + Symbol sym = symbol_table.lookup (name); + if (sym != null && !sym.active) { + sym = null; + } + return sym; + } +} + diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 2309f35c2..f11f3bba8 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -69,37 +69,37 @@ public class Vala.SemanticAnalyzer : CodeVisitor { root_symbol = context.root; bool_type = new TypeReference (); - bool_type.data_type = (DataType) root_symbol.lookup ("bool").node; + bool_type.data_type = (DataType) root_symbol.scope.lookup ("bool"); string_type = new TypeReference (); - string_type.data_type = (DataType) root_symbol.lookup ("string").node; + string_type.data_type = (DataType) root_symbol.scope.lookup ("string"); - pointer_type = (DataType) root_symbol.lookup ("pointer").node; + pointer_type = (DataType) root_symbol.scope.lookup ("pointer"); int_type = new TypeReference (); - int_type.data_type = (DataType) root_symbol.lookup ("int").node; + int_type.data_type = (DataType) root_symbol.scope.lookup ("int"); uint_type = new TypeReference (); - uint_type.data_type = (DataType) root_symbol.lookup ("uint").node; + uint_type.data_type = (DataType) root_symbol.scope.lookup ("uint"); ulong_type = new TypeReference (); - ulong_type.data_type = (DataType) root_symbol.lookup ("ulong").node; + ulong_type.data_type = (DataType) root_symbol.scope.lookup ("ulong"); unichar_type = new TypeReference (); - unichar_type.data_type = (DataType) root_symbol.lookup ("unichar").node; + unichar_type.data_type = (DataType) root_symbol.scope.lookup ("unichar"); // TODO: don't require GLib namespace in semantic analyzer - var glib_ns = root_symbol.lookup ("GLib"); + var glib_ns = root_symbol.scope.lookup ("GLib"); if (glib_ns != null) { - initially_unowned_type = (DataType) glib_ns.lookup ("InitiallyUnowned").node; + initially_unowned_type = (DataType) glib_ns.scope.lookup ("InitiallyUnowned"); type_type = new TypeReference (); - type_type.data_type = (DataType) glib_ns.lookup ("Type").node; + type_type.data_type = (DataType) glib_ns.scope.lookup ("Type"); - glist_type = (DataType) glib_ns.lookup ("List").node; - gslist_type = (DataType) glib_ns.lookup ("SList").node; + glist_type = (DataType) glib_ns.scope.lookup ("List"); + gslist_type = (DataType) glib_ns.scope.lookup ("SList"); - gerror_type = (DataType) glib_ns.lookup ("Error").node; + gerror_type = (DataType) glib_ns.scope.lookup ("Error"); } current_symbol = root_symbol; @@ -118,15 +118,15 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_class (Class! cl) { - current_symbol = cl.symbol; + current_symbol = cl; current_class = cl; if (cl.base_class != null) { - current_source_file.add_symbol_dependency (cl.base_class.symbol, SourceFileDependencyType.HEADER_FULL); + current_source_file.add_symbol_dependency (cl.base_class, SourceFileDependencyType.HEADER_FULL); } foreach (TypeReference base_type_reference in cl.get_base_types ()) { - current_source_file.add_symbol_dependency (base_type_reference.data_type.symbol, SourceFileDependencyType.HEADER_FULL); + current_source_file.add_symbol_dependency (base_type_reference.data_type, SourceFileDependencyType.HEADER_FULL); } cl.accept_children (this); @@ -142,14 +142,14 @@ public class Vala.SemanticAnalyzer : CodeVisitor { List<string> missing_prereqs = null; foreach (DataType prereq in prerequisites) { if (!class_is_a (cl, prereq)) { - missing_prereqs.prepend (prereq.symbol.get_full_name ()); + missing_prereqs.prepend (prereq.get_full_name ()); } } /* report any missing prerequisites */ if (missing_prereqs != null) { cl.error = true; - string error_string = "%s: some prerequisites (".printf (cl.symbol.get_full_name ()); + string error_string = "%s: some prerequisites (".printf (cl.get_full_name ()); bool first = true; foreach (string s in missing_prereqs) { if (first) { @@ -175,10 +175,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor { /* check methods */ foreach (Method m in iface.get_methods ()) { if (m.is_abstract) { - var sym = cl.symbol.lookup (m.name); - if (sym == null || !(sym.node is Method) || ((Method) sym.node).base_interface_method != m) { + var sym = cl.scope.lookup (m.name); + if (sym == null || !(sym is Method) || ((Method) sym).base_interface_method != m) { cl.error = true; - Report.error (cl.source_reference, "`%s' does not implement interface method `%s'".printf (cl.symbol.get_full_name (), m.symbol.get_full_name ())); + Report.error (cl.source_reference, "`%s' does not implement interface method `%s'".printf (cl.get_full_name (), m.get_full_name ())); } } } @@ -193,10 +193,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor { while (base_class != null && base_class.is_abstract) { foreach (Method m in base_class.get_methods ()) { if (m.is_abstract) { - var sym = cl.symbol.lookup (m.name); - if (sym == null || !(sym.node is Method) || ((Method) sym.node).base_method != m) { + var sym = cl.scope.lookup (m.name); + if (sym == null || !(sym is Method) || ((Method) sym).base_method != m) { cl.error = true; - Report.error (cl.source_reference, "`%s' does not implement abstract method `%s'".printf (cl.symbol.get_full_name (), m.symbol.get_full_name ())); + Report.error (cl.source_reference, "`%s' does not implement abstract method `%s'".printf (cl.get_full_name (), m.get_full_name ())); } } } @@ -248,7 +248,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_struct (Struct! st) { - current_symbol = st.symbol; + current_symbol = st; current_struct = st; st.accept_children (this); @@ -258,10 +258,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_interface (Interface! iface) { - current_symbol = iface.symbol; + current_symbol = iface; foreach (TypeReference prerequisite_reference in iface.get_prerequisites ()) { - current_source_file.add_symbol_dependency (prerequisite_reference.data_type.symbol, SourceFileDependencyType.HEADER_FULL); + current_source_file.add_symbol_dependency (prerequisite_reference.data_type, SourceFileDependencyType.HEADER_FULL); } iface.accept_children (this); @@ -279,7 +279,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (class_or_interface is Class) { if (prereq_class != null) { iface.error = true; - Report.error (iface.source_reference, "%s: Interfaces cannot have multiple instantiable prerequisites (`%s' and `%s')".printf (iface.symbol.get_full_name (), class_or_interface.symbol.get_full_name (), prereq_class.symbol.get_full_name ())); + Report.error (iface.source_reference, "%s: Interfaces cannot have multiple instantiable prerequisites (`%s' and `%s')".printf (iface.get_full_name (), class_or_interface.get_full_name (), prereq_class.get_full_name ())); return; } @@ -311,18 +311,18 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (f.access != MemberAccessibility.PRIVATE) { if (f.type_reference.data_type != null) { /* is null if it references a type parameter */ - current_source_file.add_symbol_dependency (f.type_reference.data_type.symbol, SourceFileDependencyType.HEADER_SHALLOW); + current_source_file.add_symbol_dependency (f.type_reference.data_type, SourceFileDependencyType.HEADER_SHALLOW); } } else { if (f.type_reference.data_type != null) { /* is null if it references a type parameter */ - current_source_file.add_symbol_dependency (f.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (f.type_reference.data_type, SourceFileDependencyType.SOURCE); } } } public override void visit_method (Method! m) { - current_symbol = m.symbol; + current_symbol = m; current_return_type = m.return_type; var init_attr = m.get_attribute ("ModuleInit"); @@ -332,7 +332,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (m.return_type.data_type != null) { /* is null if it is void or a reference to a type parameter */ - current_source_file.add_symbol_dependency (m.return_type.data_type.symbol, SourceFileDependencyType.HEADER_SHALLOW); + current_source_file.add_symbol_dependency (m.return_type.data_type, SourceFileDependencyType.HEADER_SHALLOW); } m.accept_children (this); @@ -340,39 +340,38 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_symbol = current_symbol.parent_symbol; current_return_type = null; - if (current_symbol.parent_symbol != null && - current_symbol.parent_symbol.node is Method) { + if (current_symbol.parent_symbol is Method) { /* lambda expressions produce nested methods */ - var up_method = (Method) current_symbol.parent_symbol.node; + var up_method = (Method) current_symbol.parent_symbol; current_return_type = up_method.return_type; } - if (current_symbol.node is Class) { + if (current_symbol is Class) { if (!(m is CreationMethod)) { - find_base_interface_method (m, (Class) current_symbol.node); + find_base_interface_method (m, (Class) current_symbol); if (m.is_virtual || m.overrides) { - find_base_class_method (m, (Class) current_symbol.node); + find_base_class_method (m, (Class) current_symbol); if (m.base_method == null) { - Report.error (m.source_reference, "%s: no suitable method found to override".printf (m.symbol.get_full_name ())); + Report.error (m.source_reference, "%s: no suitable method found to override".printf (m.get_full_name ())); } } } - } else if (current_symbol.node is Struct) { + } else if (current_symbol is Struct) { if (m.is_abstract || m.is_virtual || m.overrides) { - Report.error (m.source_reference, "A struct member `%s' cannot be marked as override, virtual, or abstract".printf (m.symbol.get_full_name ())); + Report.error (m.source_reference, "A struct member `%s' cannot be marked as override, virtual, or abstract".printf (m.get_full_name ())); return; } } } private void find_base_class_method (Method! m, Class! cl) { - var sym = cl.symbol.lookup (m.name); - if (sym != null && sym.node is Method) { - var base_method = (Method) sym.node; + var sym = cl.scope.lookup (m.name); + if (sym is Method) { + var base_method = (Method) sym; if (base_method.is_abstract || base_method.is_virtual) { if (!m.equals (base_method)) { m.error = true; - Report.error (m.source_reference, "Return type and/or parameters of overriding method `%s' do not match overridden method `%s'.".printf (m.symbol.get_full_name (), base_method.symbol.get_full_name ())); + Report.error (m.source_reference, "Return type and/or parameters of overriding method `%s' do not match overridden method `%s'.".printf (m.get_full_name (), base_method.get_full_name ())); return; } @@ -390,13 +389,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { // FIXME report error if multiple possible base methods are found foreach (TypeReference type in cl.get_base_types ()) { if (type.data_type is Interface) { - var sym = type.data_type.symbol.lookup (m.name); - if (sym != null && sym.node is Method) { - var base_method = (Method) sym.node; + var sym = type.data_type.scope.lookup (m.name); + if (sym is Method) { + var base_method = (Method) sym; if (base_method.is_abstract) { if (!m.equals (base_method)) { m.error = true; - Report.error (m.source_reference, "Return type and/or parameters of overriding method `%s' do not match overridden method `%s'.".printf (m.symbol.get_full_name (), base_method.symbol.get_full_name ())); + Report.error (m.source_reference, "Return type and/or parameters of overriding method `%s' do not match overridden method `%s'.".printf (m.get_full_name (), base_method.get_full_name ())); return; } @@ -410,12 +409,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public override void visit_creation_method (CreationMethod! m) { m.return_type = new TypeReference (); - m.return_type.data_type = (DataType) current_symbol.node; + m.return_type.data_type = (DataType) m.parent_symbol; m.return_type.transfers_ownership = true; - if (current_symbol.node is Class) { + if (current_symbol is Class) { // check for floating reference - var cl = (Class) current_symbol.node; + var cl = (Class) current_symbol; while (cl != null) { if (cl == initially_unowned_type) { m.return_type.floating_reference = true; @@ -426,7 +425,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } } - current_symbol = m.symbol; + current_symbol = m; current_return_type = m.return_type; m.accept_children (this); @@ -434,26 +433,25 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_symbol = current_symbol.parent_symbol; current_return_type = null; - if (current_symbol.parent_symbol != null && - current_symbol.parent_symbol.node is Method) { + if (current_symbol.parent_symbol is Method) { /* lambda expressions produce nested methods */ - var up_method = (Method) current_symbol.parent_symbol.node; + var up_method = (Method) current_symbol.parent_symbol; current_return_type = up_method.return_type; } - if (current_symbol.node is Class) { + if (current_symbol is Class) { if (!(m is CreationMethod)) { - find_base_interface_method (m, (Class) current_symbol.node); + find_base_interface_method (m, (Class) current_symbol); if (m.is_virtual || m.overrides) { - find_base_class_method (m, (Class) current_symbol.node); + find_base_class_method (m, (Class) current_symbol); if (m.base_method == null) { - Report.error (m.source_reference, "%s: no suitable method found to override".printf (m.symbol.get_full_name ())); + Report.error (m.source_reference, "%s: no suitable method found to override".printf (m.get_full_name ())); } } } - } else if (current_symbol.node is Struct) { + } else if (current_symbol is Struct) { if (m.is_abstract || m.is_virtual || m.overrides) { - Report.error (m.source_reference, "A struct member `%s' cannot be marked as override, virtual, or abstract".printf (m.symbol.get_full_name ())); + Report.error (m.source_reference, "A struct member `%s' cannot be marked as override, virtual, or abstract".printf (m.get_full_name ())); return; } } @@ -461,13 +459,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (m.body != null && current_class != null) { int n_params = 0; foreach (Statement stmt in m.body.get_statements ()) { - int params = stmt.get_number_of_set_construction_parameters (); - if (params == -1) { + if (!(stmt is ExpressionStatement) || !((ExpressionStatement) stmt).sets_property ()) { m.error = true; Report.error (stmt.source_reference, "class creation methods only allow property assignment statements"); return; } - n_params += params; + n_params++; } m.n_construction_params = n_params; } @@ -479,46 +476,46 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (!p.ellipsis) { if (p.type_reference.data_type != null) { /* is null if it references a type parameter */ - current_source_file.add_symbol_dependency (p.type_reference.data_type.symbol, SourceFileDependencyType.HEADER_SHALLOW); - current_source_file.add_symbol_dependency (p.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (p.type_reference.data_type, SourceFileDependencyType.HEADER_SHALLOW); + current_source_file.add_symbol_dependency (p.type_reference.data_type, SourceFileDependencyType.SOURCE); } } /* special treatment for construct formal parameters used in creation methods */ if (p.construct_parameter) { - if (!(p.symbol.parent_symbol.node is CreationMethod)) { + if (!(p.parent_symbol is CreationMethod)) { p.error = true; Report.error (p.source_reference, "construct parameters are only allowed in type creation methods"); return; } - var method_body = ((CreationMethod)p.symbol.parent_symbol.node).body; + var method_body = ((CreationMethod) p.parent_symbol).body; var left = new MemberAccess.simple (p.name); var right = new MemberAccess.simple (p.name); /* try to lookup the requested property */ - var prop_sym = symbol_lookup_inherited (current_class.symbol, p.name); - if (!(prop_sym.node is Property)) { + var prop_sym = symbol_lookup_inherited (current_class, p.name); + if (!(prop_sym is Property)) { p.error = true; - Report.error (p.source_reference, "class `%s' does not contain a property named `%s'".printf (current_class.symbol.get_full_name (), p.name)); + Report.error (p.source_reference, "class `%s' does not contain a property named `%s'".printf (current_class.get_full_name (), p.name)); return; } left.symbol_reference = prop_sym; - right.symbol_reference = p.symbol; + right.symbol_reference = p; method_body.add_statement (new ExpressionStatement (new Assignment (left, right))); } } private void find_base_class_property (Property! prop, Class! cl) { - var sym = cl.symbol.lookup (prop.name); - if (sym != null && sym.node is Property) { - var base_property = (Property) sym.node; + var sym = cl.scope.lookup (prop.name); + if (sym is Property) { + var base_property = (Property) sym; if (base_property.is_abstract || base_property.is_virtual) { if (!prop.equals (base_property)) { prop.error = true; - Report.error (prop.source_reference, "Type and/or accessors of overriding property `%s' do not match overridden property `%s'.".printf (prop.symbol.get_full_name (), base_property.symbol.get_full_name ())); + Report.error (prop.source_reference, "Type and/or accessors of overriding property `%s' do not match overridden property `%s'.".printf (prop.get_full_name (), base_property.get_full_name ())); return; } @@ -536,13 +533,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { // FIXME report error if multiple possible base properties are found foreach (TypeReference type in cl.get_base_types ()) { if (type.data_type is Interface) { - var sym = type.data_type.symbol.lookup (prop.name); - if (sym != null && sym.node is Property) { - var base_property = (Property) sym.node; + var sym = type.data_type.scope.lookup (prop.name); + if (sym is Property) { + var base_property = (Property) sym; if (base_property.is_abstract) { if (!prop.equals (base_property)) { prop.error = true; - Report.error (prop.source_reference, "Type and/or accessors of overriding property `%s' do not match overridden property `%s'.".printf (prop.symbol.get_full_name (), base_property.symbol.get_full_name ())); + Report.error (prop.source_reference, "Type and/or accessors of overriding property `%s' do not match overridden property `%s'.".printf (prop.get_full_name (), base_property.get_full_name ())); return; } @@ -555,37 +552,59 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_property (Property! prop) { + current_symbol = prop; + prop.accept_children (this); + current_symbol = current_symbol.parent_symbol; + if (prop.type_reference.data_type != null) { /* is null if it references a type parameter */ - current_source_file.add_symbol_dependency (prop.type_reference.data_type.symbol, SourceFileDependencyType.HEADER_SHALLOW); - current_source_file.add_symbol_dependency (prop.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (prop.type_reference.data_type, SourceFileDependencyType.HEADER_SHALLOW); + current_source_file.add_symbol_dependency (prop.type_reference.data_type, SourceFileDependencyType.SOURCE); } - if (prop.symbol.parent_symbol.node is Class) { - var cl = (Class) prop.symbol.parent_symbol.node; + if (prop.parent_symbol is Class) { + var cl = (Class) prop.parent_symbol; find_base_interface_property (prop, cl); if (prop.is_virtual || prop.overrides) { find_base_class_property (prop, cl); if (prop.base_property == null) { prop.error = true; - Report.error (prop.source_reference, "%s: no suitable property found to override".printf (prop.symbol.get_full_name ())); + Report.error (prop.source_reference, "%s: no suitable property found to override".printf (prop.get_full_name ())); } } } } public override void visit_property_accessor (PropertyAccessor! acc) { - var prop = (Property) acc.symbol.parent_symbol.node; + acc.prop = (Property) current_symbol; if (acc.readable) { - current_return_type = prop.type_reference; + current_return_type = acc.prop.type_reference; } else { // void current_return_type = new TypeReference (); } + if (!acc.source_reference.file.pkg) { + if (acc.body == null && !acc.prop.interface_only && !acc.prop.is_abstract) { + /* no accessor body specified, insert default body */ + + acc.body = new Block (); + if (acc.readable) { + acc.body.add_statement (new ReturnStatement (new MemberAccess.simple ("_%s".printf (acc.prop.name)))); + } else { + acc.body.add_statement (new ExpressionStatement (new Assignment (new MemberAccess.simple ("_%s".printf (acc.prop.name)), new MemberAccess.simple ("value")))); + } + } + + if (acc.writable || acc.construction) { + acc.value_parameter = new FormalParameter ("value", acc.prop.type_reference); + acc.body.scope.add (acc.value_parameter.name, acc.value_parameter); + } + } + acc.accept_children (this); current_return_type = null; @@ -596,7 +615,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_constructor (Constructor! c) { - current_symbol = c.symbol; + c.this_parameter = new FormalParameter ("this", new TypeReference ()); + c.this_parameter.type_reference.data_type = (DataType) current_symbol; + c.scope.add (c.this_parameter.name, c.this_parameter); + + c.owner = current_symbol.scope; + current_symbol = c; c.accept_children (this); @@ -604,7 +628,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_destructor (Destructor! d) { - current_symbol = d.symbol; + d.owner = current_symbol.scope; + current_symbol = d; d.accept_children (this); @@ -615,12 +640,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_begin_block (Block! b) { - current_symbol = b.symbol; + b.owner = current_symbol.scope; + current_symbol = b; } public override void visit_end_block (Block! b) { foreach (VariableDeclarator decl in b.get_local_variables ()) { - decl.symbol.active = false; + decl.active = false; } current_symbol = current_symbol.parent_symbol; @@ -654,15 +680,15 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - if (decl.initializer.symbol_reference.node is Method && + if (decl.initializer.symbol_reference is Method && decl.type_reference.data_type is Callback) { - var m = (Method) decl.initializer.symbol_reference.node; + var m = (Method) decl.initializer.symbol_reference; var cb = (Callback) decl.type_reference.data_type; /* check whether method matches callback type */ if (!cb.matches_method (m)) { decl.error = true; - Report.error (decl.source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.symbol.get_full_name (), cb.symbol.get_full_name ())); + Report.error (decl.source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.get_full_name (), cb.get_full_name ())); return; } @@ -688,16 +714,15 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } if (decl.type_reference.data_type != null) { - current_source_file.add_symbol_dependency (decl.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (decl.type_reference.data_type, SourceFileDependencyType.SOURCE); } - decl.symbol = new Symbol (decl); - current_symbol.add (decl.name, decl.symbol); + current_symbol.scope.add (decl.name, decl); - var block = (Block) current_symbol.node; + var block = (Block) current_symbol; block.add_local_variable (decl); - decl.symbol.active = true; + decl.active = true; } /** @@ -820,14 +845,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public override void visit_begin_foreach_statement (ForeachStatement! stmt) { if (stmt.type_reference.data_type != null) { - current_source_file.add_symbol_dependency (stmt.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (stmt.type_reference.data_type, SourceFileDependencyType.SOURCE); } stmt.variable_declarator = new VariableDeclarator (stmt.variable_name); stmt.variable_declarator.type_reference = stmt.type_reference; - stmt.variable_declarator.symbol = new Symbol (stmt.variable_declarator); - stmt.body.symbol.add (stmt.variable_name, stmt.variable_declarator.symbol); + stmt.body.scope.add (stmt.variable_name, stmt.variable_declarator); } public override void visit_end_foreach_statement (ForeachStatement! stmt) { @@ -874,8 +898,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } if (stmt.return_expression != null && - stmt.return_expression.symbol_reference != null && - stmt.return_expression.symbol_reference.node is VariableDeclarator && + stmt.return_expression.symbol_reference is VariableDeclarator && stmt.return_expression.static_type.takes_ownership && !current_return_type.transfers_ownership) { Report.warning (stmt.source_reference, "Local variable with strong reference used as return value and method return type hasn't been declared to transfer ownership"); @@ -892,15 +915,14 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public override void visit_catch_clause (CatchClause! clause) { if (clause.type_reference.data_type != null) { - current_source_file.add_symbol_dependency (clause.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (clause.type_reference.data_type, SourceFileDependencyType.SOURCE); } clause.variable_declarator = new VariableDeclarator (clause.variable_name); clause.variable_declarator.type_reference = new TypeReference (); clause.variable_declarator.type_reference.data_type = gerror_type; - clause.variable_declarator.symbol = new Symbol (clause.variable_declarator); - clause.body.symbol.add (clause.variable_name, clause.variable_declarator.symbol); + clause.body.scope.add (clause.variable_name, clause.variable_declarator); clause.accept_children (this); } @@ -912,7 +934,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { */ public override void visit_lock_statement (LockStatement! stmt) { /* resource must be a member access and denote a Lockable */ - if (!(stmt.resource is MemberAccess && stmt.resource.symbol_reference.node is Lockable)) { + if (!(stmt.resource is MemberAccess && stmt.resource.symbol_reference is Lockable)) { stmt.error = true; stmt.resource.error = true; Report.error (stmt.resource.source_reference, "Expression is either not a member access or does not denote a lockable member"); @@ -920,13 +942,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } /* parent symbol must be the current class */ - if (stmt.resource.symbol_reference.parent_symbol.node != current_class) { + if (stmt.resource.symbol_reference.parent_symbol != current_class) { stmt.error = true; stmt.resource.error = true; Report.error (stmt.resource.source_reference, "Only members of the current class are lockable"); } - ((Lockable)stmt.resource.symbol_reference.node).set_lock_used (true); + ((Lockable) stmt.resource.symbol_reference).set_lock_used (true); } public override void visit_begin_array_creation_expression (ArrayCreationExpression! expr) { @@ -993,17 +1015,17 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public override void visit_character_literal (CharacterLiteral! expr) { expr.static_type = new TypeReference (); - expr.static_type.data_type = (DataType) root_symbol.lookup ("char").node; + expr.static_type.data_type = (DataType) root_symbol.scope.lookup ("char"); } public override void visit_integer_literal (IntegerLiteral! expr) { expr.static_type = new TypeReference (); - expr.static_type.data_type = (DataType) root_symbol.lookup (expr.get_type_name ()).node; + expr.static_type.data_type = (DataType) root_symbol.scope.lookup (expr.get_type_name ()); } public override void visit_real_literal (RealLiteral! expr) { expr.static_type = new TypeReference (); - expr.static_type.data_type = (DataType) root_symbol.lookup (expr.get_type_name ()).node; + expr.static_type.data_type = (DataType) root_symbol.scope.lookup (expr.get_type_name ()); } public override void visit_string_literal (StringLiteral! expr) { @@ -1021,60 +1043,60 @@ public class Vala.SemanticAnalyzer : CodeVisitor { expr.static_type = expr.literal.static_type; } - private TypeReference get_static_type_for_node (CodeNode! node) { - if (node is Field) { - var f = (Field) node; + private TypeReference get_static_type_for_symbol (Symbol! sym) { + if (sym is Field) { + var f = (Field) sym; return f.type_reference; - } else if (node is Constant) { - var c = (Constant) node; + } else if (sym is Constant) { + var c = (Constant) sym; return c.type_reference; - } else if (node is Property) { - var prop = (Property) node; + } else if (sym is Property) { + var prop = (Property) sym; var type = prop.type_reference.copy (); type.takes_ownership = false; return type; - } else if (node is FormalParameter) { - var p = (FormalParameter) node; + } else if (sym is FormalParameter) { + var p = (FormalParameter) sym; return p.type_reference; - } else if (node is TypeReference) { - return (TypeReference) node; - } else if (node is VariableDeclarator) { - var decl = (VariableDeclarator) node; + } else if (sym is TypeReference) { + return (TypeReference) sym; + } else if (sym is VariableDeclarator) { + var decl = (VariableDeclarator) sym; return decl.type_reference; - } else if (node is EnumValue || node is FlagsValue) { + } else if (sym is EnumValue) { var type = new TypeReference (); - type.data_type = (DataType) node.symbol.parent_symbol.node; + type.data_type = (DataType) sym.parent_symbol; return type; } return null; } public static Symbol symbol_lookup_inherited (Symbol! sym, string! name) { - var result = sym.lookup (name); + var result = sym.scope.lookup (name); if (result != null) { return result; } - if (sym.node is Class) { - var cl = (Class) sym.node; + if (sym is Class) { + var cl = (Class) sym; foreach (TypeReference base_type in cl.get_base_types ()) { - result = symbol_lookup_inherited (base_type.data_type.symbol, name); + result = symbol_lookup_inherited (base_type.data_type, name); if (result != null) { return result; } } - } else if (sym.node is Struct) { - var st = (Struct) sym.node; + } else if (sym is Struct) { + var st = (Struct) sym; foreach (TypeReference base_type in st.get_base_types ()) { - result = symbol_lookup_inherited (base_type.data_type.symbol, name); + result = symbol_lookup_inherited (base_type.data_type, name); if (result != null) { return result; } } - } else if (sym.node is Interface) { - var iface = (Interface) sym.node; + } else if (sym is Interface) { + var iface = (Interface) sym; foreach (TypeReference prerequisite in iface.get_prerequisites ()) { - result = symbol_lookup_inherited (prerequisite.data_type.symbol, name); + result = symbol_lookup_inherited (prerequisite.data_type, name); if (result != null) { return result; } @@ -1092,8 +1114,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { private DataType find_parent_type (Symbol sym) { while (sym != null) { - if (sym.node is DataType) { - return (DataType) sym.node; + if (sym is DataType) { + return (DataType) sym; } sym = sym.parent_symbol; } @@ -1114,7 +1136,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (expr.symbol_reference == null) { foreach (NamespaceReference ns in current_using_directives) { - var local_sym = ns.namespace_symbol.lookup (expr.member_name); + var local_sym = ns.namespace_symbol.scope.lookup (expr.member_name); if (local_sym != null) { if (expr.symbol_reference != null) { expr.error = true; @@ -1134,14 +1156,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (expr.inner is MemberAccess || expr.inner is BaseAccess) { base_symbol = expr.inner.symbol_reference; - if (base_symbol.node is Namespace || - base_symbol.node is DataType) { - expr.symbol_reference = base_symbol.lookup (expr.member_name); + if (base_symbol is Namespace || base_symbol is DataType) { + expr.symbol_reference = base_symbol.scope.lookup (expr.member_name); } } if (expr.symbol_reference == null && expr.inner.static_type != null) { - base_symbol = expr.inner.static_type.data_type.symbol; + base_symbol = expr.inner.static_type.data_type; expr.symbol_reference = symbol_lookup_inherited (base_symbol, expr.member_name); } } @@ -1152,7 +1173,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - var member = expr.symbol_reference.node; + var member = expr.symbol_reference; MemberAccessibility access = MemberAccessibility.PUBLIC; if (member is Field) { access = ((Field) member).access; @@ -1161,19 +1182,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } if (access == MemberAccessibility.PRIVATE) { - var target_type = (DataType) member.symbol.parent_symbol.node; + var target_type = (DataType) member.parent_symbol; var this_type = find_parent_type (current_symbol); if (target_type != this_type) { expr.error = true; - Report.error (expr.source_reference, "Access to private member `%s' denied".printf (member.symbol.get_full_name ())); + Report.error (expr.source_reference, "Access to private member `%s' denied".printf (member.get_full_name ())); return; } } current_source_file.add_symbol_dependency (expr.symbol_reference, SourceFileDependencyType.SOURCE); - expr.static_type = get_static_type_for_node (expr.symbol_reference.node); + expr.static_type = get_static_type_for_symbol (expr.symbol_reference); } private bool is_type_compatible (TypeReference! expression_type, TypeReference! expected_type) { @@ -1266,8 +1287,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { List<weak FormalParameter> params; - if (msym.node is Invokable) { - var m = (Invokable) msym.node; + if (msym is Invokable) { + var m = (Invokable) msym; if (m.is_invokable ()) { params = m.get_parameters (); } else { @@ -1303,7 +1324,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { weak List<weak Expression> prev_arg_it = null; weak List<weak Expression> arg_it = args; - bool diag = (msym.node.get_attribute ("Diagnostics") != null); + bool diag = (msym.get_attribute ("Diagnostics") != null); bool ellipsis = false; int i = 0; @@ -1315,7 +1336,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { /* header file necessary if we need to cast argument */ if (param.type_reference.data_type != null) { - current_source_file.add_symbol_dependency (param.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (param.type_reference.data_type, SourceFileDependencyType.SOURCE); } if (arg_it == null) { @@ -1373,8 +1394,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { TypeReference ret_type; List<weak FormalParameter> params; - if (msym.node is Invokable) { - var m = (Invokable) msym.node; + if (msym is Invokable) { + var m = (Invokable) msym; ret_type = m.get_return_type (); params = m.get_parameters (); @@ -1403,7 +1424,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } else { TypeReference instance_type = ma.inner.static_type; // trace type arguments back to the datatype where the method has been declared - while (instance_type.data_type != msym.parent_symbol.node) { + while (instance_type.data_type != msym.parent_symbol) { List<weak TypeReference> base_types = null; if (instance_type.data_type is Class) { var cl = (Class) instance_type.data_type; @@ -1417,7 +1438,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } foreach (TypeReference base_type in base_types) { - if (symbol_lookup_inherited (base_type.data_type.symbol, msym.name) != null) { + if (symbol_lookup_inherited (base_type.data_type, msym.name) != null) { // construct a new type reference for the base type with correctly linked type arguments var instance_base_type = new TypeReference (); instance_base_type.data_type = base_type.data_type; @@ -1438,7 +1459,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } } } - if (instance_type.data_type != msym.parent_symbol.node) { + if (instance_type.data_type != msym.parent_symbol) { Report.error (expr.source_reference, "internal error: generic type parameter tracing not supported yet"); expr.error = true; return; @@ -1459,8 +1480,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } } - if (msym.node is Method) { - var m = (Method) msym.node; + if (msym is Method) { + var m = (Method) msym; expr.tree_can_fail = expr.can_fail = (m.get_error_domains ().length () > 0); } @@ -1532,7 +1553,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { expr.static_type.data_type = current_class.base_class; } - expr.symbol_reference = expr.static_type.data_type.symbol; + expr.symbol_reference = expr.static_type.data_type; } public override void visit_postfix_expression (PostfixExpression! expr) { @@ -1554,37 +1575,37 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - var constructor_node = expr.member_name.symbol_reference.node; - var type_node = expr.member_name.symbol_reference.node; + var constructor_sym = expr.member_name.symbol_reference; + var type_sym = expr.member_name.symbol_reference; var type_args = expr.member_name.get_type_arguments (); - if (constructor_node is Method) { - type_node = constructor_node.symbol.parent_symbol.node; + if (constructor_sym is Method) { + type_sym = constructor_sym.parent_symbol; - var constructor = (Method) constructor_node; - if (!(constructor_node is CreationMethod)) { + var constructor = (Method) constructor_sym; + if (!(constructor_sym is CreationMethod)) { expr.error = true; - Report.error (expr.source_reference, "`%s' is not a creation method".printf (constructor.symbol.get_full_name ())); + Report.error (expr.source_reference, "`%s' is not a creation method".printf (constructor.get_full_name ())); return; } - expr.symbol_reference = constructor.symbol; + expr.symbol_reference = constructor; type_args = ((MemberAccess) expr.member_name.inner).get_type_arguments (); - } else if (constructor_node is EnumValue) { - type_node = constructor_node.symbol.parent_symbol.node; + } else if (constructor_sym is EnumValue) { + type_sym = constructor_sym.parent_symbol; - expr.symbol_reference = constructor_node.symbol; + expr.symbol_reference = constructor_sym; } - if (type_node is Class || type_node is Struct) { - type = (DataType) type_node; - } else if (type_node is Enum && ((Enum) type_node).error_domain) { - type = (DataType) type_node; + if (type_sym is Class || type_sym is Struct) { + type = (DataType) type_sym; + } else if (type_sym is Enum && ((Enum) type_sym).error_domain) { + type = (DataType) type_sym; } else { expr.error = true; - Report.error (expr.source_reference, "`%s' is not a class, struct, or error domain".printf (type_node.symbol.get_full_name ())); + Report.error (expr.source_reference, "`%s' is not a class, struct, or error domain".printf (type_sym.get_full_name ())); return; } @@ -1603,7 +1624,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - current_source_file.add_symbol_dependency (type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (type, SourceFileDependencyType.SOURCE); expr.static_type = expr.type_reference.copy (); expr.static_type.transfers_ownership = true; @@ -1614,12 +1635,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (cl.is_abstract) { expr.static_type = null; expr.error = true; - Report.error (expr.source_reference, "Can't create instance of abstract class `%s'".printf (cl.symbol.get_full_name ())); + Report.error (expr.source_reference, "Can't create instance of abstract class `%s'".printf (cl.get_full_name ())); return; } - if (expr.symbol_reference == null && cl.default_construction_method != null) { - expr.symbol_reference = cl.default_construction_method.symbol; + if (expr.symbol_reference == null) { + expr.symbol_reference = cl.default_construction_method; } while (cl != null) { @@ -1633,21 +1654,21 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } else if (type is Struct) { var st = (Struct) type; - if (expr.symbol_reference == null && st.default_construction_method != null) { - expr.symbol_reference = st.default_construction_method.symbol; + if (expr.symbol_reference == null) { + expr.symbol_reference = st.default_construction_method; } } if (expr.symbol_reference == null && expr.get_argument_list ().length () != 0) { expr.static_type = null; expr.error = true; - Report.error (expr.source_reference, "No arguments allowed when constructing type `%s'".printf (type.symbol.get_full_name ())); + Report.error (expr.source_reference, "No arguments allowed when constructing type `%s'".printf (type.get_full_name ())); return; } - if (expr.symbol_reference != null && expr.symbol_reference.node is Method) { - var m = (Method) expr.symbol_reference.node; - check_arguments (expr, m.symbol, m.get_parameters (), expr.get_argument_list ()); + if (expr.symbol_reference is Method) { + var m = (Method) expr.symbol_reference; + check_arguments (expr, m, m.get_parameters (), expr.get_argument_list ()); expr.tree_can_fail = expr.can_fail = (m.get_error_domains ().length () > 0); } else if (type is Enum) { @@ -1784,7 +1805,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { // FIXME: check whether cast is allowed if (expr.type_reference.data_type != null) { - current_source_file.add_symbol_dependency (expr.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (expr.type_reference.data_type, SourceFileDependencyType.SOURCE); } expr.static_type = expr.type_reference; @@ -2009,7 +2030,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - current_source_file.add_symbol_dependency (expr.type_reference.data_type.symbol, SourceFileDependencyType.SOURCE); + current_source_file.add_symbol_dependency (expr.type_reference.data_type, SourceFileDependencyType.SOURCE); expr.static_type = bool_type; } @@ -2151,8 +2172,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { private Method find_current_method () { var sym = current_symbol; while (sym != null) { - if (sym.node is Method) { - return (Method) sym.node; + if (sym is Method) { + return (Method) sym; } sym = sym.parent_symbol; } @@ -2162,7 +2183,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { private bool is_in_constructor () { var sym = current_symbol; while (sym != null) { - if (sym.node is Constructor) { + if (sym is Constructor) { return true; } sym = sym.parent_symbol; @@ -2188,8 +2209,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { var cb = (Callback) l.expected_type.data_type; l.method = new Method (get_lambda_name (), cb.return_type); l.method.instance = cb.instance && in_instance_method; - l.method.symbol = new Symbol (l.method); - l.method.symbol.parent_symbol = current_symbol; + l.method.owner = current_symbol.scope; var lambda_params = l.get_parameters (); weak List<weak FormalParameter> lambda_param_it = lambda_params; @@ -2202,8 +2222,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor { var lambda_param = (string) lambda_param_it.data; var param = new FormalParameter (lambda_param, cb_param.type_reference); - param.symbol = new Symbol (param); - l.method.symbol.add (param.name, param.symbol); l.method.add_parameter (param); @@ -2219,8 +2237,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (l.expression_body != null) { var block = new Block (); - block.symbol = new Symbol (block); - block.symbol.parent_symbol = l.method.symbol; + block.scope.parent_scope = l.method.scope; if (l.method.return_type.data_type != null) { block.add_statement (new ReturnStatement (l.expression_body)); @@ -2231,11 +2248,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor { l.method.body = block; } else { l.method.body = l.statement_body; - l.method.body.symbol.parent_symbol = l.method.symbol; } + l.method.body.owner = l.method.scope; /* lambda expressions should be usable like MemberAccess of a method */ - l.symbol_reference = l.method.symbol; + l.symbol_reference = l.method; } public override void visit_begin_assignment (Assignment! a) { @@ -2248,8 +2265,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - if (ma.symbol_reference.node is Signal) { - var sig = (Signal) ma.symbol_reference.node; + if (ma.symbol_reference is Signal) { + var sig = (Signal) ma.symbol_reference; a.right.expected_type = new TypeReference (); a.right.expected_type.data_type = sig.get_callback (); @@ -2277,7 +2294,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { var ma = (MemberAccess) a.left; - if (!(ma.symbol_reference.node is Signal)) { + if (!(ma.symbol_reference is Signal)) { var old_value = new MemberAccess (ma.inner, ma.member_name); var bin = new BinaryExpression (BinaryOperator.PLUS, old_value, new ParenthesizedExpression (a.right, a.right.source_reference)); @@ -2314,8 +2331,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (a.left is MemberAccess) { var ma = (MemberAccess) a.left; - if (ma.symbol_reference.node is Signal) { - var sig = (Signal) ma.symbol_reference.node; + if (ma.symbol_reference is Signal) { + var sig = (Signal) ma.symbol_reference; if (a.right.symbol_reference == null) { a.error = true; @@ -2323,7 +2340,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { return; } - var m = (Method) a.right.symbol_reference.node; + var m = (Method) a.right.symbol_reference; if (m.instance && m.access != MemberAccessibility.PRIVATE) { /* TODO: generate wrapper function */ @@ -2342,27 +2359,27 @@ public class Vala.SemanticAnalyzer : CodeVisitor { */ m.instance_last = true; } - } else if (ma.symbol_reference.node is Property) { - var prop = (Property) ma.symbol_reference.node; + } else if (ma.symbol_reference is Property) { + var prop = (Property) ma.symbol_reference; if (prop.set_accessor == null) { ma.error = true; - Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.symbol.get_full_name ())); + Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ())); return; } - } else if (ma.symbol_reference.node is VariableDeclarator && a.right.static_type == null) { - var decl = (VariableDeclarator) ma.symbol_reference.node; + } else if (ma.symbol_reference is VariableDeclarator && a.right.static_type == null) { + var decl = (VariableDeclarator) ma.symbol_reference; var right_ma = (MemberAccess) a.right; - if (right_ma.symbol_reference.node is Method && + if (right_ma.symbol_reference is Method && decl.type_reference.data_type is Callback) { - var m = (Method) right_ma.symbol_reference.node; + var m = (Method) right_ma.symbol_reference; var cb = (Callback) decl.type_reference.data_type; /* check whether method matches callback type */ if (!cb.matches_method (m)) { decl.error = true; - Report.error (a.source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.symbol.get_full_name (), cb.symbol.get_full_name ())); + Report.error (a.source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.get_full_name (), cb.get_full_name ())); return; } @@ -2372,19 +2389,19 @@ public class Vala.SemanticAnalyzer : CodeVisitor { Report.error (a.source_reference, "Assignment: Invalid callback assignment attempt"); return; } - } else if (ma.symbol_reference.node is Field && a.right.static_type == null) { - var f = (Field) ma.symbol_reference.node; + } else if (ma.symbol_reference is Field && a.right.static_type == null) { + var f = (Field) ma.symbol_reference; var right_ma = (MemberAccess) a.right; - if (right_ma.symbol_reference.node is Method && + if (right_ma.symbol_reference is Method && f.type_reference.data_type is Callback) { - var m = (Method) right_ma.symbol_reference.node; + var m = (Method) right_ma.symbol_reference; var cb = (Callback) f.type_reference.data_type; /* check whether method matches callback type */ if (!cb.matches_method (m)) { f.error = true; - Report.error (a.source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.symbol.get_full_name (), cb.symbol.get_full_name ())); + Report.error (a.source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.get_full_name (), cb.get_full_name ())); return; } diff --git a/vala/valasignal.vala b/vala/valasignal.vala index 88ea75333..5e1b89ac8 100644 --- a/vala/valasignal.vala +++ b/vala/valasignal.vala @@ -27,11 +27,6 @@ using GLib; */ public class Vala.Signal : Member, Invokable, Lockable { /** - * The symbol name of this signal. - */ - public string! name { get; set construct; } - - /** * The return type of handlers of this signal. */ public TypeReference! return_type { get; set construct; } @@ -62,10 +57,7 @@ public class Vala.Signal : Member, Invokable, Lockable { * @param source reference to source code * @return newly created signal */ - public Signal (string! _name, TypeReference! _return_type, SourceReference source) { - name = _name; - return_type = _return_type; - source_reference = source; + public Signal (construct string! name, construct TypeReference! return_type, construct SourceReference source_reference = null) { } /** @@ -75,6 +67,7 @@ public class Vala.Signal : Member, Invokable, Lockable { */ public void add_parameter (FormalParameter! param) { parameters.append (param); + scope.add (param.name, param); } public List<weak FormalParameter> get_parameters () { @@ -100,7 +93,7 @@ public class Vala.Signal : Member, Invokable, Lockable { generated_callback.instance = true; var sender_type = new TypeReference (); - sender_type.data_type = (DataType) symbol.parent_symbol.node; + sender_type.data_type = (DataType) parent_symbol; var sender_param = new FormalParameter ("sender", sender_type); generated_callback.add_parameter (sender_param); diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala index d04ecde01..a1b40eedc 100644 --- a/vala/valasourcefile.vala +++ b/vala/valasourcefile.vala @@ -67,7 +67,7 @@ public class Vala.SourceFile { * The context this source file belongs to. */ public weak CodeContext context { get; set; } - + private List<NamespaceReference> using_directives; private List<CodeNode> nodes; @@ -91,10 +91,7 @@ public class Vala.SourceFile { * @param pkg true if this is a VAPI package file * @return newly created source file */ - public SourceFile (CodeContext! _context, string! _filename, bool _pkg = false) { - context = _context; - filename = _filename; - pkg = _pkg; + public SourceFile (construct CodeContext! context, construct string! filename, construct bool pkg = false) { } /** @@ -210,28 +207,28 @@ public class Vala.SourceFile { public void add_symbol_dependency (Symbol! sym, SourceFileDependencyType dep_type) { DataType t; - if (sym.node is DataType) { - t = (DataType) sym.node; - } else if (sym.node is Method || sym.node is Field) { - if (sym.parent_symbol.node is DataType) { - t = (DataType) sym.parent_symbol.node; + if (sym is DataType) { + t = (DataType) sym; + } else if (sym is Method || sym is Field) { + if (sym.parent_symbol is DataType) { + t = (DataType) sym.parent_symbol; } else { return; } - } else if (sym.node is Property) { - t = (DataType) sym.parent_symbol.node; - } else if (sym.node is Constant) { - if (sym.parent_symbol.node is DataType) { - t = (DataType) sym.parent_symbol.node; - } else if (sym.parent_symbol.node is Namespace) { - var ns = (Namespace) sym.parent_symbol.node; + } else if (sym is Property) { + t = (DataType) sym.parent_symbol; + } else if (sym is Constant) { + if (sym.parent_symbol is DataType) { + t = (DataType) sym.parent_symbol; + } else if (sym.parent_symbol is Namespace) { + var ns = (Namespace) sym.parent_symbol; source_internal_includes.concat (ns.get_cheader_filenames ()); return; } else { return; } - } else if (sym.node is FormalParameter) { - var fp = (FormalParameter) sym.node; + } else if (sym is FormalParameter) { + var fp = (FormalParameter) sym; t = fp.type_reference.data_type; if (t == null) { /* generic type parameter */ diff --git a/vala/valastatement.vala b/vala/valastatement.vala index 75cc69af5..b38a69380 100644 --- a/vala/valastatement.vala +++ b/vala/valastatement.vala @@ -23,17 +23,7 @@ using GLib; /** - * Base class for all statement types. + * Interface for all statement types. */ -public abstract class Vala.Statement : CodeNode { - /** - * Returns the number of construction parameters this statement sets in - * maximum or -1 if this statement may not be used in the construction - * part of a construction method. - * - * @return number of construction parameters set or -1 - */ - public virtual int get_number_of_set_construction_parameters () { - return -1; - } +public interface Vala.Statement : CodeNode { } diff --git a/vala/valastruct.vala b/vala/valastruct.vala index ac34755ed..f5841948b 100644 --- a/vala/valastruct.vala +++ b/vala/valastruct.vala @@ -74,6 +74,7 @@ public class Vala.Struct : DataType { public void add_type_parameter (TypeParameter! p) { type_parameters.append (p); p.type = this; + scope.add (p.name, p); } /** @@ -83,6 +84,7 @@ public class Vala.Struct : DataType { */ public void add_constant (Constant! c) { constants.append (c); + scope.add (c.name, c); } /** @@ -92,6 +94,7 @@ public class Vala.Struct : DataType { */ public void add_field (Field! f) { fields.append (f); + scope.add (f.name, f); } /** @@ -111,7 +114,17 @@ public class Vala.Struct : DataType { public void add_method (Method! m) { return_if_fail (m != null); + if (m.instance) { + m.this_parameter = new FormalParameter ("this", new TypeReference ()); + m.this_parameter.type_reference.data_type = this; + m.scope.add (m.this_parameter.name, m.this_parameter); + } + if (m is CreationMethod && m.name == null) { + default_construction_method = m; + } + methods.append (m); + scope.add (m.name, m); } /** @@ -151,7 +164,7 @@ public class Vala.Struct : DataType { } if (cname == null) { - cname = "%s%s".printf (@namespace.get_cprefix (), name); + cname = "%s%s".printf (parent_symbol.get_cprefix (), name); } return cname; } @@ -164,7 +177,7 @@ public class Vala.Struct : DataType { this.const_cname = cname; } - public override string get_lower_case_cprefix () { + public override string! get_lower_case_cprefix () { if (lower_case_cprefix == null) { lower_case_cprefix = "%s_".printf (get_lower_case_cname (null)); } @@ -173,7 +186,7 @@ public class Vala.Struct : DataType { private string get_lower_case_csuffix () { if (lower_case_csuffix == null) { - lower_case_csuffix = Namespace.camel_case_to_lower_case (name); + lower_case_csuffix = camel_case_to_lower_case (name); } return lower_case_csuffix; } @@ -182,7 +195,7 @@ public class Vala.Struct : DataType { if (infix == null) { infix = ""; } - return "%s%s%s".printf (@namespace.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); + return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ()); } public override string get_upper_case_cname (string infix) { @@ -309,7 +322,7 @@ public class Vala.Struct : DataType { public override string get_dup_function () { if (dup_function == null) { - Report.error (source_reference, "The type `%s` doesn't contain a copy function".printf (symbol.get_full_name ())); + Report.error (source_reference, "The type `%s` doesn't contain a copy function".printf (get_full_name ())); } return dup_function; } @@ -320,7 +333,7 @@ public class Vala.Struct : DataType { public override string get_free_function () { if (free_function == null) { - Report.error (source_reference, "The type `%s` doesn't contain a free function".printf (symbol.get_full_name ())); + Report.error (source_reference, "The type `%s` doesn't contain a free function".printf (get_full_name ())); } return free_function; } @@ -334,7 +347,7 @@ public class Vala.Struct : DataType { if (is_reference_type ()) { type_id = "G_TYPE_POINTER"; } else { - Report.error (source_reference, "The type `%s` doesn't declare a type id".printf (symbol.get_full_name ())); + Report.error (source_reference, "The type `%s` doesn't declare a type id".printf (get_full_name ())); } } return type_id; @@ -349,7 +362,7 @@ public class Vala.Struct : DataType { if (is_reference_type ()) { marshaller_type_name = "POINTER"; } else { - Report.error (source_reference, "The type `%s` doesn't declare a marshaller type name".printf (symbol.get_full_name ())); + Report.error (source_reference, "The type `%s` doesn't declare a marshaller type name".printf (get_full_name ())); } } return marshaller_type_name; @@ -364,7 +377,7 @@ public class Vala.Struct : DataType { if (is_reference_type ()) { return "g_value_get_pointer"; } else { - Report.error (source_reference, "The value type `%s` doesn't declare a GValue get function".printf (symbol.get_full_name ())); + Report.error (source_reference, "The value type `%s` doesn't declare a GValue get function".printf (get_full_name ())); return null; } } else { @@ -377,7 +390,7 @@ public class Vala.Struct : DataType { if (is_reference_type ()) { return "g_value_set_pointer"; } else { - Report.error (source_reference, "The value type `%s` doesn't declare a GValue set function".printf (symbol.get_full_name ())); + Report.error (source_reference, "The value type `%s` doesn't declare a GValue set function".printf (get_full_name ())); return null; } } else { diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala index b7c5a23d1..1d0ae011f 100644 --- a/vala/valaswitchstatement.vala +++ b/vala/valaswitchstatement.vala @@ -25,7 +25,7 @@ using GLib; /** * Represents a switch selection statement in the source code. */ -public class Vala.SwitchStatement : Statement { +public class Vala.SwitchStatement : CodeNode, Statement { /** * Specifies the switch expression. */ diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala index e5c5941f5..0ff6f9af4 100644 --- a/vala/valasymbol.vala +++ b/vala/valasymbol.vala @@ -25,16 +25,32 @@ using GLib; /** * Represents a node in the symbol tree. */ -public class Vala.Symbol { +public abstract class Vala.Symbol : CodeNode { /** - * The code node that created this symbol, if applicable. + * The parent of this symbol. */ - public weak CodeNode node { get; set; } - + public weak Symbol parent_symbol { + get { + if (owner == null) { + return null; + } else { + return owner.owner; + } + } + } + /** - * The parent of this symbol. + * The scope this symbol opens. */ - public weak Symbol parent_symbol { get; set; } + public weak Scope owner { + get { + return _owner; + } + set { + _owner = value; + _scope.parent_scope = value; + } + } /** * The symbol name. @@ -50,20 +66,16 @@ public class Vala.Symbol { * jump statements. */ public bool active { get; set; } - - private HashTable<string,Symbol> symbol_table = new HashTable.full (str_hash, str_equal, g_free, g_object_unref); - - /** - * Creates a new symbol. - * - * @param node the corresponding code node - * @return newly created symbol - */ - public Symbol (CodeNode _node = null) { - node = _node; + + public Scope scope { + get { return _scope; } } - + + private Scope _owner; + private Scope _scope; + construct { + _scope = new Scope (this); active = true; } @@ -88,32 +100,92 @@ public class Vala.Symbol { return "%s.%s".printf (parent_symbol.get_full_name (), name); } - + /** - * Adds the specified symbol with the specified name to the symbol table - * of this symbol. + * Returns the camel case string to be prepended to the name of members + * of this symbol when used in C code. * - * @param name name for the specified symbol - * @param sym a symbol + * @return the camel case prefix to be used in C code */ - public void add (string! name, Symbol! sym) { - symbol_table.insert (name, sym); - sym.parent_symbol = this; - sym.name = name; + public virtual string! get_cprefix () { + if (name == null) { + return ""; + } else { + return name; + } } /** - * Returns the symbol stored in the symbol table with the specified - * name. + * Returns the C name of this symbol in lower case. Words are + * separated by underscores. The lower case C name of the parent symbol + * is prefix of the result, if there is one. + * + * @param infix a string to be placed between namespace and data type + * name or null + * @return the lower case name to be used in C code + */ + public virtual string get_lower_case_cname (string infix = null) { + return null; + } + + /** + * Returns the string to be prefixed to members of this symbol in + * lower case when used in C code. + * + * @return the lower case prefix to be used in C code + */ + public virtual string! get_lower_case_cprefix () { + return ""; + } + + /** + * Returns a list of C header filenames users of this symbol must + * include. + * + * @return list of C header filenames for this symbol + */ + public virtual List<weak string> get_cheader_filenames () { + return null; + } + + /** + * Converts a string from CamelCase to lower_case. * - * @param name name of the symbol to be returned - * @return found symbol or null + * @param camel_case a string in camel case + * @return the specified string converted to lower case */ - public Symbol lookup (string! name) { - Symbol sym = symbol_table.lookup (name); - if (sym != null && !sym.active) { - sym = null; + public static string! camel_case_to_lower_case (string! camel_case) { + String result = new String (""); + + weak string i = camel_case; + + bool first = true; + while (i.len () > 0) { + unichar c = i.get_char (); + if (c.isupper () && !first) { + /* current character is upper case and + * we're not at the beginning */ + weak string t = i.prev_char (); + bool prev_upper = t.get_char ().isupper (); + t = i.next_char (); + bool next_upper = t.get_char ().isupper (); + if (!prev_upper || (i.len () >= 2 && !next_upper)) { + /* previous character wasn't upper case or + * next character isn't upper case*/ + int len = result.str.len (); + if (len != 1 && result.str.offset (len - 2).get_char () != '_') { + /* we're not creating 1 character words */ + result.append_c ('_'); + } + } + } + + result.append_unichar (c.tolower ()); + + first = false; + i = i.next_char (); } - return sym; + + return result.str; } } diff --git a/vala/valasymbolbuilder.vala b/vala/valasymbolbuilder.vala deleted file mode 100644 index 31be7f90d..000000000 --- a/vala/valasymbolbuilder.vala +++ /dev/null @@ -1,427 +0,0 @@ -/* valasymbolbuilder.vala - * - * Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jürg Billeter <j@bitron.ch> - * Raffaele Sandrini <rasa@gmx.ch> - */ - -using GLib; - -/** - * Code visitor building the symbol tree. - */ -public class Vala.SymbolBuilder : CodeVisitor { - Symbol root; - Symbol current_type; - Symbol current_symbol; - - /** - * Build the symbol tree for the specified code context. - * - * @param context a code context - */ - public void build (CodeContext! context) { - root = context.root; - context.accept (this); - } - - public override void visit_namespace (Namespace! ns) { - if (ns.name == null) { - ns.symbol = root; - } - - if (ns.symbol == null) { - ns.symbol = root.lookup (ns.name); - } - if (ns.symbol == null) { - ns.symbol = new Symbol (ns); - root.add (ns.name, ns.symbol); - } - - current_symbol = ns.symbol; - - ns.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - private weak Symbol add_symbol (string name, CodeNode! node) { - if (name != null) { - if (current_symbol.lookup (name) != null) { - node.error = true; - Report.error (node.source_reference, "`%s' already contains a definition for `%s'".printf (current_symbol.get_full_name (), name)); - return null; - } - } - node.symbol = new Symbol (node); - if (name != null) { - current_symbol.add (name, node.symbol); - } else { - node.symbol.parent_symbol = current_symbol; - } - - return node.symbol; - } - - public override void visit_class (Class! cl) { - if (cl.error) { - /* skip classes with errors */ - return; - } - - var class_symbol = current_symbol.lookup (cl.name); - if (class_symbol == null || !(class_symbol.node is Class)) { - class_symbol = add_symbol (cl.name, cl); - } else { - /* merge this class declaration with existing class symbol */ - var main_class = (Class) class_symbol.node; - foreach (TypeReference base_type in cl.get_base_types ()) { - main_class.add_base_type (base_type); - } - foreach (Field f in cl.get_fields ()) { - main_class.add_field (f); - } - foreach (Method m in cl.get_methods ()) { - main_class.add_method (m); - } - foreach (Property prop in cl.get_properties ()) { - main_class.add_property (prop, true); - } - foreach (Signal sig in cl.get_signals ()) { - main_class.add_signal (sig); - } - if (cl.constructor != null) { - if (main_class.constructor != null) { - cl.error = true; - Report.error (cl.constructor.source_reference, "`%s' already contains a constructor".printf (current_symbol.get_full_name ())); - return; - } - main_class.constructor = cl.constructor; - } - if (cl.destructor != null) { - if (main_class.destructor != null) { - cl.error = true; - Report.error (cl.destructor.source_reference, "`%s' already contains a destructor".printf (current_symbol.get_full_name ())); - return; - } - main_class.destructor = cl.destructor; - } - } - - current_symbol = class_symbol; - - cl.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - - if (cl.symbol == null) { - /* remove merged class */ - cl.@namespace.remove_class (cl); - if (cl.source_reference != null) { - cl.source_reference.file.remove_node (cl); - } - } - } - - public override void visit_struct (Struct! st) { - if (st.error) { - /* skip structs with errors */ - return; - } - - if (add_symbol (st.name, st) == null) { - return; - } - - current_symbol = st.symbol; - - st.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_interface (Interface! iface) { - if (iface.error) { - /* skip interfaces with errors */ - return; - } - - if (add_symbol (iface.name, iface) == null) { - return; - } - - current_symbol = iface.symbol; - - iface.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_enum (Enum! en) { - if (en.error) { - /* skip enums with errors */ - return; - } - - if (add_symbol (en.name, en) == null) { - return; - } - - current_symbol = en.symbol; - - en.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_enum_value (EnumValue! ev) { - ev.symbol = new Symbol (ev); - current_symbol.add (ev.name, ev.symbol); - } - - public override void visit_flags (Flags! fl) { - if (fl.error) { - /* skip flags with errors */ - return; - } - - if (add_symbol (fl.name, fl) == null) { - return; - } - - current_symbol = fl.symbol; - - fl.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_flags_value (FlagsValue! fv) { - fv.symbol = new Symbol (fv); - current_symbol.add (fv.name, fv.symbol); - } - - public override void visit_callback (Callback! cb) { - if (cb.error) { - /* skip enums with errors */ - return; - } - - if (add_symbol (cb.name, cb) == null) { - return; - } - - current_symbol = cb.symbol; - - cb.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_constant (Constant! c) { - add_symbol (c.name, c); - } - - public override void visit_field (Field! f) { - add_symbol (f.name, f); - } - - public override void visit_method (Method! m) { - if (add_symbol (m.name, m) == null) { - return; - } - - if (m.instance) { - if (!(m.symbol.parent_symbol.node is DataType)) { - Report.error (m.source_reference, "instance methods not allowed outside of data types"); - - m.error = true; - return; - } - - m.this_parameter = new FormalParameter ("this", new TypeReference ()); - m.this_parameter.type_reference.data_type = (DataType) m.symbol.parent_symbol.node; - m.this_parameter.symbol = new Symbol (m.this_parameter); - current_symbol.add (m.this_parameter.name, m.this_parameter.symbol); - } - - current_symbol = m.symbol; - - m.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_creation_method (CreationMethod! m) { - if (add_symbol (m.name, m) == null) { - return; - } - - var type_node = m.symbol.parent_symbol.node; - if (!(type_node is Class || type_node is Struct)) { - Report.error (m.source_reference, "construction methods may only be declared within classes and structs"); - - m.error = true; - return; - } - - if (m.name == null) { - if (type_node is Class) { - ((Class) type_node).default_construction_method = m; - } else if (type_node is Struct) { - ((Struct) type_node).default_construction_method = m; - } - } - - current_symbol = m.symbol; - - m.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_formal_parameter (FormalParameter! p) { - if (!p.ellipsis) { - add_symbol (p.name, p); - } - } - - public override void visit_property (Property! prop) { - if (prop.error) { - /* skip properties with errors */ - return; - } - - if (add_symbol (prop.name, prop) == null) { - return; - } - - current_symbol = prop.symbol; - - prop.this_parameter = new FormalParameter ("this", new TypeReference ()); - prop.this_parameter.type_reference.data_type = (DataType) prop.symbol.parent_symbol.node; - prop.this_parameter.symbol = new Symbol (prop.this_parameter); - current_symbol.add (prop.this_parameter.name, prop.this_parameter.symbol); - - prop.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_property_accessor (PropertyAccessor! acc) { - acc.symbol = new Symbol (acc); - acc.symbol.parent_symbol = current_symbol; - - if (acc.source_reference.file.pkg) { - return; - } - - current_symbol = acc.symbol; - - if (acc.writable || acc.construction) { - acc.value_parameter = new FormalParameter ("value", ((Property) current_symbol.parent_symbol.node).type_reference); - acc.value_parameter.symbol = new Symbol (acc.value_parameter); - - current_symbol.add (acc.value_parameter.name, acc.value_parameter.symbol); - } - - if (acc.body == null) { - /* no accessor body specified, insert default body */ - - var prop = (Property) acc.symbol.parent_symbol.node; - - if (prop.interface_only || prop.is_abstract) { - current_symbol = current_symbol.parent_symbol; - return; - } - - var block = new Block (); - if (acc.readable) { - block.add_statement (new ReturnStatement (new MemberAccess.simple ("_%s".printf (prop.name)))); - } else { - block.add_statement (new ExpressionStatement (new Assignment (new MemberAccess.simple ("_%s".printf (prop.name)), new MemberAccess.simple ("value")))); - } - acc.body = block; - } - - acc.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_signal (Signal! sig) { - if (sig.error) { - /* skip signals with errors */ - return; - } - - if (add_symbol (sig.name, sig) == null) { - return; - } - - current_symbol = sig.symbol; - - sig.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_constructor (Constructor! c) { - c.symbol = new Symbol (c); - c.symbol.parent_symbol = current_symbol; - current_symbol = c.symbol; - - c.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_destructor (Destructor! d) { - d.symbol = new Symbol (d); - d.symbol.parent_symbol = current_symbol; - current_symbol = d.symbol; - - d.accept_children (this); - - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_try_statement (TryStatement! stmt) { - stmt.accept_children (this); - } - - public override void visit_catch_clause (CatchClause! clause) { - clause.accept_children (this); - } - - public override void visit_begin_block (Block! b) { - b.symbol = new Symbol (b); - b.symbol.parent_symbol = current_symbol; - current_symbol = b.symbol; - } - - public override void visit_end_block (Block! b) { - current_symbol = current_symbol.parent_symbol; - } - - public override void visit_type_parameter (TypeParameter! p) { - add_symbol (p.name, p); - } -} - diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala index 2b90d628d..379ebeb84 100644 --- a/vala/valasymbolresolver.vala +++ b/vala/valasymbolresolver.vala @@ -27,7 +27,7 @@ using GLib; */ public class Vala.SymbolResolver : CodeVisitor { Symbol root_symbol; - Symbol current_scope; + Scope current_scope; List<weak NamespaceReference> current_using_directives; Class object_class; @@ -39,12 +39,12 @@ public class Vala.SymbolResolver : CodeVisitor { */ public void resolve (CodeContext! context) { root_symbol = context.root; - current_scope = root_symbol; + current_scope = root_symbol.scope; // TODO: don't require GLib namespace in symbol resolver - var glib_ns = root_symbol.lookup ("GLib"); + var glib_ns = root_symbol.scope.lookup ("GLib"); if (glib_ns != null) { - object_class = (Class) glib_ns.lookup ("Object").node; + object_class = (Class) glib_ns.scope.lookup ("Object"); } context.accept (this); @@ -52,7 +52,7 @@ public class Vala.SymbolResolver : CodeVisitor { public override void visit_source_file (SourceFile! file) { current_using_directives = file.get_using_directives (); - current_scope = root_symbol; + current_scope = root_symbol.scope; file.accept_children (this); @@ -60,14 +60,14 @@ public class Vala.SymbolResolver : CodeVisitor { } public override void visit_class (Class! cl) { - current_scope = cl.symbol; + current_scope = cl.scope; cl.accept_children (this); foreach (TypeReference type in cl.get_base_types ()) { if (type.data_type is Class) { if (cl.base_class != null) { - Report.error (type.source_reference, "%s: Classes cannot have multiple base classes (`%s' and `%s')".printf (cl.symbol.get_full_name (), cl.base_class.symbol.get_full_name (), type.data_type.symbol.get_full_name ())); + Report.error (type.source_reference, "%s: Classes cannot have multiple base classes (`%s' and `%s')".printf (cl.get_full_name (), cl.base_class.get_full_name (), type.data_type.get_full_name ())); return; } cl.base_class = (Class) type.data_type; @@ -80,51 +80,61 @@ public class Vala.SymbolResolver : CodeVisitor { cl.base_class = object_class; } - current_scope = current_scope.parent_symbol; + current_scope = current_scope.parent_scope; } public override void visit_struct (Struct! st) { - current_scope = st.symbol; + current_scope = st.scope; st.accept_children (this); - current_scope = current_scope.parent_symbol; + current_scope = current_scope.parent_scope; } public override void visit_interface (Interface! iface) { - current_scope = iface.symbol; + current_scope = iface.scope; iface.accept_children (this); - current_scope = current_scope.parent_symbol; + current_scope = current_scope.parent_scope; } public override void visit_enum (Enum! en) { - current_scope = en.symbol; + current_scope = en.scope; en.accept_children (this); - current_scope = current_scope.parent_symbol; + current_scope = current_scope.parent_scope; } public override void visit_callback (Callback! cb) { - current_scope = cb.symbol; + current_scope = cb.scope; cb.accept_children (this); - current_scope = current_scope.parent_symbol; + current_scope = current_scope.parent_scope; } public override void visit_constant (Constant! c) { + current_scope = c.scope; + c.accept_children (this); } public override void visit_field (Field! f) { + current_scope = f.scope; + f.accept_children (this); + + current_scope = current_scope.parent_scope; } public override void visit_method (Method! m) { + current_scope = m.scope; + m.accept_children (this); + + current_scope = current_scope.parent_scope; } public override void visit_creation_method (CreationMethod! m) { @@ -173,11 +183,11 @@ public class Vala.SymbolResolver : CodeVisitor { if (type.namespace_name == null) { Symbol sym = null; - Symbol scope = current_scope; + Scope scope = current_scope; while (sym == null && scope != null) { sym = scope.lookup (type.type_name); - scope = scope.parent_symbol; - if (sym != null && !(sym.node is DataType) && !(sym.node is TypeParameter)) { + scope = scope.parent_scope; + if (sym != null && !(sym is DataType) && !(sym is TypeParameter)) { // ignore non-type symbols sym = null; } @@ -188,7 +198,7 @@ public class Vala.SymbolResolver : CodeVisitor { continue; } - var local_sym = ns.namespace_symbol.lookup (type.type_name); + var local_sym = ns.namespace_symbol.scope.lookup (type.type_name); if (local_sym != null) { if (sym != null) { Report.error (type.source_reference, "`%s' is an ambiguous reference between `%s' and `%s'".printf (type.type_name, sym.get_full_name (), local_sym.get_full_name ())); @@ -202,25 +212,25 @@ public class Vala.SymbolResolver : CodeVisitor { Report.error (type.source_reference, "The type name `%s' could not be found".printf (type.type_name)); return; } - if (sym.node is TypeParameter) { - type.type_parameter = (TypeParameter) sym.node; + if (sym is TypeParameter) { + type.type_parameter = (TypeParameter) sym; } else { - type.data_type = (DataType) sym.node; + type.data_type = (DataType) sym; } } else { - var ns_symbol = root_symbol.lookup (type.namespace_name); + var ns_symbol = root_symbol.scope.lookup (type.namespace_name); if (ns_symbol == null) { type.error = true; Report.error (type.source_reference, "The namespace name `%s' could not be found".printf (type.namespace_name)); return; } - var sym = ns_symbol.lookup (type.type_name); + var sym = ns_symbol.scope.lookup (type.type_name); if (sym == null) { Report.error (type.source_reference, "The type name `%s' does not exist in the namespace `%s'".printf (type.type_name, type.namespace_name)); return; } - type.data_type = (DataType) sym.node; + type.data_type = (DataType) sym; } if (type.pointer_level > 0) { diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala index f89854e67..079550162 100644 --- a/vala/valathrowstatement.vala +++ b/vala/valathrowstatement.vala @@ -25,7 +25,7 @@ using GLib; /** * Represents a throw statement in the source code. */ -public class Vala.ThrowStatement : Statement { +public class Vala.ThrowStatement : CodeNode, Statement { /** * The error expression to throw. */ diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala index 3e25a4911..dca02eca2 100644 --- a/vala/valatrystatement.vala +++ b/vala/valatrystatement.vala @@ -25,7 +25,7 @@ using GLib; /** * Represents a try statement in the source code. */ -public class Vala.TryStatement : Statement { +public class Vala.TryStatement : CodeNode, Statement { /** * Specifies the body of the try statement. */ diff --git a/vala/valatypeparameter.vala b/vala/valatypeparameter.vala index 46d1f35aa..bf73bb484 100644 --- a/vala/valatypeparameter.vala +++ b/vala/valatypeparameter.vala @@ -25,12 +25,7 @@ using GLib; /** * Represents a generic type parameter in the source code. */ -public class Vala.TypeParameter : CodeNode { - /** - * The parameter name. - */ - public string! name { get; set construct; } - +public class Vala.TypeParameter : Symbol { /** * The generic type declaring this parameter. */ @@ -67,14 +62,12 @@ public class Vala.TypeParameter : CodeNode { if (array_type == null) { var new_array_type = new Array.with_type_parameter (this, rank, source_reference); - /* create a new Symbol */ - new_array_type.symbol = new Symbol (new_array_type); - this.symbol.parent_symbol.add (new_array_type.name, new_array_type.symbol); + parent_symbol.scope.add (new_array_type.name, new_array_type); /* add internal length field */ - new_array_type.symbol.add (new_array_type.get_length_field ().name, new_array_type.get_length_field ().symbol); + new_array_type.scope.add (new_array_type.get_length_field ().name, new_array_type.get_length_field ()); /* add internal resize method */ - new_array_type.symbol.add (new_array_type.get_resize_method ().name, new_array_type.get_resize_method ().symbol); + new_array_type.scope.add (new_array_type.get_resize_method ().name, new_array_type.get_resize_method ()); /* link the array type to the same source as the container type */ new_array_type.source_reference = this.source_reference; diff --git a/vala/valatypereference.vala b/vala/valatypereference.vala index 52371f5da..482a8493a 100644 --- a/vala/valatypereference.vala +++ b/vala/valatypereference.vala @@ -259,7 +259,7 @@ public class Vala.TypeReference : CodeNode { */ public string! to_string () { if (data_type != null) { - return data_type.symbol.get_full_name (); + return data_type.get_full_name (); } else if (type_parameter != null) { return type_parameter.name; } else { diff --git a/vala/valavariabledeclarator.vala b/vala/valavariabledeclarator.vala index 4a3ae8197..743a4348b 100644 --- a/vala/valavariabledeclarator.vala +++ b/vala/valavariabledeclarator.vala @@ -25,12 +25,7 @@ using GLib; /** * Represents a variable declarator in the source code. */ -public class Vala.VariableDeclarator : CodeNode, Invokable { - /** - * The variable name. - */ - public string! name { get; set construct; } - +public class Vala.VariableDeclarator : Symbol, Invokable { /** * The optional initializer expression. */ @@ -61,10 +56,7 @@ public class Vala.VariableDeclarator : CodeNode, Invokable { * @param source reference to source code * @return newly created variable declarator */ - public VariableDeclarator (string! _name, Expression init = null, SourceReference source = null) { - name = _name; - initializer = init; - source_reference = source; + public VariableDeclarator (construct string! name, construct Expression initializer = null, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { diff --git a/vala/valawhilestatement.vala b/vala/valawhilestatement.vala index ea22ea8db..496038aa4 100644 --- a/vala/valawhilestatement.vala +++ b/vala/valawhilestatement.vala @@ -1,6 +1,6 @@ /* valawhilestatement.vala * - * Copyright (C) 2006 Jürg Billeter + * Copyright (C) 2006-2007 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ using GLib; /** * Represents a while iteration statement in the source code. */ -public class Vala.WhileStatement : Statement { +public class Vala.WhileStatement : CodeNode, Statement { /** * Specifies the loop condition. */ @@ -42,7 +42,7 @@ public class Vala.WhileStatement : Statement { /** * Specifies the loop body. */ - public Statement body { get; set; } + public Block body { get; set; } private Expression! _condition; @@ -54,10 +54,7 @@ public class Vala.WhileStatement : Statement { * @param source reference to source code * @return newly created while statement */ - public WhileStatement (Expression! cond, Statement! _body, SourceReference source) { - condition = cond; - body = _body; - source_reference = source; + public WhileStatement (construct Expression! condition, construct Block! body, construct SourceReference source_reference = null) { } public override void accept (CodeVisitor! visitor) { diff --git a/vapi/atk.vala b/vapi/atk.vala index 7cca2f21e..8f4713b77 100644 --- a/vapi/atk.vala +++ b/vapi/atk.vala @@ -1,21 +1,21 @@ -[CCode (cprefix = "Atk", lower_case_cprefix = "atk_", cheader_filename = "atk/atk.h")] +[CCode (cprefix = "Atk", lower_case_cprefix = "atk_")] namespace Atk { - [CCode (cprefix = "ATK_XY_")] + [CCode (cprefix = "ATK_XY_", cheader_filename = "atk/atk.h")] public enum CoordType { SCREEN, WINDOW, } - [CCode (cprefix = "ATK_HYPERLINK_IS_")] + [CCode (cprefix = "ATK_HYPERLINK_IS_", cheader_filename = "atk/atk.h")] public enum HyperlinkStateFlags { INLINE, } - [CCode (cprefix = "ATK_KEY_EVENT_")] + [CCode (cprefix = "ATK_KEY_EVENT_", cheader_filename = "atk/atk.h")] public enum KeyEventType { PRESS, RELEASE, LAST_DEFINED, } - [CCode (cprefix = "ATK_LAYER_")] + [CCode (cprefix = "ATK_LAYER_", cheader_filename = "atk/atk.h")] public enum Layer { INVALID, BACKGROUND, @@ -26,7 +26,7 @@ namespace Atk { OVERLAY, WINDOW, } - [CCode (cprefix = "ATK_RELATION_")] + [CCode (cprefix = "ATK_RELATION_", cheader_filename = "atk/atk.h")] public enum RelationType { NULL, CONTROLLED_BY, @@ -46,7 +46,7 @@ namespace Atk { DESCRIPTION_FOR, LAST_DEFINED, } - [CCode (cprefix = "ATK_ROLE_")] + [CCode (cprefix = "ATK_ROLE_", cheader_filename = "atk/atk.h")] public enum Role { INVALID, ACCEL_LABEL, @@ -138,7 +138,7 @@ namespace Atk { INPUT_METHOD_WINDOW, LAST_DEFINED, } - [CCode (cprefix = "ATK_STATE_")] + [CCode (cprefix = "ATK_STATE_", cheader_filename = "atk/atk.h")] public enum StateType { INVALID, ACTIVE, @@ -181,7 +181,7 @@ namespace Atk { VISITED, LAST_DEFINED, } - [CCode (cprefix = "ATK_TEXT_ATTR_")] + [CCode (cprefix = "ATK_TEXT_ATTR_", cheader_filename = "atk/atk.h")] public enum TextAttribute { INVALID, LEFT_MARGIN, @@ -213,7 +213,7 @@ namespace Atk { STYLE, LAST_DEFINED, } - [CCode (cprefix = "ATK_TEXT_BOUNDARY_")] + [CCode (cprefix = "ATK_TEXT_BOUNDARY_", cheader_filename = "atk/atk.h")] public enum TextBoundary { CHAR, WORD_START, @@ -223,7 +223,7 @@ namespace Atk { LINE_START, LINE_END, } - [CCode (cprefix = "ATK_TEXT_CLIP_")] + [CCode (cprefix = "ATK_TEXT_CLIP_", cheader_filename = "atk/atk.h")] public enum TextClipType { NONE, MIN, @@ -580,12 +580,14 @@ namespace Atk { public virtual bool set_current_value (GLib.Value value); } [ReferenceType] + [CCode (cheader_filename = "atk/atk.h")] public struct Attribute { public weak string name; public weak string value; public static void set_free (GLib.SList attrib_set); } [ReferenceType] + [CCode (cheader_filename = "atk/atk.h")] public struct KeyEventStruct { public int type; public uint state; @@ -596,11 +598,13 @@ namespace Atk { public uint timestamp; } [ReferenceType] + [CCode (cheader_filename = "atk/atk.h")] public struct PropertyValues { public weak string property_name; public weak GLib.Value old_value; public weak GLib.Value new_value; } + [CCode (cheader_filename = "atk/atk.h")] public struct Rectangle { public int x; public int y; @@ -609,6 +613,7 @@ namespace Atk { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "atk/atk.h")] public struct TextRange { public weak Atk.TextRectangle bounds; public int start_offset; @@ -616,6 +621,7 @@ namespace Atk { public weak string content; } [ReferenceType] + [CCode (cheader_filename = "atk/atk.h")] public struct TextRectangle { public int x; public int y; @@ -623,11 +629,13 @@ namespace Atk { public int height; } [ReferenceType] + [CCode (cheader_filename = "atk/atk.h")] public struct Focus { public static void tracker_init (Atk.EventListenerInit init); public static void tracker_notify (Atk.Object object); } [ReferenceType] + [CCode (cheader_filename = "atk/atk.h")] public struct State { public static Atk.StateType type_for_name (string name); public static weak string type_get_name (Atk.StateType type); diff --git a/vapi/gdk-2.0.vala b/vapi/gdk-2.0.vala index 77d7bc6e3..1fb47c620 100644 --- a/vapi/gdk-2.0.vala +++ b/vapi/gdk-2.0.vala @@ -1,6 +1,6 @@ -[CCode (cprefix = "Gdk", lower_case_cprefix = "gdk_", cheader_filename = "gdk/gdk.h")] +[CCode (cprefix = "Gdk", lower_case_cprefix = "gdk_")] namespace Gdk { - [CCode (cprefix = "GDK_AXIS_")] + [CCode (cprefix = "GDK_AXIS_", cheader_filename = "gdk/gdk.h")] public enum AxisUse { IGNORE, X, @@ -11,29 +11,29 @@ namespace Gdk { WHEEL, LAST, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum ByteOrder { LSB_FIRST, MSB_FIRST, } - [CCode (cprefix = "GDK_CAP_")] + [CCode (cprefix = "GDK_CAP_", cheader_filename = "gdk/gdk.h")] public enum CapStyle { NOT_LAST, BUTT, ROUND, PROJECTING, } - [CCode (cprefix = "GDK_COLORSPACE_")] + [CCode (cprefix = "GDK_COLORSPACE_", cheader_filename = "gdk/gdk.h")] public enum Colorspace { RGB, } - [CCode (cprefix = "GDK_CROSSING_")] + [CCode (cprefix = "GDK_CROSSING_", cheader_filename = "gdk/gdk.h")] public enum CrossingMode { NORMAL, GRAB, UNGRAB, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum CursorType { X_CURSOR, ARROW, @@ -115,7 +115,7 @@ namespace Gdk { LAST_CURSOR, CURSOR_IS_PIXMAP, } - [CCode (cprefix = "GDK_ACTION_")] + [CCode (cprefix = "GDK_ACTION_", cheader_filename = "gdk/gdk.h")] public enum DragAction { DEFAULT, COPY, @@ -124,7 +124,7 @@ namespace Gdk { PRIVATE, ASK, } - [CCode (cprefix = "GDK_DRAG_PROTO_")] + [CCode (cprefix = "GDK_DRAG_PROTO_", cheader_filename = "gdk/gdk.h")] public enum DragProtocol { MOTIF, XDND, @@ -134,7 +134,7 @@ namespace Gdk { OLE2, LOCAL, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum EventMask { EXPOSURE_MASK, POINTER_MOTION_MASK, @@ -159,7 +159,7 @@ namespace Gdk { SCROLL_MASK, ALL_EVENTS_MASK, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum EventType { NOTHING, DELETE, @@ -199,36 +199,36 @@ namespace Gdk { OWNER_CHANGE, GRAB_BROKEN, } - [CCode (cprefix = "GDK_EXTENSION_EVENTS_")] + [CCode (cprefix = "GDK_EXTENSION_EVENTS_", cheader_filename = "gdk/gdk.h")] public enum ExtensionMode { NONE, ALL, CURSOR, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum Fill { SOLID, TILED, STIPPLED, OPAQUE_STIPPLED, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum FillRule { EVEN_ODD_RULE, WINDING_RULE, } - [CCode (cprefix = "GDK_FILTER_")] + [CCode (cprefix = "GDK_FILTER_", cheader_filename = "gdk/gdk.h")] public enum FilterReturn { CONTINUE, TRANSLATE, REMOVE, } - [CCode (cprefix = "GDK_FONT_")] + [CCode (cprefix = "GDK_FONT_", cheader_filename = "gdk/gdk.h")] public enum FontType { FONT, FONTSET, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum Function { COPY, INVERT, @@ -247,7 +247,7 @@ namespace Gdk { NOR, SET, } - [CCode (cprefix = "GDK_GC_")] + [CCode (cprefix = "GDK_GC_", cheader_filename = "gdk/gdk.h")] public enum GCValuesMask { FOREGROUND, BACKGROUND, @@ -268,7 +268,7 @@ namespace Gdk { CAP_STYLE, JOIN_STYLE, } - [CCode (cprefix = "GDK_GRAB_")] + [CCode (cprefix = "GDK_GRAB_", cheader_filename = "gdk/gdk.h")] public enum GrabStatus { SUCCESS, ALREADY_GRABBED, @@ -276,7 +276,7 @@ namespace Gdk { NOT_VIEWABLE, FROZEN, } - [CCode (cprefix = "GDK_GRAVITY_")] + [CCode (cprefix = "GDK_GRAVITY_", cheader_filename = "gdk/gdk.h")] public enum Gravity { NORTH_WEST, NORTH, @@ -289,51 +289,51 @@ namespace Gdk { SOUTH_EAST, STATIC, } - [CCode (cprefix = "GDK_IMAGE_")] + [CCode (cprefix = "GDK_IMAGE_", cheader_filename = "gdk/gdk.h")] public enum ImageType { NORMAL, SHARED, FASTEST, } - [CCode (cprefix = "GDK_INPUT_")] + [CCode (cprefix = "GDK_INPUT_", cheader_filename = "gdk/gdk.h")] public enum InputCondition { READ, WRITE, EXCEPTION, } - [CCode (cprefix = "GDK_MODE_")] + [CCode (cprefix = "GDK_MODE_", cheader_filename = "gdk/gdk.h")] public enum InputMode { DISABLED, SCREEN, WINDOW, } - [CCode (cprefix = "GDK_SOURCE_")] + [CCode (cprefix = "GDK_SOURCE_", cheader_filename = "gdk/gdk.h")] public enum InputSource { MOUSE, PEN, ERASER, CURSOR, } - [CCode (cprefix = "GDK_INTERP_")] + [CCode (cprefix = "GDK_INTERP_", cheader_filename = "gdk/gdk.h")] public enum InterpType { NEAREST, TILES, BILINEAR, HYPER, } - [CCode (cprefix = "GDK_JOIN_")] + [CCode (cprefix = "GDK_JOIN_", cheader_filename = "gdk/gdk.h")] public enum JoinStyle { MITER, ROUND, BEVEL, } - [CCode (cprefix = "GDK_LINE_")] + [CCode (cprefix = "GDK_LINE_", cheader_filename = "gdk/gdk.h")] public enum LineStyle { SOLID, ON_OFF_DASH, DOUBLE_DASH, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum ModifierType { SHIFT_MASK, LOCK_MASK, @@ -354,7 +354,7 @@ namespace Gdk { RELEASE_MASK, MODIFIER_MASK, } - [CCode (cprefix = "GDK_NOTIFY_")] + [CCode (cprefix = "GDK_NOTIFY_", cheader_filename = "gdk/gdk.h")] public enum NotifyType { ANCESTOR, VIRTUAL, @@ -363,24 +363,24 @@ namespace Gdk { NONLINEAR_VIRTUAL, UNKNOWN, } - [CCode (cprefix = "GDK_OVERLAP_RECTANGLE_")] + [CCode (cprefix = "GDK_OVERLAP_RECTANGLE_", cheader_filename = "gdk/gdk.h")] public enum OverlapType { IN, OUT, PART, } - [CCode (cprefix = "GDK_OWNER_CHANGE_")] + [CCode (cprefix = "GDK_OWNER_CHANGE_", cheader_filename = "gdk/gdk.h")] public enum OwnerChange { NEW_OWNER, DESTROY, CLOSE, } - [CCode (cprefix = "GDK_PIXBUF_ALPHA_")] + [CCode (cprefix = "GDK_PIXBUF_ALPHA_", cheader_filename = "gdk/gdk.h")] public enum PixbufAlphaMode { BILEVEL, FULL, } - [CCode (cprefix = "GDK_PIXBUF_ERROR_")] + [CCode (cprefix = "GDK_PIXBUF_ERROR_", cheader_filename = "gdk/gdk.h")] public enum PixbufError { CORRUPT_IMAGE, INSUFFICIENT_MEMORY, @@ -389,20 +389,20 @@ namespace Gdk { UNSUPPORTED_OPERATION, FAILED, } - [CCode (cprefix = "GDK_PIXBUF_FRAME_")] + [CCode (cprefix = "GDK_PIXBUF_FRAME_", cheader_filename = "gdk/gdk.h")] public enum PixbufFrameAction { RETAIN, DISPOSE, REVERT, } - [CCode (cprefix = "GDK_PIXBUF_ROTATE_")] + [CCode (cprefix = "GDK_PIXBUF_ROTATE_", cheader_filename = "gdk/gdk.h")] public enum PixbufRotation { NONE, COUNTERCLOCKWISE, UPSIDEDOWN, CLOCKWISE, } - [CCode (cprefix = "GDK_PIXDATA_DUMP_")] + [CCode (cprefix = "GDK_PIXDATA_DUMP_", cheader_filename = "gdk/gdk.h")] public enum PixdataDumpType { PIXDATA_STREAM, PIXDATA_STRUCT, @@ -413,7 +413,7 @@ namespace Gdk { CONST, RLE_DECODER, } - [CCode (cprefix = "GDK_PIXDATA_")] + [CCode (cprefix = "GDK_PIXDATA_", cheader_filename = "gdk/gdk.h")] public enum PixdataType { COLOR_TYPE_RGB, COLOR_TYPE_RGBA, @@ -424,37 +424,37 @@ namespace Gdk { ENCODING_RLE, ENCODING_MASK, } - [CCode (cprefix = "GDK_PROP_MODE_")] + [CCode (cprefix = "GDK_PROP_MODE_", cheader_filename = "gdk/gdk.h")] public enum PropMode { REPLACE, PREPEND, APPEND, } - [CCode (cprefix = "GDK_PROPERTY_")] + [CCode (cprefix = "GDK_PROPERTY_", cheader_filename = "gdk/gdk.h")] public enum PropertyState { NEW_VALUE, DELETE, } - [CCode (cprefix = "GDK_RGB_DITHER_")] + [CCode (cprefix = "GDK_RGB_DITHER_", cheader_filename = "gdk/gdk.h")] public enum RgbDither { NONE, NORMAL, MAX, } - [CCode (cprefix = "GDK_SCROLL_")] + [CCode (cprefix = "GDK_SCROLL_", cheader_filename = "gdk/gdk.h")] public enum ScrollDirection { UP, DOWN, LEFT, RIGHT, } - [CCode (cprefix = "GDK_SETTING_ACTION_")] + [CCode (cprefix = "GDK_SETTING_ACTION_", cheader_filename = "gdk/gdk.h")] public enum SettingAction { NEW, CHANGED, DELETED, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum Status { OK, ERROR, @@ -462,18 +462,18 @@ namespace Gdk { ERROR_FILE, ERROR_MEM, } - [CCode (cprefix = "GDK_")] + [CCode (cprefix = "GDK_", cheader_filename = "gdk/gdk.h")] public enum SubwindowMode { CLIP_BY_CHILDREN, INCLUDE_INFERIORS, } - [CCode (cprefix = "GDK_VISIBILITY_")] + [CCode (cprefix = "GDK_VISIBILITY_", cheader_filename = "gdk/gdk.h")] public enum VisibilityState { UNOBSCURED, PARTIAL, FULLY_OBSCURED, } - [CCode (cprefix = "GDK_VISUAL_")] + [CCode (cprefix = "GDK_VISUAL_", cheader_filename = "gdk/gdk.h")] public enum VisualType { STATIC_GRAY, GRAYSCALE, @@ -482,7 +482,7 @@ namespace Gdk { TRUE_COLOR, DIRECT_COLOR, } - [CCode (cprefix = "GDK_DECOR_")] + [CCode (cprefix = "GDK_DECOR_", cheader_filename = "gdk/gdk.h")] public enum WMDecoration { ALL, BORDER, @@ -492,7 +492,7 @@ namespace Gdk { MINIMIZE, MAXIMIZE, } - [CCode (cprefix = "GDK_FUNC_")] + [CCode (cprefix = "GDK_FUNC_", cheader_filename = "gdk/gdk.h")] public enum WMFunction { ALL, RESIZE, @@ -501,7 +501,7 @@ namespace Gdk { MAXIMIZE, CLOSE, } - [CCode (cprefix = "GDK_WA_")] + [CCode (cprefix = "GDK_WA_", cheader_filename = "gdk/gdk.h")] public enum WindowAttributesType { TITLE, X, @@ -513,12 +513,12 @@ namespace Gdk { NOREDIR, TYPE_HINT, } - [CCode (cprefix = "GDK_INPUT_")] + [CCode (cprefix = "GDK_INPUT_", cheader_filename = "gdk/gdk.h")] public enum WindowClass { OUTPUT, ONLY, } - [CCode (cprefix = "GDK_WINDOW_EDGE_")] + [CCode (cprefix = "GDK_WINDOW_EDGE_", cheader_filename = "gdk/gdk.h")] public enum WindowEdge { NORTH_WEST, NORTH, @@ -529,7 +529,7 @@ namespace Gdk { SOUTH, SOUTH_EAST, } - [CCode (cprefix = "GDK_HINT_")] + [CCode (cprefix = "GDK_HINT_", cheader_filename = "gdk/gdk.h")] public enum WindowHints { POS, MIN_SIZE, @@ -541,7 +541,7 @@ namespace Gdk { USER_POS, USER_SIZE, } - [CCode (cprefix = "GDK_WINDOW_STATE_")] + [CCode (cprefix = "GDK_WINDOW_STATE_", cheader_filename = "gdk/gdk.h")] public enum WindowState { WITHDRAWN, ICONIFIED, @@ -551,7 +551,7 @@ namespace Gdk { ABOVE, BELOW, } - [CCode (cprefix = "GDK_WINDOW_")] + [CCode (cprefix = "GDK_WINDOW_", cheader_filename = "gdk/gdk.h")] public enum WindowType { ROOT, TOPLEVEL, @@ -560,7 +560,7 @@ namespace Gdk { TEMP, FOREIGN, } - [CCode (cprefix = "GDK_WINDOW_TYPE_HINT_")] + [CCode (cprefix = "GDK_WINDOW_TYPE_HINT_", cheader_filename = "gdk/gdk.h")] public enum WindowTypeHint { NORMAL, DIALOG, @@ -1032,7 +1032,7 @@ namespace Gdk { public void clear_area (int x, int y, int width, int height); public void clear_area_e (int x, int y, int width, int height); public void configure_finished (); - public static void constrain_size (Gdk.Geometry geometry, uint @flags, int width, int height, int new_width, int new_height); + public static void constrain_size (Gdk.Geometry geometry, uint flags, int width, int height, int new_width, int new_height); public void deiconify (); public void destroy (); public void enable_synchronized_configure (); @@ -1138,6 +1138,7 @@ namespace Gdk { public static weak Gdk.Bitmap create_from_data (Gdk.Drawable drawable, string data, int width, int height); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct BRESINFO { public int minor_axis; public int d; @@ -1147,14 +1148,17 @@ namespace Gdk { public int incr2; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EdgeTable { public int ymax; public int ymin; public weak Gdk.ScanLineList scanlines; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EdgeTableEntry { } + [CCode (cheader_filename = "gdk/gdk.h")] public struct Color { public uint pixel; public ushort red; @@ -1174,6 +1178,7 @@ namespace Gdk { public weak string to_string (); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Cursor { public Gdk.CursorType type; public weak Gdk.Display get_display (); @@ -1188,26 +1193,31 @@ namespace Gdk { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct DeviceAxis { public Gdk.AxisUse use; public double min; public double max; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct DeviceKey { public uint keyval; public Gdk.ModifierType modifiers; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct DisplayPointerHooks { } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventAny { public Gdk.EventType type; public weak Gdk.Window window; public char send_event; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventButton { public Gdk.EventType type; public weak Gdk.Window window; @@ -1223,6 +1233,7 @@ namespace Gdk { public double y_root; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventClient { public Gdk.EventType type; public weak Gdk.Window window; @@ -1232,6 +1243,7 @@ namespace Gdk { public char b; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventConfigure { public Gdk.EventType type; public weak Gdk.Window window; @@ -1242,6 +1254,7 @@ namespace Gdk { public int height; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventCrossing { public Gdk.EventType type; public weak Gdk.Window window; @@ -1258,6 +1271,7 @@ namespace Gdk { public uint state; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventDND { public Gdk.EventType type; public weak Gdk.Window window; @@ -1268,6 +1282,7 @@ namespace Gdk { public short y_root; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventExpose { public Gdk.EventType type; public weak Gdk.Window window; @@ -1277,6 +1292,7 @@ namespace Gdk { public int count; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventFocus { public Gdk.EventType type; public weak Gdk.Window window; @@ -1284,6 +1300,7 @@ namespace Gdk { public short @in; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventGrabBroken { public Gdk.EventType type; public weak Gdk.Window window; @@ -1293,6 +1310,7 @@ namespace Gdk { public weak Gdk.Window grab_window; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventKey { public Gdk.EventType type; public weak Gdk.Window window; @@ -1307,6 +1325,7 @@ namespace Gdk { public uint is_modifier; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventMotion { public Gdk.EventType type; public weak Gdk.Window window; @@ -1322,12 +1341,14 @@ namespace Gdk { public double y_root; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventNoExpose { public Gdk.EventType type; public weak Gdk.Window window; public char send_event; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventOwnerChange { public Gdk.EventType type; public weak Gdk.Window window; @@ -1339,6 +1360,7 @@ namespace Gdk { public uint selection_time; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventProperty { public Gdk.EventType type; public weak Gdk.Window window; @@ -1348,6 +1370,7 @@ namespace Gdk { public uint state; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventProximity { public Gdk.EventType type; public weak Gdk.Window window; @@ -1356,6 +1379,7 @@ namespace Gdk { public weak Gdk.Device device; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventScroll { public Gdk.EventType type; public weak Gdk.Window window; @@ -1370,6 +1394,7 @@ namespace Gdk { public double y_root; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventSelection { public Gdk.EventType type; public weak Gdk.Window window; @@ -1381,6 +1406,7 @@ namespace Gdk { public pointer requestor; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventSetting { public Gdk.EventType type; public weak Gdk.Window window; @@ -1389,6 +1415,7 @@ namespace Gdk { public weak string name; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventVisibility { public Gdk.EventType type; public weak Gdk.Window window; @@ -1396,6 +1423,7 @@ namespace Gdk { public Gdk.VisibilityState state; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct EventWindowState { public Gdk.EventType type; public weak Gdk.Window window; @@ -1404,12 +1432,14 @@ namespace Gdk { public Gdk.WindowState new_window_state; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Font { public Gdk.FontType type; public int ascent; public int descent; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct GCValues { public Gdk.Color foreground; public Gdk.Color background; @@ -1431,6 +1461,7 @@ namespace Gdk { public Gdk.JoinStyle join_style; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Geometry { public int min_width; public int min_height; @@ -1445,30 +1476,35 @@ namespace Gdk { public Gdk.Gravity win_gravity; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct KeymapKey { public uint keycode; public int group; public int level; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PangoAttrEmbossColor { public weak Pango.Attribute attr; public Pango.Color color; public PangoAttrEmbossColor (out Gdk.Color color); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PangoAttrEmbossed { public weak Pango.Attribute attr; public bool embossed; public PangoAttrEmbossed (bool embossed); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PangoAttrStipple { public weak Pango.Attribute attr; public weak Gdk.Bitmap stipple; public PangoAttrStipple (Gdk.Bitmap stipple); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PixbufFormat { public weak string get_description (); public weak string get_extensions (); @@ -1481,6 +1517,7 @@ namespace Gdk { public void set_disabled (bool disabled); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PixbufFrame { public weak Gdk.Pixbuf pixbuf; public int x_offset; @@ -1494,14 +1531,17 @@ namespace Gdk { public weak Gdk.Pixbuf revert; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PixbufScaledAnim { public static GLib.Type get_type (); public static GLib.Type iter_get_type (); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PixbufScaledAnimClass { } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Pixdata { public uint magic; public int length; @@ -1517,19 +1557,23 @@ namespace Gdk { public weak GLib.String to_csource (string name, Gdk.PixdataDumpType dump_type); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PixmapObject { public weak Gdk.Drawable parent_instance; public weak Gdk.Drawable impl; public int depth; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Point { public int x; public int y; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct PointerHooks { } + [CCode (cheader_filename = "gdk/gdk.h")] public struct Rectangle { public int x; public int y; @@ -1542,6 +1586,7 @@ namespace Gdk { public void union (out Gdk.Rectangle src2, out Gdk.Rectangle dest); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Region { public long size; public long numRects; @@ -1570,6 +1615,7 @@ namespace Gdk { public void xor (Gdk.Region source2); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct RegionBox { public int x1; public int y1; @@ -1577,6 +1623,7 @@ namespace Gdk { public int y2; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct RgbCmap { public uint colors; public int n_colors; @@ -1585,6 +1632,7 @@ namespace Gdk { public RgbCmap (uint[] colors, int n_colors); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Segment { public int x1; public int y1; @@ -1592,17 +1640,20 @@ namespace Gdk { public int y2; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Span { public int x; public int y; public int width; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct TimeCoord { public uint time; public double axes; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Trapezoid { public double y1; public double x11; @@ -1611,6 +1662,7 @@ namespace Gdk { public double x12; public double x22; } + [CCode (cheader_filename = "gdk/gdk.h")] public struct WindowAttr { public weak string title; public int event_mask; @@ -1629,6 +1681,7 @@ namespace Gdk { public Gdk.WindowTypeHint type_hint; } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct WindowObject { public weak Gdk.Drawable parent_instance; public weak Gdk.Drawable impl; @@ -1660,20 +1713,25 @@ namespace Gdk { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct POINTBLOCK { } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct ScanLineList { } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct ScanLineListBlock { } + [CCode (cheader_filename = "gdk/gdk.h")] public struct Atom { public static Gdk.Atom intern (string atom_name, bool only_if_exists); public static Gdk.Atom intern_static_string (string atom_name); public weak string name (); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Cairo { public static weak Cairo.Context create (Gdk.Drawable drawable); public static void rectangle (Cairo.Context cr, out Gdk.Rectangle rectangle); @@ -1683,12 +1741,15 @@ namespace Gdk { public static void set_source_pixmap (Cairo.Context cr, Gdk.Pixmap pixmap, double pixmap_x, double pixmap_y); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Char { } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Colors { } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Drag { public static void abort (Gdk.DragContext context, uint time_); public static weak Gdk.DragContext begin (Gdk.Window window, GLib.List targets); @@ -1703,16 +1764,19 @@ namespace Gdk { public static void status (Gdk.DragContext context, Gdk.DragAction action, uint time_); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Drop { public static void finish (Gdk.DragContext context, bool success, uint time_); public static void reply (Gdk.DragContext context, bool ok, uint time_); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Error { public static int trap_pop (); public static void trap_push (); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Event { public weak Gdk.Event copy (); public void free (); @@ -1736,19 +1800,23 @@ namespace Gdk { public void set_screen (Gdk.Screen screen); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Fontset { } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Input { public static void set_extension_events (Gdk.Window window, int mask, Gdk.ExtensionMode mode); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Keyboard { public static Gdk.GrabStatus grab (Gdk.Window window, bool owner_events, uint time_); public static bool grab_info_libgtk_only (Gdk.Display display, Gdk.Window grab_window, bool owner_events); public static void ungrab (uint time_); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Keyval { public static void convert_case (uint symbol, uint lower, uint upper); public static uint from_name (string keyval_name); @@ -1760,11 +1828,13 @@ namespace Gdk { public static uint to_upper (uint keyval); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Notify { public static void startup_complete (); public static void startup_complete_with_id (string startup_id); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Pango { public static weak Pango.Context context_get (); public static weak Pango.Context context_get_for_screen (Gdk.Screen screen); @@ -1772,6 +1842,7 @@ namespace Gdk { public static weak Gdk.Region layout_line_get_clip_region (Pango.LayoutLine line, int x_origin, int y_origin, int index_ranges, int n_ranges); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Pointer { public static Gdk.GrabStatus grab (Gdk.Window window, bool owner_events, Gdk.EventMask event_mask, Gdk.Window confine_to, Gdk.Cursor cursor, uint time_); public static bool grab_info_libgtk_only (Gdk.Display display, Gdk.Window grab_window, bool owner_events); @@ -1779,6 +1850,7 @@ namespace Gdk { public static void ungrab (uint time_); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Property { [NoArrayLength] public static void change (Gdk.Window window, Gdk.Atom property, Gdk.Atom type, int format, Gdk.PropMode mode, uchar[] data, int nelements); @@ -1787,11 +1859,13 @@ namespace Gdk { public static bool get (Gdk.Window window, Gdk.Atom property, Gdk.Atom type, ulong offset, ulong length, int pdelete, out Gdk.Atom actual_property_type, int actual_format, int actual_length, uchar[] data); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Query { public static void depths (int depths, int count); public static void visual_types (Gdk.VisualType visual_types, int count); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Rgb { public static bool colormap_ditherable (Gdk.Colormap cmap); public static bool ditherable (); @@ -1803,6 +1877,7 @@ namespace Gdk { public static void set_verbose (bool verbose); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Selection { public static void convert (Gdk.Window requestor, Gdk.Atom selection, Gdk.Atom target, uint time_); public static weak Gdk.Window owner_get (Gdk.Atom selection); @@ -1815,12 +1890,14 @@ namespace Gdk { public static void send_notify_for_display (Gdk.Display display, uint requestor, Gdk.Atom selection, Gdk.Atom target, Gdk.Atom property, uint time_); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Spawn { public static bool command_line_on_screen (Gdk.Screen screen, string command_line, GLib.Error error); - public static bool on_screen (Gdk.Screen screen, string working_directory, string argv, string envp, GLib.SpawnFlags @flags, GLib.SpawnChildSetupFunc child_setup, pointer user_data, int child_pid, GLib.Error error); - public static bool on_screen_with_pipes (Gdk.Screen screen, string working_directory, string argv, string envp, GLib.SpawnFlags @flags, GLib.SpawnChildSetupFunc child_setup, pointer user_data, int child_pid, int standard_input, int standard_output, int standard_error, GLib.Error error); + public static bool on_screen (Gdk.Screen screen, string working_directory, string argv, string envp, GLib.SpawnFlags flags, GLib.SpawnChildSetupFunc child_setup, pointer user_data, int child_pid, GLib.Error error); + public static bool on_screen_with_pipes (Gdk.Screen screen, string working_directory, string argv, string envp, GLib.SpawnFlags flags, GLib.SpawnChildSetupFunc child_setup, pointer user_data, int child_pid, int standard_input, int standard_output, int standard_error, GLib.Error error); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Text { [NoArrayLength] public static int property_to_text_list (Gdk.Atom encoding, int format, uchar[] text, int length, string list); @@ -1832,6 +1909,7 @@ namespace Gdk { public static int property_to_utf8_list_for_display (Gdk.Display display, Gdk.Atom encoding, int format, uchar[] text, int length, string list); } [ReferenceType] + [CCode (cheader_filename = "gdk/gdk.h")] public struct Threads { public static uint add_idle (GLib.SourceFunc function, pointer data); public static uint add_idle_full (int priority, GLib.SourceFunc function, pointer data, GLib.DestroyNotify notify); diff --git a/vapi/gio-standalone.vala b/vapi/gio-standalone.vala index 57eb8061c..d1ece9d65 100644 --- a/vapi/gio-standalone.vala +++ b/vapi/gio-standalone.vala @@ -1,6 +1,6 @@ -[CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "gio/gvfs.h")] +[CCode (cprefix = "G", lower_case_cprefix = "g_")] namespace GLib { - [CCode (cprefix = "G_DIRECTORY_MONITOR_EVENT_")] + [CCode (cprefix = "G_DIRECTORY_MONITOR_EVENT_", cheader_filename = "gio/gvfs.h, glib.h")] public enum DirectoryMonitorEvent { CHANGED, DELETED, @@ -8,7 +8,7 @@ namespace GLib { ATTRIBUTE_CHANGED, UNMOUNTED, } - [CCode (cprefix = "G_FILE_ATTRIBUTE_TYPE_")] + [CCode (cprefix = "G_FILE_ATTRIBUTE_TYPE_", cheader_filename = "gio/gvfs.h, glib.h")] public enum FileAttributeType { INVALID, STRING, @@ -18,23 +18,23 @@ namespace GLib { UINT64, INT64, } - [CCode (cprefix = "G_FILE_COPY_")] + [CCode (cprefix = "G_FILE_COPY_", cheader_filename = "gio/gvfs.h, glib.h")] public enum FileCopyFlags { OVERWRITE, BACKUP, } - [CCode (cprefix = "G_FILE_FLAG_")] + [CCode (cprefix = "G_FILE_FLAG_", cheader_filename = "gio/gvfs.h, glib.h")] public enum FileFlags { HIDDEN, SYMLINK, LOCAL, VIRTUAL, } - [CCode (cprefix = "G_FILE_GET_INFO_NOFOLLOW_")] + [CCode (cprefix = "G_FILE_GET_INFO_NOFOLLOW_", cheader_filename = "gio/gvfs.h, glib.h")] public enum FileGetInfoFlags { SYMLINKS, } - [CCode (cprefix = "G_FILE_MONITOR_EVENT_")] + [CCode (cprefix = "G_FILE_MONITOR_EVENT_", cheader_filename = "gio/gvfs.h, glib.h")] public enum FileMonitorEvent { CHANGED, DELETED, @@ -42,7 +42,7 @@ namespace GLib { ATTRIBUTE_CHANGED, UNMOUNTED, } - [CCode (cprefix = "G_FILE_TYPE_")] + [CCode (cprefix = "G_FILE_TYPE_", cheader_filename = "gio/gvfs.h, glib.h")] public enum FileType { UNKNOWN, REGULAR, @@ -52,7 +52,7 @@ namespace GLib { SHORTCUT, MOUNTABLE, } - [CCode (cprefix = "G_IO_ERROR_")] + [CCode (cprefix = "G_IO_ERROR_", cheader_filename = "gio/gvfs.h, glib.h")] public enum IOErrorEnum { FAILED, NOT_FOUND, @@ -80,7 +80,7 @@ namespace GLib { WRONG_MTIME, TIMED_OUT, } - [CCode (cprefix = "G_PASSWORD_FLAGS_")] + [CCode (cprefix = "G_PASSWORD_FLAGS_", cheader_filename = "gio/gvfs.h, glib.h")] public enum PasswordFlags { NEED_PASSWORD, NEED_USERNAME, @@ -88,13 +88,13 @@ namespace GLib { SAVING_SUPPORTED, ANON_SUPPORTED, } - [CCode (cprefix = "G_PASSWORD_SAVE_")] + [CCode (cprefix = "G_PASSWORD_SAVE_", cheader_filename = "gio/gvfs.h, glib.h")] public enum PasswordSave { NEVER, FOR_SESSION, PERMANENTLY, } - [CCode (cprefix = "G_UNIX_MOUNT_TYPE_")] + [CCode (cprefix = "G_UNIX_MOUNT_TYPE_", cheader_filename = "gio/gvfs.h, glib.h")] public enum UnixMountType { UNKNOWN, FLOPPY, @@ -110,7 +110,7 @@ namespace GLib { CAMERA, HD, } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class BufferedInputStream : GLib.FilterInputStream { public static GLib.Type get_type (); public BufferedInputStream (GLib.InputStream base_stream); @@ -118,7 +118,7 @@ namespace GLib { [NoAccessorMethod] public weak uint buffer_size { get; construct; } } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class BufferedOutputStream : GLib.FilterOutputStream { public static GLib.Type get_type (); public BufferedOutputStream (GLib.OutputStream base_stream); @@ -126,7 +126,7 @@ namespace GLib { [NoAccessorMethod] public weak uint buffer_size { get; construct; } } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class Cancellable : GLib.Object { public void cancel (); public int get_fd (); @@ -136,12 +136,12 @@ namespace GLib { public void reset (); public signal void cancelled (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class DesktopAppInfo : GLib.Object, GLib.AppInfo { public static GLib.Type get_type (); public DesktopAppInfo (string desktop_id); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class DirectoryMonitor : GLib.Object { public virtual bool cancel (); public void emit_event (GLib.File child, GLib.File other_file, GLib.DirectoryMonitorEvent event_type); @@ -149,24 +149,24 @@ namespace GLib { public void set_rate_limit (int limit_msecs); public signal void changed (GLib.File child, GLib.File other_file, GLib.DirectoryMonitorEvent event_type); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FileEnumerator : GLib.Object { public static GLib.Type get_type (); public bool has_pending (); public bool is_stopped (); public virtual weak GLib.FileInfo next_file (GLib.Cancellable cancellable, GLib.Error error); - public virtual void next_files_async (int num_files, int io_priority, GLib.AsyncNextFilesCallback @callback, pointer user_data, GLib.Cancellable cancellable); + public virtual void next_files_async (int num_files, int io_priority, GLib.AsyncNextFilesCallback callback, pointer user_data, GLib.Cancellable cancellable); public void set_pending (bool pending); public virtual bool stop (GLib.Cancellable cancellable, GLib.Error error); - public virtual void stop_async (int io_priority, GLib.AsyncStopEnumeratingCallback @callback, pointer user_data, GLib.Cancellable cancellable); + public virtual void stop_async (int io_priority, GLib.AsyncStopEnumeratingCallback callback, pointer user_data, GLib.Cancellable cancellable); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FileIcon : GLib.Object, GLib.Icon, GLib.LoadableIcon { public weak GLib.File get_file (); public static GLib.Type get_type (); public FileIcon (GLib.File file); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FileInfo : GLib.Object { public weak GLib.FileInfo copy (); public weak string get_attribute_as_string (string attribute); @@ -202,19 +202,19 @@ namespace GLib { public void set_display_name (string display_name); public void set_edit_name (string edit_name); public void set_file_type (GLib.FileType type); - public void set_flags (GLib.FileFlags @flags); + public void set_flags (GLib.FileFlags flags); public void set_icon (string icon); public void set_modification_time (GLib.TimeVal mtime); public void set_name (string name); public void set_size (int64 size); public void set_symlink_target (string symlink_target); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FileInputStream : GLib.InputStream, GLib.Seekable { public virtual weak GLib.FileInfo get_file_info (string attributes, GLib.Cancellable cancellable, GLib.Error error); public static GLib.Type get_type (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FileMonitor : GLib.Object { public virtual bool cancel (); public static weak GLib.DirectoryMonitor directory (GLib.File file); @@ -224,7 +224,7 @@ namespace GLib { public void set_rate_limit (int limit_msecs); public signal void changed (GLib.File file, GLib.File other_file, GLib.FileMonitorEvent event_type); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FileOutputStream : GLib.OutputStream { public virtual weak GLib.FileInfo get_file_info (string attributes, GLib.Cancellable cancellable, GLib.Error error); public void get_final_mtime (GLib.TimeVal mtime); @@ -233,83 +233,83 @@ namespace GLib { public void set_final_mtime (GLib.TimeVal final_mtime); public void set_should_get_final_mtime (bool get_final_mtime); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FilterInputStream : GLib.InputStream { public weak GLib.InputStream get_base_stream (); public static GLib.Type get_type (); [NoAccessorMethod] public weak GLib.InputStream base_stream { get; construct; } } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class FilterOutputStream : GLib.OutputStream { public weak GLib.OutputStream get_base_stream (); public static GLib.Type get_type (); [NoAccessorMethod] public weak GLib.OutputStream base_stream { get; construct; } } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class InputStream : GLib.Object { public virtual bool close (GLib.Cancellable cancellable, GLib.Error error); - public virtual void close_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void close_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool close_finish (GLib.AsyncResult result, GLib.Error error); public static GLib.Type get_type (); public bool has_pending (); public bool is_closed (); public virtual long read (pointer buffer, ulong count, GLib.Cancellable cancellable, GLib.Error error); public bool read_all (pointer buffer, ulong count, ulong bytes_read, GLib.Cancellable cancellable, GLib.Error error); - public virtual void read_async (pointer buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void read_async (pointer buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual long read_finish (GLib.AsyncResult result, GLib.Error error); public void set_pending (bool pending); public virtual long skip (ulong count, GLib.Cancellable cancellable, GLib.Error error); - public virtual void skip_async (ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void skip_async (ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual long skip_finish (GLib.AsyncResult result, GLib.Error error); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class LocalDirectoryMonitor : GLib.DirectoryMonitor { public static GLib.Type get_type (); public static weak GLib.DirectoryMonitor start (string dirname); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class LocalFile : GLib.Object, GLib.File { public static GLib.Type get_type (); - public static weak GLib.FileInfo info_get (string basename, string path, GLib.FileAttributeMatcher attribute_matcher, GLib.FileGetInfoFlags @flags, GLib.LocalParentFileInfo parent_info, GLib.Error error); + public static weak GLib.FileInfo info_get (string basename, string path, GLib.FileAttributeMatcher attribute_matcher, GLib.FileGetInfoFlags flags, GLib.LocalParentFileInfo parent_info, GLib.Error error); public static weak GLib.FileInfo info_get_from_fd (int fd, string attributes, GLib.Error error); public static void info_get_parent_info (string dir, GLib.FileAttributeMatcher attribute_matcher, GLib.LocalParentFileInfo parent_info); public LocalFile (string filename); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class LocalFileEnumerator : GLib.FileEnumerator { public static GLib.Type get_type (); - public LocalFileEnumerator (string filename, string attributes, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public LocalFileEnumerator (string filename, string attributes, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class LocalFileInputStream : GLib.FileInputStream { public static GLib.Type get_type (); public LocalFileInputStream (int fd); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class LocalFileMonitor : GLib.FileMonitor { public static GLib.Type get_type (); public static weak GLib.FileMonitor start (string dirname); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class LocalFileOutputStream : GLib.FileOutputStream { public static weak GLib.FileOutputStream append (string filename, GLib.Cancellable cancellable, GLib.Error error); public static weak GLib.FileOutputStream create (string filename, GLib.Cancellable cancellable, GLib.Error error); public static GLib.Type get_type (); public static weak GLib.FileOutputStream replace (string filename, ulong mtime, bool make_backup, GLib.Cancellable cancellable, GLib.Error error); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class LocalVfs : GLib.Object, GLib.Vfs { public static GLib.Type get_type (); public LocalVfs (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class MemoryInputStream : GLib.InputStream, GLib.Seekable { public static weak GLib.InputStream from_data (pointer data, ulong len); public static GLib.Type get_type (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class MemoryOutputStream : GLib.OutputStream, GLib.Seekable { public static GLib.Type get_type (); public MemoryOutputStream (GLib.ByteArray data); @@ -321,7 +321,7 @@ namespace GLib { [NoAccessorMethod] public weak uint size_limit { get; set; } } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class MountOperation : GLib.Object { public bool get_anonymous (); public int get_choice (); @@ -337,18 +337,18 @@ namespace GLib { public void set_password (string password); public void set_password_save (GLib.PasswordSave save); public void set_username (string username); - public signal bool ask_password (string message, string default_user, string default_domain, GLib.PasswordFlags @flags); + public signal bool ask_password (string message, string default_user, string default_domain, GLib.PasswordFlags flags); public signal bool ask_question (string message, string[] choices); [HasEmitter] public signal void reply (bool abort); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class OutputStream : GLib.Object { public virtual bool close (GLib.Cancellable cancellable, GLib.Error error); - public virtual void close_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void close_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool close_finish (GLib.AsyncResult result, GLib.Error error); public virtual bool flush (GLib.Cancellable cancellable, GLib.Error error); - public virtual void flush_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void flush_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool flush_finish (GLib.AsyncResult result, GLib.Error error); public static GLib.Type get_type (); public bool has_pending (); @@ -356,10 +356,10 @@ namespace GLib { public void set_pending (bool pending); public virtual long write (pointer buffer, ulong count, GLib.Cancellable cancellable, GLib.Error error); public bool write_all (pointer buffer, ulong count, ulong bytes_written, GLib.Cancellable cancellable, GLib.Error error); - public virtual void write_async (pointer buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void write_async (pointer buffer, ulong count, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual long write_finish (GLib.AsyncResult result, GLib.Error error); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class SimpleAsyncResult : GLib.Object, GLib.AsyncResult { public void complete (); public void complete_in_idle (); @@ -368,9 +368,9 @@ namespace GLib { public long get_op_res_gssize (); public pointer get_source_tag (); public static GLib.Type get_type (); - public SimpleAsyncResult (GLib.Object source_object, GLib.AsyncReadyCallback @callback, pointer user_data, pointer source_tag); - public SimpleAsyncResult.error (GLib.Object source_object, GLib.AsyncReadyCallback @callback, pointer user_data, GLib.Quark domain, int code, string format); - public SimpleAsyncResult.from_error (GLib.Object source_object, GLib.AsyncReadyCallback @callback, pointer user_data, GLib.Error error); + public SimpleAsyncResult (GLib.Object source_object, GLib.AsyncReadyCallback callback, pointer user_data, pointer source_tag); + public SimpleAsyncResult.error (GLib.Object source_object, GLib.AsyncReadyCallback callback, pointer user_data, GLib.Quark domain, int code, string format); + public SimpleAsyncResult.from_error (GLib.Object source_object, GLib.AsyncReadyCallback callback, pointer user_data, GLib.Error error); public bool propagate_error (GLib.Error dest); public void run_in_thread (GLib.SimpleAsyncThreadFunc func, int io_priority, GLib.Cancellable cancellable); public void set_error (GLib.Quark domain, int code, string format); @@ -381,31 +381,31 @@ namespace GLib { public void set_op_res_gpointer (pointer op_res, GLib.DestroyNotify destroy_op_res); public void set_op_res_gssize (long op_res); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class SocketInputStream : GLib.InputStream { public static GLib.Type get_type (); public SocketInputStream (int fd, bool close_fd_at_close); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class SocketOutputStream : GLib.OutputStream { public static GLib.Type get_type (); public SocketOutputStream (int fd, bool close_fd_at_close); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class ThemedIcon : GLib.Object, GLib.Icon { public weak string get_names (); public static GLib.Type get_type (); public ThemedIcon (string iconname); public ThemedIcon.from_names (string iconnames); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class UnionDrive : GLib.Object, GLib.Drive { public bool child_is_for_monitor (GLib.VolumeMonitor child_monitor); public static GLib.Type get_type (); public bool is_for_child_drive (GLib.Drive child_drive); public UnionDrive (GLib.VolumeMonitor union_monitor, GLib.Drive child_drive, GLib.VolumeMonitor child_monitor); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class UnionVolume : GLib.Object, GLib.Volume { public void add_volume (GLib.Volume volume, GLib.VolumeMonitor monitor); public weak GLib.Volume get_child_for_monitor (GLib.VolumeMonitor child_monitor); @@ -415,13 +415,13 @@ namespace GLib { public UnionVolume (GLib.VolumeMonitor union_monitor, GLib.Volume volume, GLib.VolumeMonitor monitor); public void remove_volume (GLib.Volume volume); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class UnionVolumeMonitor : GLib.VolumeMonitor { public weak GLib.Drive convert_drive (GLib.Drive child_drive); public weak GLib.List convert_volumes (GLib.List child_volumes); public static GLib.Type get_type (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class UnixDrive : GLib.Object, GLib.Drive { public void disconnected (); public static GLib.Type get_type (); @@ -430,7 +430,7 @@ namespace GLib { public void set_volume (GLib.UnixVolume volume); public void unset_volume (GLib.UnixVolume volume); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class UnixVolume : GLib.Object, GLib.Volume { public static GLib.Type get_type (); public bool has_mountpoint (string mountpoint); @@ -438,13 +438,13 @@ namespace GLib { public void unmounted (); public void unset_drive (GLib.UnixDrive drive); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class UnixVolumeMonitor : GLib.VolumeMonitor { public static GLib.Type get_type (); public weak GLib.UnixDrive lookup_drive_for_mountpoint (string mountpoint); public UnixVolumeMonitor (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class VolumeMonitor : GLib.Object { public virtual weak GLib.List get_connected_drives (); public virtual weak GLib.List get_mounted_volumes (); @@ -455,11 +455,11 @@ namespace GLib { public signal void drive_connected (GLib.Drive drive); public signal void drive_disconnected (GLib.Drive drive); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public class Win32AppInfo : GLib.Object, GLib.AppInfo { public static GLib.Type get_type (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface AppInfo { public static weak GLib.AppInfo create_from_commandline (string commandline, string application_name, GLib.Error error); public virtual weak GLib.AppInfo dup (); @@ -475,17 +475,17 @@ namespace GLib { public virtual bool supports_uris (); public virtual bool supports_xdg_startup_notify (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface AsyncResult { public virtual weak GLib.Object get_source_object (); public static GLib.Type get_type (); public virtual pointer get_user_data (); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface Drive { public virtual bool can_eject (); public virtual bool can_mount (); - public virtual void eject (GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void eject (GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool eject_finish (GLib.AsyncResult result, GLib.Error error); public virtual weak string get_icon (); public virtual weak string get_name (); @@ -493,31 +493,31 @@ namespace GLib { public static GLib.Type get_type (); public virtual weak GLib.List get_volumes (); public virtual bool is_automounted (); - public virtual void mount (GLib.MountOperation mount_operation, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void mount (GLib.MountOperation mount_operation, GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool mount_finish (GLib.AsyncResult result, GLib.Error error); public signal void changed (); } [CCode (cheader_filename = "gio/gfile.h")] public interface File { public virtual weak GLib.FileOutputStream append_to (GLib.Cancellable cancellable, GLib.Error error); - public virtual bool copy (GLib.File destination, GLib.FileCopyFlags @flags, GLib.Cancellable cancellable, GLib.FileProgressCallback progress_callback, pointer progress_callback_data, GLib.Error error); + public virtual bool copy (GLib.File destination, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback progress_callback, pointer progress_callback_data, GLib.Error error); public virtual weak GLib.FileOutputStream create (GLib.Cancellable cancellable, GLib.Error error); public bool delete (GLib.Cancellable cancellable, GLib.Error error); public virtual weak GLib.File dup (); - public virtual void eject_mountable (GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void eject_mountable (GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool eject_mountable_finish (GLib.AsyncResult result, GLib.Error error); - public virtual weak GLib.FileEnumerator enumerate_children (string attributes, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public virtual weak GLib.FileEnumerator enumerate_children (string attributes, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); public virtual bool equal (GLib.File file2); public virtual weak string get_basename (); public weak GLib.File get_child (string name); public virtual weak GLib.File get_child_for_display_name (string display_name, GLib.Error error); - public void get_contents_async (GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public void get_contents_async (GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public bool get_contents_finish (GLib.AsyncResult res, string contents, ulong length, GLib.Error error); public virtual weak GLib.FileInfo get_filesystem_info (string attributes, GLib.Cancellable cancellable, GLib.Error error); public static weak GLib.File get_for_commandline_arg (string arg); public static weak GLib.File get_for_path (string path); public static weak GLib.File get_for_uri (string uri); - public virtual weak GLib.FileInfo get_info (string attributes, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public virtual weak GLib.FileInfo get_info (string attributes, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); public virtual weak GLib.File get_parent (); public virtual weak string get_parse_name (); public virtual weak string get_path (); @@ -527,41 +527,41 @@ namespace GLib { public virtual bool is_native (); public virtual bool make_directory (GLib.Cancellable cancellable, GLib.Error error); public virtual bool make_symbolic_link (string symlink_value, GLib.Cancellable cancellable, GLib.Error error); - public virtual void mount_mountable (GLib.MountOperation mount_operation, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void mount_mountable (GLib.MountOperation mount_operation, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual weak GLib.File mount_mountable_finish (GLib.AsyncResult result, GLib.Error error); - public virtual bool move (GLib.File destination, GLib.FileCopyFlags @flags, GLib.Cancellable cancellable, GLib.FileProgressCallback progress_callback, pointer progress_callback_data, GLib.Error error); + public virtual bool move (GLib.File destination, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback progress_callback, pointer progress_callback_data, GLib.Error error); public static weak GLib.File parse_name (string parse_name); public virtual weak GLib.FileInputStream read (GLib.Cancellable cancellable, GLib.Error error); - public virtual void read_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void read_async (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual weak GLib.FileInputStream read_finish (GLib.AsyncResult res, GLib.Error error); public virtual weak GLib.FileOutputStream replace (ulong mtime, bool make_backup, GLib.Cancellable cancellable, GLib.Error error); public virtual weak GLib.File resolve_relative (string relative_path); - public virtual bool set_attribute (string attribute, GLib.FileAttributeType type, pointer value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); - public bool set_attribute_byte_string (string attribute, string value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); - public bool set_attribute_int32 (string attribute, string value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); - public bool set_attribute_int64 (string attribute, int64 value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); - public bool set_attribute_string (string attribute, string value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); - public bool set_attribute_uint32 (string attribute, uint value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); - public bool set_attribute_uint64 (string attribute, uint64 value, GLib.FileGetInfoFlags @flags, GLib.Cancellable cancellable, GLib.Error error); + public virtual bool set_attribute (string attribute, GLib.FileAttributeType type, pointer value, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_byte_string (string attribute, string value, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_int32 (string attribute, string value, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_int64 (string attribute, int64 value, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_string (string attribute, string value, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_uint32 (string attribute, uint value, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); + public bool set_attribute_uint64 (string attribute, uint64 value, GLib.FileGetInfoFlags flags, GLib.Cancellable cancellable, GLib.Error error); public virtual weak GLib.File set_display_name (string display_name, GLib.Cancellable cancellable, GLib.Error error); public virtual bool trash (GLib.Cancellable cancellable, GLib.Error error); - public virtual void unmount_mountable (GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void unmount_mountable (GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool unmount_mountable_finish (GLib.AsyncResult result, GLib.Error error); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface Icon { public virtual bool equal (GLib.Icon icon2); public static GLib.Type get_type (); public static uint hash (pointer icon); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface LoadableIcon { public static GLib.Type get_type (); public virtual weak GLib.InputStream load (int size, string type, GLib.Cancellable cancellable, GLib.Error error); - public virtual void load_async (int size, GLib.Cancellable cancellable, GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void load_async (int size, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback, pointer user_data); public virtual weak GLib.InputStream load_finish (GLib.AsyncResult res, string type, GLib.Error error); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface Seekable { public virtual bool can_seek (); public virtual bool can_truncate (); @@ -570,7 +570,7 @@ namespace GLib { public virtual int64 tell (); public virtual bool truncate (int64 offset, GLib.Cancellable cancellable, GLib.Error err); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface Vfs { public static weak GLib.Vfs get (); public virtual weak GLib.File get_file_for_path (string path); @@ -578,11 +578,11 @@ namespace GLib { public static GLib.Type get_type (); public virtual weak GLib.File parse_name (string parse_name); } - [CCode (cheader_filename = "gio/gvfs.h")] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public interface Volume { public virtual bool can_eject (); public virtual bool can_unmount (); - public virtual void eject (GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void eject (GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool eject_finish (GLib.AsyncResult result, GLib.Error error); public virtual weak GLib.Drive get_drive (); public virtual weak string get_icon (); @@ -590,17 +590,19 @@ namespace GLib { public virtual weak string get_platform_id (); public virtual weak GLib.File get_root (); public static GLib.Type get_type (); - public virtual void unmount (GLib.AsyncReadyCallback @callback, pointer user_data); + public virtual void unmount (GLib.AsyncReadyCallback callback, pointer user_data); public virtual bool unmount_finish (GLib.AsyncResult result, GLib.Error error); public signal void changed (); } [ReferenceType] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public struct AsyncResultData { public pointer async_object; public weak GLib.Error error; public pointer user_data; } [ReferenceType] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public struct FileAttributeMatcher { public bool enumerate_namespace (string @namespace); public weak string enumerate_next (); @@ -610,16 +612,19 @@ namespace GLib { public FileAttributeMatcher (string attributes); } [ReferenceType] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public struct IOJob { public void send_to_mainloop (GLib.IODataFunc func, pointer user_data, GLib.DestroyNotify notify, bool block); } [ReferenceType] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public struct LocalParentFileInfo { public bool writable; public bool is_sticky; public int owner; } [ReferenceType] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public struct UnixMount { public weak string mount_path; public weak string device_path; @@ -627,6 +632,7 @@ namespace GLib { public bool is_read_only; } [ReferenceType] + [CCode (cheader_filename = "gio/gvfs.h, glib.h")] public struct UnixMountPoint { public weak string mount_path; public weak string device_path; diff --git a/vapi/glib-2.0.vala b/vapi/glib-2.0.vala index 4520088a7..408a63b06 100644 --- a/vapi/glib-2.0.vala +++ b/vapi/glib-2.0.vala @@ -1541,7 +1541,8 @@ namespace GLib { FILENAME_ARRAY } - public flags OptionFlags { + [Flags] + public enum OptionFlags { HIDDEN, IN_MAIN, REVERSE, @@ -1905,8 +1906,8 @@ namespace GLib { public void replace (K# key, V# value); public weak V lookup (K key); public bool remove (K key); - public ref List<weak K> get_keys (); - public ref List<weak V> get_values (); + public List<weak K> get_keys (); + public List<weak V> get_values (); [CCode (cname = "g_hash_table_foreach")] public void for_each (HFunc func, pointer user_data); } diff --git a/vapi/gstreamer-0.10.vala b/vapi/gstreamer-0.10.vala index 81116b7e1..ec18bcd05 100644 --- a/vapi/gstreamer-0.10.vala +++ b/vapi/gstreamer-0.10.vala @@ -1,34 +1,34 @@ -[CCode (cprefix = "Gst", lower_case_cprefix = "gst_", cheader_filename = "gst/gst.h")] +[CCode (cprefix = "Gst", lower_case_cprefix = "gst_")] namespace Gst { - [CCode (cprefix = "GST_ACTIVATE_")] + [CCode (cprefix = "GST_ACTIVATE_", cheader_filename = "gst/gst.h")] public enum ActivateMode { NONE, PUSH, PULL, } - [CCode (cprefix = "GST_ALLOC_TRACE_")] + [CCode (cprefix = "GST_ALLOC_TRACE_", cheader_filename = "gst/gst.h")] public enum AllocTraceFlags { LIVE, MEM_LIVE, } - [CCode (cprefix = "GST_ASSOCIATION_FLAG_")] + [CCode (cprefix = "GST_ASSOCIATION_FLAG_", cheader_filename = "gst/gst.h")] public enum AssocFlags { NONE, KEY_UNIT, DELTA_UNIT, LAST, } - [CCode (cprefix = "GST_BIN_FLAG_")] + [CCode (cprefix = "GST_BIN_FLAG_", cheader_filename = "gst/gst.h")] public enum BinFlags { LAST, } - [CCode (cprefix = "GST_BUFFER_COPY_")] + [CCode (cprefix = "GST_BUFFER_COPY_", cheader_filename = "gst/gst.h")] public enum BufferCopyFlags { FLAGS, TIMESTAMPS, CAPS, } - [CCode (cprefix = "GST_BUFFER_FLAG_")] + [CCode (cprefix = "GST_BUFFER_FLAG_", cheader_filename = "gst/gst.h")] public enum BufferFlag { READONLY, PREROLL, @@ -38,27 +38,27 @@ namespace Gst { DELTA_UNIT, LAST, } - [CCode (cprefix = "GST_BUS_")] + [CCode (cprefix = "GST_BUS_", cheader_filename = "gst/gst.h")] public enum BusFlags { FLUSHING, FLAG_LAST, } - [CCode (cprefix = "GST_BUS_")] + [CCode (cprefix = "GST_BUS_", cheader_filename = "gst/gst.h")] public enum BusSyncReply { DROP, PASS, ASYNC, } - [CCode (cprefix = "GST_CAPS_FLAGS_")] + [CCode (cprefix = "GST_CAPS_FLAGS_", cheader_filename = "gst/gst.h")] public enum CapsFlags { ANY, } - [CCode (cprefix = "GST_CLOCK_ENTRY_")] + [CCode (cprefix = "GST_CLOCK_ENTRY_", cheader_filename = "gst/gst.h")] public enum ClockEntryType { SINGLE, PERIODIC, } - [CCode (cprefix = "GST_CLOCK_FLAG_")] + [CCode (cprefix = "GST_CLOCK_FLAG_", cheader_filename = "gst/gst.h")] public enum ClockFlags { CAN_DO_SINGLE_SYNC, CAN_DO_SINGLE_ASYNC, @@ -68,7 +68,7 @@ namespace Gst { CAN_SET_MASTER, LAST, } - [CCode (cprefix = "GST_CLOCK_")] + [CCode (cprefix = "GST_CLOCK_", cheader_filename = "gst/gst.h")] public enum ClockReturn { OK, EARLY, @@ -78,7 +78,7 @@ namespace Gst { ERROR, UNSUPPORTED, } - [CCode (cprefix = "GST_CORE_ERROR_")] + [CCode (cprefix = "GST_CORE_ERROR_", cheader_filename = "gst/gst.h")] public enum CoreError { FAILED, TOO_LAZY, @@ -96,7 +96,7 @@ namespace Gst { DISABLED, NUM_ERRORS, } - [CCode (cprefix = "GST_DEBUG_")] + [CCode (cprefix = "GST_DEBUG_", cheader_filename = "gst/gst.h")] public enum DebugColorFlags { FG_BLACK, FG_RED, @@ -117,7 +117,7 @@ namespace Gst { BOLD, UNDERLINE, } - [CCode (cprefix = "GST_LEVEL_")] + [CCode (cprefix = "GST_LEVEL_", cheader_filename = "gst/gst.h")] public enum DebugLevel { NONE, ERROR, @@ -127,14 +127,14 @@ namespace Gst { LOG, COUNT, } - [CCode (cprefix = "GST_ELEMENT_")] + [CCode (cprefix = "GST_ELEMENT_", cheader_filename = "gst/gst.h")] public enum ElementFlags { LOCKED_STATE, IS_SINK, UNPARENTING, FLAG_LAST, } - [CCode (cprefix = "GST_EVENT_")] + [CCode (cprefix = "GST_EVENT_", cheader_filename = "gst/gst.h")] public enum EventType { UNKNOWN, FLUSH_START, @@ -153,13 +153,13 @@ namespace Gst { CUSTOM_BOTH, CUSTOM_BOTH_OOB, } - [CCode (cprefix = "GST_EVENT_TYPE_")] + [CCode (cprefix = "GST_EVENT_TYPE_", cheader_filename = "gst/gst.h")] public enum EventTypeFlags { UPSTREAM, DOWNSTREAM, SERIALIZED, } - [CCode (cprefix = "GST_FLOW_")] + [CCode (cprefix = "GST_FLOW_", cheader_filename = "gst/gst.h")] public enum FlowReturn { CUSTOM_SUCCESS, RESEND, @@ -172,7 +172,7 @@ namespace Gst { NOT_SUPPORTED, CUSTOM_ERROR, } - [CCode (cprefix = "GST_FORMAT_")] + [CCode (cprefix = "GST_FORMAT_", cheader_filename = "gst/gst.h")] public enum Format { UNDEFINED, DEFAULT, @@ -181,51 +181,51 @@ namespace Gst { BUFFERS, PERCENT, } - [CCode (cprefix = "GST_INDEX_")] + [CCode (cprefix = "GST_INDEX_", cheader_filename = "gst/gst.h")] public enum IndexCertainty { UNKNOWN, CERTAIN, FUZZY, } - [CCode (cprefix = "GST_INDEX_ENTRY_")] + [CCode (cprefix = "GST_INDEX_ENTRY_", cheader_filename = "gst/gst.h")] public enum IndexEntryType { ID, ASSOCIATION, OBJECT, FORMAT, } - [CCode (cprefix = "GST_INDEX_")] + [CCode (cprefix = "GST_INDEX_", cheader_filename = "gst/gst.h")] public enum IndexFlags { WRITABLE, READABLE, FLAG_LAST, } - [CCode (cprefix = "GST_INDEX_LOOKUP_")] + [CCode (cprefix = "GST_INDEX_LOOKUP_", cheader_filename = "gst/gst.h")] public enum IndexLookupMethod { EXACT, BEFORE, AFTER, } - [CCode (cprefix = "GST_INDEX_RESOLVER_")] + [CCode (cprefix = "GST_INDEX_RESOLVER_", cheader_filename = "gst/gst.h")] public enum IndexResolverMethod { CUSTOM, GTYPE, PATH, } - [CCode (cprefix = "GST_ITERATOR_ITEM_")] + [CCode (cprefix = "GST_ITERATOR_ITEM_", cheader_filename = "gst/gst.h")] public enum IteratorItem { SKIP, PASS, END, } - [CCode (cprefix = "GST_ITERATOR_")] + [CCode (cprefix = "GST_ITERATOR_", cheader_filename = "gst/gst.h")] public enum IteratorResult { DONE, OK, RESYNC, ERROR, } - [CCode (cprefix = "GST_LIBRARY_ERROR_")] + [CCode (cprefix = "GST_LIBRARY_ERROR_", cheader_filename = "gst/gst.h")] public enum LibraryError { FAILED, TOO_LAZY, @@ -235,7 +235,7 @@ namespace Gst { ENCODE, NUM_ERRORS, } - [CCode (cprefix = "GST_MESSAGE_")] + [CCode (cprefix = "GST_MESSAGE_", cheader_filename = "gst/gst.h")] public enum MessageType { UNKNOWN, EOS, @@ -262,24 +262,24 @@ namespace Gst { ASYNC_DONE, ANY, } - [CCode (cprefix = "GST_MINI_OBJECT_FLAG_")] + [CCode (cprefix = "GST_MINI_OBJECT_FLAG_", cheader_filename = "gst/gst.h")] public enum MiniObjectFlags { READONLY, LAST, } - [CCode (cprefix = "GST_OBJECT_")] + [CCode (cprefix = "GST_OBJECT_", cheader_filename = "gst/gst.h")] public enum ObjectFlags { DISPOSING, FLOATING, FLAG_LAST, } - [CCode (cprefix = "GST_PAD_")] + [CCode (cprefix = "GST_PAD_", cheader_filename = "gst/gst.h")] public enum PadDirection { UNKNOWN, SRC, SINK, } - [CCode (cprefix = "GST_PAD_")] + [CCode (cprefix = "GST_PAD_", cheader_filename = "gst/gst.h")] public enum PadFlags { BLOCKED, FLUSHING, @@ -288,7 +288,7 @@ namespace Gst { BLOCKING, FLAG_LAST, } - [CCode (cprefix = "GST_PAD_LINK_")] + [CCode (cprefix = "GST_PAD_LINK_", cheader_filename = "gst/gst.h")] public enum PadLinkReturn { OK, WRONG_HIERARCHY, @@ -298,18 +298,18 @@ namespace Gst { NOSCHED, REFUSED, } - [CCode (cprefix = "GST_PAD_")] + [CCode (cprefix = "GST_PAD_", cheader_filename = "gst/gst.h")] public enum PadPresence { ALWAYS, SOMETIMES, REQUEST, } - [CCode (cprefix = "GST_PAD_TEMPLATE_")] + [CCode (cprefix = "GST_PAD_TEMPLATE_", cheader_filename = "gst/gst.h")] public enum PadTemplateFlags { FIXED, FLAG_LAST, } - [CCode (cprefix = "GST_PARSE_ERROR_")] + [CCode (cprefix = "GST_PARSE_ERROR_", cheader_filename = "gst/gst.h")] public enum ParseError { SYNTAX, NO_SUCH_ELEMENT, @@ -319,22 +319,22 @@ namespace Gst { EMPTY_BIN, EMPTY, } - [CCode (cprefix = "GST_PIPELINE_FLAG_")] + [CCode (cprefix = "GST_PIPELINE_FLAG_", cheader_filename = "gst/gst.h")] public enum PipelineFlags { FIXED_CLOCK, LAST, } - [CCode (cprefix = "GST_PLUGIN_ERROR_")] + [CCode (cprefix = "GST_PLUGIN_ERROR_", cheader_filename = "gst/gst.h")] public enum PluginError { MODULE, DEPENDENCIES, NAME_MISMATCH, } - [CCode (cprefix = "GST_PLUGIN_FLAG_")] + [CCode (cprefix = "GST_PLUGIN_FLAG_", cheader_filename = "gst/gst.h")] public enum PluginFlags { CACHED, } - [CCode (cprefix = "GST_QUARK_")] + [CCode (cprefix = "GST_QUARK_", cheader_filename = "gst/gst.h")] public enum QuarkId { FORMAT, CURRENT, @@ -353,7 +353,7 @@ namespace Gst { STOP_VALUE, MAX, } - [CCode (cprefix = "GST_QUERY_")] + [CCode (cprefix = "GST_QUERY_", cheader_filename = "gst/gst.h")] public enum QueryType { NONE, POSITION, @@ -366,14 +366,14 @@ namespace Gst { CONVERT, FORMATS, } - [CCode (cprefix = "GST_RANK_")] + [CCode (cprefix = "GST_RANK_", cheader_filename = "gst/gst.h")] public enum Rank { NONE, MARGINAL, SECONDARY, PRIMARY, } - [CCode (cprefix = "GST_RESOURCE_ERROR_")] + [CCode (cprefix = "GST_RESOURCE_ERROR_", cheader_filename = "gst/gst.h")] public enum ResourceError { FAILED, TOO_LAZY, @@ -391,7 +391,7 @@ namespace Gst { NO_SPACE_LEFT, NUM_ERRORS, } - [CCode (cprefix = "GST_SEEK_FLAG_")] + [CCode (cprefix = "GST_SEEK_FLAG_", cheader_filename = "gst/gst.h")] public enum SeekFlags { NONE, FLUSH, @@ -399,14 +399,14 @@ namespace Gst { KEY_UNIT, SEGMENT, } - [CCode (cprefix = "GST_SEEK_TYPE_")] + [CCode (cprefix = "GST_SEEK_TYPE_", cheader_filename = "gst/gst.h")] public enum SeekType { NONE, CUR, SET, END, } - [CCode (cprefix = "GST_STATE_")] + [CCode (cprefix = "GST_STATE_", cheader_filename = "gst/gst.h")] public enum State { VOID_PENDING, NULL, @@ -414,7 +414,7 @@ namespace Gst { PAUSED, PLAYING, } - [CCode (cprefix = "GST_STATE_CHANGE_")] + [CCode (cprefix = "GST_STATE_CHANGE_", cheader_filename = "gst/gst.h")] public enum StateChange { NULL_TO_READY, READY_TO_PAUSED, @@ -423,14 +423,14 @@ namespace Gst { PAUSED_TO_READY, READY_TO_NULL, } - [CCode (cprefix = "GST_STATE_CHANGE_")] + [CCode (cprefix = "GST_STATE_CHANGE_", cheader_filename = "gst/gst.h")] public enum StateChangeReturn { FAILURE, SUCCESS, ASYNC, NO_PREROLL, } - [CCode (cprefix = "GST_STREAM_ERROR_")] + [CCode (cprefix = "GST_STREAM_ERROR_", cheader_filename = "gst/gst.h")] public enum StreamError { FAILED, TOO_LAZY, @@ -445,7 +445,7 @@ namespace Gst { FORMAT, NUM_ERRORS, } - [CCode (cprefix = "GST_TAG_FLAG_")] + [CCode (cprefix = "GST_TAG_FLAG_", cheader_filename = "gst/gst.h")] public enum TagFlag { UNDEFINED, META, @@ -453,7 +453,7 @@ namespace Gst { DECODED, COUNT, } - [CCode (cprefix = "GST_TAG_MERGE_")] + [CCode (cprefix = "GST_TAG_MERGE_", cheader_filename = "gst/gst.h")] public enum TagMergeMode { UNDEFINED, REPLACE_ALL, @@ -464,13 +464,13 @@ namespace Gst { KEEP_ALL, COUNT, } - [CCode (cprefix = "GST_TASK_")] + [CCode (cprefix = "GST_TASK_", cheader_filename = "gst/gst.h")] public enum TaskState { STARTED, STOPPED, PAUSED, } - [CCode (cprefix = "GST_TYPE_FIND_")] + [CCode (cprefix = "GST_TYPE_FIND_", cheader_filename = "gst/gst.h")] public enum TypeFindProbability { MINIMUM, POSSIBLE, @@ -478,7 +478,7 @@ namespace Gst { NEARLY_CERTAIN, MAXIMUM, } - [CCode (cprefix = "GST_URI_")] + [CCode (cprefix = "GST_URI_", cheader_filename = "gst/gst.h")] public enum URIType { UNKNOWN, SINK, @@ -527,7 +527,7 @@ namespace Gst { public uint64 offset; public uint64 offset_end; public uchar malloc_data; - public void copy_metadata (Gst.Buffer src, Gst.BufferCopyFlags @flags); + public void copy_metadata (Gst.Buffer src, Gst.BufferCopyFlags flags); public weak Gst.Buffer create_sub (uint offset, uint size); public weak Gst.Caps get_caps (); public static GLib.Type get_type (); @@ -668,7 +668,7 @@ namespace Gst { public void release_request_pad (Gst.Pad pad); public bool remove_pad (Gst.Pad pad); public bool requires_clock (); - public bool seek (double rate, Gst.Format format, Gst.SeekFlags @flags, Gst.SeekType cur_type, int64 cur, Gst.SeekType stop_type, int64 stop); + public bool seek (double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType cur_type, int64 cur, Gst.SeekType stop_type, int64 stop); public bool seek_simple (Gst.Format format, Gst.SeekFlags seek_flags, int64 seek_pos); public virtual bool send_event (Gst.Event event); public void set_base_time (uint64 time); @@ -723,14 +723,14 @@ namespace Gst { public Event.new_segment (bool update, double rate, Gst.Format format, int64 start, int64 stop, int64 position); public Event.new_segment_full (bool update, double rate, double applied_rate, Gst.Format format, int64 start, int64 stop, int64 position); public Event.qos (double proportion, int64 diff, uint64 timestamp); - public Event.seek (double rate, Gst.Format format, Gst.SeekFlags @flags, Gst.SeekType start_type, int64 start, Gst.SeekType stop_type, int64 stop); + public Event.seek (double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType start_type, int64 start, Gst.SeekType stop_type, int64 stop); public Event.tag (Gst.TagList taglist); public void parse_buffer_size (Gst.Format format, int64 minsize, int64 maxsize, bool async); public void parse_latency (uint64 latency); public void parse_new_segment (bool update, double rate, Gst.Format format, int64 start, int64 stop, int64 position); public void parse_new_segment_full (bool update, double rate, double applied_rate, Gst.Format format, int64 start, int64 stop, int64 position); public void parse_qos (double proportion, int64 diff, uint64 timestamp); - public void parse_seek (double rate, Gst.Format format, Gst.SeekFlags @flags, Gst.SeekType start_type, int64 start, Gst.SeekType stop_type, int64 stop); + public void parse_seek (double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType start_type, int64 start, Gst.SeekType stop_type, int64 stop); public void parse_tag (Gst.TagList taglist); public static Gst.EventTypeFlags type_get_flags (Gst.EventType type); public static weak string type_get_name (Gst.EventType type); @@ -738,14 +738,14 @@ namespace Gst { } [CCode (cheader_filename = "gst/gst.h")] public class Index : Gst.Object { - public weak Gst.IndexEntry add_association (int id, Gst.AssocFlags @flags, Gst.Format format, int64 value); - public weak Gst.IndexEntry add_associationv (int id, Gst.AssocFlags @flags, int n, Gst.IndexAssociation list); + public weak Gst.IndexEntry add_association (int id, Gst.AssocFlags flags, Gst.Format format, int64 value); + public weak Gst.IndexEntry add_associationv (int id, Gst.AssocFlags flags, int n, Gst.IndexAssociation list); public weak Gst.IndexEntry add_format (int id, Gst.Format format); public weak Gst.IndexEntry add_id (int id, string description); public weak Gst.IndexEntry add_object (int id, string key, GLib.Type type, pointer object); public virtual void commit (int id); - public virtual weak Gst.IndexEntry get_assoc_entry (int id, Gst.IndexLookupMethod method, Gst.AssocFlags @flags, Gst.Format format, int64 value); - public weak Gst.IndexEntry get_assoc_entry_full (int id, Gst.IndexLookupMethod method, Gst.AssocFlags @flags, Gst.Format format, int64 value, GLib.CompareDataFunc func, pointer user_data); + public virtual weak Gst.IndexEntry get_assoc_entry (int id, Gst.IndexLookupMethod method, Gst.AssocFlags flags, Gst.Format format, int64 value); + public weak Gst.IndexEntry get_assoc_entry_full (int id, Gst.IndexLookupMethod method, Gst.AssocFlags flags, Gst.Format format, int64 value, GLib.CompareDataFunc func, pointer user_data); public Gst.IndexCertainty get_certainty (); public int get_group (); public static GLib.Type get_type (); @@ -817,7 +817,7 @@ namespace Gst { [CCode (cheader_filename = "gst/gst.h")] public class MiniObject : GLib.TypeInstance, GLib.Object { public int refcount; - public uint @flags; + public uint flags; public weak Gst.MiniObject copy (); public static GLib.Type get_type (); public bool is_writable (); @@ -833,7 +833,7 @@ namespace Gst { public weak GLib.Mutex @lock; public weak string name_prefix; public weak Gst.Object parent; - public uint @flags; + public uint flags; public static bool check_uniqueness (GLib.List list, string name); public static void default_deep_notify (GLib.Object object, Gst.Object orig, GLib.ParamSpec pspec, string excluded_props); public void default_error (GLib.Error error, string debug); @@ -956,7 +956,7 @@ namespace Gst { public void set_activatepush_function (Gst.PadActivateModeFunction activatepush); public bool set_active (bool active); public bool set_blocked (bool blocked); - public bool set_blocked_async (bool blocked, Gst.PadBlockCallback @callback, pointer user_data); + public bool set_blocked_async (bool blocked, Gst.PadBlockCallback callback, pointer user_data); public void set_bufferalloc_function (Gst.PadBufferAllocFunction bufalloc); public bool set_caps (Gst.Caps caps); public void set_chain_function (Gst.PadChainFunction chain); @@ -1207,9 +1207,10 @@ namespace Gst { public virtual bool set_uri (string uri); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct AllocTrace { public weak string name; - public int @flags; + public int flags; public int live; public weak GLib.SList mem_live; public static bool available (); @@ -1219,35 +1220,43 @@ namespace Gst { public void print (); public static void print_all (); public static void print_live (); - public void set_flags (Gst.AllocTraceFlags @flags); - public static void set_flags_all (Gst.AllocTraceFlags @flags); + public void set_flags (Gst.AllocTraceFlags flags); + public static void set_flags_all (Gst.AllocTraceFlags flags); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct BinaryChunk { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct BinaryElementFactory { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct BinaryPadTemplate { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct BinaryPluginElement { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct BinaryPluginFeature { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct BinaryRegistryMagic { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct BinaryTypeFindFactory { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Caps { public GLib.Type type; public int refcount; - public Gst.CapsFlags @flags; + public Gst.CapsFlags flags; public void append (Gst.Caps caps2); public void append_structure (Gst.Structure structure); public weak Gst.Caps copy (); @@ -1288,6 +1297,7 @@ namespace Gst { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct ClockEntry { public int refcount; public weak Gst.Clock clock; @@ -1299,12 +1309,15 @@ namespace Gst { public pointer user_data; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct DebugCategory { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct DebugMessage { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct ElementDetails { public weak string longname; public weak string klass; @@ -1312,6 +1325,7 @@ namespace Gst { public weak string author; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct FormatDefinition { public Gst.Format value; public weak string nick; @@ -1319,11 +1333,13 @@ namespace Gst { public GLib.Quark quark; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct IndexAssociation { public Gst.Format format; public int64 value; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct IndexEntry { public bool assoc_map (Gst.Format format, int64 value); public weak Gst.IndexEntry copy (); @@ -1331,9 +1347,11 @@ namespace Gst { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct IndexGroup { } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Iterator { public Gst.IteratorNextFunction next; public Gst.IteratorItemFunction item; @@ -1353,6 +1371,7 @@ namespace Gst { public void push (Gst.Iterator other); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct PluginDesc { public int major_version; public int minor_version; @@ -1367,6 +1386,7 @@ namespace Gst { public pointer _gst_reserved; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct QueryTypeDefinition { public Gst.QueryType value; public weak string nick; @@ -1374,11 +1394,12 @@ namespace Gst { public GLib.Quark quark; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Segment { public double rate; public double abs_rate; public Gst.Format format; - public Gst.SeekFlags @flags; + public Gst.SeekFlags flags; public int64 start; public int64 stop; public int64 time; @@ -1395,11 +1416,12 @@ namespace Gst { public void set_last_stop (Gst.Format format, int64 position); public void set_newsegment (bool update, double rate, Gst.Format format, int64 start, int64 stop, int64 time); public void set_newsegment_full (bool update, double rate, double applied_rate, Gst.Format format, int64 start, int64 stop, int64 time); - public void set_seek (double rate, Gst.Format format, Gst.SeekFlags @flags, Gst.SeekType start_type, int64 start, Gst.SeekType stop_type, int64 stop, bool update); + public void set_seek (double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType start_type, int64 start, Gst.SeekType stop_type, int64 stop, bool update); public int64 to_running_time (Gst.Format format, int64 position); public int64 to_stream_time (Gst.Format format, int64 position); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct StaticCaps { public weak Gst.Caps caps; public weak string string; @@ -1407,6 +1429,7 @@ namespace Gst { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct StaticPadTemplate { public weak string name_template; public Gst.PadDirection direction; @@ -1417,6 +1440,7 @@ namespace Gst { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Structure { public GLib.Type type; public weak Gst.Structure copy (); @@ -1467,6 +1491,7 @@ namespace Gst { public weak string to_string (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct TagList { public GLib.Type type; public void add (Gst.TagMergeMode mode, string tag); @@ -1517,6 +1542,7 @@ namespace Gst { public void remove_tag (string tag); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Trace { public void destroy (); public void flush (); @@ -1526,6 +1552,7 @@ namespace Gst { public void text_flush (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct TraceEntry { public int64 timestamp; public uint sequence; @@ -1533,6 +1560,7 @@ namespace Gst { public char message; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct TypeFind { public pointer data; public pointer _gst_reserved; @@ -1543,11 +1571,13 @@ namespace Gst { public void suggest (uint probability, Gst.Caps caps); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct TypeNameData { public weak string name; public GLib.Type type; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct ValueTable { public GLib.Type type; public Gst.ValueCompareFunc compare; @@ -1555,37 +1585,44 @@ namespace Gst { public Gst.ValueDeserializeFunc deserialize; } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Debug { public static void print_stack_trace (); public static uint remove_log_function (Gst.LogFunction func); public static uint remove_log_function_by_data (pointer data); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Flow { public static weak string get_name (Gst.FlowReturn ret); public static GLib.Quark to_quark (Gst.FlowReturn ret); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Fraction { public static GLib.Type get_type (); public static GLib.Type range_get_type (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Init { public static bool check (int argc, string argv, GLib.Error err); public static weak GLib.OptionGroup get_option_group (); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Print { public static void element_args (GLib.String buf, int indent, Gst.Element element); public static void pad_caps (GLib.String buf, int indent, Gst.Pad pad); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Segtrap { public static bool is_enabled (); public static void set_enabled (bool enabled); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Tag { public static bool exists (string tag); public static weak string get_description (string tag); @@ -1598,6 +1635,7 @@ namespace Gst { public static void register (string name, Gst.TagFlag flag, GLib.Type type, string nick, string blurb, Gst.TagMergeFunc func); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Uri { public static weak string @construct (string protocol, string location); public static weak string get_location (string uri); @@ -1608,6 +1646,7 @@ namespace Gst { public static bool protocol_is_valid (string protocol); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Util { [NoArrayLength] public static void dump_mem (uchar[] mem, uint size); @@ -1619,6 +1658,7 @@ namespace Gst { public static uint64 uint64_scale_int (uint64 val, int num, int denom); } [ReferenceType] + [CCode (cheader_filename = "gst/gst.h")] public struct Value { public static void array_append_value (GLib.Value value, GLib.Value append_value); public static uint array_get_size (GLib.Value value); @@ -1719,6 +1759,7 @@ namespace Gst { public static delegate string ValueSerializeFunc (GLib.Value value1); public static delegate bool ValueSubtractFunc (GLib.Value dest, GLib.Value minuend, GLib.Value subtrahend); public static delegate bool ValueUnionFunc (GLib.Value dest, GLib.Value value1, GLib.Value value2); + public static void init (ref string[] args); public static void atomic_int_set (int atomic_int, int value); public static void class_signal_emit_by_name (Gst.Object object, string name, pointer self); public static GLib.Quark core_error_quark (); @@ -1739,7 +1780,7 @@ namespace Gst { public static GLib.Type int_range_get_type (); public static bool is_tag_list (pointer p); public static GLib.Quark library_error_quark (); - public static weak GLib.ParamSpec param_spec_mini_object (string name, string nick, string blurb, GLib.Type object_type, GLib.ParamFlags @flags); + public static weak GLib.ParamSpec param_spec_mini_object (string name, string nick, string blurb, GLib.Type object_type, GLib.ParamFlags flags); public static weak Gst.Element parse_bin_from_description (string bin_description, bool ghost_unconnected_pads, GLib.Error err); public static GLib.Quark parse_error_quark (); public static weak Gst.Element parse_launch (string pipeline_description, GLib.Error error); @@ -1749,7 +1790,3 @@ namespace Gst { public static bool update_registry (); public static weak string version_string (); } -[CCode (cprefix = "Gst", lower_case_cprefix = "gst_", cheader_filename = "gst/gst.h")] -namespace Gst { - public static void init (ref string[] args); -} diff --git a/vapi/gtk+-2.0.vala b/vapi/gtk+-2.0.vala index 04dfee009..fdd432a92 100644 --- a/vapi/gtk+-2.0.vala +++ b/vapi/gtk+-2.0.vala @@ -1,12 +1,12 @@ -[CCode (cprefix = "Gtk", lower_case_cprefix = "gtk_", cheader_filename = "gtk/gtk.h")] +[CCode (cprefix = "Gtk", lower_case_cprefix = "gtk_")] namespace Gtk { - [CCode (cprefix = "GTK_ACCEL_")] + [CCode (cprefix = "GTK_ACCEL_", cheader_filename = "gtk/gtk.h")] public enum AccelFlags { VISIBLE, LOCKED, MASK, } - [CCode (cprefix = "GTK_ANCHOR_")] + [CCode (cprefix = "GTK_ANCHOR_", cheader_filename = "gtk/gtk.h")] public enum AnchorType { CENTER, NORTH, @@ -26,7 +26,7 @@ namespace Gtk { W, E, } - [CCode (cprefix = "GTK_ARG_")] + [CCode (cprefix = "GTK_ARG_", cheader_filename = "gtk/gtk.h")] public enum ArgFlags { READABLE, WRITABLE, @@ -34,7 +34,7 @@ namespace Gtk { CONSTRUCT_ONLY, CHILD_ARG, } - [CCode (cprefix = "GTK_ARROW_")] + [CCode (cprefix = "GTK_ARROW_", cheader_filename = "gtk/gtk.h")] public enum ArrowType { UP, DOWN, @@ -42,7 +42,7 @@ namespace Gtk { RIGHT, NONE, } - [CCode (cprefix = "GTK_ASSISTANT_PAGE_")] + [CCode (cprefix = "GTK_ASSISTANT_PAGE_", cheader_filename = "gtk/gtk.h")] public enum AssistantPageType { CONTENT, INTRO, @@ -50,13 +50,13 @@ namespace Gtk { SUMMARY, PROGRESS, } - [CCode (cprefix = "GTK_")] + [CCode (cprefix = "GTK_", cheader_filename = "gtk/gtk.h")] public enum AttachOptions { EXPAND, SHRINK, FILL, } - [CCode (cprefix = "GTK_BUILDER_ERROR_")] + [CCode (cprefix = "GTK_BUILDER_ERROR_", cheader_filename = "gtk/gtk.h")] public enum BuilderError { INVALID_TYPE_FUNCTION, UNHANDLED_TAG, @@ -64,7 +64,7 @@ namespace Gtk { INVALID_ATTRIBUTE, INVALID_TAG, } - [CCode (cprefix = "GTK_BUTTONBOX_")] + [CCode (cprefix = "GTK_BUTTONBOX_", cheader_filename = "gtk/gtk.h")] public enum ButtonBoxStyle { DEFAULT_STYLE, SPREAD, @@ -73,7 +73,7 @@ namespace Gtk { END, CENTER, } - [CCode (cprefix = "GTK_BUTTONS_")] + [CCode (cprefix = "GTK_BUTTONS_", cheader_filename = "gtk/gtk.h")] public enum ButtonsType { NONE, OK, @@ -82,7 +82,7 @@ namespace Gtk { YES_NO, OK_CANCEL, } - [CCode (cprefix = "GTK_CALENDAR_")] + [CCode (cprefix = "GTK_CALENDAR_", cheader_filename = "gtk/gtk.h")] public enum CalendarDisplayOptions { SHOW_HEADING, SHOW_DAY_NAMES, @@ -90,18 +90,18 @@ namespace Gtk { SHOW_WEEK_NUMBERS, WEEK_START_MONDAY, } - [CCode (cprefix = "GTK_CELL_RENDERER_ACCEL_MODE_")] + [CCode (cprefix = "GTK_CELL_RENDERER_ACCEL_MODE_", cheader_filename = "gtk/gtk.h")] public enum CellRendererAccelMode { GTK, OTHER, } - [CCode (cprefix = "GTK_CELL_RENDERER_MODE_")] + [CCode (cprefix = "GTK_CELL_RENDERER_MODE_", cheader_filename = "gtk/gtk.h")] public enum CellRendererMode { INERT, ACTIVATABLE, EDITABLE, } - [CCode (cprefix = "GTK_CELL_RENDERER_")] + [CCode (cprefix = "GTK_CELL_RENDERER_", cheader_filename = "gtk/gtk.h")] public enum CellRendererState { SELECTED, PRELIT, @@ -109,20 +109,20 @@ namespace Gtk { SORTED, FOCUSED, } - [CCode (cprefix = "GTK_CORNER_")] + [CCode (cprefix = "GTK_CORNER_", cheader_filename = "gtk/gtk.h")] public enum CornerType { TOP_LEFT, BOTTOM_LEFT, TOP_RIGHT, BOTTOM_RIGHT, } - [CCode (cprefix = "GTK_CURVE_TYPE_")] + [CCode (cprefix = "GTK_CURVE_TYPE_", cheader_filename = "gtk/gtk.h")] public enum CurveType { LINEAR, SPLINE, FREE, } - [CCode (cprefix = "GTK_DEBUG_")] + [CCode (cprefix = "GTK_DEBUG_", cheader_filename = "gtk/gtk.h")] public enum DebugFlag { MISC, PLUGSOCKET, @@ -137,7 +137,7 @@ namespace Gtk { PRINTING, BUILDER, } - [CCode (cprefix = "GTK_DELETE_")] + [CCode (cprefix = "GTK_DELETE_", cheader_filename = "gtk/gtk.h")] public enum DeleteType { CHARS, WORD_ENDS, @@ -148,20 +148,20 @@ namespace Gtk { PARAGRAPHS, WHITESPACE, } - [CCode (cprefix = "GTK_DEST_DEFAULT_")] + [CCode (cprefix = "GTK_DEST_DEFAULT_", cheader_filename = "gtk/gtk.h")] public enum DestDefaults { MOTION, HIGHLIGHT, DROP, ALL, } - [CCode (cprefix = "GTK_DIALOG_")] + [CCode (cprefix = "GTK_DIALOG_", cheader_filename = "gtk/gtk.h")] public enum DialogFlags { MODAL, DESTROY_WITH_PARENT, NO_SEPARATOR, } - [CCode (cprefix = "GTK_DIR_")] + [CCode (cprefix = "GTK_DIR_", cheader_filename = "gtk/gtk.h")] public enum DirectionType { TAB_FORWARD, TAB_BACKWARD, @@ -170,7 +170,7 @@ namespace Gtk { LEFT, RIGHT, } - [CCode (cprefix = "GTK_DRAG_RESULT_")] + [CCode (cprefix = "GTK_DRAG_RESULT_", cheader_filename = "gtk/gtk.h")] public enum DragResult { SUCCESS, NO_TARGET, @@ -179,59 +179,59 @@ namespace Gtk { GRAB_BROKEN, ERROR, } - [CCode (cprefix = "GTK_EXPANDER_")] + [CCode (cprefix = "GTK_EXPANDER_", cheader_filename = "gtk/gtk.h")] public enum ExpanderStyle { COLLAPSED, SEMI_COLLAPSED, SEMI_EXPANDED, EXPANDED, } - [CCode (cprefix = "GTK_FILE_CHOOSER_ACTION_")] + [CCode (cprefix = "GTK_FILE_CHOOSER_ACTION_", cheader_filename = "gtk/gtk.h")] public enum FileChooserAction { OPEN, SAVE, SELECT_FOLDER, CREATE_FOLDER, } - [CCode (cprefix = "GTK_FILE_CHOOSER_CONFIRMATION_")] + [CCode (cprefix = "GTK_FILE_CHOOSER_CONFIRMATION_", cheader_filename = "gtk/gtk.h")] public enum FileChooserConfirmation { CONFIRM, ACCEPT_FILENAME, SELECT_AGAIN, } - [CCode (cprefix = "GTK_FILE_CHOOSER_ERROR_")] + [CCode (cprefix = "GTK_FILE_CHOOSER_ERROR_", cheader_filename = "gtk/gtk.h")] public enum FileChooserError { NONEXISTENT, BAD_FILENAME, ALREADY_EXISTS, } - [CCode (cprefix = "GTK_FILE_FILTER_")] + [CCode (cprefix = "GTK_FILE_FILTER_", cheader_filename = "gtk/gtk.h")] public enum FileFilterFlags { FILENAME, URI, DISPLAY_NAME, MIME_TYPE, } - [CCode (cprefix = "GTK_IM_PREEDIT_")] + [CCode (cprefix = "GTK_IM_PREEDIT_", cheader_filename = "gtk/gtk.h")] public enum IMPreeditStyle { NOTHING, CALLBACK, NONE, } - [CCode (cprefix = "GTK_IM_STATUS_")] + [CCode (cprefix = "GTK_IM_STATUS_", cheader_filename = "gtk/gtk.h")] public enum IMStatusStyle { NOTHING, CALLBACK, NONE, } - [CCode (cprefix = "GTK_ICON_LOOKUP_")] + [CCode (cprefix = "GTK_ICON_LOOKUP_", cheader_filename = "gtk/gtk.h")] public enum IconLookupFlags { NO_SVG, FORCE_SVG, USE_BUILTIN, GENERIC_FALLBACK, } - [CCode (cprefix = "GTK_ICON_SIZE_")] + [CCode (cprefix = "GTK_ICON_SIZE_", cheader_filename = "gtk/gtk.h")] public enum IconSize { INVALID, MENU, @@ -241,12 +241,12 @@ namespace Gtk { DND, DIALOG, } - [CCode (cprefix = "GTK_ICON_THEME_")] + [CCode (cprefix = "GTK_ICON_THEME_", cheader_filename = "gtk/gtk.h")] public enum IconThemeError { NOT_FOUND, FAILED, } - [CCode (cprefix = "GTK_ICON_VIEW_")] + [CCode (cprefix = "GTK_ICON_VIEW_", cheader_filename = "gtk/gtk.h")] public enum IconViewDropPosition { NO_DROP, DROP_INTO, @@ -255,7 +255,7 @@ namespace Gtk { DROP_ABOVE, DROP_BELOW, } - [CCode (cprefix = "GTK_IMAGE_")] + [CCode (cprefix = "GTK_IMAGE_", cheader_filename = "gtk/gtk.h")] public enum ImageType { EMPTY, PIXMAP, @@ -266,14 +266,14 @@ namespace Gtk { ANIMATION, ICON_NAME, } - [CCode (cprefix = "GTK_JUSTIFY_")] + [CCode (cprefix = "GTK_JUSTIFY_", cheader_filename = "gtk/gtk.h")] public enum Justification { LEFT, RIGHT, CENTER, FILL, } - [CCode (cprefix = "GTK_MATCH_")] + [CCode (cprefix = "GTK_MATCH_", cheader_filename = "gtk/gtk.h")] public enum MatchType { ALL, ALL_TAIL, @@ -282,14 +282,14 @@ namespace Gtk { EXACT, LAST, } - [CCode (cprefix = "GTK_MENU_DIR_")] + [CCode (cprefix = "GTK_MENU_DIR_", cheader_filename = "gtk/gtk.h")] public enum MenuDirectionType { PARENT, CHILD, NEXT, PREV, } - [CCode (cprefix = "GTK_MESSAGE_")] + [CCode (cprefix = "GTK_MESSAGE_", cheader_filename = "gtk/gtk.h")] public enum MessageType { INFO, WARNING, @@ -297,13 +297,13 @@ namespace Gtk { ERROR, OTHER, } - [CCode (cprefix = "GTK_")] + [CCode (cprefix = "GTK_", cheader_filename = "gtk/gtk.h")] public enum MetricType { PIXELS, INCHES, CENTIMETERS, } - [CCode (cprefix = "GTK_MOVEMENT_")] + [CCode (cprefix = "GTK_MOVEMENT_", cheader_filename = "gtk/gtk.h")] public enum MovementStep { LOGICAL_POSITIONS, VISUAL_POSITIONS, @@ -316,49 +316,49 @@ namespace Gtk { BUFFER_ENDS, HORIZONTAL_PAGES, } - [CCode (cprefix = "GTK_NOTEBOOK_TAB_")] + [CCode (cprefix = "GTK_NOTEBOOK_TAB_", cheader_filename = "gtk/gtk.h")] public enum NotebookTab { FIRST, LAST, } - [CCode (cprefix = "GTK_")] + [CCode (cprefix = "GTK_", cheader_filename = "gtk/gtk.h")] public enum ObjectFlags { IN_DESTRUCTION, FLOATING, RESERVED_1, RESERVED_2, } - [CCode (cprefix = "GTK_ORIENTATION_")] + [CCode (cprefix = "GTK_ORIENTATION_", cheader_filename = "gtk/gtk.h")] public enum Orientation { HORIZONTAL, VERTICAL, } - [CCode (cprefix = "GTK_PACK_DIRECTION_")] + [CCode (cprefix = "GTK_PACK_DIRECTION_", cheader_filename = "gtk/gtk.h")] public enum PackDirection { LTR, RTL, TTB, BTT, } - [CCode (cprefix = "GTK_PACK_")] + [CCode (cprefix = "GTK_PACK_", cheader_filename = "gtk/gtk.h")] public enum PackType { START, END, } - [CCode (cprefix = "GTK_PAGE_ORIENTATION_")] + [CCode (cprefix = "GTK_PAGE_ORIENTATION_", cheader_filename = "gtk/gtk.h")] public enum PageOrientation { PORTRAIT, LANDSCAPE, REVERSE_PORTRAIT, REVERSE_LANDSCAPE, } - [CCode (cprefix = "GTK_PAGE_SET_")] + [CCode (cprefix = "GTK_PAGE_SET_", cheader_filename = "gtk/gtk.h")] public enum PageSet { ALL, EVEN, ODD, } - [CCode (cprefix = "GTK_PATH_PRIO_")] + [CCode (cprefix = "GTK_PATH_PRIO_", cheader_filename = "gtk/gtk.h")] public enum PathPriorityType { LOWEST, GTK, @@ -367,35 +367,35 @@ namespace Gtk { RC, HIGHEST, } - [CCode (cprefix = "GTK_PATH_")] + [CCode (cprefix = "GTK_PATH_", cheader_filename = "gtk/gtk.h")] public enum PathType { WIDGET, WIDGET_CLASS, CLASS, } - [CCode (cprefix = "GTK_POLICY_")] + [CCode (cprefix = "GTK_POLICY_", cheader_filename = "gtk/gtk.h")] public enum PolicyType { ALWAYS, AUTOMATIC, NEVER, } - [CCode (cprefix = "GTK_POS_")] + [CCode (cprefix = "GTK_POS_", cheader_filename = "gtk/gtk.h")] public enum PositionType { LEFT, RIGHT, TOP, BOTTOM, } - [CCode (cprefix = "GTK_PREVIEW_")] + [CCode (cprefix = "GTK_PREVIEW_", cheader_filename = "gtk/gtk.h")] public enum PreviewType { COLOR, GRAYSCALE, } - [CCode (cprefix = "GTK_PRINT_BACKEND_ERROR_")] + [CCode (cprefix = "GTK_PRINT_BACKEND_ERROR_", cheader_filename = "gtk/gtk.h")] public enum PrintBackendError { GENERIC, } - [CCode (cprefix = "GTK_PRINT_CAPABILITY_")] + [CCode (cprefix = "GTK_PRINT_CAPABILITY_", cheader_filename = "gtk/gtk.h")] public enum PrintCapabilities { PAGE_SET, COPIES, @@ -407,47 +407,47 @@ namespace Gtk { PREVIEW, NUMBER_UP, } - [CCode (cprefix = "GTK_PRINT_DUPLEX_")] + [CCode (cprefix = "GTK_PRINT_DUPLEX_", cheader_filename = "gtk/gtk.h")] public enum PrintDuplex { SIMPLEX, HORIZONTAL, VERTICAL, } - [CCode (cprefix = "GTK_PRINT_ERROR_")] + [CCode (cprefix = "GTK_PRINT_ERROR_", cheader_filename = "gtk/gtk.h")] public enum PrintError { GENERAL, INTERNAL_ERROR, NOMEM, INVALID_FILE, } - [CCode (cprefix = "GTK_PRINT_OPERATION_ACTION_")] + [CCode (cprefix = "GTK_PRINT_OPERATION_ACTION_", cheader_filename = "gtk/gtk.h")] public enum PrintOperationAction { PRINT_DIALOG, PRINT, PREVIEW, EXPORT, } - [CCode (cprefix = "GTK_PRINT_OPERATION_RESULT_")] + [CCode (cprefix = "GTK_PRINT_OPERATION_RESULT_", cheader_filename = "gtk/gtk.h")] public enum PrintOperationResult { ERROR, APPLY, CANCEL, IN_PROGRESS, } - [CCode (cprefix = "GTK_PRINT_PAGES_")] + [CCode (cprefix = "GTK_PRINT_PAGES_", cheader_filename = "gtk/gtk.h")] public enum PrintPages { ALL, CURRENT, RANGES, } - [CCode (cprefix = "GTK_PRINT_QUALITY_")] + [CCode (cprefix = "GTK_PRINT_QUALITY_", cheader_filename = "gtk/gtk.h")] public enum PrintQuality { LOW, NORMAL, HIGH, DRAFT, } - [CCode (cprefix = "GTK_PRINT_STATUS_")] + [CCode (cprefix = "GTK_PRINT_STATUS_", cheader_filename = "gtk/gtk.h")] public enum PrintStatus { INITIAL, PREPARING, @@ -459,7 +459,7 @@ namespace Gtk { FINISHED, FINISHED_ABORTED, } - [CCode (cprefix = "GTK_PRINTER_OPTION_TYPE_")] + [CCode (cprefix = "GTK_PRINTER_OPTION_TYPE_", cheader_filename = "gtk/gtk.h")] public enum PrinterOptionType { BOOLEAN, PICKONE, @@ -472,26 +472,26 @@ namespace Gtk { STRING, FILESAVE, } - [CCode (cprefix = "GTK_PROGRESS_")] + [CCode (cprefix = "GTK_PROGRESS_", cheader_filename = "gtk/gtk.h")] public enum ProgressBarOrientation { LEFT_TO_RIGHT, RIGHT_TO_LEFT, BOTTOM_TO_TOP, TOP_TO_BOTTOM, } - [CCode (cprefix = "GTK_PROGRESS_")] + [CCode (cprefix = "GTK_PROGRESS_", cheader_filename = "gtk/gtk.h")] public enum ProgressBarStyle { CONTINUOUS, DISCRETE, } - [CCode (cprefix = "GTK_RC_")] + [CCode (cprefix = "GTK_RC_", cheader_filename = "gtk/gtk.h")] public enum RcFlags { FG, BG, TEXT, BASE, } - [CCode (cprefix = "GTK_RC_TOKEN_")] + [CCode (cprefix = "GTK_RC_TOKEN_", cheader_filename = "gtk/gtk.h")] public enum RcTokenType { INVALID, INCLUDE, @@ -534,12 +534,12 @@ namespace Gtk { UNBIND, LAST, } - [CCode (cprefix = "GTK_RECENT_CHOOSER_ERROR_")] + [CCode (cprefix = "GTK_RECENT_CHOOSER_ERROR_", cheader_filename = "gtk/gtk.h")] public enum RecentChooserError { NOT_FOUND, INVALID_URI, } - [CCode (cprefix = "GTK_RECENT_CHOOSER_PROP_")] + [CCode (cprefix = "GTK_RECENT_CHOOSER_PROP_", cheader_filename = "gtk/gtk.h")] public enum RecentChooserProp { FIRST, RECENT_MANAGER, @@ -554,7 +554,7 @@ namespace Gtk { FILTER, LAST, } - [CCode (cprefix = "GTK_RECENT_FILTER_")] + [CCode (cprefix = "GTK_RECENT_FILTER_", cheader_filename = "gtk/gtk.h")] public enum RecentFilterFlags { URI, DISPLAY_NAME, @@ -563,7 +563,7 @@ namespace Gtk { GROUP, AGE, } - [CCode (cprefix = "GTK_RECENT_MANAGER_ERROR_")] + [CCode (cprefix = "GTK_RECENT_MANAGER_ERROR_", cheader_filename = "gtk/gtk.h")] public enum RecentManagerError { NOT_FOUND, INVALID_URI, @@ -573,26 +573,26 @@ namespace Gtk { WRITE, UNKNOWN, } - [CCode (cprefix = "GTK_RECENT_SORT_")] + [CCode (cprefix = "GTK_RECENT_SORT_", cheader_filename = "gtk/gtk.h")] public enum RecentSortType { NONE, MRU, LRU, CUSTOM, } - [CCode (cprefix = "GTK_RELIEF_")] + [CCode (cprefix = "GTK_RELIEF_", cheader_filename = "gtk/gtk.h")] public enum ReliefStyle { NORMAL, HALF, NONE, } - [CCode (cprefix = "GTK_RESIZE_")] + [CCode (cprefix = "GTK_RESIZE_", cheader_filename = "gtk/gtk.h")] public enum ResizeMode { PARENT, QUEUE, IMMEDIATE, } - [CCode (cprefix = "GTK_RESPONSE_")] + [CCode (cprefix = "GTK_RESPONSE_", cheader_filename = "gtk/gtk.h")] public enum ResponseType { NONE, REJECT, @@ -606,7 +606,7 @@ namespace Gtk { APPLY, HELP, } - [CCode (cprefix = "GTK_SCROLL_")] + [CCode (cprefix = "GTK_SCROLL_", cheader_filename = "gtk/gtk.h")] public enum ScrollStep { STEPS, PAGES, @@ -615,7 +615,7 @@ namespace Gtk { HORIZONTAL_PAGES, HORIZONTAL_ENDS, } - [CCode (cprefix = "GTK_SCROLL_")] + [CCode (cprefix = "GTK_SCROLL_", cheader_filename = "gtk/gtk.h")] public enum ScrollType { NONE, JUMP, @@ -634,7 +634,7 @@ namespace Gtk { START, END, } - [CCode (cprefix = "GTK_SELECTION_")] + [CCode (cprefix = "GTK_SELECTION_", cheader_filename = "gtk/gtk.h")] public enum SelectionMode { NONE, SINGLE, @@ -642,13 +642,13 @@ namespace Gtk { MULTIPLE, EXTENDED, } - [CCode (cprefix = "GTK_SENSITIVITY_")] + [CCode (cprefix = "GTK_SENSITIVITY_", cheader_filename = "gtk/gtk.h")] public enum SensitivityType { AUTO, ON, OFF, } - [CCode (cprefix = "GTK_SHADOW_")] + [CCode (cprefix = "GTK_SHADOW_", cheader_filename = "gtk/gtk.h")] public enum ShadowType { NONE, IN, @@ -656,14 +656,14 @@ namespace Gtk { ETCHED_IN, ETCHED_OUT, } - [CCode (cprefix = "GTK_SIDE_")] + [CCode (cprefix = "GTK_SIDE_", cheader_filename = "gtk/gtk.h")] public enum SideType { TOP, BOTTOM, LEFT, RIGHT, } - [CCode (cprefix = "GTK_RUN_")] + [CCode (cprefix = "GTK_RUN_", cheader_filename = "gtk/gtk.h")] public enum SignalRunType { FIRST, LAST, @@ -672,24 +672,24 @@ namespace Gtk { ACTION, NO_HOOKS, } - [CCode (cprefix = "GTK_SIZE_GROUP_")] + [CCode (cprefix = "GTK_SIZE_GROUP_", cheader_filename = "gtk/gtk.h")] public enum SizeGroupMode { NONE, HORIZONTAL, VERTICAL, BOTH, } - [CCode (cprefix = "GTK_SORT_")] + [CCode (cprefix = "GTK_SORT_", cheader_filename = "gtk/gtk.h")] public enum SortType { ASCENDING, DESCENDING, } - [CCode (cprefix = "GTK_UPDATE_")] + [CCode (cprefix = "GTK_UPDATE_", cheader_filename = "gtk/gtk.h")] public enum SpinButtonUpdatePolicy { ALWAYS, IF_VALID, } - [CCode (cprefix = "GTK_SPIN_")] + [CCode (cprefix = "GTK_SPIN_", cheader_filename = "gtk/gtk.h")] public enum SpinType { STEP_FORWARD, STEP_BACKWARD, @@ -699,7 +699,7 @@ namespace Gtk { END, USER_DEFINED, } - [CCode (cprefix = "GTK_STATE_")] + [CCode (cprefix = "GTK_STATE_", cheader_filename = "gtk/gtk.h")] public enum StateType { NORMAL, ACTIVE, @@ -707,41 +707,41 @@ namespace Gtk { SELECTED, INSENSITIVE, } - [CCode (cprefix = "GTK_DIRECTION_")] + [CCode (cprefix = "GTK_DIRECTION_", cheader_filename = "gtk/gtk.h")] public enum SubmenuDirection { LEFT, RIGHT, } - [CCode (cprefix = "GTK_")] + [CCode (cprefix = "GTK_", cheader_filename = "gtk/gtk.h")] public enum SubmenuPlacement { TOP_BOTTOM, LEFT_RIGHT, } - [CCode (cprefix = "GTK_TARGET_")] + [CCode (cprefix = "GTK_TARGET_", cheader_filename = "gtk/gtk.h")] public enum TargetFlags { SAME_APP, SAME_WIDGET, OTHER_APP, OTHER_WIDGET, } - [CCode (cprefix = "GTK_TEXT_BUFFER_TARGET_INFO_")] + [CCode (cprefix = "GTK_TEXT_BUFFER_TARGET_INFO_", cheader_filename = "gtk/gtk.h")] public enum TextBufferTargetInfo { BUFFER_CONTENTS, RICH_TEXT, TEXT, } - [CCode (cprefix = "GTK_TEXT_DIR_")] + [CCode (cprefix = "GTK_TEXT_DIR_", cheader_filename = "gtk/gtk.h")] public enum TextDirection { NONE, LTR, RTL, } - [CCode (cprefix = "GTK_TEXT_SEARCH_")] + [CCode (cprefix = "GTK_TEXT_SEARCH_", cheader_filename = "gtk/gtk.h")] public enum TextSearchFlags { VISIBLE_ONLY, TEXT_ONLY, } - [CCode (cprefix = "GTK_TEXT_WINDOW_")] + [CCode (cprefix = "GTK_TEXT_WINDOW_", cheader_filename = "gtk/gtk.h")] public enum TextWindowType { PRIVATE, WIDGET, @@ -751,7 +751,7 @@ namespace Gtk { TOP, BOTTOM, } - [CCode (cprefix = "GTK_TOOLBAR_CHILD_")] + [CCode (cprefix = "GTK_TOOLBAR_CHILD_", cheader_filename = "gtk/gtk.h")] public enum ToolbarChildType { SPACE, BUTTON, @@ -759,44 +759,44 @@ namespace Gtk { RADIOBUTTON, WIDGET, } - [CCode (cprefix = "GTK_TOOLBAR_SPACE_")] + [CCode (cprefix = "GTK_TOOLBAR_SPACE_", cheader_filename = "gtk/gtk.h")] public enum ToolbarSpaceStyle { EMPTY, LINE, } - [CCode (cprefix = "GTK_TOOLBAR_")] + [CCode (cprefix = "GTK_TOOLBAR_", cheader_filename = "gtk/gtk.h")] public enum ToolbarStyle { ICONS, TEXT, BOTH, BOTH_HORIZ, } - [CCode (cprefix = "GTK_TREE_MODEL_")] + [CCode (cprefix = "GTK_TREE_MODEL_", cheader_filename = "gtk/gtk.h")] public enum TreeModelFlags { ITERS_PERSIST, LIST_ONLY, } - [CCode (cprefix = "GTK_TREE_VIEW_COLUMN_")] + [CCode (cprefix = "GTK_TREE_VIEW_COLUMN_", cheader_filename = "gtk/gtk.h")] public enum TreeViewColumnSizing { GROW_ONLY, AUTOSIZE, FIXED, } - [CCode (cprefix = "GTK_TREE_VIEW_DROP_")] + [CCode (cprefix = "GTK_TREE_VIEW_DROP_", cheader_filename = "gtk/gtk.h")] public enum TreeViewDropPosition { BEFORE, AFTER, INTO_OR_BEFORE, INTO_OR_AFTER, } - [CCode (cprefix = "GTK_TREE_VIEW_GRID_LINES_")] + [CCode (cprefix = "GTK_TREE_VIEW_GRID_LINES_", cheader_filename = "gtk/gtk.h")] public enum TreeViewGridLines { NONE, HORIZONTAL, VERTICAL, BOTH, } - [CCode (cprefix = "GTK_UI_MANAGER_")] + [CCode (cprefix = "GTK_UI_MANAGER_", cheader_filename = "gtk/gtk.h")] public enum UIManagerItemType { AUTO, MENUBAR, @@ -809,26 +809,26 @@ namespace Gtk { SEPARATOR, ACCELERATOR, } - [CCode (cprefix = "GTK_UNIT_")] + [CCode (cprefix = "GTK_UNIT_", cheader_filename = "gtk/gtk.h")] public enum Unit { PIXEL, POINTS, INCH, MM, } - [CCode (cprefix = "GTK_UPDATE_")] + [CCode (cprefix = "GTK_UPDATE_", cheader_filename = "gtk/gtk.h")] public enum UpdateType { CONTINUOUS, DISCONTINUOUS, DELAYED, } - [CCode (cprefix = "GTK_VISIBILITY_")] + [CCode (cprefix = "GTK_VISIBILITY_", cheader_filename = "gtk/gtk.h")] public enum Visibility { NONE, PARTIAL, FULL, } - [CCode (cprefix = "GTK_")] + [CCode (cprefix = "GTK_", cheader_filename = "gtk/gtk.h")] public enum WidgetFlags { TOPLEVEL, NO_WINDOW, @@ -850,12 +850,12 @@ namespace Gtk { DOUBLE_BUFFERED, NO_SHOW_ALL, } - [CCode (cprefix = "GTK_WIDGET_HELP_")] + [CCode (cprefix = "GTK_WIDGET_HELP_", cheader_filename = "gtk/gtk.h")] public enum WidgetHelpType { TOOLTIP, WHATS_THIS, } - [CCode (cprefix = "GTK_WIN32_EMBED_")] + [CCode (cprefix = "GTK_WIN32_EMBED_", cheader_filename = "gtk/gtk.h")] public enum Win32EmbedMessageType { WINDOW_ACTIVATE, WINDOW_DEACTIVATE, @@ -873,7 +873,7 @@ namespace Gtk { UNGRAB_KEY, LAST, } - [CCode (cprefix = "GTK_WIN_POS_")] + [CCode (cprefix = "GTK_WIN_POS_", cheader_filename = "gtk/gtk.h")] public enum WindowPosition { NONE, CENTER, @@ -881,12 +881,12 @@ namespace Gtk { CENTER_ALWAYS, CENTER_ON_PARENT, } - [CCode (cprefix = "GTK_WINDOW_")] + [CCode (cprefix = "GTK_WINDOW_", cheader_filename = "gtk/gtk.h")] public enum WindowType { TOPLEVEL, POPUP, } - [CCode (cprefix = "GTK_WRAP_")] + [CCode (cprefix = "GTK_WRAP_", cheader_filename = "gtk/gtk.h")] public enum WrapMode { NONE, CHAR, @@ -1298,7 +1298,7 @@ namespace Gtk { public Calendar (); public void select_day (uint day); public bool select_month (uint month, uint year); - public void set_display_options (Gtk.CalendarDisplayOptions @flags); + public void set_display_options (Gtk.CalendarDisplayOptions flags); public bool unmark_day (uint day); [NoAccessorMethod] public weak int year { get; set; } @@ -1324,13 +1324,13 @@ namespace Gtk { } [CCode (cheader_filename = "gtk/gtk.h")] public class CellRenderer : Gtk.Object { - public virtual bool activate (Gdk.Event event, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState @flags); + public virtual bool activate (Gdk.Event event, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags); public void get_fixed_size (int width, int height); public virtual void get_size (Gtk.Widget widget, Gdk.Rectangle cell_area, int x_offset, int y_offset, int width, int height); public static GLib.Type get_type (); - public virtual void render (Gdk.Window window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState @flags); + public virtual void render (Gdk.Window window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags); public void set_fixed_size (int width, int height); - public virtual weak Gtk.CellEditable start_editing (Gdk.Event event, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState @flags); + public virtual weak Gtk.CellEditable start_editing (Gdk.Event event, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags); public void stop_editing (bool canceled); [NoAccessorMethod] public weak Gtk.CellRendererMode mode { get; set; } @@ -1570,11 +1570,11 @@ namespace Gtk { public static weak Gtk.Clipboard get_for_display (Gdk.Display display, Gdk.Atom selection); public weak GLib.Object get_owner (); public static GLib.Type get_type (); - public void request_contents (Gdk.Atom target, Gtk.ClipboardReceivedFunc @callback, pointer user_data); - public void request_image (Gtk.ClipboardImageReceivedFunc @callback, pointer user_data); - public void request_rich_text (Gtk.TextBuffer buffer, Gtk.ClipboardRichTextReceivedFunc @callback, pointer user_data); - public void request_targets (Gtk.ClipboardTargetsReceivedFunc @callback, pointer user_data); - public void request_text (Gtk.ClipboardTextReceivedFunc @callback, pointer user_data); + public void request_contents (Gdk.Atom target, Gtk.ClipboardReceivedFunc callback, pointer user_data); + public void request_image (Gtk.ClipboardImageReceivedFunc callback, pointer user_data); + public void request_rich_text (Gtk.TextBuffer buffer, Gtk.ClipboardRichTextReceivedFunc callback, pointer user_data); + public void request_targets (Gtk.ClipboardTargetsReceivedFunc callback, pointer user_data); + public void request_text (Gtk.ClipboardTextReceivedFunc callback, pointer user_data); [NoArrayLength] public void set_can_store (Gtk.TargetEntry[] targets, int n_targets); public void set_image (Gdk.Pixbuf pixbuf); @@ -1735,8 +1735,8 @@ namespace Gtk { public static weak GLib.ParamSpec class_find_child_property (pointer cclass, string property_name); public static void class_install_child_property (pointer cclass, uint property_id, GLib.ParamSpec pspec); public static weak GLib.ParamSpec class_list_child_properties (pointer cclass, uint n_properties); - public virtual void forall (Gtk.Callback @callback, pointer callback_data); - public void @foreach (Gtk.Callback @callback, pointer callback_data); + public virtual void forall (Gtk.Callback callback, pointer callback_data); + public void @foreach (Gtk.Callback callback, pointer callback_data); public uint get_border_width (); public weak GLib.List get_children (); public bool get_focus_chain (GLib.List focusable_widgets); @@ -1801,7 +1801,7 @@ namespace Gtk { public int get_response_for_widget (Gtk.Widget widget); public static GLib.Type get_type (); public Dialog (); - public Dialog.with_buttons (string title, Gtk.Window parent, Gtk.DialogFlags @flags, ...); + public Dialog.with_buttons (string title, Gtk.Window parent, Gtk.DialogFlags flags, ...); public int run (); public void set_alternative_button_order (...); public void set_alternative_button_order_from_array (int n_params, int new_order); @@ -2201,7 +2201,7 @@ namespace Gtk { public static void add_builtin_icon (string icon_name, int size, Gdk.Pixbuf pixbuf); public void append_search_path (string path); [NoArrayLength] - public weak Gtk.IconInfo choose_icon (string[] icon_names, int size, Gtk.IconLookupFlags @flags); + public weak Gtk.IconInfo choose_icon (string[] icon_names, int size, Gtk.IconLookupFlags flags); public static GLib.Quark error_quark (); public static weak Gtk.IconTheme get_default (); public weak string get_example_icon_name (); @@ -2213,8 +2213,8 @@ namespace Gtk { public bool has_icon (string icon_name); public weak GLib.List list_contexts (); public weak GLib.List list_icons (string context); - public weak Gdk.Pixbuf load_icon (string icon_name, int size, Gtk.IconLookupFlags @flags, GLib.Error error); - public weak Gtk.IconInfo lookup_icon (string icon_name, int size, Gtk.IconLookupFlags @flags); + public weak Gdk.Pixbuf load_icon (string icon_name, int size, Gtk.IconLookupFlags flags, GLib.Error error); + public weak Gtk.IconInfo lookup_icon (string icon_name, int size, Gtk.IconLookupFlags flags); public IconTheme (); public void prepend_search_path (string path); public bool rescan_if_needed (); @@ -2655,8 +2655,8 @@ namespace Gtk { public void format_secondary_markup (string message_format); public void format_secondary_text (string message_format); public static GLib.Type get_type (); - public MessageDialog (Gtk.Window parent, Gtk.DialogFlags @flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string message_format); - public MessageDialog.with_markup (Gtk.Window parent, Gtk.DialogFlags @flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string message_format); + public MessageDialog (Gtk.Window parent, Gtk.DialogFlags flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string message_format); + public MessageDialog.with_markup (Gtk.Window parent, Gtk.DialogFlags flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string message_format); public void set_image (Gtk.Widget image); public void set_markup (string str); [NoAccessorMethod] @@ -2942,7 +2942,7 @@ namespace Gtk { public weak GLib.List get_printer_list (); public static GLib.Type get_type (); public static weak GLib.List load_modules (); - public virtual void print_stream (Gtk.PrintJob job, GLib.IOChannel data_io, Gtk.PrintJobCompleteFunc @callback, pointer user_data, GLib.DestroyNotify dnotify); + public virtual void print_stream (Gtk.PrintJob job, GLib.IOChannel data_io, Gtk.PrintJobCompleteFunc callback, pointer user_data, GLib.DestroyNotify dnotify); public bool printer_list_is_done (); public void remove_printer (Gtk.Printer printer); public void set_list_done (); @@ -2976,7 +2976,7 @@ namespace Gtk { public bool get_track_print_status (); public static GLib.Type get_type (); public PrintJob (string title, Gtk.Printer printer, Gtk.PrintSettings settings, Gtk.PageSetup page_setup); - public void send (Gtk.PrintJobCompleteFunc @callback, pointer user_data, GLib.DestroyNotify dnotify); + public void send (Gtk.PrintJobCompleteFunc callback, pointer user_data, GLib.DestroyNotify dnotify); public bool set_source_file (string filename, GLib.Error error); public void set_track_print_status (bool track_status); [NoAccessorMethod] @@ -5130,39 +5130,52 @@ namespace Gtk { [HasEmitter] public signal void sort_column_changed (); } + [CCode (cheader_filename = "gtk/gtk.h")] + public struct Allocation { + public int x; + public int y; + public int width; + public int height; + } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct CacheInfo { public weak string cache; public ulong cache_size; public uint n_directories; - public int @flags; + public int flags; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct AccelGroupEntry { public weak Gtk.AccelKey key; public GLib.Closure closure; public GLib.Quark accel_path_quark; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct AccelKey { public uint accel_key; public Gdk.ModifierType accel_mods; public uint accel_flags; } + [CCode (cheader_filename = "gtk/gtk.h")] public struct ActionEntry { public weak string name; public weak string stock_id; public weak string label; public weak string accelerator; public weak string tooltip; - public GLib.Callback @callback; + public GLib.Callback callback; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct BindingArg { public GLib.Type arg_type; public long long_data; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct BindingEntry { public uint keyval; public Gdk.ModifierType modifiers; @@ -5178,6 +5191,7 @@ namespace Gtk { public static void skip (Gtk.BindingSet binding_set, uint keyval, Gdk.ModifierType modifiers); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct BindingSet { public weak string set_name; public int priority; @@ -5194,12 +5208,14 @@ namespace Gtk { public BindingSet (string set_name); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct BindingSignal { public weak Gtk.BindingSignal next; public weak string signal_name; public uint n_args; public weak Gtk.BindingArg args; } + [CCode (cheader_filename = "gtk/gtk.h")] public struct Border { public int left; public int right; @@ -5212,6 +5228,7 @@ namespace Gtk { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct BoxChild { public weak Gtk.Widget widget; public ushort padding; @@ -5221,6 +5238,7 @@ namespace Gtk { public uint is_secondary; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct FileFilterInfo { public Gtk.FileFilterFlags contains; public weak string filename; @@ -5229,12 +5247,14 @@ namespace Gtk { public weak string mime_type; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct FixedChild { public weak Gtk.Widget widget; public int x; public int y; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct IMContextInfo { public weak string context_id; public weak string context_name; @@ -5243,6 +5263,7 @@ namespace Gtk { public weak string default_locales; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct IconInfo { public weak Gtk.IconInfo copy (); public void free (); @@ -5258,6 +5279,7 @@ namespace Gtk { public void set_raw_coordinates (bool raw_coordinates); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct IconSet { public void add_source (Gtk.IconSource source); public weak Gtk.IconSet copy (); @@ -5271,6 +5293,7 @@ namespace Gtk { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct IconSource { public weak Gtk.IconSource copy (); public void free (); @@ -5296,64 +5319,78 @@ namespace Gtk { public void set_state_wildcarded (bool setting); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ImageAnimationData { public weak Gdk.PixbufAnimation anim; public weak Gdk.PixbufAnimationIter iter; public uint frame_timeout; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ImageIconNameData { public weak string icon_name; public weak Gdk.Pixbuf pixbuf; public uint theme_change_id; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ImageIconSetData { public weak Gtk.IconSet icon_set; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ImageImageData { public weak Gdk.Image image; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ImagePixbufData { public weak Gdk.Pixbuf pixbuf; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ImagePixmapData { public weak Gdk.Pixmap pixmap; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ImageStockData { public weak string stock_id; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct KeyHash { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct LabelSelectionInfo { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct MenuEntry { public weak string path; public weak string accelerator; - public Gtk.MenuCallback @callback; + public Gtk.MenuCallback callback; public pointer callback_data; public weak Gtk.Widget widget; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct MnemonicHash { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct NotebookPage { public static int num (Gtk.Notebook notebook, Gtk.Widget child); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct PageRange { public int start; public int end; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct PaperSize { public weak Gtk.PaperSize copy (); public void free (); @@ -5379,16 +5416,18 @@ namespace Gtk { public void to_key_file (GLib.KeyFile key_file, string group_name); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct PrintWin32Devnames { public weak string driver; public weak string device; public weak string output; - public int @flags; + public int flags; public void free (); public static pointer from_printer_name (string printer); public static weak Gtk.PrintWin32Devnames from_win32 (pointer global); public pointer to_win32 (); } + [CCode (cheader_filename = "gtk/gtk.h")] public struct RadioActionEntry { public weak string name; public weak string stock_id; @@ -5398,15 +5437,19 @@ namespace Gtk { public int value; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RangeLayout { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RangeStepTimer { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RcContext { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RcProperty { public GLib.Quark type_name; public GLib.Quark property_name; @@ -5419,6 +5462,7 @@ namespace Gtk { public static bool parse_requisition (GLib.ParamSpec pspec, GLib.String gstring, GLib.Value property_value); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RecentData { public weak string display_name; public weak string description; @@ -5429,6 +5473,7 @@ namespace Gtk { public bool is_private; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RecentFilterInfo { public Gtk.RecentFilterFlags contains; public weak string uri; @@ -5439,6 +5484,7 @@ namespace Gtk { public int age; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RecentInfo { public bool exists (); public ulong get_added (); @@ -5465,6 +5511,7 @@ namespace Gtk { public weak Gtk.RecentInfo @ref (); public void unref (); } + [CCode (cheader_filename = "gtk/gtk.h")] public struct Requisition { public int width; public int height; @@ -5475,6 +5522,7 @@ namespace Gtk { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct RulerMetric { public weak string metric_name; public weak string abbrev; @@ -5483,6 +5531,7 @@ namespace Gtk { public int subdivide; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct SelectionData { public Gdk.Atom selection; public Gdk.Atom target; @@ -5510,14 +5559,17 @@ namespace Gtk { public bool targets_include_uri (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct SettingsPropertyValue { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct SettingsValue { public weak string origin; public weak GLib.Value value; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct StockItem { public weak string stock_id; public weak string label; @@ -5528,6 +5580,7 @@ namespace Gtk { public void free (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TableChild { public weak Gtk.Widget widget; public ushort left_attach; @@ -5544,6 +5597,7 @@ namespace Gtk { public uint yfill; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TableRowCol { public ushort requisition; public ushort allocation; @@ -5555,16 +5609,18 @@ namespace Gtk { public uint empty; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TargetEntry { public weak string target; - public uint @flags; + public uint flags; public uint info; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TargetList { public weak GLib.List list; public uint ref_count; - public void add (Gdk.Atom target, uint @flags, uint info); + public void add (Gdk.Atom target, uint flags, uint info); public void add_image_targets (uint info, bool writable); public void add_rich_text_targets (uint info, bool deserializable, Gtk.TextBuffer buffer); public void add_table (Gtk.TargetEntry targets, uint ntargets); @@ -5578,12 +5634,14 @@ namespace Gtk { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TargetPair { public Gdk.Atom target; - public uint @flags; + public uint flags; public uint info; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TextAppearance { public Gdk.Color bg_color; public Gdk.Color fg_color; @@ -5597,6 +5655,7 @@ namespace Gtk { public uint is_text; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TextAttributes { public weak Gtk.TextAppearance appearance; public Gtk.Justification justification; @@ -5624,8 +5683,10 @@ namespace Gtk { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TextBTree { } + [CCode (cheader_filename = "gtk/gtk.h")] public struct TextIter { [InstanceByReference] public bool backward_char (); @@ -5642,7 +5703,7 @@ namespace Gtk { [InstanceByReference] public bool backward_lines (int count); [InstanceByReference] - public bool backward_search (string str, Gtk.TextSearchFlags @flags, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out Gtk.TextIter limit); + public bool backward_search (string str, Gtk.TextSearchFlags flags, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out Gtk.TextIter limit); [InstanceByReference] public bool backward_sentence_start (); [InstanceByReference] @@ -5700,7 +5761,7 @@ namespace Gtk { [InstanceByReference] public bool forward_lines (int count); [InstanceByReference] - public bool forward_search (string str, Gtk.TextSearchFlags @flags, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out Gtk.TextIter limit); + public bool forward_search (string str, Gtk.TextSearchFlags flags, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out Gtk.TextIter limit); [InstanceByReference] public bool forward_sentence_end (); [InstanceByReference] @@ -5810,27 +5871,33 @@ namespace Gtk { public bool toggles_tag (Gtk.TextTag tag); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TextLogAttrCache { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TextPendingScroll { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TextWindow { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct ThemeEngine { } + [CCode (cheader_filename = "gtk/gtk.h")] public struct ToggleActionEntry { public weak string name; public weak string stock_id; public weak string label; public weak string accelerator; public weak string tooltip; - public GLib.Callback @callback; + public GLib.Callback callback; public bool is_active; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Tooltip { public static GLib.Type get_type (); public void set_custom (Gtk.Widget custom_widget); @@ -5841,6 +5908,7 @@ namespace Gtk { public static void trigger_tooltip_query (Gdk.Display display); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TooltipsData { public weak Gtk.Tooltips tooltips; public weak Gtk.Widget widget; @@ -5848,6 +5916,7 @@ namespace Gtk { public weak string tip_private; public static weak Gtk.TooltipsData get (Gtk.Widget widget); } + [CCode (cheader_filename = "gtk/gtk.h")] public struct TreeIter { public int stamp; public pointer user_data; @@ -5860,6 +5929,7 @@ namespace Gtk { public static GLib.Type get_type (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TreePath { public void append_index (int index_); public int compare (Gtk.TreePath b); @@ -5883,6 +5953,7 @@ namespace Gtk { public bool up (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct TreeRowReference { public weak Gtk.TreeRowReference copy (); public static void deleted (GLib.Object proxy, Gtk.TreePath path); @@ -5897,10 +5968,12 @@ namespace Gtk { public bool valid (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct VolumeButtonClass { public pointer parent_class; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct WidgetAuxInfo { public int x; public int y; @@ -5910,20 +5983,24 @@ namespace Gtk { public uint y_set; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct WidgetShapeInfo { public short offset_x; public short offset_y; public weak Gdk.Bitmap shape_mask; } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct WindowGeometryInfo { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Accel { public static bool groups_activate (GLib.Object object, uint accel_key, Gdk.ModifierType accel_mods); public static weak GLib.SList groups_from_object (GLib.Object object); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Accelerator { public static uint get_default_mod_mask (); public static weak string get_label (uint accelerator_key, Gdk.ModifierType accelerator_mods); @@ -5933,11 +6010,13 @@ namespace Gtk { public static bool valid (uint keyval, Gdk.ModifierType modifiers); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Bindings { public static bool activate (Gtk.Object object, uint keyval, Gdk.ModifierType modifiers); public static bool activate_event (Gtk.Object object, Gdk.EventKey event); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Ctree { public static GLib.Type expander_style_get_type (); public static GLib.Type expansion_type_get_type (); @@ -5945,6 +6024,7 @@ namespace Gtk { public static GLib.Type pos_get_type (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Drag { public static weak Gdk.DragContext begin (Gtk.Widget widget, Gtk.TargetList targets, Gdk.DragAction actions, int button, Gdk.Event event); public static bool check_threshold (Gtk.Widget widget, int start_x, int start_y, int current_x, int current_y); @@ -5955,7 +6035,7 @@ namespace Gtk { public static weak Gtk.TargetList dest_get_target_list (Gtk.Widget widget); public static bool dest_get_track_motion (Gtk.Widget widget); [NoArrayLength] - public static void dest_set (Gtk.Widget widget, Gtk.DestDefaults @flags, Gtk.TargetEntry[] targets, int n_targets, Gdk.DragAction actions); + public static void dest_set (Gtk.Widget widget, Gtk.DestDefaults flags, Gtk.TargetEntry[] targets, int n_targets, Gdk.DragAction actions); public static void dest_set_proxy (Gtk.Widget widget, Gdk.Window proxy_window, Gdk.DragProtocol protocol, bool use_coordinates); public static void dest_set_target_list (Gtk.Widget widget, Gtk.TargetList target_list); public static void dest_set_track_motion (Gtk.Widget widget, bool track_motion); @@ -5985,21 +6065,25 @@ namespace Gtk { public static void unhighlight (Gtk.Widget widget); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Draw { public static void insertion_cursor (Gtk.Widget widget, Gdk.Drawable drawable, Gdk.Rectangle area, Gdk.Rectangle location, bool is_primary, Gtk.TextDirection direction, bool draw_arrow); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Gc { public static weak Gdk.GC get (int depth, Gdk.Colormap colormap, Gdk.GCValues values, Gdk.GCValuesMask values_mask); public static void release (Gdk.GC gc); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Grab { public static void add (Gtk.Widget widget); public static weak Gtk.Widget get_current (); public static void remove (Gtk.Widget widget); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Icon { public static Gtk.IconSize size_from_name (string name); public static weak string size_get_name (Gtk.IconSize size); @@ -6009,9 +6093,11 @@ namespace Gtk { public static void size_register_alias (string alias, Gtk.IconSize target); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Idle { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Init { public static void abi_check (int argc, string argv, int num_checks, ulong sizeof_GtkWindow, ulong sizeof_GtkBox); public static void add (Gtk.Function function, pointer data); @@ -6020,14 +6106,17 @@ namespace Gtk { public static bool with_args (int argc, string argv, string parameter_string, GLib.OptionEntry entries, string translation_domain, GLib.Error error); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Input { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Key { public static uint snooper_install (Gtk.KeySnoopFunc snooper, pointer func_data); public static void snooper_remove (uint snooper_handler_id); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Main { public static void do_event (Gdk.Event event); public static bool iteration (); @@ -6036,12 +6125,14 @@ namespace Gtk { public static void quit (); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Print { public static GLib.Quark error_quark (); public static weak Gtk.PageSetup run_page_setup_dialog (Gtk.Window parent, Gtk.PageSetup page_setup, Gtk.PrintSettings settings); public static void run_page_setup_dialog_async (Gtk.Window parent, Gtk.PageSetup page_setup, Gtk.PrintSettings settings, Gtk.PageSetupDoneFunc done_cb, pointer data); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Quit { public static uint add (uint main_level, Gtk.Function function, pointer data); public static void add_destroy (uint main_level, Gtk.Object object); @@ -6049,6 +6140,7 @@ namespace Gtk { public static void remove_by_data (pointer data); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Rc { public static void add_default_file (string filename); public static weak string find_module_in_path (string module_file); @@ -6073,6 +6165,7 @@ namespace Gtk { public static void set_default_files (string filenames); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Selection { public static void add_target (Gtk.Widget widget, Gdk.Atom selection, Gdk.Atom target, uint info); public static void add_targets (Gtk.Widget widget, Gdk.Atom selection, Gtk.TargetEntry targets, uint ntargets); @@ -6083,9 +6176,11 @@ namespace Gtk { public static void remove_all (Gtk.Widget widget); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Signal { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Stock { [NoArrayLength] public static void add (Gtk.StockItem[] items, uint n_items); @@ -6096,12 +6191,14 @@ namespace Gtk { public static void set_translate_func (string domain, Gtk.TranslateFunc func, pointer data, Gtk.DestroyNotify notify); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Target { [NoArrayLength] public static void table_free (Gtk.TargetEntry[] targets, int n_targets); public static weak Gtk.TargetEntry table_new_from_list (Gtk.TargetList list, int n_targets); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Targets { [NoArrayLength] public static bool include_image (Gdk.Atom[] targets, int n_targets, bool writable); @@ -6113,14 +6210,17 @@ namespace Gtk { public static bool include_uri (Gdk.Atom[] targets, int n_targets); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Timeout { } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Tree { public static bool get_row_drag_data (Gtk.SelectionData selection_data, Gtk.TreeModel tree_model, Gtk.TreePath path); public static bool set_row_drag_data (Gtk.SelectionData selection_data, Gtk.TreeModel tree_model, Gtk.TreePath path); } [ReferenceType] + [CCode (cheader_filename = "gtk/gtk.h")] public struct Type { public pointer @class (); } @@ -6129,7 +6229,7 @@ namespace Gtk { public static delegate bool AccelGroupFindFunc (Gtk.AccelKey key, GLib.Closure closure, pointer data); public static delegate void AccelMapForeach (pointer data, string accel_path, uint accel_key, Gdk.ModifierType accel_mods, bool changed); public static delegate int AssistantPageFunc (int current_page, pointer data); - public static delegate void BuilderConnectFunc (Gtk.Builder builder, GLib.Object object, string signal_name, string handler_name, GLib.Object connect_object, GLib.ConnectFlags @flags, pointer user_data); + public static delegate void BuilderConnectFunc (Gtk.Builder builder, GLib.Object object, string signal_name, string handler_name, GLib.Object connect_object, GLib.ConnectFlags flags, pointer user_data); public static delegate void Callback (Gtk.Widget widget, pointer data); public static delegate void CellLayoutDataFunc (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, out Gtk.TreeIter iter, pointer data); public static delegate void ClipboardClearFunc (Gtk.Clipboard clipboard, pointer user_data_or_owner); @@ -6285,6 +6385,9 @@ namespace Gtk { public const string STOCK_ZOOM_FIT; public const string STOCK_ZOOM_IN; public const string STOCK_ZOOM_OUT; + public static void init (out string[] args); + public static void main (); + public static void main_quit (); public static bool alternative_dialog_button_order (Gdk.Screen screen); public static GLib.Type cell_type_get_type (); public static weak string check_version (uint required_major, uint required_minor, uint required_micro); @@ -6327,15 +6430,3 @@ namespace Gtk { public static void show_about_dialog (Gtk.Window parent, ...); public static void text_layout_draw (pointer layout, Gtk.Widget widget, Gdk.Drawable drawable, Gdk.GC cursor_gc, int x_offset, int y_offset, int x, int y, int width, int height, GLib.List widgets); } -[CCode (cprefix = "Gtk", lower_case_cprefix = "gtk_", cheader_filename = "gtk/gtk.h")] -namespace Gtk { - public struct Allocation { - public int x; - public int y; - public int width; - public int height; - } - public static void init (out string[] args); - public static void main (); - public static void main_quit (); -} 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 2af6f2dcd..75a2843ad 100644 --- a/vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala +++ b/vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala @@ -20,7 +20,6 @@ * Jürg Billeter <j@bitron.ch> */ -[CCode (cheader_filename = "gst/gst.h")] namespace Gst { public void init (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 8f327324a..62059cf6e 100644 --- a/vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala +++ b/vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala @@ -20,7 +20,6 @@ * Jürg Billeter <j@bitron.ch> */ -[CCode (cheader_filename = "gtk/gtk.h")] namespace Gtk { public void init (out string[] args); public void main (); diff --git a/vapi/pango.vala b/vapi/pango.vala index 3835fbf5e..2d012f4af 100644 --- a/vapi/pango.vala +++ b/vapi/pango.vala @@ -1,12 +1,12 @@ -[CCode (cprefix = "Pango", lower_case_cprefix = "pango_", cheader_filename = "pango/pango.h")] +[CCode (cprefix = "Pango", lower_case_cprefix = "pango_")] namespace Pango { - [CCode (cprefix = "PANGO_ALIGN_")] + [CCode (cprefix = "PANGO_ALIGN_", cheader_filename = "pango/pango.h")] public enum Alignment { LEFT, CENTER, RIGHT, } - [CCode (cprefix = "PANGO_ATTR_")] + [CCode (cprefix = "PANGO_ATTR_", cheader_filename = "pango/pango.h")] public enum AttrType { INVALID, LANGUAGE, @@ -32,14 +32,14 @@ namespace Pango { GRAVITY, GRAVITY_HINT, } - [CCode (cprefix = "PANGO_COVERAGE_")] + [CCode (cprefix = "PANGO_COVERAGE_", cheader_filename = "pango/pango.h")] public enum CoverageLevel { NONE, FALLBACK, APPROXIMATE, EXACT, } - [CCode (cprefix = "PANGO_DIRECTION_")] + [CCode (cprefix = "PANGO_DIRECTION_", cheader_filename = "pango/pango.h")] public enum Direction { LTR, RTL, @@ -49,14 +49,14 @@ namespace Pango { WEAK_RTL, NEUTRAL, } - [CCode (cprefix = "PANGO_ELLIPSIZE_")] + [CCode (cprefix = "PANGO_ELLIPSIZE_", cheader_filename = "pango/pango.h")] public enum EllipsizeMode { NONE, START, MIDDLE, END, } - [CCode (cprefix = "PANGO_FONT_MASK_")] + [CCode (cprefix = "PANGO_FONT_MASK_", cheader_filename = "pango/pango.h")] public enum FontMask { FAMILY, STYLE, @@ -66,7 +66,7 @@ namespace Pango { SIZE, GRAVITY, } - [CCode (cprefix = "PANGO_GRAVITY_")] + [CCode (cprefix = "PANGO_GRAVITY_", cheader_filename = "pango/pango.h")] public enum Gravity { SOUTH, EAST, @@ -74,20 +74,20 @@ namespace Pango { WEST, AUTO, } - [CCode (cprefix = "PANGO_GRAVITY_HINT_")] + [CCode (cprefix = "PANGO_GRAVITY_HINT_", cheader_filename = "pango/pango.h")] public enum GravityHint { NATURAL, STRONG, LINE, } - [CCode (cprefix = "PANGO_RENDER_PART_")] + [CCode (cprefix = "PANGO_RENDER_PART_", cheader_filename = "pango/pango.h")] public enum RenderPart { FOREGROUND, BACKGROUND, UNDERLINE, STRIKETHROUGH, } - [CCode (cprefix = "PANGO_SCRIPT_")] + [CCode (cprefix = "PANGO_SCRIPT_", cheader_filename = "pango/pango.h")] public enum Script { INVALID_CODE, COMMON, @@ -158,7 +158,7 @@ namespace Pango { PHAGS_PA, NKO, } - [CCode (cprefix = "PANGO_STRETCH_")] + [CCode (cprefix = "PANGO_STRETCH_", cheader_filename = "pango/pango.h")] public enum Stretch { ULTRA_CONDENSED, EXTRA_CONDENSED, @@ -170,17 +170,17 @@ namespace Pango { EXTRA_EXPANDED, ULTRA_EXPANDED, } - [CCode (cprefix = "PANGO_STYLE_")] + [CCode (cprefix = "PANGO_STYLE_", cheader_filename = "pango/pango.h")] public enum Style { NORMAL, OBLIQUE, ITALIC, } - [CCode (cprefix = "PANGO_TAB_")] + [CCode (cprefix = "PANGO_TAB_", cheader_filename = "pango/pango.h")] public enum TabAlign { LEFT, } - [CCode (cprefix = "PANGO_UNDERLINE_")] + [CCode (cprefix = "PANGO_UNDERLINE_", cheader_filename = "pango/pango.h")] public enum Underline { NONE, SINGLE, @@ -188,12 +188,12 @@ namespace Pango { LOW, ERROR, } - [CCode (cprefix = "PANGO_VARIANT_")] + [CCode (cprefix = "PANGO_VARIANT_", cheader_filename = "pango/pango.h")] public enum Variant { NORMAL, SMALL_CAPS, } - [CCode (cprefix = "PANGO_WEIGHT_")] + [CCode (cprefix = "PANGO_WEIGHT_", cheader_filename = "pango/pango.h")] public enum Weight { ULTRALIGHT, LIGHT, @@ -203,7 +203,7 @@ namespace Pango { ULTRABOLD, HEAVY, } - [CCode (cprefix = "PANGO_WRAP_")] + [CCode (cprefix = "PANGO_WRAP_", cheader_filename = "pango/pango.h")] public enum WrapMode { WORD, CHAR, @@ -364,43 +364,50 @@ namespace Pango { public void set_matrix (out Pango.Matrix matrix); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Analysis { public weak Pango.EngineShape shape_engine; public weak Pango.EngineLang lang_engine; public weak Pango.Font font; public uchar level; public uchar gravity; - public uchar @flags; + public uchar flags; public uchar script; public weak Pango.Language language; public weak GLib.SList extra_attrs; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrClass { public Pango.AttrType type; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrColor { public weak Pango.Attribute attr; public Pango.Color color; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrFloat { public weak Pango.Attribute attr; public double value; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrFontDesc { public weak Pango.Attribute attr; public weak Pango.FontDescription desc; public AttrFontDesc (Pango.FontDescription desc); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrInt { public weak Pango.Attribute attr; public int value; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrIterator { public weak Pango.AttrIterator copy (); public void destroy (); @@ -411,12 +418,14 @@ namespace Pango { public void range (int start, int end); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrLanguage { public weak Pango.Attribute attr; public weak Pango.Language value; public AttrLanguage (Pango.Language language); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrList { public void change (Pango.Attribute attr); public weak Pango.AttrList copy (); @@ -431,6 +440,7 @@ namespace Pango { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrShape { public weak Pango.Attribute attr; public Pango.Rectangle ink_rect; @@ -442,6 +452,7 @@ namespace Pango { public AttrShape.with_data (out Pango.Rectangle ink_rect, out Pango.Rectangle logical_rect, pointer data, Pango.AttrDataCopyFunc copy_func, GLib.DestroyNotify destroy_func); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrSize { public weak Pango.Attribute attr; public int size; @@ -449,11 +460,13 @@ namespace Pango { public AttrSize (int size); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct AttrString { public weak Pango.Attribute attr; public weak string value; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Attribute { public pointer klass; public uint start_index; @@ -462,6 +475,7 @@ namespace Pango { public void destroy (); public bool equal (Pango.Attribute attr2); } + [CCode (cheader_filename = "pango/pango.h")] public struct Color { public ushort red; public ushort green; @@ -477,6 +491,7 @@ namespace Pango { public weak string to_string (); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Coverage { public weak Pango.Coverage copy (); [NoArrayLength] @@ -491,12 +506,15 @@ namespace Pango { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct EngineLang { } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct EngineShape { } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct FontDescription { public bool better_match (Pango.FontDescription old_match, Pango.FontDescription new_match); public weak Pango.FontDescription copy (); @@ -532,6 +550,7 @@ namespace Pango { public void unset_fields (Pango.FontMask to_unset); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct FontMetrics { public int get_approximate_char_width (); public int get_approximate_digit_width (); @@ -546,18 +565,21 @@ namespace Pango { public void unref (); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct GlyphGeometry { public int width; public int x_offset; public int y_offset; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct GlyphInfo { public uint glyph; public weak Pango.GlyphGeometry geometry; public weak Pango.GlyphVisAttr attr; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct GlyphItem { public weak Pango.Item item; public weak Pango.GlyphString glyphs; @@ -567,6 +589,7 @@ namespace Pango { public weak Pango.GlyphItem split (string text, int split_index); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct GlyphString { public int num_glyphs; public weak Pango.GlyphInfo glyphs; @@ -584,10 +607,12 @@ namespace Pango { public void x_to_index (string text, int length, Pango.Analysis analysis, int x_pos, int index_, int trailing); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct GlyphVisAttr { public uint is_cluster_start; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Item { public int offset; public int length; @@ -600,6 +625,7 @@ namespace Pango { public weak Pango.Item split (int split_index, int split_offset); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Language { public static weak Pango.Language from_string (string language); public static weak Pango.Language get_default (); @@ -609,6 +635,7 @@ namespace Pango { public bool matches (string range_list); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct LayoutIter { public bool at_last_line (); public void free (); @@ -631,6 +658,7 @@ namespace Pango { public bool next_run (); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct LayoutLine { public weak Pango.Layout layout; public int start_index; @@ -649,11 +677,13 @@ namespace Pango { public bool x_to_index (int x_pos, int index_, int trailing); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct LayoutRun { public weak Pango.Item item; public weak Pango.GlyphString glyphs; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct LogAttr { public uint is_line_break; public uint is_mandatory_break; @@ -668,6 +698,7 @@ namespace Pango { public uint backspace_deletes_character; public uint is_expandable_space; } + [CCode (cheader_filename = "pango/pango.h")] public struct Matrix { public double xx; public double xy; @@ -699,6 +730,7 @@ namespace Pango { [InstanceByReference] public void translate (double tx, double ty); } + [CCode (cheader_filename = "pango/pango.h")] public struct Rectangle { public int x; public int y; @@ -706,6 +738,7 @@ namespace Pango { public int height; } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct ScriptIter { public void free (); public void get_range (string start, string end, Pango.Script script); @@ -713,6 +746,7 @@ namespace Pango { public bool next (); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct TabArray { public weak Pango.TabArray copy (); public void free (); @@ -727,6 +761,7 @@ namespace Pango { public void set_tab (int tab_index, Pango.TabAlign alignment, int location); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Win32FontCache { public void free (); public pointer load (pointer logfont); @@ -735,6 +770,7 @@ namespace Pango { public void unload (pointer hfont); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Attr { public static weak Pango.Attribute background_new (ushort red, ushort green, ushort blue); public static weak Pango.Attribute fallback_new (bool enable_fallback); @@ -756,6 +792,7 @@ namespace Pango { public static weak Pango.Attribute weight_new (Pango.Weight weight); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Cairo { public static pointer context_get_font_options (Pango.Context context); public static double context_get_resolution (Pango.Context context); @@ -777,11 +814,13 @@ namespace Pango { public static void update_layout (Cairo.Context cr, Pango.Layout layout); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Units { public static int from_double (double d); public static double to_double (int i); } [ReferenceType] + [CCode (cheader_filename = "pango/pango.h")] public struct Version { public static weak string check (int required_major, int required_minor, int required_micro); public static weak string string (); diff --git a/vapi/vte.vala b/vapi/vte.vala index bd0006fda..c4604eb6a 100644 --- a/vapi/vte.vala +++ b/vapi/vte.vala @@ -1,12 +1,12 @@ -[CCode (cprefix = "Vte", lower_case_cprefix = "vte_", cheader_filename = "vte/vte.h")] +[CCode (cprefix = "Vte", lower_case_cprefix = "vte_")] namespace Vte { - [CCode (cprefix = "VTE_ANTI_ALIAS_")] + [CCode (cprefix = "VTE_ANTI_ALIAS_", cheader_filename = "vte/vte.h")] public enum TerminalAntiAlias { USE_DEFAULT, FORCE_ENABLE, FORCE_DISABLE, } - [CCode (cprefix = "VTE_ERASE_")] + [CCode (cprefix = "VTE_ERASE_", cheader_filename = "vte/vte.h")] public enum TerminalEraseBinding { AUTO, ASCII_BACKSPACE, @@ -150,6 +150,7 @@ namespace Vte { public TerminalAccessibleFactory (); } [ReferenceType] + [CCode (cheader_filename = "vte/vte.h")] public struct CharAttributes { public long row; public long column; diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index ee9f362d5..536f225d5 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -29,6 +29,8 @@ using GLib; public class Vala.GIdlParser : CodeVisitor { private CodeContext context; + private SourceFile current_source_file; + private SourceReference current_source_reference; private DataType current_data_type; @@ -54,7 +56,9 @@ public class Vala.GIdlParser : CodeVisitor { private void parse_file (SourceFile! source_file) { string metadata_filename = "%s.metadata".printf (source_file.filename.ndup (source_file.filename.size () - ".gidl".size ())); - + + current_source_file = source_file; + codenode_attributes_map = new HashTable.full (str_hash, str_equal, g_free, g_free); if (FileUtils.test (metadata_filename, FileTest.EXISTS)) { @@ -83,7 +87,9 @@ public class Vala.GIdlParser : CodeVisitor { foreach (IdlModule module in modules) { var ns = parse_module (module); - context.add_namespace (ns); + if (ns != null) { + context.root.add_namespace (ns); + } } } catch (MarkupError e) { stdout.printf ("error parsing GIDL file: %s\n", e.message); @@ -109,7 +115,14 @@ public class Vala.GIdlParser : CodeVisitor { } private Namespace parse_module (IdlModule! module) { - var ns = new Namespace (module.name, current_source_reference); + Symbol sym = context.root.scope.lookup (module.name); + Namespace ns; + if (sym is Namespace) { + ns = (Namespace) sym; + ns.pkg = false; + } else { + ns = new Namespace (module.name, current_source_reference); + } var attributes = get_attributes (ns.name); if (attributes != null) { @@ -133,6 +146,7 @@ public class Vala.GIdlParser : CodeVisitor { } cb.name = fix_type_name (cb.name, module); ns.add_callback (cb); + current_source_file.add_node (cb); } else if (node.type == IdlNodeTypeId.STRUCT) { var st = parse_struct ((IdlNodeStruct) node); if (st == null) { @@ -140,36 +154,46 @@ public class Vala.GIdlParser : CodeVisitor { } st.name = fix_type_name (st.name, module); ns.add_struct (st); + current_source_file.add_node (st); } else if (node.type == IdlNodeTypeId.BOXED) { var st = parse_boxed ((IdlNodeBoxed) node); st.name = fix_type_name (st.name, module); ns.add_struct (st); st.set_type_id (st.get_upper_case_cname ("TYPE_")); + current_source_file.add_node (st); } else if (node.type == IdlNodeTypeId.ENUM) { var en = parse_enum ((IdlNodeEnum) node); en.name = fix_type_name (en.name, module); ns.add_enum (en); + current_source_file.add_node (en); } else if (node.type == IdlNodeTypeId.OBJECT) { var cl = parse_object ((IdlNodeInterface) node); cl.name = fix_type_name (cl.name, module); ns.add_class (cl); + current_source_file.add_node (cl); } else if (node.type == IdlNodeTypeId.INTERFACE) { var iface = parse_interface ((IdlNodeInterface) node); iface.name = fix_type_name (iface.name, module); ns.add_interface (iface); + current_source_file.add_node (iface); } else if (node.type == IdlNodeTypeId.CONSTANT) { var c = parse_constant ((IdlNodeConstant) node); c.name = fix_const_name (c.name, module); ns.add_constant (c); + current_source_file.add_node (c); } else if (node.type == IdlNodeTypeId.FUNCTION) { var m = parse_function ((IdlNodeFunction) node); if (m != null) { m.instance = false; ns.add_method (m); + current_source_file.add_node (m); } } } + if (sym is Namespace) { + return null; + } return ns; } diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala index 0d1d65d84..71bfdc0c4 100644 --- a/vapigen/valavapigen.vala +++ b/vapigen/valavapigen.vala @@ -139,13 +139,6 @@ class Vala.VAPIGen { return quit (); } - var builder = new SymbolBuilder (); - builder.build (context); - - if (Report.get_errors () > 0) { - return quit (); - } - var attributeprocessor = new AttributeProcessor (); attributeprocessor.process (context); |