[Vala] Posix.lstat problems

2011-11-07 Thread Leon Bogaert
I've got this piece of code:

using Posix;

int fuseguifs_getattr(string path, Posix.Stat *stbuf)
{
int res;
res = Posix.lstat(path, stbuf);
if (res == -1)
return -Posix.errno;

return 0;
}

static int main(string [] args)
{
Posix.Stat *a;
fuseguifs_getattr(/home/leon, a);
return 0;
}

When I'm trying to compile it I get this error:
test.vala:6.26-6.30: error: Argument 2: Cannot convert from
`Posix.Stat' to `Posix.Stat*'
res = Posix.lstat(path, stbuf);
^
Compilation failed: 1 error(s), 0 warning(s)

I've tried changing this:
fuseguifs_getattr(/home/leon, a);
to
fuseguifs_getattr(/home/leon, *a);

But then I get an error: Cannot pass value to reference or output
parameter

I've tried adding out:
res = Posix.lstat(path, out *stbuf);

That gives this error:
error: ref and out method arguments can only be used with fields,
parameters, local variables, and array element access

I can't change the fuseguifs_getattr method parameters because that's
part of how the fuse bindings expect it.

I'm really stuck. Does anyone how I can solve this?

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


Re: [Vala] How to generate inline C functions?

2011-11-07 Thread Tal Hadad

 Is there any CCode attribute to make the generated C function inline?
 Or, is it possible to generate C macros instead of functions with vala?

 For example:
 class Test {
   inline public void func1() {
   }Vala tutorial sadly doesn't say a word about it, but it shell look 
 like:public inline void func1() {}This onw works currently in vala.   [Macro]
   public void func2() {
   }
 }
 
This is sound a great feature request.But I would like that the macro could 
also not be function-like, butalso be able to define functon,  varibles, 
...(i.e. full featured CMacro).
 
 Another question is, is it possible to use bit-field in vala classes?
 Like this:
 class Test {
   private bool b1 : 1;
   private bool b2 : 1;
   private bool b3 : 1;
   private uint i1 : 4;
 }
Good feature request.Tal  ___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] research papers

2011-11-07 Thread august


Hi,

I'm looking for research papers on Vala, GObject, or related
technologies, but I can't seem to find anything on google scholar.

Do they exist?

thanks -august.

-- 
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952

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


Re: [Vala] How to generate inline C functions?

2011-11-07 Thread Luca Bruno
2011/11/7 Tal Hadad tal...@hotmail.com


  Is there any CCode attribute to make the generated C function inline?
  Or, is it possible to generate C macros instead of functions with vala?
 
  For example:
  class Test {
inline public void func1() {
}Vala tutorial sadly doesn't say a word about it, but it shell look
 like:public inline void func1() {}This onw works currently in vala.
 [Macro]
public void func2() {
}
  }

 This is sound a great feature request.But I would like that the macro
 could also not be function-like, butalso be able to define functon,
  varibles, ...(i.e. full featured CMacro).


Vala produces static functions when possible, and gcc inlines them when
possible. So this is feature is already there.

 Another question is, is it possible to use bit-field in vala classes?
  Like this:
  class Test {
private bool b1 : 1;
private bool b2 : 1;
private bool b3 : 1;
private uint i1 : 4;
  }


It's not possible. This is something that could be trivially implemented
using a CCode argument like [CCode (bitfield = 1)] or such, without adding
new syntax.
If you have a good use case, you can request the feature at
bugzilla.gnome.org .

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


[Vala] get the fg, bg colors

2011-11-07 Thread rastersoft

Hi all:

I've been trying to get the RC info from a window, to be able to 
replicate the background color of an iconview in other parts with Cairo, 
but I've been unable to do it. I always receive a core dump. How can I 
get access to it? (foreground color, background color, text color, and 
so on).


Thanks.

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


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


[Vala] Multiple Namespace problem

2011-11-07 Thread Daniel Espinosa
I'm seeing at GXml project (http://git.gnome.org/browse/gxml), and I
found that it uses two Namespaces to define its classes. But GXml
namespace don't have any class defined (yet), I suppose will be used
to define new modules after DOM is finished (may be XSD or others).
But when I try to generate GIR and typelib files, it tries to include
GXml module from outside (and doesn't exists of course) and Dom is
located inside GXml namespace. The next example generate a GIR file
but refuse to create typelib because GXml include fails.

Is this the expected behavior or what is the better to do on Multiple
and incomplete namespaces?


This is an example:

[CCode (gir_namespace=GXml, gir_version=1.0)]
namespace GXml {
[CCode (gir_namespace=GXml, gir_version=1.0)]
namespace Dom {
public class Node : GLib.Object {
public void foo() {
stdout.printf(Node.foo()\n);
}
}

public class Attr : Node {
public new void foo () {
stdout.printf(Attr.foo());
}
}
}
}
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Multiple Namespace problem

2011-11-07 Thread Alexandre Rosenfeld
I believe the problem you have there is that you have nested namespaces and
there was a discussion sometime ago which said that GIR doesn't support it,
although I don't know if specifying the gir namespace should avoid it.
At that discussion (it's Support for custom attribute
introspection/reflection? if you want to search for it) they pointed to
this bug https://bugzilla.gnome.org/show_bug.cgi?id=576327

I believe that is your issue, but I'm no expert, I just found your problem
familiar.

Regards

On Mon, Nov 7, 2011 at 23:09, Daniel Espinosa eso...@gmail.com wrote:

 I'm seeing at GXml project (http://git.gnome.org/browse/gxml), and I
 found that it uses two Namespaces to define its classes. But GXml
 namespace don't have any class defined (yet), I suppose will be used
 to define new modules after DOM is finished (may be XSD or others).
 But when I try to generate GIR and typelib files, it tries to include
 GXml module from outside (and doesn't exists of course) and Dom is
 located inside GXml namespace. The next example generate a GIR file
 but refuse to create typelib because GXml include fails.

 Is this the expected behavior or what is the better to do on Multiple
 and incomplete namespaces?


 This is an example:

 [CCode (gir_namespace=GXml, gir_version=1.0)]
 namespace GXml {
[CCode (gir_namespace=GXml, gir_version=1.0)]
namespace Dom {
public class Node : GLib.Object {
public void foo() {
stdout.printf(Node.foo()\n);
}
}

public class Attr : Node {
public new void foo () {
stdout.printf(Attr.foo());
}
}
}
 }
 ___
 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] How to generate inline C functions?

2011-11-07 Thread pancake
Hi

On 07/11/2011, at 20:58, Luca Bruno lethalma...@gmail.com wrote:

 2011/11/7 Tal Hadad tal...@hotmail.com
 
 
 Is there any CCode attribute to make the generated C function inline?
 Or, is it possible to generate C macros instead of functions with vala?
 
 For example:
 class Test {
  inline public void func1() {
  }Vala tutorial sadly doesn't say a word about it, but it shell look
 like:public inline void func1() {}This onw works currently in vala.
 [Macro]
  public void func2() {
  }
 }
 
 This is sound a great feature request.But I would like that the macro
 could also not be function-like, butalso be able to define functon,
 varibles, ...(i.e. full featured CMacro).
 
 
 Vala produces static functions when possible, and gcc inlines them when
 possible. So this is feature is already there.
 

I thought inline was already supported keyword in the past..

A way to do this is by using ccode or a define in a .h

But to be sincere... Inline is a premature optimization... Something like 
register does. They are properly used by the compiler optimization correctly, 
so users should not use them.

It's different case for 'volatile' do vala supports this? Maybe we could add a 
ccode directive like cname, but to be appended before the return type.

[CCode (ctype=inline)]
int foo() {...

This way we can let the user do those tricks without messing the syntax with 
stuff 99% users will missuse.

Functions defined in Macros should be forbidden by the compiler. They just mess 
the code and the debuggers use to fail when stepping into them. Lines of code 
loss their sense and can result on weird compiler errors.


 Another question is, is it possible to use bit-field in vala classes?
 Like this:
 class Test {
  private bool b1 : 1;
  private bool b2 : 1;
  private bool b3 : 1;
  private uint i1 : 4;
 }
 
 
 It's not possible. This is something that could be trivially implemented
 using a CCode argument like [CCode (bitfield = 1)] or such, without adding
 new syntax.
 If you have a good use case, you can request the feature at
 bugzilla.gnome.org .
 

I remembee this was discussed some years ago and it was rejected because 
implementation depends on C compiler and architecture.

Bitfields are not portable. And vala code aims to be coherent everywhere. 

If you want bitfields use a .h and a .vapi defining such struct. You will 
probably then need some ifdef tuning depending on the endian of the target 
platform.

 -- 
 www.debian.org - The Universal Operating System
 ___
 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