Re: libseed-list watching stdin
- From: "Alan Knowles" <alan akbkhome com>
- To: "Jonatan Liljedahl" <libseed-list-bounces gnome org>
- Cc: libseed-list gnome org
- Subject: Re: libseed-list watching stdin
- Date: Mon, 28 Jun 2010 12:18:53 +0800
Finally got time to look at this.
This is an example using the old API - the one you are using.
http://git.akbkhome.com/?p=gitlive;a=blob;f=Spawn.js
The new API has changed (most of the methods have moved into GLib.IOChannel
http://devel.akbkhome.com/seed/GLib.IOChannel.html
For some of this to work, we need support for byte arrays using the new introspection array syntax. - those methods also need correct introspection hints.
Regards
Alan
--- On 24/Jun/2010, Jonatan Liljedahl wrote:
> This worked:
>
> GLib.io_add_watch(stdin, 0, GLib.IOCondition.IN, watch_func);
>
> And I had to use GString as buffer when reading:
>
> var linebuf = new GLib.String;
> var codebuf = "";
> var watch = function(source, condition, data) {
> GLib.io_channel_read_line_string(source, linebuf);
> codebuf += linebuf.str;
> ....
> return true;
> }
>
> It would be nice if also the other read-functions worked, those who take
> a gchar pointer. How does Seed handle pointer-arguments?
>
> Also, why does some stuff work in OOP style and some not? I created the
> GString with "new GLib.String", but it doesn't seem to have any methods.
> The IOChannel is created with GLib.io_channel_unix_new(), since "new
> GLib.IOChannel" can't pass any filedescriptor. And the returned
> IOChannel doesn't have any methods either. Is this because both are only
> GLib and not GObject?
>
> /Jonatan
>
> Jonatan Liljedahl wrote:
> > What's the simplest way to have a watcher on stdin?
> >
> > I tried something like
> > GLib.io_channel_add_watch(GLib.io_channel_unix_new(1),1,my_func) but get
> > "ConversionError Can not convert Javascript value to long".
> >
> > /Jonatan
> >
> > _______________________________________________
> > libseed-list mailing list
> > libseed-list gnome org
> > http://mail.gnome.org/mailman/listinfo/libseed-list
>
> _______________________________________________
> libseed-list mailing list
> libseed-list gnome org
> http://mail.gnome.org/mailman/listinfo/libseed-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]