guile-gtk-general
[Top][All Lists]
Advanced

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

Re: (in)stability / parallel installs / platform-2.7.93


From: Jan Nieuwenhuizen
Subject: Re: (in)stability / parallel installs / platform-2.7.93
Date: Wed, 27 Oct 2004 14:20:04 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Andy Wingo writes:

> The bits about strict stability scared me at first. I mean, we don't
> have a stable product, and I don't see a time in the future when we can
> call it stable.

Do we have a policy for handling &multiple &returns from a function?
In my patch wrapper fro g_io_channel_read_line, I return a list,
combining GIOStatus and &line, and ignoring GError (see below

    +  result = g_io_channel_read_line (channel, &line, NULL, NULL, NULL);
    +
    +  return scm_list_2 (scm_long2num (result), scm_makfrom0str (line));


> http://download.gna.org/guile-gnome/releases/guile-gnome-platform-2.7.93.tar.gz

I can't commit to gna yet, maybe you can include my patch for the next
release?  I also like to wrap gtk-menu-popup to allow menu positioning
function.

Jan.



* looking for address@hidden/glib--janneke--0--patch-1 to compare with
* build pristine tree for address@hidden/glib--janneke--0--patch-1
* from archive cached: address@hidden/glib--janneke--0--patch-1
* comparing to address@hidden/glib--janneke--0--patch-1
A  examples/.arch-ids/fifo.scm.id
A  examples/fifo.scm
A  {arch}/glib/glib--janneke/glib--janneke--0/address@hidden/patch-log/patch-2
M  ChangeLog
M  gnome/gw/glib-support.h
M  gnome/overrides/glib.defs
M  gnome/gw/Makefile.am
M  gnome/gw/glib-support.c

* modified files

--- orig/ChangeLog
+++ mod/ChangeLog
@@ -1,3 +1,17 @@
+2004-10-22  Jan Nieuwenhuizen  <address@hidden>
+
+       * examples/fifo.scm: New file.
+
+       * gnome/gw/glib-support.c (_wrap_g_io_add_watch): New wrapper.
+
+       * gnome/overrides/glib.defs (g_io_channel_read_line): New override.
+
+2004-10-21  Jan Nieuwenhuizen  <address@hidden>
+
+       * gnome/gw/glib-support.c (_wrap_g_io_add_watch): New wrapper.
+
+       * gnome/overrides/glib.defs (g_io_add_watch): New override.
+
 2004-10-12  Andreas Rottmann  <address@hidden>
 
        * shlib-dirs.ac: New file, to be used by dev-environ.


--- orig/gnome/gw/Makefile.am
+++ mod/gnome/gw/Makefile.am
@@ -29,9 +29,10 @@
 
 nodist_libgw_guile_gnome_gobject_la_SOURCES = guile-gnome-gw-gobject.c
 libgw_guile_gnome_gobject_la_CFLAGS = -I$(srcdir)/../gobject -I../gobject \
-        $(AM_CFLAGS) $(GOBJECT_CFLAGS) $(GUILE_CFLAGS) $(G_WRAP_CFLAGS)
+        $(AM_CFLAGS) $(GOBJECT_CFLAGS) $(GUILE_CFLAGS) $(G_WRAP_CFLAGS) \
+       $(GUILE_GLIB_CFLAGS)
 libgw_guile_gnome_gobject_la_LIBADD = $(G_WRAP_LIBS) $(GOBJECT_LIBS) \
-       $(GUILE_LIBS) \
+       $(GUILE_LIBS) $(GUILE_GLIB_LIBS) \
         ../gobject/libguile-gnome-gobject.la
 libgw_guile_gnome_gobject_la_LDFLAGS = -module
 
@@ -42,9 +43,10 @@
 nodist_libgw_guile_gnome_glib_la_SOURCES = guile-gnome-gw-glib.c
 libgw_guile_gnome_glib_la_SOURCES = glib-support.c
 libgw_guile_gnome_glib_la_CFLAGS = \
-       $(AM_CFLAGS) $(GLIB_CFLAGS) $(GUILE_CFLAGS) $(G_WRAP_CFLAGS)
+       $(AM_CFLAGS) $(GLIB_CFLAGS) $(GUILE_CFLAGS) $(G_WRAP_CFLAGS) \
+       $(GUILE_GLIB_CFLAGS)
 libgw_guile_gnome_glib_la_LIBADD = $(GLIB_LIBS) $(GUILE_LIBS) \
-       $(G_WRAP_LIBS)
+       $(G_WRAP_LIBS) $(GUILE_GLIB_LIBS)
 libgw_guile_gnome_glib_la_LDFLAGS = -module
 
 BUILT_SOURCES = \


--- orig/gnome/gw/glib-support.c
+++ mod/gnome/gw/glib-support.c
@@ -1,5 +1,6 @@
 /* guile-gnome
  * Copyright (C) 2003,2004 Andy Wingo <wingo at pobox dot com>
+ *              2004 Jan Nieuwenhuizen <address@hidden>
  *
  * glib-support.c: Support routines for the GLib wrapper
  *
@@ -21,6 +22,7 @@
  * Boston, MA  02111-1307,  USA       address@hidden
  */
 
+#include <g-wrap-wct.h>
 #include "glib-support.h"
 
 #define GRUNTIME_ERROR(format, func_name, args...) \
@@ -99,3 +101,49 @@
 {
   return scm_mem2string (str->str, str->len);
 }
+
+static gboolean
+g_io_func (GIOChannel *source,
+          GIOCondition condition,
+          gpointer data)
+{
+  SCM proc;
+  SCM result;
+
+  proc = SCM_PACK (GPOINTER_TO_INT (data));
+  result = scm_call_2 (proc,
+#if 0 /* GIOChannel is not wrapped, assimilate by hand, says Andy -- jcn */    
               
+                      scm_c_gtype_instance_to_scm ((GTypeInstance*) source),
+#else                 
+                      gw_wcp_assimilate_ptr (source, SCM_VARIABLE_REF 
(scm_c_lookup ("<gio-channel*>"))),
+#endif
+                      scm_long2num (condition));
+  return result == SCM_BOOL_T;
+}
+
+guint
+_wrap_g_io_add_watch (GIOChannel *channel,
+                     GIOCondition condition,
+                     SCM func)
+#define FUNC_NAME "g-io-add-watch"
+{
+  SCM_VALIDATE_PROC (3, func);
+  return g_io_add_watch (channel,
+                        condition,
+                        ((GIOFunc) (g_io_func)),
+                        GINT_TO_POINTER (SCM_UNPACK (func)));
+}
+#undef FUNC_NAME
+
+SCM
+_wrap_g_io_channel_read_line (GIOChannel *channel)
+#define FUNC_NAME "g-io-channel-read-line"
+{
+  gchar *line;
+  GIOStatus result;
+
+  result = g_io_channel_read_line (channel, &line, NULL, NULL, NULL);
+
+  return scm_list_2 (scm_long2num (result), scm_makfrom0str (line));
+}
+#undef FUNC_NAME


--- orig/gnome/gw/glib-support.h
+++ mod/gnome/gw/glib-support.h
@@ -26,12 +26,15 @@
 
 #include <glib.h>
 #include <libguile.h>
+#include "guile-gnome-gobject.h"
 
 G_BEGIN_DECLS
 
 void scm_init_glib (void);
 void _wrap_g_main_loop_run (GMainLoop *loop);
 SCM  _wrap_g_string_get_str (GString *str);
+guint _wrap_g_io_add_watch (GIOChannel *channel, GIOCondition condition, SCM 
func);
+SCM _wrap_g_io_channel_read_line (GIOChannel *channel);
 
 G_END_DECLS
 


--- orig/gnome/overrides/glib.defs
+++ mod/gnome/overrides/glib.defs
@@ -37,6 +37,22 @@
   (c-name "_wrap_g_string_get_str")
   (return-type "SCM"))
 
+(define-function g_io_add_watch
+  (c-name "_wrap_g_io_add_watch")
+  (overrides "g_io_add_watch")
+  (return-type "gboolean")
+  (parameters
+    '("GIOChannel*" "channel")
+    '("GIOCondition" "condition")
+    '("SCM" "func")))
+
+(define-function g_io_channel_read_line
+  (c-name "_wrap_g_io_channel_read_line")
+  (overrides "g_io_channel_read_line")
+  (return-type "SCM") ;; (list GIOStatus line)
+  (parameters
+    '("GIOChannel*" "channel")))
+
 (ignore-glob  "_*"
               "*_copy"
               "*_newv"
@@ -49,6 +65,8 @@
               "g_timeout_remove*"
               "g_idle_add*"
               "g_idle_remove*"
+              "g_io_add_watch"
+              "g_io_channel_read_line"
               "g_error_*"
               "g_child_watch_add*"
               "g_parse_debug_string"



* added files

--- /dev/null
+++ 
/home/janneke/arch/gg-pristine/src/glib/,,address@hidden/new-files-archive/./examples/.arch-ids/fifo.scm.id
@@ -0,0 +1 @@
+Jan Nieuwenhuizen <address@hidden> Fri Oct 22 15:24:40 2004 5956.0
--- /dev/null
+++ 
/home/janneke/arch/gg-pristine/src/glib/,,address@hidden/new-files-archive/./examples/fifo.scm
@@ -0,0 +1,66 @@
+#! /usr/bin/guile -s
+!#
+;; guile-gnome
+;; Copyright (C) 2004 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or    
+;; modify it under the terms of the GNU General Public License as   
+;; published by the Free Software Foundation; either version 2 of   
+;; the License, or (at your option) any later version.              
+;;                                                                  
+;; This program is distributed in the hope that it will be useful,  
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of   
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
+;; GNU General Public License for more details.                     
+;;                                                                  
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, contact:
+;;
+;; Free Software Foundation           Voice:  +1-617-542-5942
+;; 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
+;; Boston, MA  02111-1307,  USA       address@hidden
+
+(debug-enable 'debug)
+(debug-enable 'backtrace)
+
+(use-modules (gnome gtk))
+
+(define FIFO (tmpnam))
+
+(define (stderr string . rest)
+  (apply format (current-error-port) string rest)
+  (force-output (current-error-port)))
+
+(define (stderr string . rest)
+  (apply format (cons (current-error-port) (cons string rest)))
+  (force-output (current-error-port)))
+
+(define (fifo-callback source condition)
+  (stderr "FIFO\n")
+  (let* ((result (g-io-channel-read-line source))
+        (status (car result))
+        (line (cadr result)))
+    (stderr "result: ~S\n" result)
+    (if (equal? line "exit\n")
+       (gtk-main-quit)))
+  #t)
+
+(define (talk)
+  (sleep 1)
+  (let ((fifo (open-file FIFO "w")))
+    (display "Do you read me?\n" fifo)
+    (system (string-append "echo Do you read me>" FIFO))
+    (sleep 2)
+    (display "exit\n" fifo)
+    (system (string-append "echo exit >" FIFO))))
+        
+(define (main)
+  (mknod FIFO 'fifo #o600 0)
+  (if (= 0 (primitive-fork))
+      (talk))
+  (g-io-add-watch (g-io-channel-new-file FIFO) 'in fifo-callback)
+  (gtk-main)
+  (delete-file FIFO))
+
+(main)
+
--- /dev/null
+++ 
/home/janneke/arch/gg-pristine/src/glib/,,address@hidden/new-files-archive/./{arch}/glib/glib--janneke/glib--janneke--0/address@hidden/patch-log/patch-2
@@ -0,0 +1,27 @@
+Revision: glib--janneke--0--patch-2
+Archive: address@hidden
+Creator: Jan Nieuwenhuizen <address@hidden>
+Date: Fri Oct 22 15:24:45 CEST 2004
+Standard-date: 2004-10-22 13:24:45 GMT
+New-files: examples/.arch-ids/fifo.scm.id examples/fifo.scm
+Modified-files: ChangeLog gnome/gw/Makefile.am
+    gnome/gw/glib-support.c gnome/gw/glib-support.h
+    gnome/overrides/glib.defs
+New-patches: address@hidden/glib--janneke--0--patch-2
+Summary: wrap g_io_add_watch and g_io_channel_read_line
+Keywords: 
+
+2004-10-22  Jan Nieuwenhuizen  <address@hidden>
+
+       * examples/fifo.scm: New file.
+
+       * gnome/gw/glib-support.c (_wrap_g_io_add_watch): New wrapper.
+
+       * gnome/overrides/glib.defs (g_io_channel_read_line): New override.
+
+2004-10-21  Jan Nieuwenhuizen  <address@hidden>
+
+       * gnome/gw/glib-support.c (_wrap_g_io_add_watch): New wrapper.
+
+       * gnome/overrides/glib.defs (g_io_add_watch): New override.
+



-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]