[Vala] vala, glib and zeromq

2019-11-23 Thread Michele Dionisio via vala-list
I don't know if it can be useful but I write few lines of code to easy integrate zeromq in glib mainloop. Source code and examples (not so much) are in https://bitbucket.org/michele_dionisio/easyzmq/ I also write .vapi file and asynchronous function so it is possible to write vala code like:

Re: [Vala] Why is 77 greater than 4294967295?

2018-11-22 Thread Michele Dionisio via vala-list
You are working on an architecture where long and int have the same size. And at the end you compare a long with an unsigned int. The unsigned int is converted to long and the maximum unsigned long is a negative signed long. Il giorno ven 23 nov 2018, 04:34 Jason Martin via vala-list <

[Vala] error in GLib.DataInputStream

2018-01-06 Thread Michele Dionisio
in GLib.DataInputStream the error reported in case of read_line is IOError but this is not true, infact in documentation of glib method g_data_input_stream_read_line () whe have error GError for error reporting. and example of this problem can be reached if you do

[Vala] read_line_utf8, read_line_utf8_async length parameter can be null

2017-06-02 Thread Michele Dionisio
I have create 2 bug in the bug report, one on glib and one on vala https://bugzilla.gnome.org/show_bug.cgi?id=783350 https://bugzilla.gnome.org/show_bug.cgi?id=783351 the main issue is for read_line_utf8_async that for me has to have the same prototype of read_line_async I have double

Re: [Vala] [Announcement] Vala will use GTask for async code instead of GSimpleAsyncResult if --target-glib=2.36 or greater is selected

2016-11-22 Thread michele . dionisio
The problem is not gtask but how vala generate the c code to manage yield. In this moment yield need that the control go back to the mainloop almost one time. Il mer nov 23 02:41:14 2016 GMT+0100, Nor Jaidi Tuah scrive: > > > 1. Treat it as a documentation bug and make it clear async code > >

Re: [Vala] [Announcement] Vala will use GTask for async code instead of GSimpleAsyncResult if --target-glib=2.36 or greater is selected

2016-11-21 Thread Michele Dionisio
I will test it. few weeks ago I post bug: https://bugzilla.gnome.org/show_bug.cgi?id=772084 With patch attached to solve a bug raised calling an sync function that is not really asyncronous (with vala only is not possible to create async code that is not asyncronous, but if vala call C code,

Re: [Vala] Need help in debugging async code

2016-09-27 Thread Michele Dionisio
I'm sorry the url is: https://bugzilla.gnome.org/show_bug.cgi?id=772084 2016-09-27 22:38 GMT+02:00 Michele Dionisio <michele.dioni...@gmail.com>: > I think that now the patch is ok. I have add a bug for that on gnome bugzilla: > https://bugzilla.gnome.org/show_bug.cgi?id=772084

Re: [Vala] Need help in debugging async code

2016-09-27 Thread Michele Dionisio
I think that now the patch is ok. I have add a bug for that on gnome bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=772084 regards 2016-09-24 10:33 GMT+02:00 Nor Jaidi Tuah : > >> now, >> >> _state_in_progress_ is assigned to -1 at beginning >> the check if >> >>

Re: [Vala] Need help in debugging async code

2016-09-24 Thread Michele Dionisio
many thanks for your test and feedback. Now I'will spend more than 2 minutes to make the fix, spending more time understanding and testing. I have undestand exactly way the patch if not working, and everything came from from my mistake undestanding how vala works. for example. When you call

Re: [Vala] Need help in debugging async code

2016-09-24 Thread Michele Dionisio
absolutly not tested my last patch attached that teorically solve all the issue: now, _state_in_progress_ is assigned to -1 at beginning the check if _state_in_progress_ == _state_ is move before the switch to work in any state. Do you think that is good now? 2016-09-24 5:46 GMT+02:00 Nor

Re: [Vala] Need help in debugging async code

2016-09-24 Thread michele . dionisio
Yes state 0 is not safe yet. I have to find -state-in-progress and implement the same check. What do you thinl. It is a good odea to continue to work on it or it is useless? Il sab set 24 05:46:34 2016 GMT+0200, Nor Jaidi Tuah scrive: > If I understand your patch correctly, it would generate >

Re: [Vala] Need help in debugging async code

2016-09-22 Thread michele . dionisio
Vala implement async like in http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html To avoid the limitation of stack usage (and to implement clousure) vala use the heap. Also the state is in the heap. I have only add a check to check if a specific state is already executed. There is no

Re: [Vala] Need help in debugging async code

2016-09-22 Thread Michele Dionisio
Hi all. I have implemented a patch for vala for safe manage situation like the one describe on this discution. The solution to call Idle.add(myfunc.callback) is not good for 2 reason: 1. performance. you go back to the mainloop 2. Idle.add has to have less priority that the function that you have

Re: [Vala] add check lifetime

2016-09-17 Thread Michele Dionisio
I have add bug 'Bug 771594 - check lifetime assigment to unowned and weak reference' on https://bugzilla.gnome.org/show_bug.cgi?id=771594 I have try also to create a patch of 1 of the 2 doungerous scenarious. regards. 2016-09-17 8:46 GMT+02:00 Nor Jaidi Tuah : > On

[Vala] Bug 737913 patch implemented

2016-09-16 Thread Michele Dionisio
Hi all, I have attach a patch for bug Bug 737913 that it seams working. If someone want to make a review or test it I think that it is convinient to merge it to the master Regards Michele ___ vala-list mailing list vala-list@gnome.org

[Vala] Bug 737913 patch implemented

2016-09-16 Thread Michele Dionisio
Hi all, I have attach a patch for bug Bug 737913 that it seams working. If someone want to make a review or test it I think that it is convinient to merge it to the master Regards Michele ___ vala-list mailing list vala-list@gnome.org

[Vala] add check lifetime

2016-09-15 Thread Michele Dionisio
Hi, Sometime can happes to have code like: string lifetime(string a) { { string b = "pippo"; a = b; } stdout.printf (a + "\n"); return a; } void main () { stdout.printf (lifetime("pippo") + "\n"); } or simplier: void main () { unowned string a = "123";

[Vala] regression on commit cbd7b68

2016-04-06 Thread Michele Dionisio
I have created a pull request for a regression of gio-2.0.vapi on commit cbd7b68 https://github.com/GNOME/vala/pull/7 without this patch, the example "UDP Server example" in https://wiki.gnome.org/Projects/Vala/GIONetworkingSample does not build because socket.create_source return type Source

Re: [Vala] Need help in debugging async code

2016-03-19 Thread michele . dionisio
A crash can happes if you call the callback to wakeup before the yield. Are you completly sure that your code is completly asyncrounous in any condition. Il ven mar 18 01:05:05 2016 GMT+0100, Felipe Lavratti scrive: > Hey Marcin, > > Just wondering, > Is your program using threading or any

Re: [Vala] idea for vala performance optimization

2015-11-21 Thread Michele Dionisio
f this can really introduce notable performance benefit. regards 2015-11-21 13:44 GMT+01:00 Al Thomas <astav...@yahoo.co.uk>: > > From: Michele Dionisio <michele.dioni...@gmail.com> > > > Sent: Saturday, 21 November 2015, 9:37 > > Subject: [Vala] idea f

Re: [Vala] bug in glib vapi ????

2015-08-26 Thread Michele Dionisio
ok. bug 754137 created 2015-08-26 17:18 GMT+02:00 Luca Bruno lethalma...@gmail.com: On 25/08/2015 20:11, Michele Dionisio wrote: Hi, I think that the following function: [CCode (cname = g_list_find_custom, simple_generics = true)] public unowned ListG searchT (T data, SearchFuncT,G

[Vala] bug in glib vapi ????

2015-08-25 Thread Michele Dionisio
Hi, I think that the following function: [CCode (cname = g_list_find_custom, simple_generics = true)] public unowned ListG searchT (T data, SearchFuncT,G func); in glib vapi is wrong because the g_list_find_custom documentation says? Finds an element in a GList, using a supplied function to

Re: [Vala] Tokenize_and_fold bug?

2014-11-17 Thread Michele Dionisio
try to define your variable x with [CCode (array_length = false, array_null_terminated = true)] 2014-11-17 5:15 GMT+01:00 Andy Lees andrewl...@gmail.com: Hi, Not sure if I'm doing this wrong, but if I do something like: public static int main(string [] argv) { string[] x; var a =

Re: [Vala] vala cross-compiling

2014-09-16 Thread Michele Dionisio
: unrecognized options: --disable-vapigen Not I'm starting to test only rollingback that checkin. regards 2014-09-16 10:14 GMT+02:00 Luca Bruno lethalma...@gmail.com: On 15/09/2014 14:50, Michele Dionisio wrote: It is not possible any more to cross-compile vala after commit

[Vala] vala cross-compiling

2014-09-15 Thread Michele Dionisio
It is not possible any more to cross-compile vala after commit 797a15747b7c0cb43ea7e13687f1af34f6e14ddf build: Avoid using .. for referencing paths and reorganize valac-calls 7a4f0befbd58286a69367ba78d16187da25724f7build: Make building vapigen non-optional because the builded vala is

[Vala] warning: unreachable code detected

2014-07-30 Thread Michele Dionisio
Hi all, I use quite a log assert_not_reached in my vala code, but I have a lot of warning like: gio-server-async.vala:2838.9-2838.30: warning: unreachable code detected assert_not_reached (); ^^ I already know that the code is not reached, and it is for that

[Vala] box array does not work

2014-07-18 Thread Michele Dionisio
Hi all, I try to defive an object like: Gee.TreeMap uint8[] ?, FileInformation where FileInformation is class. I have boxed uint8[] with ? but I receive fro valac 0.24 the following error error: `uint8[]?' is not a supported generic type argument, use `?' to box value types I think that it

Re: [Vala] box array does not work

2014-07-18 Thread Michele Dionisio
but the message sya that I have to box it. Can you explain me why I cannot box an array? 2014-07-18 11:57 GMT+02:00 Luca Bruno lethalma...@gmail.com: On 18/07/2014 11:51, Michele Dionisio wrote: Hi all, I try to defive an object like: Gee.TreeMap uint8[] ?, FileInformation

Re: [Vala] box array does not work

2014-07-18 Thread Michele Dionisio
many thanks, clear. 2014-07-18 12:29 GMT+02:00 Luca Bruno lethalma...@gmail.com: On 18/07/2014 12:22, Michele Dionisio wrote: but the message sya that I have to box it. The message is wrong. Can you explain me why I cannot box an array? Because arrays in vala carry a length. Use

Re: [Vala] volatile variable

2014-06-11 Thread Michele Dionisio
you can try to create a vapi file with [SimpleType] [IntegerType] [CCode (cname = volatile_int_t, cheader_filename = volatile.h, has_type_id = false)] public struct volatile_int_t { } and a volatile.h with typedef volatile int volatile_int_t 2014-06-11 10:54 GMT+02:00 Nor Jaidi Tuah

Re: [Vala] Memory safety

2014-05-15 Thread Michele Dionisio
do you think that in a code like: void func() { uint64[] output = new uint64[1]; // return callback GLib.Timeout.add( 1000, () = { output[0]=1; return false;

[Vala] --enable-experimental-non-null and GLib.OptionEntry[]

2014-01-07 Thread Michele Dionisio
Hi I'm working not with valac 0.22. building with --enable-experimental-non-null there is no way to define private const GLib.OptionEntry[] options = { // --version { version, 0, 0, OptionArg.NONE, ref version, Display version number, null }, //

Re: [Vala] --enable-experimental-non-null and GLib.OptionEntry[]

2014-01-07 Thread Michele Dionisio
sorry how I can do that? 2014/1/7 Luca Bruno lethalma...@gmail.com On 07/01/2014 15:51, Michele Dionisio wrote: Hi I'm working not with valac 0.22. building with --enable-experimental-non-null there is no way to define private const GLib.OptionEntry[] options

[Vala] object leak in async and closure

2014-01-04 Thread Michele Dionisio
Hi, I'm new in this mailing list and quite new in vala programming. I have a big software that somethime leak objct. Now I have replicate the issue with a small code: class Pippo: Object { public async void

Re: [Vala] object leak in async and closure

2014-01-04 Thread Michele Dionisio
:56 PM, Luca Bruno lethalma...@gmail.com wrote: Please report a bug at bugzilla.gnome.org . So, using o in the lambda seems to be the problem. On Sat, Jan 4, 2014 at 7:39 PM, Michele Dionisio michele.dioni...@gmail.com wrote: Hi, I'm new in this mailing list and quite new in vala programming

Re: [Vala] object leak in async and closure

2014-01-04 Thread Michele Dionisio
Yes it is true, I'm sorry my fault. I'm rying your last fix 2014/1/4 Luca Bruno lethalma...@gmail.com I see destroy pippo with valac-0.22. On Sat, Jan 4, 2014 at 9:28 PM, Michele Dionisio michele.dioni...@gmail.com wrote: I will try, reading the comment on git it seams a problem