[Vala] array of function pointer

2008-08-14 Thread picca
Hello

I am playing with the Gsl.vapi file.

here the definition of a delegate type in this vapi file (no CCode for now)

static delegate int MultirootF (Vector x, void* params, Vector f);

In one of my classes I want an array of this MultirootF

struct my_func {
MultirootF[] fs;
}

For now the c code generated is as simple as
MultiRootF *f;
but the gsl headers do not define this MultirootF type.
So how can I tweak the vapi with CCode to obtain the right result.


PS: The real c type of the MultiRootF is
int (*f)(gsl_vector const *x, void* params, gsl_vector *f);

Thanks

Frederic.
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] how to initialize a static struct ?

2008-08-14 Thread picca
Hello

I have a struct like this

public struct Lattice {
public Parameter a;
public Parameter b;
public Parameter c;
public Parameter alpha;
public Parameter beta;
public Parameter gamma;
}

the Parameter is also a struct with only a doubles.

So I try to create a default struct for the Lattice

public static Lattice default = {
{1.0}, {1.0}, {1.0}, {90.}, {90.}, {90.}
};

but vala complaine saying hkl-lattice.vala:1.49-1.49: error: syntax
error, expected identifier
public static Lattice default = {
^


how can I create a static Lattice and use it in other classes ?

Thanks

Frederic
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] array of function pointer

2008-08-14 Thread Matías De la Puente
2008/8/14 picca <[EMAIL PROTECTED]>

> Hello
>
> I am playing with the Gsl.vapi file.
>

Great!! I think i was the only one..


> here the definition of a delegate type in this vapi file (no CCode for now)
>
> static delegate int MultirootF (Vector x, void* params, Vector f);
>


> PS: The real c type of the MultiRootF is
> int (*f)(gsl_vector const *x, void* params, gsl_vector *f);
>

In the binding I have to create a delegate because is the only way that vala
point to a function.
MultirootF was the only name that occurred me to use. The importat think is
the parameters (Vector, void*, Vector ) and the returned type (int)...


> In one of my classes I want an array of this MultirootF
>
> struct my_func {
>MultirootF[] fs;
> }
>
> For now the c code generated is as simple as
> MultiRootF *f;

but the gsl headers do not define this MultirootF type.


I Think vala do not handle array of delegate, see
http://bugzilla.gnome.org/show_bug.cgi?id=521688


>
> So how can I tweak the vapi with CCode to obtain the right result.
>
>
I Think in the near future a static delegate will desappear, see
http://bugzilla.gnome.org/show_bug.cgi?id=526549
I still don't know how will be implemented the static delegates, but i will
change the gsl vapi file with the proper code...


>
> Thanks


You are welcome, any opinion is welcome


>
> Frederic.
>


Matias

PS: you are f7 in the irc?
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] RE : array of function pointer

2008-08-14 Thread PICCA Frédéric-Emmanuel
> Great!! I think i was the only one..

Thanks for the work you have done with GSL.

I found 2 errors in the current .vapi. I will send you a patch in a next email,

don't you think that this vapi file can be part of the officisl GSL repository. 
(the git one) ?

> In the binding I have to create a delegate because is the only way that vala
> point to a function.
> MultirootF was the only name that occurred me to use. The importat think is
> the parameters (Vector, void*, Vector ) and the returned type (int)...

good name :).
the problem with vala is that you can not declare a parameter as a constant.
so you have warnings during the C colpilation.
the real C signature is (const gsl_vector*, void*, gsl_vector*) 


> I Think vala do not handle array of delegate, see
> http://bugzilla.gnome.org/show_bug.cgi?id=521688

so we need to waite a little longer :)

> I Think in the near future a static delegate will desappear, see
> http://bugzilla.gnome.org/show_bug.cgi?id=526549
> I still don't know how will be implemented the static delegates, but i will
> change the gsl vapi file with the proper code...

Good luke.

> You are welcome, any opinion is welcome

I am using the multiroot minimization and root finding so if I find something 
wrong, I will send a patch.

> PS: you are f7 in the irc?

No sorry :)

which irc canal is it ?
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] RE : array of function pointer

2008-08-14 Thread Matías De la Puente
2008/8/14 PICCA Frédéric-Emmanuel <
[EMAIL PROTECTED]>

> > Great!! I think i was the only one..
>

> Thanks for the work you have done with GSL.
>
> I found 2 errors in the current .vapi. I will send you a patch in a next
> email,
>

Great, I will update!


>
> don't you think that this vapi file can be part of the officisl GSL
> repository. (the git one) ?
>

Yes, could be. We need to test it more. I see the link to the external vapi
bindings in http://www.gnu.org/software/gsl/ (section
extensions/applications). For me it's just fine...


> > In the binding I have to create a delegate because is the only way that
> vala
> > point to a function.
> > MultirootF was the only name that occurred me to use. The importat think
> is
> > the parameters (Vector, void*, Vector ) and the returned type (int)...
>
> good name :).
> the problem with vala is that you can not declare a parameter as a
> constant.
> so you have warnings during the C colpilation.
> the real C signature is (const gsl_vector*, void*, gsl_vector*)


yeah, but isn't a big problem...

which irc canal is it ?


IRC channel #vala on GIMPnet

Matias
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] RE : RE : array of function pointer

2008-08-14 Thread PICCA Frédéric-Emmanuel
> Yes, could be. We need to test it more. I see the link to the external vapi
> bindings in http://www.gnu.org/software/gsl/ (section
> extensions/applications). For me it's just fine...

Yes but do you have a repository for the gsl.vapi ?

Cheers
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] RE : RE : array of function pointer

2008-08-14 Thread Matías De la Puente
2008/8/14 PICCA Frédéric-Emmanuel <
[EMAIL PROTECTED]>

> > Yes, could be. We need to test it more. I see the link to the external
> vapi
> > bindings in http://www.gnu.org/software/gsl/ (section
> > extensions/applications). For me it's just fine...
>
> Yes but do you have a repository for the gsl.vapi ?
>

No I don't, I just put the vapi file in the external bindings...

>
> Cheers
>
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [ANNOUNCE] Vala 0.3.5 - Compiler for the GObject type system

2008-08-14 Thread Jürg Billeter
We are pleased to announce version 0.3.5 of Vala, a compiler for the
GObject type system.

Vala 0.3.5 is now available for download at:
   http://download.gnome.org/sources/vala/0.3/

Changes since 0.3.4
 * Notify on property changes by default (Jared Moore)
 * Add unique-1.0 bindings (Phil Housley)
 * Updates to the GLib, GTK+, and GStreamer bindings.
 * Many bug fixes.

Vala is a new programming language that aims to bring modern programming
language features to GNOME developers without imposing any additional
runtime requirements and without using a different ABI compared to
applications and libraries written in C.

valac, the Vala compiler, is a self-hosting compiler that translates
Vala source code into C source and header files. It uses the GObject
type system to create classes and interfaces declared in the Vala source
code. It's also planned to generate GIDL files when gobject-
introspection is ready.

The syntax of Vala is similar to C#, modified to better fit the GObject
type system. Vala supports modern language features as the following:

* Interfaces
* Properties
* Signals
* Foreach
* Lambda expressions
* Type inference for local variables
* Generics
* Non-null types
* Assisted memory management
* Exception handling

Vala is designed to allow access to existing C libraries, especially
GObject-based libraries, without the need for runtime bindings. Each to
be used library requires a Vala API file at compile-time, containing the
class and method declarations in Vala syntax. Vala currently comes with
bindings for current versions of GLib, GTK+, and many more.

Using classes and methods written in Vala from an application written in
C is not difficult. The Vala library only has to install the generated
header files and C applications may then access the GObject-based API of
the Vala library as usual. It should also be easily possible to write a
bindings generator for access to Vala libraries from applications
written in e.g. C# as the Vala parser is written as a library, so that
all compile-time information is available when generating a binding.

More information about Vala is available at

http://live.gnome.org/Vala


The Vala Team

Jürg Billeter and Raffaele Sandrini


___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] GLX (OpenGL Extension to the X Window System) binding!!

2008-08-14 Thread Xavier Bestel
Hi,

Le mercredi 13 août 2008 à 16:56 -0300, Matías De la Puente a écrit :
> Hello all,
> 
> I made a glx binding for vala (glx.vapi). An example is also attach to
> this mail.
> For compile the example you need also the gl.vapi file
> (http://live.gnome.org/Vala/ExternalBindings).
> 
> Compile the example with:
> valac glxtest.vala --pkg gtk+-2.0 --pkg glx --pkg gl --pkg gdk-x11-2.0
> 
> Any suggestion is welcome.


just a question: why did you call constants GLX.GLX_SOMETHING instead of
just GLX.SOMETHING ?

Xav


___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list