Re: [Vala] Iterate in VAPI bindings



Hello,

I guess "Pkg.Repo" represents a single repo, so is it normal that
"Pkg.Repo.repos (out r)" isn't called on every iteration ?

What was the tested condition in the while-loop ?
"while (Pkg.Status.OK == Pkg.Repo.repos (out r))"

Hope it helps.

Le ven. 30 déc. 2016 à 15:24, Olivier Duchateau <duchateau olivier gmail com>
a écrit :

Hi,

I'm trying to write Vala bindings for pkg(8), FreeBSD's packages manager.
But I encounter weird behaviour in while loop.

Currently I try to display name of repositories (FreeBSD and Xfce).

My simple C program [1] works fine (expected result). If I use same while
loop in my Vala program, I get an infinite loop. So I use for loop [2], but
it's only FreeBSD which is displayed. I wonder how to iterate in loop.

Traduction of related pkg_repo* methods is here [3], and corresponding C
[4].

Regards,

[1]
https://bitbucket.org/olivierduchateau/scripts/src/1f34246a6bc9/pkg/repos.c?at=default
[2]
https://bitbucket.org/olivierduchateau/libpkg-vapi/src/cc552a344dac/test.vala?at=default
[3]
https://bitbucket.org/olivierduchateau/libpkg-vapi/src/cc552a344dac/pkg.vapi?at=default&fileviewer=file-view-default#pkg.vapi-146
[4] https://github.com/freebsd/pkg/blob/1.9.4/libpkg/pkg.h.in#L1501

--
olivier
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]