[Vala] Plugable Code Generators



Hi all,

recently with these two commits [1], [2] support for the posix and
dova profiles was removed from the vala compiler.

I fully agree with this decision, for a number of reason starting from
the fact that these profiles were incomplete and somewhat broken.
Anyway as I said I like the idea of experimenting with alternative
codegen backends so I think that adding plugin support to the vala
compiler will be very useful.

Attached to this email there's patch that implements it, if there is
some interest I can open a bug in bugzilla and continue the discussion
there.

Following a sample profile code that re-implements a minimal test
profile that mimic the GObject codgen backend:

using GLib;

public class Vala.TestProfile {

    [CCode(cname="vala_codegenerator_factory")]
    public static Vala.CodeGenerator factory (Vala.CodeContext context) {
        context.add_define ("GOBJECT");
        for (int i = 16; i <= context.target_glib_minor; i += 2) {
            context.add_define ("GLIB_2_%d".printf (i));
        }

        /* default packages */
        context.add_external_package ("glib-2.0");
        context.add_external_package ("gobject-2.0");
        return new Vala.GDBusServerModule ();
    }
}

Ciao,
Andrea

[1] http://git.gnome.org/browse/vala/commit/?id=ca020bf04a09fe16e5583eea5a3a341e7796bff5
[2] http://git.gnome.org/browse/vala/commit/?id=5ea6dc05d62c71ba4e633f70b86e4dd0a5e9c089

Attachment: 0001-Added-support-for-plugable-C-code-generators.patch
Description: Binary data



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