The attached patch allows to insert a C code section (in the .c file)
between the declarations and the method implementations, eg:
%afterdecls{
static const struct
{
void (*one) (Self *self);
void (*two) (Self *self);
} things[] = {
{ self_foo, self_bar },
};
%}
class Foo:Bar
{
private void
foo (self)
{
}
private void
bar (self)
{
}
}
Without this patch, one has to make methods protected if he wants to
refer to them from the %{} code section.
Or, alternatively, put things[] in a %{} section at the end of the
file:
%{
typedef struct
{
void (*one) (FooBar *self);
void (*two) (FooBar *self);
} Thing;
static const Thing things[];
%}
class Foo:Bar
{
...
}
%{
static const Thing things[] = {
...
};
%}
But it's more verbose and forbids code such as:
G_N_ELEMENTS(things)
since things[] is not yet defined in the class code.
-- Jean-Yves Lefort <jylefort_at_brutele.be>
This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT