Re: [Vala] vapi

2019-04-06 Thread Wolfgang Mauer

Nobody has an info?

Am 04.04.19 um 16:53 schrieb Wolfgang Mauer:

Of course I meant the libreoffice sdk to use with vala
Am 04.04.19 um 16:36 schrieb Wolfgang Mauer:

Hi all,
is there a way to use the libreoffice interfaces with vala?


Nice day
Wolfgang


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

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


Re: [Vala] vapi

2019-04-04 Thread Wolfgang Mauer

Of course I meant the libreoffice sdk to use with vala

Am 04.04.19 um 16:36 schrieb Wolfgang Mauer:

Hi all,
is there a way to use the libreoffice interfaces with vala?


Nice day
Wolfgang


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

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


Re: [Vala] VAPI-Bindings to obscure c-types.

2016-12-05 Thread Guillaume Poirier-Morency
There's a rank table sitting somewhere and I'm always looking for it. It
would be really nice to add it to
https://wiki.gnome.org/Projects/Vala/Manual/Attributes

If you want some more examples of numeric datatypes, I also have defined a
couple in
https://github.com/arteymix/numeric-glib/blob/master/src/numeric-glib-1.0.vapi

2016-12-05 13:16 GMT-05:00 Al Thomas :

> 
> > From: Guillaume Poirier-Morency 
> > Sent: Monday, 5 December 2016, 17:30
> > Subject: Re: [Vala] VAPI-Bindings to obscure c-types.
>
> > You could also use a [FloatingType] declaration and not mess with
> pre-processor directives.
>
> > [FloatingType]
> > public struct dReal {}
>
>
> Nice solution. I presume [FloatingType] allows for the struct to be
> initialized with a real literal, whereas just using [SimpleType] means it
> has to use the struct syntax. So
>
> dReal x = 1.23456;
>
> instead of
>
>
> dReal x = { 1.23456 );
>
> >  [SimpleType]
> >  [CCode (cname = "dReal", has_type_id = false)]
> >  public struct dReal : float {
> >  }
>
>
> In terms of Vala syntax I think [FloatingType], [IntegerType] and
> [BooleanType] enable the use of the relevant Vala literal syntax when
> initializing the struct. I'm not so sure about the implicit casting rules
> in Vala, is the rank detail required? There is also a width detail.
>
> In terms of the C code generated the glib-2.0.vapi also has CCode details
> for 'default_value' and for doubles 'type_signature'. Not sure how relevant
> they are.
>
> It would be nice to get my understanding of [FloatingType], [IntegerType]
> and [BooleanType] nailed and I'll try updating the Simple Types section of
> the Legacy Bindings doc.
>
> Al
>



-- 
Guillaume Poirier-Morency 

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

*Mon blog:* arteymix.github.io
*Mon projet de coopérative:* pittoresque.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex&search=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI-Bindings to obscure c-types.

2016-12-05 Thread Al Thomas via vala-list

> From: Guillaume Poirier-Morency 
> Sent: Monday, 5 December 2016, 17:30
> Subject: Re: [Vala] VAPI-Bindings to obscure c-types.

> You could also use a [FloatingType] declaration and not mess with 
> pre-processor directives.

> [FloatingType]
> public struct dReal {}


Nice solution. I presume [FloatingType] allows for the struct to be initialized 
with a real literal, whereas just using [SimpleType] means it has to use the 
struct syntax. So

dReal x = 1.23456;

instead of 


dReal x = { 1.23456 );

>  [SimpleType]
>  [CCode (cname = "dReal", has_type_id = false)]
>  public struct dReal : float {
>  }


In terms of Vala syntax I think [FloatingType], [IntegerType] and [BooleanType] 
enable the use of the relevant Vala literal syntax when initializing the 
struct. I'm not so sure about the implicit casting rules in Vala, is the rank 
detail required? There is also a width detail.

In terms of the C code generated the glib-2.0.vapi also has CCode details for 
'default_value' and for doubles 'type_signature'. Not sure how relevant they 
are.

It would be nice to get my understanding of [FloatingType], [IntegerType] and 
[BooleanType] nailed and I'll try updating the Simple Types section of the 
Legacy Bindings doc.

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI-Bindings to obscure c-types.

2016-12-05 Thread Guillaume Poirier-Morency
You could also use a [FloatingType] declaration and not mess with
pre-processor directives.

[FloatingType]
public struct dReal {}

2016-12-05 7:20 GMT-05:00 Al Thomas via vala-list :

> > - Original Message -
>
> > From: Daniel Brendle 
> > Sent: Monday, 5 December 2016, 7:53
> > Subject: [Vala] VAPI-Bindings to obscure c-types.
>
> > In libode's code, there is a type called dReal. Depending on some
> > compiler flags, dReal might be a double or a float:
>
> > #if defined(dSINGLE)
> > typedef float dReal;
> > #ifdef dDOUBLE
> > #error You can only #define dSINGLE or dDOUBLE, not both.
> > #endif /* dDOUBLE */
> > #elif defined(dDOUBLE)
> > typedef double dReal;
> > #else
> > #error You must #define dSINGLE or dDOUBLE
> > #endif
>
> > The library then uses dReal in various method signatures that I have to
>
> > bind against. Is there any possibility to cover this in vala?
>
>
> These are macros that are defined without a value and are used by the C
> pre-processor. To define such a macro from valac, as you probably know, you
> use the -X option:
> valac --pkg libode6 -X -DdDOUBLE example.vala
>
> Vala has a similiar, but much simpler, pre-processor:
> https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor
> https://wiki.gnome.org/Projects/Vala/ConditionalCompilationSample
>
> The Vala pre-processor can also be used in a VAPI file:
> #if ODE_FLOAT
>   [SimpleType]
>
>   [CCode (cname = "dReal", has_type_id = false)]
>   public struct dReal : float {
>   }
> #else
>   [SimpleType]
>   [CCode (cname = "dReal", has_type_id = false)]
>   public struct dReal : double {
>   }
> #endif
>
> So for double you would compile with:
> valac --pkg libode6 -X -DdDOUBLE example.vala
>
>
> and for float:
> valac --pkg libode6 -X -DdSINGLE -D ODE_FLOAT example.vala
>
> You will have to use separate declarations for both the C pre-processor
> and the Vala pre-processor. While you can define a macro in a .vala file by
> using const, this cannot currently be emitted before the #include in the
> generated C file. So it is not set at the time when the C header is
> processed.
>
> This is untested and probably doesn't reflect your binding, but should
> convey the method.
>
> Al
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>



-- 
Guillaume Poirier-Morency 

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

*Mon blog:* arteymix.github.io
*Mon projet de coopérative:* pittoresque.github.io
*Clé PGP:* B1AD6EA5

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


Re: [Vala] VAPI-Bindings to obscure c-types.

2016-12-05 Thread Al Thomas via vala-list
> - Original Message -

> From: Daniel Brendle 
> Sent: Monday, 5 December 2016, 7:53
> Subject: [Vala] VAPI-Bindings to obscure c-types.

> In libode's code, there is a type called dReal. Depending on some
> compiler flags, dReal might be a double or a float:

> #if defined(dSINGLE)
> typedef float dReal;
> #ifdef dDOUBLE
> #error You can only #define dSINGLE or dDOUBLE, not both.
> #endif /* dDOUBLE */
> #elif defined(dDOUBLE)
> typedef double dReal;
> #else
> #error You must #define dSINGLE or dDOUBLE
> #endif

> The library then uses dReal in various method signatures that I have to

> bind against. Is there any possibility to cover this in vala?


These are macros that are defined without a value and are used by the C 
pre-processor. To define such a macro from valac, as you probably know, you use 
the -X option:
valac --pkg libode6 -X -DdDOUBLE example.vala

Vala has a similiar, but much simpler, pre-processor:
https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor
https://wiki.gnome.org/Projects/Vala/ConditionalCompilationSample

The Vala pre-processor can also be used in a VAPI file:
#if ODE_FLOAT
  [SimpleType]

  [CCode (cname = "dReal", has_type_id = false)]
  public struct dReal : float {
  }
#else
  [SimpleType]
  [CCode (cname = "dReal", has_type_id = false)]
  public struct dReal : double {
  }
#endif

So for double you would compile with:
valac --pkg libode6 -X -DdDOUBLE example.vala


and for float:
valac --pkg libode6 -X -DdSINGLE -D ODE_FLOAT example.vala

You will have to use separate declarations for both the C pre-processor and the 
Vala pre-processor. While you can define a macro in a .vala file by using 
const, this cannot currently be emitted before the #include in the generated C 
file. So it is not set at the time when the C header is processed.

This is untested and probably doesn't reflect your binding, but should convey 
the method.

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi bindings and a weird C-pattern

2016-05-14 Thread Al Thomas
> From: Daniel Brendle 

> Sent: Sunday, 15 May 2016, 0:52
> Subject: [Vala] Vapi bindings and a weird C-pattern
> 
> I want to write VAPI bindings for liborient [0].

For reference this is:
https://github.com/dam2k/liborient/blob/master/include/liborient/liborient.h



> A typical method-definition looks like this:> 
> long o_bin_dataclustercount(orientdb *o, orientdb_con *c, struct timeval
> *timeout, int nonblocking, short clusternumber);
> 
> In Vala I'd like to use the lib like this:
> var handle = new OrientDB();
> var connection = handle.connect("foo","bar");
> connection.dataclustercount(sometimeval, 1, 1);

The only thing I could think of was connection being a nested class.
Similar to an iterator:
https://wiki.gnome.org/Projects/Vala/Tutorial#CA-da256d2dad8b53fad2ae12a6292bfe22240a3fb5

Not sure if this works with a VAPI, but I would like to know if it does.

> Under the given circumstances I have the feeling that the best thing one
> can achieve is something like this:
> 
> var handle = new OrientDB();
> var connection = Connection.connect(handle, "foo", "bar")
> handle.dataclustercount(connection, sometimeval, 1, 1);
> 
> Am I right? Is there any possibility to cover this C-Pattern?


That would be my understanding as well. 


> Second question: The library imports  at some point and uses
> the timeval definition from in there in method signatures. How can i

> write equivalent Vala Types to write Vala signatures for them?

I believe timeval is Posix only, so you need:
http://valadoc.org/#!api=posix/Posix.timeval
Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi bindings and a weird C-pattern

2016-05-14 Thread Felipe Lavratti
Oh god, they use opaque handlers.

See the orientdb type as a context. You might abstract or hide it with a
static global. Careful with the initalization of statics in vala. I am not
experienced with vapis, but i believe you can instantiate a static field in
a class within it.


On Sat, May 14, 2016 at 20:57 Daniel Brendle  wrote:

> Hi, Guys
>
> I want to write VAPI bindings for liborient [0].
>
> While analyzing the C-code i came across the functions which turned out
> to work in a somewhat unexpected way.
> Usually one has some struct, methods to create and free the struct and a
> set of methods that operate on that struct. Such code can be converted
> to VAPI bindings in a straightforward way.
> However liborient keeps managing stuff like this:
>
>  - One struct to represent a handle
>  - One struct to represent a connection
>  - A set of methods which operate on _both_ of the previously mentioned
> structs.
>
> A typical method-definition looks like this:
>
> long o_bin_dataclustercount(orientdb *o, orientdb_con *c, struct timeval
> *timeout, int nonblocking, short clusternumber);
>
> In Vala I'd like to use the lib like this:
> var handle = new OrientDB();
> var connection = handle.connect("foo","bar");
> connection.dataclustercount(sometimeval, 1, 1);
>
> Under the given circumstances I have the feeling that the best thing one
> can achieve is something like this:
>
> var handle = new OrientDB();
> var connection = Connection.connect(handle, "foo", "bar")
> handle.dataclustercount(connection, sometimeval, 1, 1);
>
> Am I right? Is there any possibility to cover this C-Pattern?
>
> Second question: The library imports  at some point and uses
> the timeval definition from in there in method signatures. How can i
> write equivalent Vala Types to write Vala signatures for them?
>
> Thanks in Advance and a nice evening,
> grindhold
>
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] vapi for libpng

2015-06-23 Thread Evan Nemerson
On Wed, 2015-06-24 at 08:16 +0800, Nor Jaidi Tuah wrote:
> > 
> > Not that I know. You cannot use gdkpixbuf?
> 
> I don't see any file output function in
> gdkpixbuf, or at the very least in-memory
> serialization.

Gdk.Pixbuf.save*

There are lots of versions for saving to files, buffers, and streams.


-Evan


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] vapi for libpng

2015-06-23 Thread Nor Jaidi Tuah
> Not that I know. You cannot use gdkpixbuf?

I don't see any file output function in
gdkpixbuf, or at the very least in-memory
serialization.

I glanced through libpng manual and found out
that error handling is done by setting a setjmp
destination (continuation rather than callback
or error-flag). I wonder how to wrap that in
vala.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] vapi for libpng

2015-06-23 Thread Luca Bruno
On 23/06/2015 08:18, Nor Jaidi Tuah wrote:
> Are there any vapi for libpng (hidden somehow
> from google)?
Not that I know. You cannot use gdkpixbuf?
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi duplication in different dir

2015-04-02 Thread 中川祥
Thanks, Evan.

On 2015年4月2日(木) PM2:08 Evan Nemerson  wrote:

> Just pass --vapidir path/to/local/dir to valac, or pass the vapi file to
> valac just as you would a source file and omit the --pkg flag.
>
> How to do that in CMake depends on how you are compiling vala stuff in
> your project―if you're using https://github.com/jakobwesthoff/Vala_CMake
> then it looks like you pass the CUSTOM_VAPIS argument to vala_precompile
> ―there is an example in the README.
>
>
> -Evan
>
>
> On Thu, 2015-04-02 at 13:11 +0900, 中川祥 wrote:
> > I have a question now.
> > I have two version of vapi file for the slightestly same c library and
> the
> > file in vapi default dir /usr/share/vala/vapi/ is not complete vapi
> > file,though my original local file is completed.
> > The project loads the default dir's file and I have no execution to
> > change.Does anyone know how to set up CMakelist.txt to load local one and
> > ignore the default dir one?
> > ___
> > vala-list mailing list
> > vala-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/vala-list
>
>
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi duplication in different dir

2015-04-01 Thread Evan Nemerson
Just pass --vapidir path/to/local/dir to valac, or pass the vapi file to
valac just as you would a source file and omit the --pkg flag.

How to do that in CMake depends on how you are compiling vala stuff in
your project—if you're using https://github.com/jakobwesthoff/Vala_CMake
then it looks like you pass the CUSTOM_VAPIS argument to vala_precompile
—there is an example in the README.


-Evan


On Thu, 2015-04-02 at 13:11 +0900, 中川祥 wrote:
> I have a question now.
> I have two version of vapi file for the slightestly same c library and the
> file in vapi default dir /usr/share/vala/vapi/ is not complete vapi
> file,though my original local file is completed.
> The project loads the default dir's file and I have no execution to
> change.Does anyone know how to set up CMakelist.txt to load local one and
> ignore the default dir one?
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list


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


Re: [Vala] VAPI to GIR

2015-03-25 Thread Abderrahim Kitouni
Hello,

I think it's not possible to convert from vapi to gir. But if this is
a vala library, you can generate the gir at the same time as the vapi
by using the --gir option of valac.

HTH,
Abderrahim

2015-03-24 13:31 GMT+01:00 Konstantin P. :
> Hello. I have some vala library (with generated VAPI). This is possible to
> convert VAPI to GIR for using it in Python app, or I need to write GIR by
> hand?
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI bindings for external lib

2014-11-17 Thread Luca Bruno
On 17/11/2014 17:46, Gonzalo Aguilar Delgado wrote:
> Hi,
>
> perfect! Thank you for fast response.
>
> Just one question. Is there any vapi repos to upload resulting vapi.
> It would be nice to have something like nexus for maven but in this
> case for vapis.
>
This is the official "unofficial" list of extra vapis :)
https://github.com/nemequ/vala-extra-vapis . It's unofficial in the
sense that it's not maintained in the vala tree, it's official in the
sense that as Vala developers we suggest using it. Should be the perfect
place for sharing your vapi.

Best regards,
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI bindings for external lib

2014-11-17 Thread Gonzalo Aguilar Delgado

Hi Michael,

I missed this one. Thank you.

El 17/11/14 a las 16:07, Michael Catanzaro escribió:

On Mon, 2014-11-17 at 14:28 +0100, Gonzalo Aguilar Delgado wrote:

Hello,

I'm modifiying babobab to support a ceph cluster. And want to do add
several tools to position files on OSDs, show fragemntation of
underlaying filesystems, etc. Maybe this will generate other tool, but
for now just modifying.

The problem is that I cannot access directly to librados, libcephfs
libraries from vala. Ehem, I can do it by just linking but figuring out
what's the best way to do it.

I suppose that creating a binding is the best. I saw some tutorials but
all require that library already uses GObject system that's not the case.

So, should I create a wrapping object lib, and then generate bindings
from there?

Or should I do another way? I'm thinking about just adding dep and call
it from vala like c. But don't know what's the best way to proceed.

Best regards

There's a lot of documentation on this here:
https://wiki.gnome.org/Projects/Vala/LegacyBindings


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


Re: [Vala] VAPI bindings for external lib

2014-11-17 Thread Gonzalo Aguilar Delgado

Hi,

perfect! Thank you for fast response.

Just one question. Is there any vapi repos to upload resulting vapi. It 
would be nice to have something like nexus for maven but in this case 
for vapis.


Best regards,


El 17/11/14 a las 14:41, Luca Bruno escribió:

On 17/11/2014 14:28, Gonzalo Aguilar Delgado wrote:

Hello,

I'm modifiying babobab to support a ceph cluster. And want to do add
several tools to position files on OSDs, show fragemntation of
underlaying filesystems, etc. Maybe this will generate other tool, but
for now just modifying.

The problem is that I cannot access directly to librados, libcephfs
libraries from vala. Ehem, I can do it by just linking but figuring
out what's the best way to do it.

I suppose that creating a binding is the best. I saw some tutorials
but all require that library already uses GObject system that's not
the case.

So, should I create a wrapping object lib, and then generate bindings
from there?

Or should I do another way? I'm thinking about just adding dep and
call it from vala like c. But don't know what's the best way to proceed.


If those libs are C, just write the .vapi by hand. Use compact classes
and structs, unless they have reference-counted objects.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list



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


Re: [Vala] VAPI bindings for external lib

2014-11-17 Thread Michael Catanzaro
On Mon, 2014-11-17 at 14:28 +0100, Gonzalo Aguilar Delgado wrote:
> Hello,
> 
> I'm modifiying babobab to support a ceph cluster. And want to do add 
> several tools to position files on OSDs, show fragemntation of 
> underlaying filesystems, etc. Maybe this will generate other tool, but 
> for now just modifying.
> 
> The problem is that I cannot access directly to librados, libcephfs 
> libraries from vala. Ehem, I can do it by just linking but figuring out 
> what's the best way to do it.
> 
> I suppose that creating a binding is the best. I saw some tutorials but 
> all require that library already uses GObject system that's not the case.
> 
> So, should I create a wrapping object lib, and then generate bindings 
> from there?
> 
> Or should I do another way? I'm thinking about just adding dep and call 
> it from vala like c. But don't know what's the best way to proceed.
> 
> Best regards

There's a lot of documentation on this here:
https://wiki.gnome.org/Projects/Vala/LegacyBindings


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI bindings for external lib

2014-11-17 Thread Luca Bruno
On 17/11/2014 14:28, Gonzalo Aguilar Delgado wrote:
> Hello,
>
> I'm modifiying babobab to support a ceph cluster. And want to do add
> several tools to position files on OSDs, show fragemntation of
> underlaying filesystems, etc. Maybe this will generate other tool, but
> for now just modifying.
>
> The problem is that I cannot access directly to librados, libcephfs
> libraries from vala. Ehem, I can do it by just linking but figuring
> out what's the best way to do it.
>
> I suppose that creating a binding is the best. I saw some tutorials
> but all require that library already uses GObject system that's not
> the case.
>
> So, should I create a wrapping object lib, and then generate bindings
> from there?
>
> Or should I do another way? I'm thinking about just adding dep and
> call it from vala like c. But don't know what's the best way to proceed.
>
If those libs are C, just write the .vapi by hand. Use compact classes
and structs, unless they have reference-counted objects.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI tutorial

2013-12-28 Thread rastersoft
Why isn't that document linked in the Vala's page? (at least, I didn't 
found it). It looks very useful.


El 28/12/13 04:59, Andre Masella escribió:

Probably best to link to the legacy VAPI guide:
https://wiki.gnome.org/Projects/Vala/LegacyBindings


On 27 December 2013 15:43, rastersoft  wrote:


Hi all:

I wrote a little VAPI writing tutorial to help people to start writing
VAPI files for libraries. I put it at

https://wiki.gnome.org/Projects/Vala/WrittingVAPIs

Of course it is incomplete, and is possible that it has mistakes, so I
accept all kind of suggestions and fixes.

--
Nos leemos
  RASTER(Linux user #228804)
ras...@rastersoft.com  http://www.rastersoft.com

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






--
Nos leemos
 RASTER(Linux user #228804)
ras...@rastersoft.com  http://www.rastersoft.com

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


Re: [Vala] VAPI tutorial

2013-12-27 Thread Evan Nemerson
On Sat, 2013-12-28 at 00:43 +0100, rastersoft wrote:
> Hi all:
> 
> I wrote a little VAPI writing tutorial to help people to start writing 
> VAPI files for libraries. I put it at
> 
> https://wiki.gnome.org/Projects/Vala/WrittingVAPIs
> 
> Of course it is incomplete, and is possible that it has mistakes, so I 
> accept all kind of suggestions and fixes.

Seems like a duplicate of
https://wiki.gnome.org/Projects/Vala/LegacyBindings

I hope you'll consider merging what you've written into the other page.
Meanwhile, I've added a note to WrittingVAPIs (which, BTW, is misspelled
—writing only has one 't').

I haven't read what you posted yet, but on a quick skim I noticed that
you are encouraging people to use ref_function="", unref_function="..."
instead of just free_function="..." for a compact class.  This is almost
never the right thing to do since it will prevent Vala from properly
managing the memory.  In general, you might want to avoid using Xcb as
an example since it's generally not a very good VAPI (though your recent
changes do improve things quite a bit).


-Evan

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


Re: [Vala] VAPI tutorial

2013-12-27 Thread Andre Masella
Probably best to link to the legacy VAPI guide:
https://wiki.gnome.org/Projects/Vala/LegacyBindings


On 27 December 2013 15:43, rastersoft  wrote:

> Hi all:
>
> I wrote a little VAPI writing tutorial to help people to start writing
> VAPI files for libraries. I put it at
>
> https://wiki.gnome.org/Projects/Vala/WrittingVAPIs
>
> Of course it is incomplete, and is possible that it has mistakes, so I
> accept all kind of suggestions and fixes.
>
> --
> Nos leemos
>  RASTER(Linux user #228804)
> ras...@rastersoft.com  http://www.rastersoft.com
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>



-- 
--Andre Masella
http://www.masella.name/
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI tutorial

2013-12-27 Thread Steven Oliver
There's a short section on VAPIs in the tutorial if I remember correctly. Would 
probably be helpful to link to this from there if you haven't already. 

—
Sent from Mailbox for iPhone

On Fri, Dec 27, 2013 at 6:43 PM, rastersoft  wrote:

> Hi all:
> I wrote a little VAPI writing tutorial to help people to start writing 
> VAPI files for libraries. I put it at
> https://wiki.gnome.org/Projects/Vala/WrittingVAPIs
> Of course it is incomplete, and is possible that it has mistakes, so I 
> accept all kind of suggestions and fixes.
> -- 
> Nos leemos
>RASTER(Linux user #228804)
> ras...@rastersoft.com  http://www.rastersoft.com
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI: turning a function into a property?

2012-12-08 Thread Aaron

Please let us know when you finish the bindings!

Quoting foracc :


On Sat, Dec 8, 2012 at 3:42 PM, foracc  wrote:


  [CCode (cheader_filename="allegro5/allegro5.h")]
  namespace Allegro5
  {
[Compact]
[CCode(cname="ALLEGRO_EVENT_**QUEUE",
   free_function="al_destroy_**event_queue")]
class EventQueue {
  [CCode (cname="al_is_event_queue_**empty", instance_pos=0)]
  public bool empty { get; }
}
  }



Try putting the CCode on the "get" rather than on the property:
public bool empty { [CCode (cname="al_is_event_queue_empty",
instance_pos=0)] get; }



Thanks, that did the trick.

Regards
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list





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


Re: [Vala] VAPI: turning a function into a property?

2012-12-08 Thread foracc

On Sat, Dec 8, 2012 at 3:42 PM, foracc  wrote:


   [CCode (cheader_filename="allegro5/allegro5.h")]
   namespace Allegro5
   {
 [Compact]
 [CCode(cname="ALLEGRO_EVENT_**QUEUE",
free_function="al_destroy_**event_queue")]
 class EventQueue {
   [CCode (cname="al_is_event_queue_**empty", instance_pos=0)]
   public bool empty { get; }
 }
   }



Try putting the CCode on the "get" rather than on the property:
public bool empty { [CCode (cname="al_is_event_queue_empty",
instance_pos=0)] get; }



Thanks, that did the trick.

Regards
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI: turning a function into a property?

2012-12-08 Thread Luca Bruno
On Sat, Dec 8, 2012 at 3:42 PM, foracc  wrote:

>   [CCode (cheader_filename="allegro5/allegro5.h")]
>   namespace Allegro5
>   {
> [Compact]
> [CCode(cname="ALLEGRO_EVENT_**QUEUE",
>free_function="al_destroy_**event_queue")]
> class EventQueue {
>   [CCode (cname="al_is_event_queue_**empty", instance_pos=0)]
>   public bool empty { get; }
> }
>   }
>

Try putting the CCode on the "get" rather than on the property:
public bool empty { [CCode (cname="al_is_event_queue_empty",
instance_pos=0)] get; }

-- 
www.debian.org - The Universal Operating System
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi help

2012-01-11 Thread Andrew Higginson
On 10/01/12 22:52, Denis Kuzmenok wrote:
> Hi.
> I  need  some  help  with  vapi  file.  I'm making vapi for C non-Glib
> library. There are structs, i write them into vapi, as
>  namespace AC -> struct AC_Automata
> 
> And i'm getting errors:
> undefined reference to `ac_ac_automata_destroy'
> 
> But  there  is no destroy calls in .c files (except one free call from
> the  function),  so  i  suppose it's some vapi magic that inserts that
> calls.
> Is  there any docs describing possible variables for CCode? There is a
> link to image on live.gnome.org, but it's broken..

https://live.gnome.org/Vala/Manual/Attributes



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


Re: [Vala] Vapi help

2012-01-11 Thread Axel FILMORE
Attached files are an example I have done, I use the vala-gen-introspect 
method :

https://live.gnome.org/Vala/Bindings/GI

Then I modifed the generated file, I had to tweak the "cname" and 
"cprefix" values

in order that it works.

Well I'm not an expert I don't know if it's really correct, but it works 
fine, it seems

that you have the same troubles.

Regards.

On 10/01/2012 23:52, Denis Kuzmenok wrote:

Hi.
I  need  some  help  with  vapi  file.  I'm making vapi for C non-Glib
library. There are structs, i write them into vapi, as
  namespace AC ->  struct AC_Automata

And i'm getting errors:
undefined reference to `ac_ac_automata_destroy'

But  there  is no destroy calls in .c files (except one free call from
the  function),  so  i  suppose it's some vapi magic that inserts that
calls.
Is  there any docs describing possible variables for CCode? There is a
link to image on live.gnome.org, but it's broken..

Thanks.

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




--
Axel FILMORE

/* libmenu-cache.vapi generated by vapigen, do not modify. */

namespace Mc {
	[CCode (cname = "MenuCache", cprefix="menu_cache_", cheader_filename = "menu-cache.h", ref_function = "menu_cache_ref", unref_function = "menu_cache_unref")]
	[Compact]
	public class Cache {
		public void* add_reload_notify (GLib.Func func);
		public uint32 get_desktop_env_flag (string desktop_env);
		public unowned CacheDir get_dir_from_path (string path);
		public unowned CacheDir get_root_dir ();
		public static void init (int flags);
		public unowned GLib.SList list_all_apps ();
		public static unowned Cache lookup (string menu_name);
		public static unowned Cache lookup_sync (string menu_name);
		public bool reload ();
		public void remove_reload_notify (void* notify_id);
	}
	[CCode (cname = "MenuCacheApp", cprefix="menu_cache_app_", cheader_filename = "menu-cache.h")]
	[Compact]
	public class CacheApp {
		public unowned string get_exec ();
		public bool get_is_visible (uint32 de_flags);
		public uint32 get_show_flags ();
		public bool get_use_sn ();
		public bool get_use_terminal ();
		public unowned string get_working_dir ();
	}
	[CCode (cname = "MenuCacheDir", cprefix="menu_cache_dir_", cheader_filename = "menu-cache.h")]
	[Compact]
	public class CacheDir {
		public unowned GLib.SList get_children ();
		public unowned string make_path ();
	}
	[CCode (cname = "MenuCacheItem", cprefix="menu_cache_item_", cheader_filename = "menu-cache.h", ref_function = "menu_cache_item_ref", unref_function = "menu_cache_item_unref")]
	[Compact]
	public class CacheItem {
		public unowned Type get_type ();
		public unowned string get_comment ();
		public unowned string get_file_basename ();
		public unowned string get_file_dirname ();
		public unowned string get_file_path ();
		public unowned string get_icon ();
		public unowned string get_id ();
		public unowned string get_name ();
		public unowned CacheDir get_parent ();
	}
	[CCode (cname="MenuCacheItemFlag", cheader_filename = "menu-cache.h", cprefix = "FLAG_", has_type_id = false)]
	public enum Item {
		USE_TERMINAL,
		USE_SN
	}
	[CCode (cname="MenuCacheShowFlag", cheader_filename = "menu-cache.h", cprefix = "SHOW_", has_type_id = false)]
	public enum Show {
		IN_LXDE,
		IN_GNOME,
		IN_KDE,
		IN_XFCE,
		IN_ROX,
		N_KNOWN_DESKTOPS
	}
	[CCode (cname="MenuCacheType", cheader_filename = "menu-cache.h", cprefix = "MENU_CACHE_TYPE_", has_type_id = false)]
	public enum Type {
		NONE,
		DIR,
		APP,
		SEP
	}
}
/* libmenu-cache.vapi generated by vapigen, do not modify. */

namespace Menu {
[CCode (cheader_filename = "libmenu-cache.h", ref_function = 
"menu_cache_ref", unref_function = "menu_cache_unref")]
[Compact]
public class Cache {
public void* add_reload_notify (GLib.Func func);
public uint32 get_desktop_env_flag (string desktop_env);
public unowned Menu.CacheDir get_dir_from_path (string path);
public unowned Menu.CacheDir get_root_dir ();
public static void init (int flags);
public unowned GLib.SList list_all_apps ();
public static unowned Menu.Cache lookup (string menu_name);
public static unowned Menu.Cache lookup_sync (string menu_name);
public bool reload ();
public void remove_reload_notify (void* notify_id);
}
[CCode (cheader_filename = "libmenu-cache.h")]
[Compact]
public class CacheApp {
public unowned string get_exec ();
public bool get_is_visible (uint32 de_flags);
public uint32 get_show_flags ();
public bool get_use_sn ();
public bool get_use_terminal ();
public unowned string get_working_dir ();
}
[CCode (cheader_filename = "libmenu-cache.h")]
[Compact]
public clas

Re: [Vala] Vapi help

2012-01-10 Thread Jonathan Ryan
Please provide the vapi and the header file it's wrapping.

Documentation:
https://live.gnome.org/Vala/Bindings


-jryan

On Tue, Jan 10, 2012 at 5:52 PM, Denis Kuzmenok  wrote:

> Hi.
> I  need  some  help  with  vapi  file.  I'm making vapi for C non-Glib
> library. There are structs, i write them into vapi, as
>  namespace AC -> struct AC_Automata
>
> And i'm getting errors:
> undefined reference to `ac_ac_automata_destroy'
>
> But  there  is no destroy calls in .c files (except one free call from
> the  function),  so  i  suppose it's some vapi magic that inserts that
> calls.
> Is  there any docs describing possible variables for CCode? There is a
> link to image on live.gnome.org, but it's broken..
>
> Thanks.
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi automatic installation

2012-01-06 Thread Daniel Espinosa
I think that all projects must distribute its own VAPI files and
install in system's directories defined by vala. This is done by
libgda and gxml projects, including its GObject Introspection files,
created at build time and installed automatically. Distribution
packagers can create different packages for GI and VAPI.

Libgda master have added resently GIR and VAPI files in order to track
API updates and unwanted changes.

2012/1/6 Antono Vasiljev :
> On Tue, 2012-01-03 at 16:16 +0200, Denis Kuzmenok wrote:
>
>> What do you think about making vapi repository like perl's cpan to
>> search over different vapi's, and install them easily via commandline
>> utils?  With storage containing them, of course.
>
> vapi is not usable without headers and libs. and if this tool will
> install headers and libs we are reinventing package manager :)
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list



-- 
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los
cuates: LIBRE)
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi automatic installation

2012-01-06 Thread Antono Vasiljev
On Tue, 2012-01-03 at 16:16 +0200, Denis Kuzmenok wrote:

> What do you think about making vapi repository like perl's cpan to
> search over different vapi's, and install them easily via commandline
> utils?  With storage containing them, of course. 

vapi is not usable without headers and libs. and if this tool will
install headers and libs we are reinventing package manager :)

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


Re: [Vala] [.vapi] delegate types

2011-12-25 Thread Artem Tarasov
Thanks, it's at least less clumsy.

2011/12/25 Luca Bruno :
> On Sun, Dec 25, 2011 at 10:37 AM, Artem Tarasov 
> wrote:
>>
>> Is there a better solution? Maybe another CCode option should be
>> added, like "generate_typedef" or something, which value of false
>> would mean to expand the type everywhere (into "return-type
>> (*variable-name) (param-types)")?
>
>
> No better solution at the moment, just create a custom .h with the relevant
> define and add that to the cheader_filename of the struct, very simple.
>
> --
> www.debian.org - The Universal Operating System
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [.vapi] delegate types

2011-12-25 Thread Luca Bruno
On Sun, Dec 25, 2011 at 10:37 AM, Artem Tarasov
wrote:

> Is there a better solution? Maybe another CCode option should be
> added, like "generate_typedef" or something, which value of false
> would mean to expand the type everywhere (into "return-type
> (*variable-name) (param-types)")?
>

No better solution at the moment, just create a custom .h with the relevant
define and add that to the cheader_filename of the struct, very simple.

-- 
www.debian.org - The Universal Operating System
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-11 Thread Daniel Espinosa
Missing symbols could be because gtk-doc annotations, (skip) in this case,
or because there are missing other required symbols not included at GIR
generation (in this case the symbol is tagged as introspectable="0"). See
warnings and messages at GIR generation.

In other cases, using (skip), means that is better for bindings to not use
this symbol, because is hard to be parsed or is unbindable. Look at:

https://live.gnome.org/GObjectIntrospection/WritingBindingableAPIs

2011/10/10 Matthias Klumpp 

> I get exactly the same errors, but I get a working vapi file -
> although some symbols seem to be missing.
>
> 2011/10/10 Andrew Higginson :
> > Hi,
> >
> > On 09/10/11 18:04, bsquared wrote:
> >> It looks like you need to add packages to the command line.  I
> >> found the wiki page http://live.gnome.org/Vala/Bindings helpful.
> >
> > On 10/10/11 04:54, Daniel Espinosa wrote:
> >> Messages report an error on Gio-2.0.gir, are you using the lastes
> >> version of this file?
> >> You can check at Vala repository for vapi generation examples in
> >> Makefile.am for --pkg switches used for diferent bindings.
> >
> > My Gio-2.0.gir file is available here, and it is the latest in Ubuntu
> > 11.10 (libglib2.0 package version 2.30.0) :
> >http://db.tt/e621C6EA
> >
> > I tried to use the --pkg switches on the command line, and simply used
> > all the packages that were listed in the Meta-3.0.gir file in the
> >  >
> > vapigen --library libmutter --pkg atk --pkg clutter-1.0 --pkg cogl-1.0
> > --pkg glib-2.0 --pkg gmodule-2.0 --pkg gobject-2.0 --pkg gdk-3.0 --pkg
> > gdk-pixbuf-2.0 --pkg gio-2.0 --pkg gtk+-3.0 --pkg json-glib-1.0 --pkg
> > pango --pkg pangocairo --pkg cairo --pkg x11
> /usr/share/gir-1.0/Meta-3.0.gir
> >
> >
> > But received the following errors:
> >http://pastebin.com/Mwkuy468
> >
> > And again the libmutter.vapi file is empty :(
> >
> > --
> > Andrew
> > ___
> > vala-list mailing list
> > vala-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/vala-list
> >
> ___
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-11 Thread Matthias Klumpp
I get exactly the same errors, but I get a working vapi file -
although some symbols seem to be missing.

2011/10/10 Andrew Higginson :
> Hi,
>
> On 09/10/11 18:04, bsquared wrote:
>> It looks like you need to add packages to the command line.  I
>> found the wiki page http://live.gnome.org/Vala/Bindings helpful.
>
> On 10/10/11 04:54, Daniel Espinosa wrote:
>> Messages report an error on Gio-2.0.gir, are you using the lastes
>> version of this file?
>> You can check at Vala repository for vapi generation examples in
>> Makefile.am for --pkg switches used for diferent bindings.
>
> My Gio-2.0.gir file is available here, and it is the latest in Ubuntu
> 11.10 (libglib2.0 package version 2.30.0) :
>    http://db.tt/e621C6EA
>
> I tried to use the --pkg switches on the command line, and simply used
> all the packages that were listed in the Meta-3.0.gir file in the
> 
> vapigen --library libmutter --pkg atk --pkg clutter-1.0 --pkg cogl-1.0
> --pkg glib-2.0 --pkg gmodule-2.0 --pkg gobject-2.0 --pkg gdk-3.0 --pkg
> gdk-pixbuf-2.0 --pkg gio-2.0 --pkg gtk+-3.0 --pkg json-glib-1.0 --pkg
> pango --pkg pangocairo --pkg cairo --pkg x11 /usr/share/gir-1.0/Meta-3.0.gir
>
>
> But received the following errors:
>    http://pastebin.com/Mwkuy468
>
> And again the libmutter.vapi file is empty :(
>
> --
> Andrew
> ___
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-10 Thread Daniel Espinosa
Have you made your modifications by hand?

Is much better to modify gtk-doc annotations[1] in order to generate correct
GIR files, this will help other languages as well like python, JavaScript
and other supporting GObjectIntrospection, including Vala. Or use a
Meta-3.0.metadata[2] in order to tell vapi generator to create correct vapi,
including header files to use[3].

I don't really know but Vala may is switching to GIR. Vala's compiler search
for GIR/TYPLIB when --pkg request a package like:

valac --pkg Meta-3.0 test.vala

will search on {prefix}/share/gir-1.0/ directory for Meta-3.0.gir package,
parse it automatically (including its dependencies) and them compiles. It
sends lot of CRITICAL messages on vala_gir_parser_* and other functions, but
they will be seen even when generating VAPI files, because they come from
Vala's GIR parser.

Take the last and search just Error messages on VAPI generation, they are
more useful than the CRITICAL ones.

See at:

[1] http://live.gnome.org/GObjectIntrospection/Annotations
[2] http://live.gnome.org/Vala/Manual/GIR%20metadata%20format
[3] http://git.gnome.org/browse/libgda/tree/libgda/Gda-5.0.metadata


2011/10/10 Andrew Higginson 

> Hi,
>
> First off, thanks so much for everyone's help so far on this :)
>
> Once I removed those incorrect  lines and excluded those X11
> methods  I got a vapi that looks like this:
>http://pastebin.com/wq1dtK0y
>
> I then replaced the cheader_filename = "Meta-3.0.h" with header files
> that actually exist, and added the methods load() and get_current() to
> the Meta.Theme struct, as well as changing the parameter 'button_states'
> of Meta.Theme.draw_frame() to be a Meta.ButtonState[]
>
> This gave me a vapi file like so:
>http://pastebin.com/Mkf59c1p
>
> Now I have actually tried to use it and that's where the problems arise :)
>
> I have compiled and tried to run the following piece of code:
>http://pastebin.com/aPLr3Nak
>
> With the command:
>valac -g --save-temps --pkg gtk+-3.0 --pkg libmutter --pkg
> clutter-1.0 --vapidir=. window.vala
>
> Which generates the .c file:
>http://pastebin.com/Yaf1iYm2
>
> And it crashes with a Segmentation Fault, with the following backtrace:
>http://pastebin.com/yyNyTZx1
>
> The respective .c and .h files for meta_theme_draw_frame and related
> functions are available:
>http://pastebin.com/taFeLdcm
>http://pastebin.com/vkbCN9z6
>
> I guess something is wrong with the vapi?
>
> Thanks,
>
> --
> Andrew
> ___
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-10 Thread Andrew Higginson
Hi,

First off, thanks so much for everyone's help so far on this :)

Once I removed those incorrect  lines and excluded those X11
methods  I got a vapi that looks like this:
http://pastebin.com/wq1dtK0y

I then replaced the cheader_filename = "Meta-3.0.h" with header files
that actually exist, and added the methods load() and get_current() to
the Meta.Theme struct, as well as changing the parameter 'button_states'
of Meta.Theme.draw_frame() to be a Meta.ButtonState[]

This gave me a vapi file like so:
http://pastebin.com/Mkf59c1p

Now I have actually tried to use it and that's where the problems arise :)

I have compiled and tried to run the following piece of code:
http://pastebin.com/aPLr3Nak

With the command:
valac -g --save-temps --pkg gtk+-3.0 --pkg libmutter --pkg
clutter-1.0 --vapidir=. window.vala

Which generates the .c file:
http://pastebin.com/Yaf1iYm2

And it crashes with a Segmentation Fault, with the following backtrace:
http://pastebin.com/yyNyTZx1

The respective .c and .h files for meta_theme_draw_frame and related
functions are available:
http://pastebin.com/taFeLdcm
http://pastebin.com/vkbCN9z6

I guess something is wrong with the vapi?

Thanks,

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


Re: [Vala] VAPI Generation Problems

2011-10-10 Thread Luca Bruno
On Sun, Oct 9, 2011 at 5:41 PM, Andrew Higginson wrote:

> Hi,
>
> I am using the latest vala from git and am trying to generate a vapi
> file for libmutter.
>
> When I build libmutter (from git) a .gir file is generated which can be
> seen here:
>   http://pastebin.com/vapMQ2T1
>
>
1) The gir is broken as it contains the following lines, remove them:


2) There're no bindings for CoglPango. So you either add bindings for it or
drop the ___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-10 Thread Abderrahim Kitouni
Hello Andrew,

You have more than one problem here, see below

2011/10/10 Andrew Higginson :
> My Gio-2.0.gir file is available here, and it is the latest in Ubuntu
> 11.10 (libglib2.0 package version 2.30.0) :
>    http://db.tt/e621C6EA

As far as I know, vapigen still cannot parse the gio gir correctly
(nor the gtk one). So you probably need to pass at least --pkg
gtk+-3.0 to vapigen.

> I tried to use the --pkg switches on the command line, and simply used
> all the packages that were listed in the Meta-3.0.gir file in the
> 
> vapigen --library libmutter --pkg atk --pkg clutter-1.0 --pkg cogl-1.0
> --pkg glib-2.0 --pkg gmodule-2.0 --pkg gobject-2.0 --pkg gdk-3.0 --pkg
> gdk-pixbuf-2.0 --pkg gio-2.0 --pkg gtk+-3.0 --pkg json-glib-1.0 --pkg
> pango --pkg pangocairo --pkg cairo --pkg x11 /usr/share/gir-1.0/Meta-3.0.gir

You don't need to pass all these, --pkg gtk+-3.0 --pkg clutter-1.0
should be enough. However, this still doesn't solve the problem.

> And again the libmutter.vapi file is empty :(

The problem here is that the Meta-3.0.gir incorrectly reports the
packages it provides (it reports gtk+-3.0 and clutter-1.0, where it
should report libmutter (or mutter-plugins, or both. I'm not sure)),
so it is ignored (since we've already included gtk and clutter). This
should be fixed in mutter. and btw, they don't include the headers
either, that should be fixed as well.

At this point, I get the following errors:


Meta-3.0.gir:1581.45-1581.45: error: The type name `X.KeySym' could not be found

^
Meta-3.0.gir:1584.49-1584.49: error: The type name `X.KeyCode' could
not be found

^

The problem here is that the vala bindings for x11 don't have KeySym
and KeyCode (they are replaced by ulong and uchar). The simplest way
is to skip MetaKeyBinding (assuming you don't need it). This is done
by creating a file Meta-3.0.metadata containing

KeyBinding skip

and pass the directory containing this file to vapigen using --metadatadir.

At this point, you have a non-empty libmutter.vapi (I didn't test it,
so not sure it works). There are still crtitical warning (that seem to
be related to the fact that cogl-pango is put in the same vapi as
cogl, but they're harmless afaict).

HTH,
Abderrahim
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-10 Thread Matthias Klumpp
I get exactly the same errors, but I get a working vapi file -
although some symbols seem to be missing.

2011/10/10 Andrew Higginson :
> Hi,
>
> On 09/10/11 18:04, bsquared wrote:
>> It looks like you need to add packages to the command line.  I
>> found the wiki page http://live.gnome.org/Vala/Bindings helpful.
>
> On 10/10/11 04:54, Daniel Espinosa wrote:
>> Messages report an error on Gio-2.0.gir, are you using the lastes
>> version of this file?
>> You can check at Vala repository for vapi generation examples in
>> Makefile.am for --pkg switches used for diferent bindings.
>
> My Gio-2.0.gir file is available here, and it is the latest in Ubuntu
> 11.10 (libglib2.0 package version 2.30.0) :
>    http://db.tt/e621C6EA
>
> I tried to use the --pkg switches on the command line, and simply used
> all the packages that were listed in the Meta-3.0.gir file in the
> 
> vapigen --library libmutter --pkg atk --pkg clutter-1.0 --pkg cogl-1.0
> --pkg glib-2.0 --pkg gmodule-2.0 --pkg gobject-2.0 --pkg gdk-3.0 --pkg
> gdk-pixbuf-2.0 --pkg gio-2.0 --pkg gtk+-3.0 --pkg json-glib-1.0 --pkg
> pango --pkg pangocairo --pkg cairo --pkg x11 /usr/share/gir-1.0/Meta-3.0.gir
>
>
> But received the following errors:
>    http://pastebin.com/Mwkuy468
>
> And again the libmutter.vapi file is empty :(
>
> --
> Andrew
> ___
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-10 Thread Andrew Higginson
Hi,

On 09/10/11 18:04, bsquared wrote:
> It looks like you need to add packages to the command line.  I
> found the wiki page http://live.gnome.org/Vala/Bindings helpful.

On 10/10/11 04:54, Daniel Espinosa wrote:
> Messages report an error on Gio-2.0.gir, are you using the lastes
> version of this file?
> You can check at Vala repository for vapi generation examples in
> Makefile.am for --pkg switches used for diferent bindings.

My Gio-2.0.gir file is available here, and it is the latest in Ubuntu
11.10 (libglib2.0 package version 2.30.0) :
http://db.tt/e621C6EA

I tried to use the --pkg switches on the command line, and simply used
all the packages that were listed in the Meta-3.0.gir file in the
http://pastebin.com/Mwkuy468

And again the libmutter.vapi file is empty :(

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


Re: [Vala] VAPI Generation Problems

2011-10-09 Thread Daniel Espinosa
Messages report an error on Gio-2.0.gir, are you using the lastes version of
this file?

You can check at Vala repository for vapi generation examples in Makefile.am
for --pkg switches used for diferent bindings.

El domingo 9 de octubre de 2011, Andrew Higginson 
escribió:
> Hi,
>
> I am using the latest vala from git and am trying to generate a vapi
> file for libmutter.
>
> When I build libmutter (from git) a .gir file is generated which can be
> seen here:
>   http://pastebin.com/vapMQ2T1
>
> Then I try to generate a .vapi file from this using the following command:
>   vapigen-0.16 --library libmutter Meta-3.0.gir
>
> However I get the following errors:
>   http://pastebin.com/pUz3ALJM
>
> And the file libmutter.vapi simply contains:
>   /* libmutter.vapi generated by vapigen-0.16, do not modify. */
>
>
> Could someone please help me :/
>
> Thanks,
>
> --
> Andrew
> ___
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI Generation Problems

2011-10-09 Thread bsquared
It looks like you need to add packages to the command line.  I
found the wiki page http://live.gnome.org/Vala/Bindings helpful.
-- 
Regards,
Brian Winfrey

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


Re: [Vala] VAPI metadata problem

2011-07-06 Thread Jim Nelson
That wound up working -- kind of.  I had to use lower_case_cprefix="gmime_"
for it to generate the right type conversion macro.  My big fear, as you
mentioned, was then having to go back and patch up every method with the
right cname.  It turns out that vapigen magically saw the problem and
provided the proper cname, saving me a bunch of work.

-- Jim

On Tue, Jul 5, 2011 at 12:03 AM, Luca Bruno  wrote:

> On Mon, Jul 04, 2011 at 08:16:28PM -0700, Jim Nelson wrote:
> > Hello,
> >
> > I'm attempting to build a VAPI for GMime.  (If anyone can point me to a
> > completed version, it would be appreciated!)
> >
> > The problem I'm running into is this:
> >
> > The namespace for the module is GMime.  The class GMimeStream's type
> > conversion macro is GMIME_STREAM but valac auto-generates it as
> > G_MIME_STREAM, leading to compilation errors.  I've been unable to find a
> > way via the .metadata file to coerce valac to use the proper macro.  The
> > type_id field seems to be for the GType of the class (GMIME_TYPE_STREAM)
> and
> > the other fields don't help here either.
> >
> > In C, the problem is when an instance of a subclass of GMimeStream is
> being
> > passed to a function that expects a GMimeStream:
> >
> > g_mime_stream_cat_add_source (stream_cat, G_MIME_STREAM (_tmp14_));
> >
> > I need valac to use GMIME_STREAM instead.
> >
> > I'm sure this is something simple, but it's escaping me right now.
>
> Well that's a weird api unfortunately. I fear the only thing you can do is:
> GMime lower_case_cprefix="gmime"
> But then you have to add cname to all other methods and so on.
>
> --
> http://www.debian.org - The Universal Operating System
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] VAPI metadata problem

2011-07-05 Thread Luca Bruno
On Mon, Jul 04, 2011 at 08:16:28PM -0700, Jim Nelson wrote:
> Hello,
> 
> I'm attempting to build a VAPI for GMime.  (If anyone can point me to a
> completed version, it would be appreciated!)
> 
> The problem I'm running into is this:
> 
> The namespace for the module is GMime.  The class GMimeStream's type
> conversion macro is GMIME_STREAM but valac auto-generates it as
> G_MIME_STREAM, leading to compilation errors.  I've been unable to find a
> way via the .metadata file to coerce valac to use the proper macro.  The
> type_id field seems to be for the GType of the class (GMIME_TYPE_STREAM) and
> the other fields don't help here either.
> 
> In C, the problem is when an instance of a subclass of GMimeStream is being
> passed to a function that expects a GMimeStream:
> 
> g_mime_stream_cat_add_source (stream_cat, G_MIME_STREAM (_tmp14_));
> 
> I need valac to use GMIME_STREAM instead.
> 
> I'm sure this is something simple, but it's escaping me right now.

Well that's a weird api unfortunately. I fear the only thing you can do is:
GMime lower_case_cprefix="gmime"
But then you have to add cname to all other methods and so on.

-- 
http://www.debian.org - The Universal Operating System
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi delegate problems.

2011-04-27 Thread Lewis Gunsch
That gives me the following error.

libzmq.vapi:80.34-80.41: error: The type name `GLib.Fun' could not be found
public Msg.data(uint8[] data, GLib.Fun? ffn = null);

Although, I tried:

[CCode (cname = "zmq_free_fn", type = "void (*)(void *, void *)")]
public delegate void free_fn(void *data);

with the constructor:

[CCode (cname = "zmq_msg_init_data")]
public Msg.data(owned uint8[] data, free_fn?  ffn = null);

And it now compiles and runs. It seems to work properly now. I have the
hello world example working.

Although, in the constructor the data is type uint8[], and in it's free
function free_fn it's a void*. Is there any way to correct this?


Thanks,
~Lewis

On Wed, Apr 27, 2011 at 1:18 AM, Luca Bruno  wrote:

> On Tue, Apr 26, 2011 at 03:50:39PM -0600, Lewis Gunsch wrote:
> > Hi,
> >
> > I am having trouble getting a delegate in a vapi to work correctly. My
> > original attempt (line 70 of the vapi) did not work because of how the
> > typedef is in the C header (it's not a function pointer), so instead of
> > using their typedef I used GLib.Func which matches the function
> signature.
> > This is suppose to be (void*)(void*, void*), but Vala creates it to be
> > (void*)(const void*, void*) and then produces an error. The method that
> > produces this error is
> >
> > ZMQ.MSG.Msg.data(uint8[] data, GLib.Func? ffn = null);
> >
> > and the corresponding C method is
> >
> > ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, size_t
> size,
> > zmq_free_fn *ffn, void *hint);
> >
> > The library I'm am trying to write the vapi for is ZeroMQ. Here is a link
> to
> > zmq.h.
> > https://github.com/zeromq/zeromq2-1/blob/v2.1.4/include/zmq.h
> >
> > You can see my attempt at the vapi below. My original delegate which I
> could
> > not get to work is on line 70.
> > https://github.com/lgunsch/zmq-vala/blob/msg_refactor/libzmq.vapi
> >
> > And my test is here:
> >
> https://github.com/lgunsch/zmq-vala/blob/msg_refactor/examples/delegatetest.vala
> >
> > Sorry if I have not explained myself in a clear manner. Help is much
> > appreciated!
>
> What happens if you add [CCode (type = "(void*)(void*, void*)")] to the
> parameter?
>
> --
> http://www.debian.org - The Universal Operating System
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iQIcBAEBCAAGBQJNt8NLAAoJEETrFmfSwntrCUUP/RDgIfMZj2juJXdOzF7T+M29
> lXhtNi3tUP2rlEOwfeeozwQahno2v0YyNmvoKxK8WNqpMp9aK73ejH4zqeE1tb1i
> Qau12DN9p3ipPF7ek07OcGqKvwQocVppVLRrefg5cMrhhoa4iFkUBm2g1FzYv89t
> 81D8xMMnq2NH4LNqrl3kIxUOn4e0lMfoNq3GwI+4kBgSLdIo/lEu8shfRYnW/zOv
> 7mjm7abWEOxXWRWLC/MMNTvMmzdPUqRY515xOKOMAzg1usUXs+GppIsLbMmpdUMT
> dkwMF0qGp98TjjJlNIE2J6HpXILnqM8+1R2iudUakMkN+dCbStUs9a523qom8xUx
> P6Dga/5NqJpywgyYje3rUGWm8TXppLQUr2SK71J04Qh4yeBvT3dnMK7ogUraqyQC
> LgZADRE3I6fA2GWux9kEbH3TmYo/LYZYzCp7pDK+XRiKfG2ENneAbIAC+4YlXSRb
> iKpNUK0+LZO5QLuVhmshJ9djP3bcNylTo90MS/ibhQ8dB0QnXNWBnPGVpFxVjR8v
> /RPG1fc4ijAHdLvNQoxBdsMJkeR47n51beBBFiTJ82HsYy3cVx8u0yF/1ZXgKYaD
> 7jeRK5UgOiL7zQWXCQdM2l2vVMpmtDSp1rVG4BxeG0rLx7mI8qo7kJQT6B+fe7wX
> dpIp/GRmNxM01EIq9aoX
> =cZId
> -END PGP SIGNATURE-
>
>
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi delegate problems.

2011-04-27 Thread Luca Bruno
On Tue, Apr 26, 2011 at 03:50:39PM -0600, Lewis Gunsch wrote:
> Hi,
> 
> I am having trouble getting a delegate in a vapi to work correctly. My
> original attempt (line 70 of the vapi) did not work because of how the
> typedef is in the C header (it's not a function pointer), so instead of
> using their typedef I used GLib.Func which matches the function signature.
> This is suppose to be (void*)(void*, void*), but Vala creates it to be
> (void*)(const void*, void*) and then produces an error. The method that
> produces this error is
> 
> ZMQ.MSG.Msg.data(uint8[] data, GLib.Func? ffn = null);
> 
> and the corresponding C method is
> 
> ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, size_t size,
> zmq_free_fn *ffn, void *hint);
> 
> The library I'm am trying to write the vapi for is ZeroMQ. Here is a link to
> zmq.h.
> https://github.com/zeromq/zeromq2-1/blob/v2.1.4/include/zmq.h
> 
> You can see my attempt at the vapi below. My original delegate which I could
> not get to work is on line 70.
> https://github.com/lgunsch/zmq-vala/blob/msg_refactor/libzmq.vapi
> 
> And my test is here:
> https://github.com/lgunsch/zmq-vala/blob/msg_refactor/examples/delegatetest.vala
> 
> Sorry if I have not explained myself in a clear manner. Help is much
> appreciated!

What happens if you add [CCode (type = "(void*)(void*, void*)")] to the 
parameter?

-- 
http://www.debian.org - The Universal Operating System


signature.asc
Description: Digital signature
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] vapi Autoupdate

2011-01-22 Thread Abderrahim Kitouni
Hello,

 في خ، 20-01-2011 عند 17:54 -0600 ، كتب Daniel Espinosa:
> Is it recommended to allow a library like GDA to update its Vala's vapi on
> build and install? Any sugestions?
Ideally, the vapi should be taken care of by the original library, but
this isn't always feasible (often maintainers don't want to be bothered
with this Vala thing).

And btw, if GDA does have a gir (as most gobject libraries do), it may
be a better idea to generate the vapi from the gir directly (it'll
reduce duplication: you fix the annotations once and every binding
profits). This functionality is still considered experimental, but
should mostly work with recent Vala (>=0.11.2).

HTH,
Abderrahim

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


Re: [Vala] vapi for the Bullet Physics Engine

2010-11-28 Thread Bob Hazard
Thanks for this.  I have heard great things about libbullet.  I
believe it is even used by professional PS3 devs in commercial games



-- 
Sent from my Amiga
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi generation problem

2009-12-18 Thread Julian Andres Klode
Am Donnerstag, den 17.12.2009, 18:54 +0100 schrieb Nicolas:
> Hello,
> 
> I try to use a non glib-library, and i have a problem generating the 
> vapi file.
> 
> On my header i have:
> typedef struct my_instance my_instance;
> 
> In my vapi file, i wrote:
> public struct my_instance {}
> 
> When i use this structure (test_instance), vala generate this:
> my_instance test_instance;
> 
> But i need this:
> my_instance *test_instance;
> 
> There is a way to say to vala to generate the second one ?
If you always need a pointer, you can use

[Compact]
class my_instance {}

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.


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


Re: [Vala] Vapi generation problem

2009-12-17 Thread Michael 'Mickey' Lauer
Am Donnerstag, den 17.12.2009, 18:54 +0100 schrieb Nicolas:
> Hello,
> 
> I try to use a non glib-library, and i have a problem generating the 
> vapi file.
> 
> On my header i have:
> typedef struct my_instance my_instance;
> 
> In my vapi file, i wrote:
> public struct my_instance {}
> 
> When i use this structure (test_instance), vala generate this:
> my_instance test_instance;
> 
> But i need this:
> my_instance *test_instance;

Why do you think you need to state this explicitly? Structs are usually
passed as reference types by Vala.

> There is a way to say to vala to generate the second one ?

If you don't have another way, you can use pointers in Vala as well... 

-- 
:M:

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


Re: [Vala] Vapi help..

2009-10-25 Thread Shawn Ferris
On Sat, 2009-10-24 at 22:23 -0600, Shawn Ferris wrote:
> On Sat, 2009-10-24 at 15:59 +0100, Abderrahim Kitouni wrote:
> > Short answer : I think GLib.Value? should do the trick. (and from
> > reading the doc, I think it should also be unowned).
> 
> That did the trick. I couldn't use unowned however. Making it unowned
> got rid of the extra arg, but also threw away the return value.
> 
> > HTH,
> > Abderrahim
> 
> It did indeed.. Thank you!
> 

Ooops.. I lied.. unowned was required. I must have botched something
else when testing it. Works perfect now though.. thanks again!

SMF

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


Re: [Vala] Vapi help..

2009-10-24 Thread Shawn Ferris
On Sat, 2009-10-24 at 15:59 +0100, Abderrahim Kitouni wrote:
> Short answer : I think GLib.Value? should do the trick. (and from
> reading the doc, I think it should also be unowned).

That did the trick. I couldn't use unowned however. Making it unowned
got rid of the extra arg, but also threw away the return value.

> HTH,
> Abderrahim

It did indeed.. Thank you!

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


Re: [Vala] Vapi help..

2009-10-24 Thread Abderrahim Kitouni
Hi,

2009/10/23 Shawn Ferris :
> Hi All --
>
> I've been trying to troubleshoot a problem with the libgda vapi and I just
> can't figure out where it's coming from.. decided it was time to ask. I'm
> sure this is something stupid, but I can't find it.
>
> The vapi has this:
>
>    public GLib.Value get_value_at (int col, int row) throws GLib.Error;
>
> Which looks good according to the header from libgda. But the generated c
> is:
>
>    GValue _tmp10_;
>    GValue _tmp9_ = {0};
>    _tmp10_ = (gda_data_model_get_value_at (self->res, 1, 1, &_tmp9_,
> &_inner_error_), _tmp9_);
>
> The problem is that &_tmp9_ is being injected into the arguments and I can't
> figure out how to prevent it.  gda_data_model_get_value_at should return the
> value rather then set it through a pointer.
Short answer : I think GLib.Value? should do the trick. (and from
reading the doc, I think it should also be unowned).

Long answer :
I think this has something to do with bug 534781, I don't know about
"the usual way" in the description, but you can find the reason of
this behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=534781

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


Re: [Vala] Vapi help..

2009-10-24 Thread Jan Hudec
On Fri, Oct 23, 2009 at 09:59:06 -0600, Shawn Ferris wrote:
> Hi All --
> 
> I've been trying to troubleshoot a problem with the libgda vapi and I just
> can't figure out where it's coming from.. decided it was time to ask. I'm
> sure this is something stupid, but I can't find it.
> 
> The vapi has this:
> 
> public GLib.Value get_value_at (int col, int row) throws GLib.Error;
> 
> Which looks good according to the header from libgda. But the generated c
> is:
> 
> GValue _tmp10_;
> GValue _tmp9_ = {0};
> _tmp10_ = (gda_data_model_get_value_at (self->res, 1, 1, &_tmp9_,
> &_inner_error_), _tmp9_);
> 
> The problem is that &_tmp9_ is being injected into the arguments and I can't
> figure out how to prevent it.  gda_data_model_get_value_at should return the
> value rather then set it through a pointer.

Hm, gda_data_model_get_value_at's signature is evil.

GValue is normally passed by reference and for that reason it is not
a [SimpleType]. That however means Vala assumes it's returned by reference
too. All GValue-returning functions in glib, gdk and gtk do it that way.
I don't know whether there is any [CCode(...)] attribute to force pass or
return by value.

In fact I think returning it by value is not legal. The type-dependent setter
is free to store it in any way it wants, which could teoretically include
doing it in a location-dependent fashion, which would make copying the memory
in other way than via g_value_copy incorrect.

The code generated by vala is not valid either, since the assignment from
_tmp9_ to _tmp10_ is not valid for precisely the same reason.

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


Re: [Vala] vapi docs

2009-08-08 Thread Frederik
pancake wrote:
> After reading the VAPI reference website I find it useful but missed some
> extra documentation for methods, fields and so on. Because reading the
> website is just the same as reading the vapi file with no extra benefits.

You can click 'edit' on valadoc.org and add the documentation if it's
missing (e.g. take the original documentation and adapt it) - similar to
Wikipedia. Most of glib-2.0 is already documented.

Best Regards,

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


Re: [Vala] .vapi and GPL

2009-02-01 Thread Ed Schouten
* vas...@gmail.com  wrote:
> .vapi files are licensed under LGPL license, but some of them defines
> bindings to kernel api and hence make use of linux headers on stage of
> compiling generated C code which are GPL. does it mean that those
> files also should be licensed under GPL or that one can reduce GPL to
> LGPL since those vapi files are not derived from linux code?

I can't really understand why vapi's of libraries of which we can't be
sure they are GPL are GPL licensed themselves. In my opinion it would
make more sense to use a MIT, X11 or BSD license on, say, the POSIX
vapi.

But I'm not sure this is required. I seem to recall that you are allowed
to use GPL licensed headers/libraries if the API that is implemented is
a default system interface... But IANAL. :-)

-- 
 Ed Schouten 
 WWW: http://80386.nl/


pgpfsoCw02Fn6.pgp
Description: PGP signature
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] .vapi and GPL

2009-02-01 Thread Maciej Piechotka
vas...@gmail.com writes:

> .vapi files are licensed under LGPL license, but some of them defines
> bindings to kernel api and hence make use of linux headers on stage of
> compiling generated C code which are GPL. does it mean that those
> files also should be licensed under GPL or that one can reduce GPL to
> LGPL since those vapi files are not derived from linux code?
>

IANAL but I'd guess that the vapi files are the description of linux
headers - which can be published on any license. But the code which use
them needs to be on GPL. But - as I pointed out - I'm not a specialist
in this area.

Regards
-- 
I've probably left my head... somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)

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


Re: [Vala] VAPI for FreeImage and a question about enums

2009-01-02 Thread Mihail Naydenov
Hi,
It turned out that enums in vala can contain instance methods just like classes.
So I have rewriten part of the freeimage.vapi (that deals with 
FREE_IMAGE_FORMAT enum) 
to make use of this feature, thus making the hole vapi pretty much 100% object 
oriented!

My question is: Is the use of member functions (both instance and static) in an 
enum considered an abuse?

You can download both the vapi and the rewriten samples at the location from my 
previous mail(included below), 
just dw FI_vapi_Dist_rev1.zip insted of FI_vapi_Dist.zip


The interesting part is in enum Format in freeimage.vapi

Any feedback on my question is welcome 

Happy New Year!
MihailNaydenov




From: Mihail Naydenov 
To: vala 
Sent: Monday, December 29, 2008 2:21:32 PM
Subject: [Vala] [ANNOUNCE] VAPI for FreeImage


Here are bindings for FreeImage*.
The package also contains quite a few vala samples, and some images, to test 
FreeImage functionality.

Download

via ftp client:
host: edom-ltd.com
user:  st...@edom-ltd.com
pass:  open
browse to FreeImage directory and download FI_vapi_Dist.zip

via web browser(IE does not work):
ftp://st...@edom-ltd.com:o...@edom-ltd.com/FreeImage/


Note that both the bindings and sample applications are "first release" and 
should be considered preliminary..

MihailNaydenov

*http://freeimage.sourceforge.net/


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


Re: [Vala] VAPI bindings: omit function target argument

2008-12-13 Thread Frederik
Frederik wrote:
> I want to write vapi bindings for a C function that gets passed another
> function as argument:
> 
>   public delegate void HookFunc ();
>   public void set_hook (HookFunc f);
> 
> But the original C function doesn't want a target argument (which Vala
> passes implicitly). I can move its position with
> 
>   public void set_hook ([CCode (delegate_target_pos=...)] HookFunc f);
> 
> but I haven't figured out how to omit it. Is it possible to do that?

My fault, I have to use a /static/ delegate.


Regards,

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


Re: [Vala] [VAPI] define class constructor function

2008-11-29 Thread Ali Sabil
On Sat, Nov 29, 2008 at 3:32 PM, Florian Brosch <[EMAIL PROTECTED]>wrote:

> NewMagickWand should be a static method in vala:
>
>
I don't think so. You should define a creation method instead:
[Compact]
[CCode (cname="MagickWand", free_function="DestroyMagickWand" )]
public class Wand {
[CCode (cname="NewMagickWand")]
public Wand ();
[CCode (cname="MagickGetSize")]
public bool get_size (out ulong width, out ulong height);
}


>
> [Compact]
> [CCode (cname="MagickWand", free_function="DestroyMagickWand" )]
> public class Wand {
> [CCode (cname="NewMagickWand")]
>public static Wand new_magick_wand ();
>
>[CCode (cname="MagickGetSize")]
>public bool get_size(out ulong width, out ulong height);
> }
>
>
> 2008/11/29 fdsdœ Fsfsd <[EMAIL PROTECTED]>:
> > Hi,
> >
> > I'm trying to create a binding to ImageMagick library. I've made a simple
> > vapi file :
> >
> > [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename =
> > "ImageMagick/wand/MagickWand..h")]
> > namespace ImageMagick.Wand {
> >
> > [Compact]
> > [CCode (cname="MagickWand", free_function="DestroyMagickWand" )]
> > public class Wand {
> >
> > [CCode (cname="MagickGetSize")]
> > public bool get_size(out ulong width, out ulong height);
> >
> >
> > }
> > }
> >
> > But, instantiation of MagickWand class is made by function NewMagickWand
> and
> > I don't know how to define this C function as class's constructor.
> >
> > Any help would be great.
> >
> > Thnaks you.
> >
> >
> > ___
> > Vala-list mailing list
> > Vala-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/vala-list
> >
> >
> ___
> Vala-list mailing list
> Vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [VAPI] define class constructor function

2008-11-29 Thread Florian Brosch
NewMagickWand should be a static method in vala:


[Compact]
[CCode (cname="MagickWand", free_function="DestroyMagickWand" )]
public class Wand {
[CCode (cname="NewMagickWand")]
public static Wand new_magick_wand ();

[CCode (cname="MagickGetSize")]
public bool get_size(out ulong width, out ulong height);
}


2008/11/29 fdsdœ Fsfsd <[EMAIL PROTECTED]>:
> Hi,
>
> I'm trying to create a binding to ImageMagick library. I've made a simple
> vapi file :
>
> [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename =
> "ImageMagick/wand/MagickWand..h")]
> namespace ImageMagick.Wand {
>
> [Compact]
> [CCode (cname="MagickWand", free_function="DestroyMagickWand" )]
> public class Wand {
>
> [CCode (cname="MagickGetSize")]
> public bool get_size(out ulong width, out ulong height);
>
>
> }
> }
>
> But, instantiation of MagickWand class is made by function NewMagickWand and
> I don't know how to define this C function as class's constructor.
>
> Any help would be great.
>
> Thnaks you.
>
>
> ___
> Vala-list mailing list
> Vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
>
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] vapi tip

2008-07-18 Thread Sam Liddicott

Daniel Svensson wrote:

On Fri, Jul 18, 2008 at 4:58 PM, Sam Liddicott <[EMAIL PROTECTED]> wrote:
  

you can do:
/usr/bin/valac -C --pkg zlib --pkg gtk+-2.0 --basedir .
src/mainwindow.vala src/api.vapi



However, --pkg api automagically handles dependencies and runs
pkg-config for you, so it's much easier to use in most scenorios.
  
I should have said it was useful for mixed C/vala projects, so that vala 
can generated C code compatible with the existing C which can then all 
be linked together,


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


Re: [Vala] vapi tip

2008-07-18 Thread Daniel Svensson
On Fri, Jul 18, 2008 at 4:58 PM, Sam Liddicott <[EMAIL PROTECTED]> wrote:
> you can do:
> /usr/bin/valac -C --pkg zlib --pkg gtk+-2.0 --basedir .
> src/mainwindow.vala src/api.vapi

However, --pkg api automagically handles dependencies and runs
pkg-config for you, so it's much easier to use in most scenorios.


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


Re: [Vala] VAPI file syntax documented somewhere?

2008-03-26 Thread Daniel Svensson
On Tue, Mar 25, 2008 at 10:54 PM, Jaap A. Haitsma <[EMAIL PROTECTED]> wrote:
>  I'm trying to make  vala bindings for a library not based on gobject.
>  Is there documentation on the syntax of the vapi file I have to create

Not really.. I at least didn't find any either..

>  So far I only found [1], but that only talks about the case when you
>  have a gobject based library

I looked at the bindings that came with vala...

http://svn.gnome.org/viewvc/vala/trunk/vapi/

Here's my non-gobject based bindings:

http://tinyurl.com/yueyls

Also, the people at the IRC channel were very helpful when reading
existing vapi-files weren't enough, or if something seemed confusing.
There's really not much diffrence between non-gobject and gobject
based bindings, it has mostly to do how your API looks like, and how
it works. In my case I had to modify the library I wrote bindings for
a tiny bit to make it a bit more vala-friendly (luckily
abi-compatible), it all depends on what you try to bind.

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


Re: [Vala] VAPI GOBJECT/gtk binding constructions differ

2008-03-25 Thread Jürg Billeter
On Tue, 2008-03-25 at 23:57 +0100, Mikael Hermansson wrote:
> hmm  I have noticed this:
> 
> 
> Gtk.Image a = new Gtk.Image().new_from_file(...)

You probably mean

new Gtk.Image.from_file ()

> then we have
> 
> GLib.File = File().new_for_path(...)

You probably mean

File.new_for_path ()

> Why not use the same rules for all this special constuctions?

The reason GFile is different is that GFile is an interface, not a
class. g_file_new_for_path is not a normal creation method, it's just a
static (factory) method that returns a new instance of a class that
implements GFile.

Jürg

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


Re: [Vala] Vapi for time/localtime

2008-02-09 Thread Mikael Hermansson
check the Glib API at
http://library.gnome.org/devel/glib/stable/glib-Date-and-Time-Functions.html

in vala it will be similar as:

TimeVal tm=GLib.get_current_time();



/

M.H.

On Fri, 2008-02-08 at 23:40 +0100, Andreas Sliwka wrote:
> On Feb 8, 2008 8:06 PM, Mikael Hermansson <[EMAIL PROTECTED]> wrote:
> > Hmm isnt there a glib binding for GTimeVal in vala already. (I havent
> > checked )
> I couldnt find docs on this - any hints?
> 
> mfg

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


Re: [Vala] Vapi for time/localtime

2008-02-09 Thread Clément DAVID
You can check fonctions in the Glib API documentation
[http://library.gnome.org/devel/glib/stable/glib-Date-and-Time-Functions.html]
and there corresponding Vala binding in glib-2.0.vapi file.


2008/2/8, Andreas Sliwka <[EMAIL PROTECTED]>:
> On Feb 8, 2008 8:06 PM, Mikael Hermansson <[EMAIL PROTECTED]> wrote:
> > Hmm isnt there a glib binding for GTimeVal in vala already. (I havent
> > checked )
> I couldnt find docs on this - any hints?
>
> mfg
> ___
> Vala-list mailing list
> Vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vapi for time/localtime

2008-02-08 Thread Andreas Sliwka
On Feb 8, 2008 8:06 PM, Mikael Hermansson <[EMAIL PROTECTED]> wrote:
> Hmm isnt there a glib binding for GTimeVal in vala already. (I havent
> checked )
I couldnt find docs on this - any hints?

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


Re: [Vala] Vapi for time/localtime

2008-02-08 Thread Mikael Hermansson
Hmm isnt there a glib binding for GTimeVal in vala already. (I havent
checked )

If So you can use GLib.get_local_time() and its members se g_time* API
for more info...





On Fri, 2008-02-08 at 11:05 +0100, Andreas Sliwka wrote:
> Greetings,
>   yesterday I wanted to get the current time from time() and
> localtime, found that there is no vapi file for it (at least not on my
> ubuntu 0.1.6 packages), and so I tried to make my own.
> 
> [CCode (cprefix = "", lower_case_cprefix = "",cheader_filename="time.h")]
> namespace Time {
> [CCode (cname="struct tm", cprefix="")]
> public class TimeStruct {
>   [CCode (cname="tm_sec")] public int second;
>   [CCode (cname="tm_min")] public int minute;
>   [CCode (cname="tm_hour")] public int hour;
>   [CCode (cname="tm_mday")] public int day_of_month;
>   [CCode (cname="tm_mon")] public int month;
>   [CCode (cname="tm_year")] public int year;
>   [CCode (cname="tm_wday")] public int day_of_week;
>   [CCode (cname="tm_yday")] public int day_of_year;
>   [CCode (cname="tm_isdst")] public bool daylight_saving_time;
> }
> [CCode (cheader_filename = "time.h")]
> public static int time (pointer int_ref);
> public static weak TimeStruct localtime(ref int time);
> }
> 
> 
> I somehow suceeded, I can call the functions, but I am not totally
> satisfied with what I got so far.
> 
> For one thing, the return type of the time() is not int, but (at
> loeast on ubuntu) a long long, which would be a gint64 in
> . but as far as I can see I can not specify this type
> in vala - or am I overlooking something?
> 
> Secondly the documentation of the GNU localtime says that the returned
> pointer to the struct will always point to the same struct, so one
> should not keep the reference around and expect the structs content to
> stay the same. As a remedy time.h defined the *_r methods which are
> thread safe and write the data into a struct, but the user has to
> manage the struct herself, mallocing and freeing it as necessary. Now,
> how would I write that in a vapi file?
> 
> BTW, I started to write the 97th AnalogClock widget (my personal
> hello-world in any new language), and I really am astonished about how
> easy it is in vala. even while the language feels somehow unfinished,
> and the compiler messages are not always helpful and so on, it is fun.
> Plain simple fun. The compiler is fast, the turnaround is quick, I
> sometimes wondered if valas compile && execute is just as fast as
> python's I-have-to-load-4-Mb-of-this-and-that-code-before-I-handle-yours,
> the code is clean, bla bla, I think I'm getting carried away.
> 
> Best regards,
> 
> mfg
> Best regards,
> ___
> Vala-list mailing list
> Vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list

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