[Vala] Fwd: Sharing a trick to use some C macros in VALA
- From: Feng Yu <rainwoodman gmail com>
- To: Vala-list <vala-list gnome org>
- Subject: [Vala] Fwd: Sharing a trick to use some C macros in VALA
- Date: Fri, 6 Nov 2009 11:14:52 -0500
GMAIL doesn't want me to post to the list. :(
---------- Forwarded message ----------
From: Feng Yu <rainwoodman gmail com>
Date: Fri, Nov 6, 2009 at 11:14 AM
Subject: Re: [Vala] Sharing a trick to use some C macros in VALA
To: Sam Liddicott <sam liddicott com>
Cc: Jürg Billeter <j bitron ch>
I am thinking of the <Type> syntax.
---VALA---
[CCode (type_symbol_pos=-1)]
talloc_zero<T1>(void * memctx);
--CCODE--
talloc_zero(void * memctx, T1) ?
To me, this syntax is consistent with the VALA style.
It also reflects the fact that the function is a templated function.
Notice that this syntax allows only one type template.
As a reference, currently for the GObject backend,
we are compiling the templated function into something like
talloc_zero(void * memctx, _dup_func, _free_func_, ...)
Will a patch for this be welcomed? Who can write one?
Regards,
Yu
On Tue, Nov 3, 2009 at 3:14 AM, Sam Liddicott <sam liddicott com> wrote:
* Feng Yu wrote, On 03/11/09 00:55:
import themwith Pragmas
You mean that a pragma would identify that an argument took a C type?
e.g.
talloc_zero(void* memctx, [argtype="typesymbol"] typesymbol);
Sam
On Nov 2, 2009 2:03 PM, "Sam Liddicott" <sam liddicott com <mailto:
sam liddicott com>> wrote:
To get some of these tricks to work it would be helpful to be able to
pass the C type underlying the vala type as a macro parameter.
I've a bug with patches that does this using typeof() to emit the C
typesymbol but it doesn't meet Juerg's syntax expactations.
As interfacing with c macros is topical again, does anyone have ideas on
this?
Sam
-----Original Message----- From: pancake <pancake youterm com <mailto:
pancake youterm com>> Sent: 01 November 2009 10:29 To: Yu ...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]