Re: [Vala] Confusing issue with static struct method: too many arguments to function

2018-01-22 Thread Al Thomas via vala-list
   > On Monday, 22 January 2018, 22:00:19 GMT, Michael Murphy 
 wrote:  > I have the following which is automatically 
generated by bindgen.

Would that be vala-gen-introspect ? That's a bit of an old tool. I'm not sure 
how well it fares, butmay be a good starting point for a hand written bindings.

>    [CCode (has_type_id = false)]
>   public struct Sector {
>        public static Sector megabyte (uint64 value);
>    }

If this is a named initializer then you want:
public Sector.megabyte (uint64 value);

An initializer of a struct is similar to a constructor of an object. 

> distinst_sector_megabyte ((guint64) 512, &_tmp39_);

My working assumption would be the return value, Sector, has been converted to 
an outparameter. I've not looked in to the reasoning for that.
Hope that helps,
Al
  
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Confusing issue with static struct method: too many arguments to function

2018-01-22 Thread Michael Murphy
I have the following which is automatically generated by bindgen.

```c
DistinstSector distinst_sector_megabyte(uint64_t value);
```

And I have this defined in the accompanying vapi file.

```vala
[CCode (has_type_id = false)]
public struct Sector {
SectorKind flag;
uint64 value;

public static Sector start ();
public static Sector end ();
public static Sector unit (uint64 value);
public static Sector megabyte (uint64 value);
}
```

I'm attempting to use this within Vala like so

```vala
var end = disk.get_sector (Sector.megabyte (512));
```

But I am getting this error message

```
error: too many arguments to function ‘distinst_sector_megabyte’
```

And the generated C from Vala's compiler is inserting an extra argument.
```
distinst_sector_megabyte ((guint64) 512, &_tmp39_);
```

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


Re: [Vala] Books and Guides for VALA-GTK-Networking Development

2018-01-22 Thread Ulink
Hi Hans,

try
https://wiki.gnome.org/Projects/Vala/GIONetworkingSample

or basically

https://wiki.gnome.org/Projects/Vala/Documentation (below "Sample Code")

and of course Valadoc

https://valadoc.org/gio-2.0/GLib.SocketClient.html
https://valadoc.org/gio-2.0/GLib.SocketService.html
https://valadoc.org/gio-2.0/GLib.ThreadedSocketService.html
https://valadoc.org/gio-2.0/GLib.SocketListener.html
https://valadoc.org/gio-2.0/GLib.Socket.html


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


[Vala] Books and Guides for VALA-GTK-Networking Development

2018-01-22 Thread Hans Schueren
Hallo vala-list,

may i ask for more informations about actual books and tutorials

for software programming in

VALA

in combination with GTK and networking (TCP-SMTP)  etc.   perhaps GIO


What are the best Tutorials to learn from ?


Best Regards
MHE


Hans Schueren
---
werb...@hans-schueren.de
22.01.2018 
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list