Re: [Vala] Posix profile



Quoting Johan Mattsson <johan mattsson m gmail com>

Hi

I have created a new prosix profile for the vala compiler that makes
it possible to compile libraries and programs with libc as the only
runtime dependency. Many features like signals and lambdas will not
work with the posix profile but the implementation works well for my
purposes.

A few things changes the language specification. C symbols for true
and false has been added as parameters to the BooleanType definition.

All classes compiled with the posix profile must be compact but
reference counting can be added to the class if needed. Here is an
example class:

[CCode (ref_function = "compact_ref_counting_ref", unref_function =
"compact_ref_counting_unref")]
class CompactRefCounting {
    public string field = "Hello World\n";
    public int ref_count = 1;

    public void hello () {
        print (field);
    }

    public unowned CompactRefCounting @ref () {
        ref_count++;
        return this;
    }

    public void unref () {
        if (--ref_count == 0) {
            this.finalize ();
        }
    }

    private extern void finalize ();
}


Compile with: valac --profile posix test.vala

The code is not well tested yet but I will maintain it and develop it
further. Any ideas or suggestions that could make it easier to get
this feature in to a stable release of vala is highly appreciated.

The code is available here: https://github.com/johanmattssonm/vala

Cheers
Johan
_______________________________________________
vala-devel-list mailing list
vala-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-devel-list

What version of vala is this based on? Are you planning on following the development version of vala?

Thanks

On Oct 26, 2014 7:54 PM, Johan Mattsson <johan mattsson m gmail com> wrote:

Hi I have created a new prosix profile for the vala compiler that make



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