[Vala] Coroutines (was: [ANNOUNCE] Vala 0.5.1 - Compiler for the GObject type system)
On Tue, 04 Nov 2008 00:16:33 -0800, Jürg Billeter wrote: void foo () yields { message (hello); yield; message (world); } void main () { foo.begin (); message (vala); var loop = new MainLoop (null, false); loop.run (); } This will print the messages in the order hello vala world. The yield statement in the method foo() schedules the rest of the method to be run in an idle handler. The invocation of foo() in main using `begin' lets the method return on the first yield instead of waiting for it to finish. This doesen't compile for me: coroutine.c: In function 'foo': coroutine.c:26: error: 'data' undeclared (first use in this function) coroutine.c:26: error: (Each undeclared identifier is reported only once coroutine.c:26: error: for each function it appears in.) coroutine.c:28: warning: 'return' with a value, in function returning void coroutine.c:29: error: case label not within a switch statement error: cc exited with status 256 Compilation failed: 1 error(s), 0 warning(s) Has the (experimental) coroutine syntax changed since then? Or is it broken at the moment? Thanks and regards, Frederik ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] jack binding
Hi I'm sure that someone is already working on them... just so as to minimise duplication of efforts, I attach my attempt. Transport control is missing, but the rest should be complete. Any feedback is greatly appreciated, especially regarding: - how to define a method that takes an array of 2 structs and writes on them - what exactly the difference is between struct, [Compact] class and class... - where to find more documentation about the [directives] thanks, regards alberto -- Alberto Colombo, MSc PhD student at Digital Imaging Research Centre Kingston University, London e-mail: a.colo...@kingston.ac.uk phone: +44 (0)20 8547 8642 http://cism.kingston.ac.uk/people/details.php?AuthorID=925 This email has been scanned for all viruses by the MessageLabs Email Security System.[CCode (lower_case_cprefix = jack_, cheader_filename=jack/jack.h)] namespace Jack{ // note: there are no bindings for deprecated methods public const int MAX_FRAMES; public const int LOAD_INIT_LIMIT; public const string DEFAULT_AUDIO_TYPE; public const string DEFAULT_MIDI_TYPE; [CCode (cname=JackOpenOptions)] public const Options OpenOptions; [CCode (cname=JackLoadOptions)] public const Options LoadOptions; [SimpleType] [CCode (cname=jack_shmsize_t)] public struct ShmSize : int32 {} [SimpleType] [CCode (cname=jack_nframes_t)] public struct NFrames : uint32 {} [SimpleType] [CCode (cname=jack_time_t)] public struct Time : uint64 {} [SimpleType] [CCode (cname=jack_intclient_t, cprefix=jack_internal_client, cheader_filename=jack/intclient.h)] public struct InternalClient : uint64 { public static void close(string name); } [Compact] [CCode (cname=jack_port_t, cprefix=jack_port_)] public class Port { public void* get_buffer(NFrames nframes); public string name(); public string short_name(); public int flags(); public string type(); public bool connected(); public bool connected_to(string name); [CCode (array_null_terminated = true)] [NoArrayLength] public string[] get_connections(); public NFrames get_latency(); public NFrames get_total_latency(); public void set_latency(NFrames nframes); public int set_name(string name); public int set_alias(string alias); public int unset_alias(string alias); public int get_aliases(ref string[2] aliases); public int request_monitor(bool onoff); public int ensure_monitor(bool onoff); public int monitoring_input(); public static int name_size(); public static int type_size(); [CCode (cprefix=JackPort, cname=enum JackPortFlags)] [Flags] public enum Flags{ IsInput, IsOutput, IsPhysical, CanMonitor, IsTerminal } } [Compact] [CCode (cname=jack_client_t, free_function=jack_client_close, cprefix=jack_)] public class Client{ // creation and manipulation [CCode (cname=jack_client_open)] public static Client open(string name, Jack.Options options, out Jack.Status status, ...); [CCode (cname=jack_client_name_size)] public static int get_name_size(); [CCode (cname=jack_get_client_name)] public string get_name(); public int activate(); public int deactivate(); [CCode (cname=jack_client_thread_id)] public GLib.Thread get_thread_id(); // setting callbacks public int set_thread_init_callback(ThreadInitCallback cb); public void on_shutdown(ShutdownFunc f); public int set_process_callback(ProcessCallback cb); public int set_freewheel_callback(FreewheelCallback cb); public int set_buffer_size_callback(BufferSizeCallback cb); public int set_sample_rate_callback(SampleRateCallback cb); public int set_client_registration_callback(ClientRegistrationCallback cb); public int set_port_registration_callback(PortRegistrationCallback cb); public int set_port_connect_callback(PortConnectCallback cb); public int set_graph_order_callback(GraphOrderCallback cb); public int set_xrun_callback(XRunCallback cb); // controlling and querying server operations [CCode (cname=jack_client_create_thread)] public int create_thread(out GLib.Thread thread, int priority, bool realtime, ThreadCallback cb); [CCode (cname=jack_client_real_time_priority)] public int get_real_time_priority(); [CCode (cname=jack_client_max_real_time_priority)] public int get_max_real_time_priority(); public int set_freewheel(bool onoff); public int set_buffer_size(NFrames nframes); public NFrames get_sample_rate(); public NFrames get_buffer_size(); public float
[Vala] Extension Methods
Hi, is there any feature like extension methods from c# 3.0 in vala supported. It would be a cool feature in vala and could allow to write better code. namespace ExtensionMethods { public static class MyExtensions { public static int WordCount(this String str) { return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length; } } } (see http://msdn.microsoft.com/en-us/library/bb383977.aspx) thanks, regards uwe ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Added kill and pid_t to posix.vapi
Curious: What does rank mean? Yu On Wed, 2009-03-04 at 14:15 +0100, Jürg Billeter wrote: On Wed, 2009-03-04 at 13:50 +0100, pancake wrote: mmh, pid_t is not a struct, is an 'int', in which whay do you get the (int) value of this empty struct? I would rather prefer to do it in another way to allow vala use the 'int' nature of the pid_t type for conversions between numbers, strings and process-id's. The IntegerType attribute should help us here: [IntegerType (rank = 6)] Jürg ___ 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] jack binding
Here is my jack.vapi, that I use in http://www.hans-baier.de/wordpress/jackpanel http://repo.or.cz/w/jackpanel.git?a=blob;f=jack.vapi;hb=HEAD Sincerely, Hans ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Fwd: jack binding
-- Forwarded message -- From: Hans Baier hansfba...@googlemail.com Date: 2009/3/6 Subject: Re: [Vala] jack binding To: Alberto Colombo a.colo...@kingston.ac.uk 2009/3/6 Hans Baier hansfba...@googlemail.com: Here is my jack.vapi, that I use in http://www.hans-baier.de/wordpress/jackpanel http://repo.or.cz/w/jackpanel.git?a=blob;f=jack.vapi;hb=HEAD Sincerely, Hans I must admit mine is a bit hackish and more plain C-style, but If your one works, then I will use it too, since it is much more elegant. Hans ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Added kill and pid_t to posix.vapi
Added the IntegerType descriptor. Can we apply the attached patch then? Cheers, -- :M: From 64dba8143862518d7979af4dacdc4258c9cdc3a6 Mon Sep 17 00:00:00 2001 From: Hans Baier hansfba...@googlemail.com Date: Fri, 6 Mar 2009 01:38:41 +0100 Subject: [PATCH] posix.vapi: add pid_t and kill Signed-off-by: Hans Baier hansfba...@googlemail.com --- vapi/posix.vapi |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/vapi/posix.vapi b/vapi/posix.vapi index 3418038..5c87f00 100644 --- a/vapi/posix.vapi +++ b/vapi/posix.vapi @@ -355,6 +355,14 @@ namespace Posix { [CCode (cheader_filename = signal.h)] public const int SIGSTKFLT; + [SimpleType] + [IntegerType (rank = 6)] + [CCode (cname = pid_t, default_value = 0, cheader_filename = sys/types.h)] + public struct pid_t { + } + [CCode (cheader_filename = signal.h)] + public int kill (pid_t pid, int signum); + public static delegate void sighandler_t (int signal); [CCode (cheader_filename = signal.h)] -- 1.5.6.3 ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Added kill and pid_t to posix.vapi
2009/3/6 Michael 'Mickey' Lauer mic...@vanille-media.de: Added the IntegerType descriptor. Can we apply the attached patch then? Maybe you could consider altering glib.vapi too, because there, Pid is defined as: [SimpleType] [CCode (default_value = 0)] public struct Pid { } Hans ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list