Re: [Vala] Metadata: Add "weak" keyword parameter



On Tue, Jun 14, 2011 at 05:53:24PM -0500, Daniel Espinosa wrote:
I'm trying to generate libgda-5.0 bindings for Vala from GIR file but I have
the following error message:

Gda-5.0.gir:15894.7-15894.6: error: Recursive value types are not allowed
      </field>

At this I have the following GdaSqlAnyPart declaration as:

struct _GdaSqlAnyPart {
    GdaSqlAnyPartType  type;
    GdaSqlAnyPart     *parent;
};

And GIR as:

<record name="SqlAnyPart" c:type="GdaSqlAnyPart">
      <doc xml:whitespace="preserve">Base structure of which all structures
(except #GdaSqlStatement) "inherit". It identifies, for each structure,
its type and its parent in the structure hierarchy.</doc>
      <field name="type" writable="1">
        <type name="SqlAnyPartType" c:type="GdaSqlAnyPartType"/>
      </field>
      <field name="parent" writable="1">
        <type name="SqlAnyPart" c:type="GdaSqlAnyPart*"/>
      </field>
      <method name="check_structure"
              c:identifier="gda_sql_any_part_check_structure"
              throws="1">
        <doc xml:whitespace="preserve">Checks for any error in @node's
structure to make sure it is valid. This
is the same as gda_sql_statement_check_structure() but for individual
#GdaSqlAnyPart
parts. This function is mainly for database provider's implementations</doc>
        <return-value transfer-ownership="none">
          <doc xml:whitespace="preserve">TRUE if no error occurred</doc>
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
      </method>
      <method name="foreach"
              c:identifier="gda_sql_any_part_foreach"
              throws="1">
        <doc xml:whitespace="preserve">Calls a function for each element of
a #GdaSqlAnyPart node
otherwise.</doc>
        <return-value transfer-ownership="none">
          <doc xml:whitespace="preserve">TRUE if @func has been called for
any sub node of @node and always returned TRUE, or FALSE</doc>
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <parameter name="func"
                     transfer-ownership="none"
                     scope="call"
                     closure="1">
            <doc xml:whitespace="preserve">function to call for each sub
node</doc>
            <type name="SqlForeachFunc" c:type="GdaSqlForeachFunc"/>
          </parameter>
          <parameter name="data" transfer-ownership="none">
            <doc xml:whitespace="preserve">data to pass to @func each time
it is called</doc>
            <type name="gpointer" c:type="gpointer"/>
          </parameter>
        </parameters>
      </method>
    </record>


In libgda-4.0.vapi we have:

    [Compact]
    [CCode (cheader_filename = "libgda/libgda.h")]
    public class SqlAnyPart {
        public weak Gda.SqlAnyPart parent;
        public Gda.SqlAnyPartType type;
        public bool check_structure () throws GLib.Error;
        public bool @foreach (Gda.SqlForeachFunc func, void* data) throws
GLib.Error;
    }

Do I need a metadata information to "tell" vapigen to use <weak
Gda.SqlAnyPart> as the type of parent to avoid recursive?

The problem is that while in libgda-4 it was a compact class, the gir
says it's a <record> which is a struct.
There's no metadata currently to force a struct to become a class: if you
report a bug I can take care of it, should be trivial.

-- 
http://www.debian.org - The Universal Operating System

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]