Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Hans Vercammen
Hi, On Fri, 2008-08-22 at 05:49 -0400, Yu Feng wrote: > Just a scratch of idea: > > class array { >[CCode (snippet = "int i; while(((T)this)[i]) i++; return i;")] >public int get_length(); >[CCode (snippet = "gpointer * rt; while((T)(this)[i]) i++; result.length = > i; rt = g_new0(T,

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Sam Liddicott
* Jürg Billeter wrote, On 22/08/08 11:26: > >>[CCode (snippet = "g_free(this);")] >>public void free(); >> > > We don't want free functions in the bindings API, we already have > `delete' to free memory if you use raw pointers. > Darn, I'll need them for compact classes... Sam ___

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Sam Liddicott
* Alexey Lubimov wrote, On 22/08/08 12:53: > Jürg Billeter пишет: >> On Fri, 2008-08-22 at 06:45 -0400, Yu Feng wrote: >> >>> Man this is a trap. There is no logical relation between failing to >>> provide examples and the the validaty of a feature. >>> >> >> I agree, however, I don't see a

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Alexey Lubimov
Jürg Billeter пишет: On Fri, 2008-08-22 at 06:45 -0400, Yu Feng wrote: Man this is a trap. There is no logical relation between failing to provide examples and the the validaty of a feature. I agree, however, I don't see a reason to merge a feature as long as there is no use case for i

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
On Fri, 2008-08-22 at 14:35 +0400, Alexey Lubimov wrote: > Jürg Billeter пишет: > > On Fri, 2008-08-22 at 13:28 +0400, Alexey Lubimov wrote: > >> You can see 15 bugs in vala-0.3.5 sources only... > >> > > > > Most of these look correct from a quick look. The scanner and parser use > > byte off

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
On Fri, 2008-08-22 at 06:45 -0400, Yu Feng wrote: > Man this is a trap. There is no logical relation between failing to > provide examples and the the validaty of a feature. I agree, however, I don't see a reason to merge a feature as long as there is no use case for it. Cheers, Jürg ___

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Alexey Lubimov
Jürg Billeter пишет: On Fri, 2008-08-22 at 13:28 +0400, Alexey Lubimov wrote: Jürg Billeter пишет: Ok, as you agree that the null-terminated arrays should be handled, your g_strv_length example is not a real use case for the snippet support. Can you provide a concrete exam

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Yu Feng
Man this is a trap. There is no logical relation between failing to provide examples and the the validaty of a feature. The consideration about maintenance makes more sense. and I would like to say again, I agree it is a large patch and I understand any repulsion toward it: after all it is alien a

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Alexey Lubimov
Jürg Billeter пишет: On Fri, 2008-08-22 at 13:28 +0400, Alexey Lubimov wrote: Jürg Billeter пишет: Ok, as you agree that the null-terminated arrays should be handled, your g_strv_length example is not a real use case for the snippet support. Can you provide a concrete exam

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
On Fri, 2008-08-22 at 05:49 -0400, Yu Feng wrote: > Just a scratch of idea: > > class array { >[CCode (snippet = "int i; while(((T)this)[i]) i++; return i;")] >public int get_length(); This won't work (arrays may contain null/0 entries), and it would be slow. >[CCode (snippet = "gpoi

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
On Fri, 2008-08-22 at 05:24 -0400, Yu Feng wrote: > On Fri, 2008-08-22 at 11:04 +0200, Jürg Billeter wrote: > > > 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

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread pancake
On Fri, 2008-08-22 at 05:24 -0400, Yu Feng wrote: > > 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 em

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Yu Feng
Just a scratch of idea: class array { [CCode (snippet = "int i; while(((T)this)[i]) i++; return i;")] public int get_length(); [CCode (snippet = "gpointer * rt; while((T)(this)[i]) i++; result.length = i; rt = g_new0(T, i); for(i=0; i with in generics, class array { [CCode (snippet =

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
On Fri, 2008-08-22 at 13:28 +0400, Alexey Lubimov wrote: > Jürg Billeter пишет: > > Ok, as you agree that the null-terminated arrays should be handled, > your > > g_strv_length example is not a real use case for the snippet support. > > Can you provide a concrete example where you think it makes mo

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Alexey Lubimov
Jürg Billeter пишет: On Fri, 2008-08-22 at 05:09 -0400, Yu Feng wrote: On Fri, 2008-08-22 at 10:44 +0200, Jürg Billeter wrote: Maybe I'm just missing an interesting use case, however, I currently fail to see where the snippet approach makes it more comfortable to write or use bindings.

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Yu Feng
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

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
On Fri, 2008-08-22 at 05:09 -0400, Yu Feng wrote: > On Fri, 2008-08-22 at 10:44 +0200, Jürg Billeter wrote: > > Maybe I'm just missing an interesting use case, however, I currently > > fail to see where the snippet approach makes it more comfortable to > > write or use bindings. Can you provide exa

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Yu Feng
On Fri, 2008-08-22 at 10:44 +0200, Jürg Billeter wrote: > Hi Yu, > > On Fri, 2008-08-22 at 02:58 -0400, Yu Feng wrote: > > Which do you prefer if you want to split a string? mysplit or split? > > > > [CCode (cname = "g_strmysplit", snippet = "gchar ** rt = > > g_strsplit(this, > > delimiter,

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
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. >

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Jürg Billeter
Hi Yu, On Fri, 2008-08-22 at 02:58 -0400, Yu Feng wrote: > Which do you prefer if you want to split a string? mysplit or split? > > [CCode (cname = "g_strmysplit", snippet = "gchar ** rt = g_strsplit(this, > delimiter, max_tokens); *result_length1 = rt?g_strv_length(rt):0; return > rt;")] >

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Daniel Svensson
On Thu, Aug 21, 2008 at 8:27 PM, Yu Feng <[EMAIL PROTECTED]> wrote: > Dear all, > > I made a patch that allows embedding c code snippet in vala source. > > http://bugzilla.gnome.org/show_bug.cgi?id=548897 Why not just write a .vapi-file for your C-code? It's easy as pie to mix vala with C-code. Ju

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Yu Feng
ac > class virtual method enhancement, the expression use used by vala to locate > the virtual method table for acompact class or object. > > Sam > > -Original Message- > From: Emmanuele Bassi <[EMAIL PROTECTED]> > Sent: Thursday, August 21, 2008 11:18 PM > To:

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Alexey Lubimov
Ali Sabil пишет: On Fri, Aug 22, 2008 at 7:32 AM, Yu Feng <[EMAIL PROTECTED] > wrote: On Thu, 2008-08-21 at 23:18 +0100, Emmanuele Bassi wrote: > On Thu, 2008-08-21 at 14:27 -0400, Yu Feng wrote: > > Dear all, > > > > I made a patch that allows

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Sam Liddicott
rtual method enhancement, the expression use used by vala to locate the virtual method table for acompact class or object. Sam -Original Message- From: Emmanuele Bassi <[EMAIL PROTECTED]> Sent: Thursday, August 21, 2008 11:18 PM To: vala-list@gnome.org Subject: Re: [Vala] embedding c c

Re: [Vala] embedding c code snippet in vala source.

2008-08-22 Thread Daniel Lucraft
--- Emmanuele Bassi <[EMAIL PROTECTED]> wrote: > no, please: let's not turn Vala into the new GOB. > this makes the code an > unbearable mess - been there, done that. wow, I'd not seen that project before. I like how one of the GOB examples includes a 'shoot_yourself_in_the_head' function. Says i

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Yu Feng
Dear Friend, I've changed the title of the bug 548897 to 'Wrapping c code segment (snippet) around cfunc in .vapi files' I hope this name is more GOB-victim friendly. I understand that as you pointed out, using external can glue c code in a more pretty way. However we don't want any extra libra

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Alexey Lubimov
Ali Sabil пишет: On Fri, Aug 22, 2008 at 7:32 AM, Yu Feng <[EMAIL PROTECTED] > wrote: On Thu, 2008-08-21 at 23:18 +0100, Emmanuele Bassi wrote: > On Thu, 2008-08-21 at 14:27 -0400, Yu Feng wrote: > > Dear all, > > > > I made a patch that allows

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Ali Sabil
On Fri, Aug 22, 2008 at 7:32 AM, Yu Feng <[EMAIL PROTECTED]> wrote: > > On Thu, 2008-08-21 at 23:18 +0100, Emmanuele Bassi wrote: > > On Thu, 2008-08-21 at 14:27 -0400, Yu Feng wrote: > > > Dear all, > > > > > > I made a patch that allows embedding c code snippet in vala source. > > > > > > http:/

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Ali Sabil
On Fri, Aug 22, 2008 at 12:18 AM, Emmanuele Bassi <[EMAIL PROTECTED]> wrote: > On Thu, 2008-08-21 at 14:27 -0400, Yu Feng wrote: > > Dear all, > > > > 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

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Yu Feng
On Thu, 2008-08-21 at 23:18 +0100, Emmanuele Bassi wrote: > On Thu, 2008-08-21 at 14:27 -0400, Yu Feng wrote: > > Dear all, > > > > 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 mo

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Emmanuele Bassi
On Thu, 2008-08-21 at 14:27 -0400, Yu Feng wrote: > Dear all, > > 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 cna

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Feng Yu
Not yet. Two steps away. On 8/21/08, Alexey Lubimov <[EMAIL PROTECTED]> wrote: > Yu Feng пишет: > > > Dear all, > > > > 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 do

Re: [Vala] embedding c code snippet in vala source.

2008-08-21 Thread Alexey Lubimov
Yu Feng пишет: Dear all, 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 embeddin

[Vala] embedding c code snippet in vala source.

2008-08-21 Thread Yu Feng
Dear all, 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.