Re: [Vala] embedding c code snippet in vala source.
- From: Yu Feng <rainwoodman gmail com>
- To: Jürg Billeter <j bitron ch>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] embedding c code snippet in vala source.
- Date: Fri, 22 Aug 2008 05:24:48 -0400
On Fri, 2008-08-22 at 11:04 +0200, Jürg Billeter wrote:
Hi Yu,
On Thu, 2008-08-21 at 14:27 -0400, Yu Feng wrote:
I made a patch that allows embedding c code snippet in vala source.
http://bugzilla.gnome.org/show_bug.cgi?id=548897
This is quite primitive and more has to be done, especially to translate
the vala variable names to cnames.
I would like to analogue this with embedding asm code in c. :-)
C doesn't support inline assembly code. Some C compilers support inline
assembly but that's a compiler-specific extension to the C language.
My idea came from some experience with open watcom's asm embedding. They
encouraged people to embed asm as a whole function. While on the other
hand when I learned about gcc's asm embedding, it was really a mess that
c code is mixed with asm instructions, like GOB? Does gcc support
embedding ams as a whole function yet?
I will certainly not add support for inline C code to the Vala language.
It's of course possible to support it using backend-specific attributes
as you did in your patch. I don't think that this is sensible for
embedding C code into your Vala application, though. Using the `extern'
modifier is a better way to do this.
Yes I regret for using such a big title. It is
Another direction of this patch is to allow small wrapping code in
the .vapi declarations (which might ease the vapi authors's life)
This is the only place where I might consider it useful. However, so far
I'm not convinced that it really helps, see my other response.
intended for binding (again, using some asm wrap a call to int13) and I
began with .vala files because I thought they were easier to do
experiment with.
Perhaps the binding authors can find more examples? in Samba and GST
bindings? If we put it to upstream people will eventually find use
cases. It should be rare.
To pull the vala GList wrappers out I need to patch the <generic>
(valagenis?) to allow overriding with respect of generic. The patch is
already large and it is not wise to make it larger before positive
responses.
How much can this vapi-only patch hurt vala in a long run?
Regards,
Yu
Jürg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]