You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(68) |
Aug
(4) |
Sep
|
Oct
(23) |
Nov
(95) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
(51) |
May
(81) |
Jun
(2) |
Jul
(86) |
Aug
(143) |
Sep
(3) |
Oct
(31) |
Nov
(63) |
Dec
(90) |
2005 |
Jan
(277) |
Feb
(157) |
Mar
(99) |
Apr
(195) |
May
(151) |
Jun
(148) |
Jul
(98) |
Aug
(123) |
Sep
(20) |
Oct
(174) |
Nov
(155) |
Dec
(26) |
2006 |
Jan
(51) |
Feb
(19) |
Mar
(16) |
Apr
(12) |
May
(5) |
Jun
|
Jul
(11) |
Aug
(7) |
Sep
(10) |
Oct
(31) |
Nov
(174) |
Dec
(56) |
2007 |
Jan
(45) |
Feb
(52) |
Mar
(10) |
Apr
(5) |
May
(47) |
Jun
(16) |
Jul
(80) |
Aug
(29) |
Sep
(14) |
Oct
(59) |
Nov
(46) |
Dec
(16) |
2008 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
(49) |
Jun
(26) |
Jul
(8) |
Aug
(4) |
Sep
(25) |
Oct
(53) |
Nov
(9) |
Dec
(1) |
2009 |
Jan
(66) |
Feb
(11) |
Mar
(1) |
Apr
(14) |
May
(8) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(9) |
Oct
(23) |
Nov
(35) |
Dec
|
2010 |
Jan
(7) |
Feb
(2) |
Mar
(39) |
Apr
(19) |
May
(161) |
Jun
(19) |
Jul
(32) |
Aug
(65) |
Sep
(113) |
Oct
(120) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
(5) |
Mar
(4) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(12) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(17) |
Mar
(4) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(8) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Jens-Ulrik P. <ju...@us...> - 2004-07-27 08:20:30
|
Update of /cvsroot/gtk2hs/gtk2hs/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7571/doc Modified Files: Makefile Log Message: Use common.mk and EXTRA_TARFILES, drop own tarsource target and no longer set CURDIR and TARDIR. tarsource then works correctly again. Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/doc/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile 23 May 2003 01:01:25 -0000 1.7 +++ Makefile 27 Jul 2004 08:20:21 -0000 1.8 @@ -1,10 +1,6 @@ TOP = .. HERE = doc/ -# directories of interest -CURDIR = $(shell $(PWD)) -TARDIR = $(subst $(TOP),$(TARNAME),$(CURDIR))/ - include $(TOP)/mk/config.mk EMPTY = @@ -73,6 +69,6 @@ rm -rf MOGUL GTK rm -f referenceGTK.xml referenceMOGUL.xml -tarsource : - $(strip $(TAR) rf $(TOP)/$(TARNAME).tar -C $(TOP) \ - $(addprefix $(TARDIR), Makefile gtk2hs.xml mogul.xml)) +EXTRA_TARFILES += gtk2hs.xml mogul.xml + +include $(TOP)/mk/common.mk |
From: Jens-Ulrik P. <ju...@us...> - 2004-07-27 08:10:50
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6062 Modified Files: VERSION Log Message: Up to 0.9.5.50 Index: VERSION =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/VERSION,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VERSION 17 Apr 2004 13:19:46 -0000 1.7 +++ VERSION 27 Jul 2004 08:10:40 -0000 1.8 @@ -1 +1 @@ -0.9.5 +0.9.5.50 |
From: Axel S. <as...@us...> - 2004-07-26 16:12:54
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5643 Modified Files: ChangeLog Log Message: Do not include Gtk 2.4 function in a Gtk 2.2 build. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.184 retrieving revision 1.185 diff -u -d -r1.184 -r1.185 --- ChangeLog 26 Jul 2004 15:24:24 -0000 1.184 +++ ChangeLog 26 Jul 2004 16:12:43 -0000 1.185 @@ -1,3 +1,8 @@ +2004-07-26 Axel Simon <A....@ke...> + + * gtk/abstract/ButtonBox.chs: Remove buttonBoxGetChildSecondary + for Gtk prior to 2.4. + 2004-07-26 Duncan Coutts <du...@co...> * configure.in: use relative $(TOP) variable rather than absolute $TOP |
From: Axel S. <as...@us...> - 2004-07-26 16:12:54
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/abstract In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5643/gtk/abstract Modified Files: ButtonBox.chs Log Message: Do not include Gtk 2.4 function in a Gtk 2.2 build. Index: ButtonBox.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/abstract/ButtonBox.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ButtonBox.chs 23 May 2004 15:46:02 -0000 1.2 +++ ButtonBox.chs 26 Jul 2004 16:12:43 -0000 1.3 @@ -1,3 +1,4 @@ +{-# OPTIONS -cpp #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget ButtonBox -- @@ -21,6 +22,7 @@ -- -- | -- +#include<gtk/gtkversion.h> module ButtonBox( ButtonBox, @@ -29,7 +31,9 @@ buttonBoxGetLayout, buttonBoxGetChildSecondary, buttonBoxSetLayout, +#if GTK_CHECK_VERSION(2,4,0) buttonBoxSetChildSecondary +#endif ) where import Monad (liftM) @@ -52,12 +56,15 @@ buttonBoxGetLayout b = liftM (toEnum . fromIntegral) $ {#call gtk_button_box_get_layout#} (toButtonBox b) +#if GTK_CHECK_VERSION(2,4,0) -- | Returns whether child should appear -- in a secondary group of children -- +-- * Since Gtk 2.4. buttonBoxGetChildSecondary :: (ButtonBoxClass b, WidgetClass w) => b -> w -> IO Bool buttonBoxGetChildSecondary b w = liftM toBool $ {#call gtk_button_box_get_child_secondary#} (toButtonBox b) (toWidget w) +#endif -- | Changes the way buttons are arranged in their container -- |
From: Duncan C. <dun...@us...> - 2004-07-26 15:24:34
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28092 Modified Files: ChangeLog Log Message: Only create GtkFileFilter when building against gtk 2.4 or later. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.183 retrieving revision 1.184 diff -u -d -r1.183 -r1.184 --- ChangeLog 26 Jul 2004 12:28:40 -0000 1.183 +++ ChangeLog 26 Jul 2004 15:24:24 -0000 1.184 @@ -9,7 +9,8 @@ * tools/hierarchyGen/hierarchy.list: add GConf object. Remove preprocessor annotations, build classes conditionally using tags like 'gtk-2.4'. Remove unnecessary annotations by taking advantage - of changes in the TypeGenerator. + of changes in the TypeGenerator. Only create GtkFileFilter when + building against gtk 2.4 or later. * tools/hierarchyGen/TypeGen.hs: be a bit cleverer with dealing with type prefixes, less hard coded knowledge of Gtk types. No not require |
From: Duncan C. <dun...@us...> - 2004-07-26 15:24:34
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28092/tools/hierarchyGen Modified Files: hierarchy.list Log Message: Only create GtkFileFilter when building against gtk 2.4 or later. Index: hierarchy.list =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen/hierarchy.list,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- hierarchy.list 26 Jul 2004 12:14:47 -0000 1.6 +++ hierarchy.list 26 Jul 2004 15:24:25 -0000 1.7 @@ -149,7 +149,7 @@ GtkCellRendererText # GtkCellRendererTextPixbuf GtkCellRendererToggle - GtkFileFilter + GtkFileFilter if gtk-2.4 # These are derived from GObject: GtkTreeSelection GtkTreeModel |
From: Duncan C. <dun...@us...> - 2004-07-26 12:28:52
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27273 Modified Files: ChangeLog Log Message: fix date on changelog entry Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.182 retrieving revision 1.183 diff -u -d -r1.182 -r1.183 --- ChangeLog 26 Jul 2004 12:14:46 -0000 1.182 +++ ChangeLog 26 Jul 2004 12:28:40 -0000 1.183 @@ -1,4 +1,4 @@ -2004-07-24 Duncan Coutts <du...@co...> +2004-07-26 Duncan Coutts <du...@co...> * configure.in: use relative $(TOP) variable rather than absolute $TOP variable, so Makefiles use relative paths. Add test for gconf package. |
From: Duncan C. <dun...@us...> - 2004-07-26 12:15:04
|
Update of /cvsroot/gtk2hs/gtk2hs/sourceview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24664/sourceview Modified Files: Makefile Log Message: add gconf to build. cleanup hierarchy.list and the prog that processes it. no longer use cpp over hierarchy.list. detect gtk versions in configure make TypeGenerator work with hierarchical module names. Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/sourceview/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile 30 Apr 2004 12:50:03 -0000 1.9 +++ Makefile 26 Jul 2004 12:14:47 -0000 1.10 @@ -49,9 +49,8 @@ NEEDCHI = SourceViewType SourceViewType.chs : ../tools/hierarchyGen/hierarchy.list - $(CPP) $(GTK_CFLAGS) - < $(TOP)/tools/hierarchyGen/hierarchy.list | \ - $(strip ../tools/hierarchyGen/TypeGenerator - \ - SourceViewType.chs \ + $(strip ../tools/hierarchyGen/TypeGenerator \ + $(TOP)/tools/hierarchyGen/hierarchy.list SourceViewType.chs \ $(addprefix --tag=,$(TYPE_TAGS))) |
From: Duncan C. <dun...@us...> - 2004-07-26 12:15:03
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/callbackGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24664/tools/callbackGen Modified Files: gtkmarshal.list Log Message: add gconf to build. cleanup hierarchy.list and the prog that processes it. no longer use cpp over hierarchy.list. detect gtk versions in configure make TypeGenerator work with hierarchical module names. Index: gtkmarshal.list =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/callbackGen/gtkmarshal.list,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gtkmarshal.list 15 Nov 2003 09:46:20 -0000 1.1 +++ gtkmarshal.list 26 Jul 2004 12:14:47 -0000 1.2 @@ -82,3 +82,5 @@ VOID:INT,BOOL # This is for the "edited" signal in CellRendererText: VOID:POINTER,STRING +# This is for the GConfClient value_changed signal +VOID:STRING,POINTER |
From: Duncan C. <dun...@us...> - 2004-07-26 12:15:03
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24664 Modified Files: ChangeLog configure.in Makefile Log Message: add gconf to build. cleanup hierarchy.list and the prog that processes it. no longer use cpp over hierarchy.list. detect gtk versions in configure make TypeGenerator work with hierarchical module names. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.181 retrieving revision 1.182 diff -u -d -r1.181 -r1.182 --- ChangeLog 24 Jul 2004 02:31:05 -0000 1.181 +++ ChangeLog 26 Jul 2004 12:14:46 -0000 1.182 @@ -1,5 +1,43 @@ 2004-07-24 Duncan Coutts <du...@co...> + * configure.in: use relative $(TOP) variable rather than absolute $TOP + variable, so Makefiles use relative paths. Add test for gconf package. + Test for particular versions of gtk API. + + * Makefile: add gconf to list of dirs to build + + * tools/hierarchyGen/hierarchy.list: add GConf object. + Remove preprocessor annotations, build classes conditionally using + tags like 'gtk-2.4'. Remove unnecessary annotations by taking advantage + of changes in the TypeGenerator. + + * tools/hierarchyGen/TypeGen.hs: be a bit cleverer with dealing with + type prefixes, less hard coded knowledge of Gtk types. No not require + _get_type annotations when they can be worked out automatically. Allow + tags like 'gtk-2.4'. Extra command line option to specify module name. + + * tools/callbackGen/gtkmarshal.list: add callback spec needed by gconf + + * sourceview/Makefile: do not run cpp over hierarchy.list + + * mk/config.mk.in: remove absolute path TOP variable. Add gconf flags. + Add gtk version check flags. + + * gtk/Makefile: do not run cpp over hierarchy.list. Add gtk-2.x tags + conditional on appropriate config flags. + + * c2hs/chs/CHS.hs: parse hierarchical module names ok. + + * c2hs/base/syntax/Parsers.hs, c2hs/c/CParser.hs: Manuel Chakravarty's + patch to fix the space leak I found. c2hs runs much faster now. + + * gconf/Makefile, gconf/System/Gnome/GConf.hs, + gconf/System/Gnome/GConf/GConfClient.chs, + gconf/System/Gnome/GConf/GConfValue.chs: new binding to GConf config + system. Uses hierarchical module names. + +2004-07-24 Duncan Coutts <du...@co...> + * gtk/glib/GError.chs, gtk/abstract/FileChooser.chs: spelling fix propogateGError to propagateGError Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/Makefile,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- Makefile 7 May 2004 16:40:01 -0000 1.28 +++ Makefile 26 Jul 2004 12:14:46 -0000 1.29 @@ -23,7 +23,7 @@ endif ifeq ($(strip $(ENABLE_GNOME)),yes) -MAKE_LIBS += sourceview +MAKE_LIBS += sourceview gconf endif MAKE_LIBS += mogul Index: configure.in =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/configure.in,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- configure.in 5 May 2004 16:16:19 -0000 1.36 +++ configure.in 26 Jul 2004 12:14:46 -0000 1.37 @@ -200,7 +200,7 @@ dnl suite in-place. AC_ARG_WITH(pkgconf, [ --with-pkgconf=pkg.conf use another package.conf file for building in-place], - [LOCALPKGCONF=$withval],[LOCALPKGCONF=$TOP/localpackage.conf]) + [LOCALPKGCONF=$withval],[LOCALPKGCONF='$(TOP)/localpackage.conf']) dnl Check for pkg-config which holds information about all Gtk related dnl libraries. @@ -263,9 +263,15 @@ PKG_CHECK_MODULES(LIBGLADE,[libglade-2.0 >= 2.0.0]) fi if test x$ENABLE_GNOME = xyes; then + PKG_CHECK_MODULES(GCONF,[gconf-2.0 >= 2.0.0]) PKG_CHECK_MODULES(SOURCEVIEW,[gtksourceview-1.0 >= 0.6.0]) fi +dnl Some APIs only appeared in later versions of libraries, so check if we're +dnl using later than particular versions. +GTK_VERSION_2_2=`$PKG_CONFIG gtk+-2.0 --atleast-version=2.2 && echo yes || echo no` +GTK_VERSION_2_4=`$PKG_CONFIG gtk+-2.0 --atleast-version=2.4 && echo yes || echo no` + dnl The configuration program for GTK is kind of stupid in that it dnl lists directories which don't exist. ghc-pkg in ghc 5.04 or greater dnl does not like that, so we need to filter out non-existent directories. @@ -326,6 +332,26 @@ esac; done; +TMPGCONF_CFLAGS=$GCONF_CFLAGS; +GCONF_CFLAGS=; +for FLAG in $TMPGCONF_CFLAGS; do + case $FLAG in + -I*) DIR=`echo $FLAG | $SED "s/-I//"`; + if test -d $DIR; then GCONF_CFLAGS="$GCONF_CFLAGS -I$DIR"; fi;; + *) GCONF_CFLAGS="$GCONF_CFLAGS $FLAG";; + esac; +done; +TMPGCONF_LIBS=$GCONF_LIBS; +GCONF_LIBS=; +for FLAG in $TMPGCONF_LIBS; do + case $FLAG in + -L*) DIR=`echo $FLAG | $SED "s/-L//"`; + if test -d $DIR; then GCONF_LIBS="$GCONF_LIBS -L$DIR"; fi;; + *) GCONF_LIBS="$GCONF_LIBS $FLAG";; + esac; +done; + + dnl Have a special marshall list (available in the source tree of Gtk+ under dnl gtk/gtkmarshal.list) @@ -334,7 +360,7 @@ [ --with-mlist=GTK-SOURCE use special marshall list from GTK+ sources], [MARSHALLDEFS=$withval; AC_MSG_RESULT($withval)], - [MARSHALLDEFS=$TOP/tools/callbackGen/gtkmarshal.list; + [MARSHALLDEFS='$(TOP)/tools/callbackGen/gtkmarshal.list'; AC_MSG_RESULT(built-in)]) @@ -383,7 +409,7 @@ if test $BUILT_IN_C2HS = yes; then AC_MSG_RESULT([built-in]) dnl Use the local c2hs. - C2HS=$TOP/c2hs/c2hs; + C2HS='$(TOP)/c2hs/c2hs'; MULTIPLE_CHS=yes; dnl These are the settings needed to compile c2hs. @@ -528,6 +554,9 @@ dnl AC_SUBST(GTK_MAJOR_VERSION) dnl AC_SUBST(GTK_MINOR_VERSION) dnl AC_SUBST(GTK_MICRO_VERSION) +AC_SUBST(GTK_VERSION_2_2) +AC_SUBST(GTK_VERSION_2_4) +dnl Optional packages AC_SUBST(ENABLE_OPENGL) AC_SUBST(ENABLE_LIBGLADE) AC_SUBST(ENABLE_GNOME) @@ -535,6 +564,8 @@ AC_SUBST(SOURCEVIEW_LIBS) AC_SUBST(LIBGLADE_CFLAGS) AC_SUBST(LIBGLADE_LIBS) +AC_SUBST(GCONF_CFLAGS) +AC_SUBST(GCONF_LIBS) dnl Documentation AC_SUBST(BUILDDOCS) AC_SUBST(XSLTTRANS) |
From: Duncan C. <dun...@us...> - 2004-07-26 12:15:03
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24664/gtk Modified Files: Makefile Log Message: add gconf to build. cleanup hierarchy.list and the prog that processes it. no longer use cpp over hierarchy.list. detect gtk versions in configure make TypeGenerator work with hierarchical module names. Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Makefile,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- Makefile 28 Apr 2004 13:50:17 -0000 1.28 +++ Makefile 26 Jul 2004 12:14:47 -0000 1.29 @@ -207,9 +207,16 @@ CREATE_TYPES = plugNsocket default endif +ifeq ($(GTK_VERSION_2_2),yes) +CREATE_TYPES += gtk-2.2 +endif +ifeq ($(GTK_VERSION_2_4),yes) +CREATE_TYPES += gtk-2.4 +endif + general/Hierarchy.chs : $(TOP)/tools/hierarchyGen/hierarchy.list - $(CPP) $(GTK_CFLAGS) - < $(TOP)/tools/hierarchyGen/hierarchy.list | \ - $(strip $(TOP)/tools/hierarchyGen/TypeGenerator - \ + $(strip $(TOP)/tools/hierarchyGen/TypeGenerator \ + $(TOP)/tools/hierarchyGen/hierarchy.list \ general/Hierarchy.chs $(addprefix --tag=,$(CREATE_TYPES))) include $(TOP)/mk/common.mk |
From: Duncan C. <dun...@us...> - 2004-07-26 12:15:01
|
Update of /cvsroot/gtk2hs/gtk2hs/mk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24664/mk Modified Files: config.mk.in Log Message: add gconf to build. cleanup hierarchy.list and the prog that processes it. no longer use cpp over hierarchy.list. detect gtk versions in configure make TypeGenerator work with hierarchical module names. Index: config.mk.in =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/mk/config.mk.in,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- config.mk.in 5 May 2004 16:16:20 -0000 1.24 +++ config.mk.in 26 Jul 2004 12:14:47 -0000 1.25 @@ -2,8 +2,6 @@ # # This Makefile contains all configuration data. -TOP = @TOP@ - AR = @AR@ LN = @LN_S@ PWD = @PWD@ @@ -149,8 +147,14 @@ SOURCEVIEW_LIBS = @SOURCEVIEW_LIBS@ SOURCEVIEW_CFLAGS = @SOURCEVIEW_CFLAGS@ -LIBGLADE_LIBS = @LIBGLADE_LIBS@ -LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ +LIBGLADE_LIBS = @LIBGLADE_LIBS@ +LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ + +GCONF_LIBS = @GCONF_LIBS@ +GCONF_CFLAGS = @GCONF_CFLAGS@ + +GTK_VERSION_2_2 = @GTK_VERSION_2_2@ +GTK_VERSION_2_4 = @GTK_VERSION_2_4@ .PHONY: default all install installdirs installfiles installpackage \ installcheck uninstall uninstallfiles uninstallpackage \ |
From: Duncan C. <dun...@us...> - 2004-07-26 12:15:00
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24664/tools/hierarchyGen Modified Files: hierarchy.list TypeGen.hs Log Message: add gconf to build. cleanup hierarchy.list and the prog that processes it. no longer use cpp over hierarchy.list. detect gtk versions in configure make TypeGenerator work with hierarchical module names. Index: hierarchy.list =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen/hierarchy.list,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- hierarchy.list 27 Apr 2004 18:07:52 -0000 1.5 +++ hierarchy.list 26 Jul 2004 12:14:47 -0000 1.6 @@ -1,32 +1,28 @@ -## This list is the result of a copy-and-paste from the GtkObject hierarchy -## html documentation. Deprecated widgets are uncommented. Some additional -## object have been defined at the end of the copied list. +# This list is the result of a copy-and-paste from the GtkObject hierarchy +# html documentation. Deprecated widgets are uncommented. Some additional +# object have been defined at the end of the copied list. -## The Gtk prefix of every object is removed, the other prefixes are -## kept. The indentation implies the object hierarchy. In case the -## type query function cannot be derived from the name or the type name -## is different, an alternative name and type query function can be -## specified by appending 'as typename, <query_func>'. In case this -## function is not specified, the <name> is converted to -## gtk_<name'>_get_type where <name'> is <name> where each upperscore -## letter is converted to an underscore and lowerletter. The underscore -## is omitted if an upperscore letter preceeded: GtkHButtonBox -> -## gtk_hbutton_box_get_type. The generation of a type can be -## conditional by appending 'if <tag>'. Such types are only produces if -## --only=<tag> is given on the command line of TypeGenerator. -## This file is preprocessed so you can also generate types conditional -## on the version of gtk by using the GTK_CHECK_VERSION(major,minor,micro) -## macro. +# The Gtk prefix of every object is removed, the other prefixes are +# kept. The indentation implies the object hierarchy. In case the +# type query function cannot be derived from the name or the type name +# is different, an alternative name and type query function can be +# specified by appending 'as typename, <query_func>'. In case this +# function is not specified, the <name> is converted to +# gtk_<name'>_get_type where <name'> is <name> where each upperscore +# letter is converted to an underscore and lowerletter. The underscore +# is omitted if an upperscore letter preceeded: GtkHButtonBox -> +# gtk_hbutton_box_get_type. The generation of a type can be +# conditional by appending 'if <tag>'. Such types are only produces if +# --tag=<tag> is given on the command line of TypeGenerator. -#include <gtk/gtkversion.h> GObject - GdkDrawable as Drawable, gdk_drawable_get_type + GdkDrawable GdkWindow as DrawWindow, gdk_window_object_get_type -## GdkDrawableImplX11 -## GdkWindowImplX11 - GdkPixmap as Pixmap, gdk_pixmap_get_type - GdkColormap as Colormap, gdk_colormap_get_type +# GdkDrawableImplX11 +# GdkWindowImplX11 + GdkPixmap + GdkColormap GtkSettings GtkTextBuffer GtkSourceBuffer if sourceview @@ -35,8 +31,8 @@ GtkTextTagTable GtkSourceTagTable if sourceview GtkStyle - GdkDragContext as DragContext, gdk_drag_context_get_type - GdkPixbuf as Pixbuf, gdk_pixbuf_get_type + GdkDragContext + GdkPixbuf GtkTextChildAnchor GtkTextMark GtkSourceMarker if sourceview @@ -65,14 +61,12 @@ GtkTearoffMenuItem GtkImageMenuItem GtkListItem -## GtkTreeItem +# GtkTreeItem GtkWindow GtkDialog GtkColorSelectionDialog GtkFileSelection -#if GTK_CHECK_VERSION(2,4,0) - GtkFileChooserDialog -#endif + GtkFileChooserDialog if gtk-2.4 GtkFontSelectionDialog GtkInputDialog GtkMessageDialog @@ -81,11 +75,9 @@ GtkHandleBox GtkScrolledWindow GtkViewport -#if GTK_CHECK_VERSION(2,4,0) - GtkExpander - GtkComboBox - GtkComboBoxEntry -#endif + GtkExpander if gtk-2.4 + GtkComboBox if gtk-2.4 + GtkComboBoxEntry if gtk-2.4 GtkBox GtkButtonBox GtkHButtonBox @@ -94,9 +86,7 @@ GtkColorSelection GtkFontSelection GtkGammaCurve -#if GTK_CHECK_VERSION(2,4,0) - GtkFileChooserWidget -#endif + GtkFileChooserWidget if gtk-2.4 GtkHBox GtkCombo GtkStatusbar @@ -112,7 +102,7 @@ GtkMenu GtkMenuBar GtkNotebook -## GtkPacker +# GtkPacker GtkSocket if plugNsocket GtkTable GtkTextView @@ -138,11 +128,11 @@ GtkHSeparator GtkVSeparator GtkInvisible -## GtkOldEditable -## GtkText +# GtkOldEditable +# GtkText GtkPreview -## Progress is deprecated, ProgressBar contains everything necessary -## GtkProgress +# Progress is deprecated, ProgressBar contains everything necessary +# GtkProgress GtkProgressBar GtkAdjustment GtkIMContext @@ -150,43 +140,40 @@ GtkItemFactory GtkTooltips -## These object were added by hand because they do not show up in the hierarchy -## chart. -## These are derived from GtkObject: +# These object were added by hand because they do not show up in the hierarchy +# chart. +# These are derived from GtkObject: GtkTreeViewColumn GtkCellRenderer GtkCellRendererPixbuf GtkCellRendererText -## GtkCellRendererTextPixbuf +# GtkCellRendererTextPixbuf GtkCellRendererToggle GtkFileFilter -## These are derived from GObject: +# These are derived from GObject: GtkTreeSelection GtkTreeModel GtkTreeStore GtkListStore GtkTreeModelSort GtkIconFactory -#if GTK_CHECK_VERSION(2,4,0) - GtkEntryCompletion -#endif + GtkEntryCompletion if gtk-2.4 GtkSourceLanguage if sourceview GtkSourceLanguagesManager if sourceview - GladeXML as GladeXML, glade_xml_get_type if libglade -## These ones are actualy interfaces, but all interface implementations must be GObjects + GladeXML as GladeXML, glade_xml_get_type if libglade + GConfClient as GConf if gconf +# These ones are actualy interfaces, but interface implementations are GObjects GtkSourceStyleScheme if sourceview -#if GTK_CHECK_VERSION(2,4,0) - GtkFileChooser -#endif -## This now became a GObject in version 2: - GdkGC as GC, gdk_gc_get_type -## These are Pango structures - PangoContext as PangoContext, pango_context_get_type - PangoLayout as PangoLayout, pango_layout_get_type - PangoFont as Font, pango_font_get_type - PangoFontFamily as FontFamiliy, pango_font_family_get_type - PangoFontFace as FontFace, pango_font_face_get_type - PangoFontMap as FontMap, pango_font_face_get_type - PangoFontset as FontSet, pango_fontset_get_type -## This type is only available for PANGO_ENABLE_BACKEND compiled source -## PangoFontsetSimple as FontSetSimple, pango_fontset_simple_get_type + GtkFileChooser if gtk-2.4 +# This became a GObject in version 2: + GdkGC +# These are Pango structures: + PangoContext + PangoLayout + PangoFont as Font + PangoFontFamily as FontFamiliy + PangoFontFace as FontFace + PangoFontMap as FontMap + PangoFontset as FontSet +# This type is only available for PANGO_ENABLE_BACKEND compiled source +# PangoFontsetSimple as FontSetSimple, pango_fontset_simple_get_type Index: TypeGen.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen/TypeGen.hs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- TypeGen.hs 25 May 2004 02:05:10 -0000 1.7 +++ TypeGen.hs 26 Jul 2004 12:14:47 -0000 1.8 @@ -3,7 +3,7 @@ -- Haskell class that reflect this hierarchy. module Main(main) where -import Char(showLitChar, isAlpha, isAlphaNum, isSpace, toLower, isUpper) +import Char(showLitChar, isAlpha, isAlphaNum, isSpace, toLower, toUpper, isUpper) import List(nub, isPrefixOf) import Maybe(catMaybes, fromMaybe) import Monad(when) @@ -15,7 +15,8 @@ -- This is a mapping from a type name to a) the type name in Haskell and -- b) the GTK blah_get_type function. -type TypeQuery = Maybe (String, (String, String)) +type TypeQuery = (String, (String, Maybe String)) +type TypeTable = [TypeQuery] -- A Tag is a string restricting the generation of type entries to -- those lines that have the appropriate "if <tag>" at the end. @@ -41,32 +42,35 @@ pFL ps ('\n':rem) = pFL (ps {line = line ps+1, col=1}) rem pFL ps (' ':rem) = pFL (ps {col=col ps+1}) rem pFL ps ('\t':rem) = pFL (ps {col=col ps+8}) rem - pFL ps ('G':'t':'k':rem) = pGetObject ps rem + pFL ps all@('G':'t':'k':rem)= pGetObject ps all rem + pFL ps all@('G':'d':'k':rem)= pGetObject ps all rem + pFL ps all@('G':'n':'o':'m':'e':rem)= pGetObject ps all rem pFL ps [] = [] - pFL ps all = pGetObject ps all + pFL ps all = pGetObject ps all all -pGetObject :: ParserState -> String -> [(ObjectSpec, TypeQuery)] -pGetObject ps@ParserState { onlyTags=tags } txt = +pGetObject :: ParserState -> String -> String -> [(ObjectSpec, TypeQuery)] +pGetObject ps@ParserState { onlyTags=tags } txt txt' = (if readTag `elem` tags then (:) (spec, specialQuery) else id) $ pFreshLine (ps { hierObjs=spec}) (dropWhile ((/=) '\n') rem'') where isBlank c = c==' ' || c=='\t' isAlphaNum_ c = isAlphaNum c || c=='_' - (origName,rem) = span isAlphaNum txt + isTagName c = isAlphaNum_ c || c=='-' || c=='.' --to allow tag 'gtk-2.4' + (origCName,rem) = span isAlphaNum txt + (origHsName,_) = span isAlphaNum txt' (name,specialQuery,rem') = case (dropWhile isBlank rem) of ('a':'s':r) -> let (tyName,r') = span isAlphaNum_ (dropWhile isBlank r) in case (dropWhile isBlank r') of (',':r) -> let (tyQuery,r') = span isAlphaNum_ (dropWhile isBlank r) in - (tyName, Just (tyName, (origName, tyQuery)), r') - r -> error ("line "++show (line ps)++ - ": Expected a comma, found:"++take 5 r) - r -> (origName, Nothing, r) + (tyName, (tyName, (origCName, Just tyQuery)), r') + r -> (tyName, (tyName, (origCName, Nothing)), r) + r -> (origHsName, (origHsName, (origCName, Nothing)), r) parents = dropWhile (\(c,_) -> c>=col ps) (hierObjs ps) spec = (col ps,name):parents (readTag, rem'') = case (dropWhile isBlank rem') of - ('i':'f':r) -> span isAlphaNum_ (dropWhile isBlank r) + ('i':'f':r) -> span isTagName (dropWhile isBlank r) r -> ("default",r) @@ -96,25 +100,29 @@ let prefix = case map (drop 9) (filter ("--prefix=" `isPrefixOf`) rem) of [] -> "gtk" (prefix:_) -> prefix + let modName = case map (drop 10) (filter ("--modname=" `isPrefixOf`) rem) of + [] -> bareFName goalFile + (modName:_) -> modName + where bareFName = reverse . + takeWhile isAlphaNum . + drop 1 . + dropWhile isAlpha . + reverse content <- if hierFile == "-" then getContents -- read stdin else readFile hierFile let (objs, specialQueries) = unzip $ pFreshLine (freshParserState tags) content - let bareFName = reverse . - takeWhile isAlphaNum . - drop 1 . - dropWhile isAlpha . - reverse writeFile goalFile $ - generate (bareFName goalFile) lib prefix - (map (map snd) objs) (catMaybes specialQueries) "" + generate modName lib prefix + (map (map snd) objs) specialQueries "" usage = do putStr "\nProgram to generate Gtk's object hierarchy in Haskell. Usage:\n\ \TypeGenerator <hierFile> <outFile> {--tag=<tag>}\n\ \ {--lib=<lib>} {--prefix=<prefix>}\n\ + \ {--modname=<modName>}\n\ \where\n\ \ <hierFile> a list of all possible objects, the hierarchy is\n\ \ taken from the indentation\n\ @@ -124,7 +132,9 @@ \ <lib> set the lib to use in the c2hs {#context #}\n\ \ declaration (the default is \"gtk\")\n\ \ <prefix> set the prefix to use in the c2hs {#context #}\n\ - \ declaration (the default is \"gtk\")\n" + \ declaration (the default is \"gtk\")\n\ + \ <modName> specify module name if it does not match the\n\ + \ file name, eg a hierarchical module name" exitWith $ ExitFailure 1 @@ -133,7 +143,7 @@ -- generate dynamic fragments ------------------------------------------------------------------------------- -generate :: String -> String -> String -> [[String]] -> [(String, (String, String))] -> ShowS +generate :: String -> String -> String -> [[String]] -> TypeTable -> ShowS generate fname lib prefix objs typeTable = let fillCol str = ss $ replicate (maximum (map (length.head) objs)-length str) ' ' @@ -195,20 +205,23 @@ -- ss " = LT". -- indent 0. indent 0. - foldl (.) id (map (makeClass typeTable) objs) + foldl (.) id (map (makeClass prefix typeTable) objs) makeTypeTags :: Char -> [String] -> ShowS makeTypeTags c [] = ss "deriving Eq" makeTypeTags c (obj:ects) = sc c.sc ' '.ss obj.ss "Tag".indent 8. makeTypeTags '|' ects +makeUpcast :: TypeTable -> [String] -> ShowS makeUpcast table [obj] = id -- no casting for GObject makeUpcast table (obj:_:_) = indent 0.ss "castTo".ss obj.ss " :: GObjectClass obj => obj -> ".ss obj. indent 0.ss "castTo".ss obj.ss " obj =". indent 1.ss "if typeInstanceIsA ((foreignPtrToPtr.castForeignPtr.unGObject.toGObject) obj)". indent 2.ss "{#call fun unsafe ". - ss (maybe ("gtk"++c2u True obj++"_get_type") snd (lookup obj table)). + ss (case lookup obj table of + (Just (_, Just get_type_func)) -> get_type_func + (Just (cname, _)) -> tail $ c2u True cname++"_get_type"). ss "#} then". indent 3.ss "(fromGObject.toGObject) obj else". indent 4.ss "error \"Cannot cast object to ".ss obj.ss ".\"". @@ -234,12 +247,19 @@ fill obj.ss pr.ss "Tag".fill pr. ss " = GT".makeGT obj eds -makeClass :: [(String,(String, String))] -> [String] -> ShowS -makeClass table (name:parents) = +makeClass :: String -> TypeTable -> [String] -> ShowS +makeClass prefix table (name:parents) = indent 0.ss "-- ".ss (replicate (75-length name) '*').sc ' '.ss name. indent 0. indent 0.ss "{#pointer *". - maybe (ss name) (\s -> ss (fst s).ss " as ".ss name) (lookup name table). + (case lookup name table of + (Just (cname, _)) | stripPrefix cname == name -> ss name + | otherwise -> ss cname.ss " as ".ss name + where stripPrefix s = if uCasePrefix `isPrefixOf` s + then drop (length prefix) s + else s + uCasePrefix = toUpper (head prefix) : tail prefix -- gtk -> Gtk + ). ss " foreign newtype #}". indent 0. indent 0.ss "mk".ss name.ss " = ".ss name. |
From: Duncan C. <dun...@us...> - 2004-07-26 12:09:00
|
Update of /cvsroot/gtk2hs/gtk2hs/c2hs/chs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24128/c2hs/chs Modified Files: CHS.hs Log Message: parse hierarchical module names ok. Manuel has not reviewed this patch, so it's not officially blessed. Index: CHS.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/c2hs/chs/CHS.hs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CHS.hs 20 May 2004 16:42:17 -0000 1.4 +++ CHS.hs 26 Jul 2004 12:08:49 -0000 1.5 @@ -743,14 +743,32 @@ parseImport pos toks = do (qual, modid, toks') <- case toks of - CHSTokIdent _ ide :toks -> return (False, ide, toks) - CHSTokQualif _: CHSTokIdent _ ide:toks -> return (True , ide, toks) + CHSTokIdent _ ide :toks -> + let (ide', toks') = rebuildModuleId ide toks + in return (False, ide', toks') + CHSTokQualif _: CHSTokIdent _ ide:toks -> + let (ide', toks') = rebuildModuleId ide toks + in return (True , ide', toks') _ -> syntaxError toks - chi <- loadCHI . identToLexeme $ modid + chi <- loadCHI . moduleNameToFileName . identToLexeme $ modid toks'' <- parseEndHook toks' frags <- parseFrags toks'' return $ CHSHook (CHSImport qual modid chi pos) : frags +-- Qualified module names do not get lexed as a single token so we need to +-- reconstruct it from a sequence of identifer and dot tokens. +-- +rebuildModuleId ide (CHSTokDot _ : CHSTokIdent _ ide' : toks) = + let catIdent ide ide' = onlyPosIdent (posOf ide) --FIXME: unpleasent hack + (identToLexeme ide ++ '.' : identToLexeme ide') + in rebuildModuleId (catIdent ide ide') toks +rebuildModuleId ide toks = (ide, toks) + +moduleNameToFileName :: String -> FilePath +moduleNameToFileName = map dotToSlash + where dotToSlash '.' = '/' + dotToSlash c = c + parseContext :: Position -> [CHSToken] -> CST s [CHSFrag] parseContext pos toks = do (oheader , toks' ) <- parseOptHeader toks |
From: Duncan C. <dun...@us...> - 2004-07-26 12:07:34
|
Update of /cvsroot/gtk2hs/gtk2hs/c2hs/c In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24012/c2hs/c Modified Files: CParser.hs Log Message: Manuel Chakravarty's patch to fix the space leak I found in the parser. c2hs runs much faster now. Index: CParser.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/c2hs/c/CParser.hs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CParser.hs 16 Nov 2003 13:30:55 -0000 1.4 +++ CParser.hs 26 Jul 2004 12:07:24 -0000 1.5 @@ -5,7 +5,7 @@ -- -- Version $Revision$ from $Date$ -- --- Copyright (c) [1999..2002] Manuel M T Chakravarty +-- Copyright (c) [1999..2004] Manuel M T Chakravarty -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -82,6 +82,7 @@ import Maybe (catMaybes) import Common (Position, Pos(..), nopos) +import Sets (Set, listToSet, joinSet, elemSet) import Utils (Tag(tag)) import UNames (Name, NameSupply, names) import Idents (Ident) @@ -277,58 +278,56 @@ nameSupply <- getNameSupply let name = (head . names) nameSupply at = newAttrs pos name - predefTypeIds = map fst builtinTypeNames - decls <- parseCExtDeclList (morphTypeNames predefTypeIds tokens) + predefTypeIds = listToSet . map fst $ builtinTypeNames + decls <- parseCExtDeclList [] predefTypeIds tokens return (CHeader decls at) where -- the set contains all identifiers that were turned into a -- typedef-name by a `typedef' declaration -- - parseCExtDeclList :: [CToken] -> CST s [CExtDecl] - parseCExtDeclList toks = - do - nameSupply <- getNameSupply - let ns = names nameSupply - (decl, errs, toks') = execParser parseCExtDecl ns toks - mapM raise errs +parseCExtDeclList :: [CExtDecl] -- accumulator (reverse order!) + -> Set Ident -- typedef'd identifiers + -> [CToken] -- token stream + -> CST s [CExtDecl] +parseCExtDeclList decls _ [] = return (reverse decls) +parseCExtDeclList decls tdefNames toks = + do + nameSupply <- getNameSupply + let ns = names nameSupply + tokMorpher = morphTypeNames tdefNames + -- changes token type of typedef'd idents + (decl, errs, toks') = execParser parseCExtDecl ns tokMorpher toks + mapM raise errs -- -- raise the errors first, in case any of them is fatal -- - let tdefNames = getTDefNames decl - morphedToks = if null tdefNames then toks' -- as `toks'' is *long* - else morphTypeNames tdefNames toks' - if null morphedToks - then return [decl] - else do - decls <- parseCExtDeclList morphedToks - return (decl:decls) + mapM raise errs + let tdefNames' = tdefNames `joinSet` (listToSet $ getTDefNames decl) + parseCExtDeclList (decl:decls) tdefNames' toks' -- extract all identifiers turned into `typedef-name's -- - getTDefNames :: CDecl -> [Ident] - getTDefNames (CDecl specs declrs _) - | isTypedef = catMaybes [declrToOptIdent declr - | (Just declr, _, _) <- declrs] - | otherwise = [] - where - isTypedef = (not . null) [()| CStorageSpec (CTypedef _) <- specs] +getTDefNames :: CDecl -> [Ident] +getTDefNames (CDecl specs declrs _) + | isTypedef = catMaybes [declrToOptIdent declr + | (Just declr, _, _) <- declrs] + | otherwise = [] + where + isTypedef = (not . null) [()| CStorageSpec (CTypedef _) <- specs] - declrToOptIdent :: CDeclr -> Maybe Ident - declrToOptIdent (CVarDeclr optIde _) = optIde - declrToOptIdent (CPtrDeclr _ declr _) = declrToOptIdent declr - declrToOptIdent (CArrDeclr declr _ _) = declrToOptIdent declr - declrToOptIdent (CFunDeclr declr _ _ _) = declrToOptIdent declr + declrToOptIdent :: CDeclr -> Maybe Ident + declrToOptIdent (CVarDeclr optIde _) = optIde + declrToOptIdent (CPtrDeclr _ declr _) = declrToOptIdent declr + declrToOptIdent (CArrDeclr declr _ _) = declrToOptIdent declr + declrToOptIdent (CFunDeclr declr _ _ _) = declrToOptIdent declr - -- convert all identifier tokens mentioned in the first arguments into - -- typedef-name tokens + -- token converter that changes any identifier tokens whose identifier is + -- contained in the first set into a typedef-name token -- - morphTypeNames :: [Ident] -> [CToken] -> [CToken] - morphTypeNames _ [] = [] - morphTypeNames tides (tok@(CTokIdent pos ide):toks) - | ide `elem` tides = CTokTypeName pos ide : morphTypeNames tides toks - | otherwise = tok : morphTypeNames tides toks - morphTypeNames tides (tok :toks) - = tok : morphTypeNames tides toks +morphTypeNames :: Set Ident -> CToken -> CToken +morphTypeNames tides (CTokIdent pos ide) + | ide `elemSet` tides = CTokTypeName pos ide +morphTypeNames tides tok = tok -- parse external C declaration (K&R A10) -- |
From: Duncan C. <dun...@us...> - 2004-07-26 12:07:33
|
Update of /cvsroot/gtk2hs/gtk2hs/c2hs/base/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24012/c2hs/base/syntax Modified Files: Parsers.hs Log Message: Manuel Chakravarty's patch to fix the space leak I found in the parser. c2hs runs much faster now. Index: Parsers.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/c2hs/base/syntax/Parsers.hs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Parsers.hs 14 Apr 2002 16:57:47 -0000 1.1 +++ Parsers.hs 26 Jul 2004 12:07:24 -0000 1.2 @@ -1,11 +1,11 @@ -- Compiler Toolkit: Self-optimizing LL(1) parser combinators -- --- Author : Manuel M. T. Chakravarty +-- Author : Manuel M T Chakravarty -- Created: 27 February 99 -- -- Version $Revision$ from $Date$ -- --- Copyright (c) [1999..2000] Manuel M. T. Chakravarty +-- Copyright (c) [1999..2004] Manuel M T Chakravarty -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public @@ -398,6 +398,11 @@ -- apply a parser to a token sequence (EXPORTED) -- +-- * The token mapping is applied to every token just before consumption. It +-- is useful if a processing phase needs to be put between scanner and +-- lexer, where only the tokens actually consumed are to be processed (and +-- the rest returned in their original form). +-- -- * Trailing tokens are returned in the third component of the result (the -- longest match is found). -- @@ -405,7 +410,12 @@ -- returned pair) is undefined in case of an error (this changes when error -- correction is added). -- -execParser :: Token t => Parser a t r -> a -> [t] -> (r, [Error], [t]) +execParser :: Token t + => Parser a t r -- parser specification + -> a -- initial state + -> (t -> t) -- token mapping + -> [t] -- token stream + -> (r, [Error], [t]) -- result with errors and rest tokens -- -- * Regarding the case cascade in the second equation, note that laziness is -- not our friend here. The root of the parse tree will be constructed at @@ -413,25 +423,27 @@ -- with following stages here (and then there are the error messages, which -- also spoil pipelining). -- -execParser (Parser (Action m con) c) a [] = -- eof +execParser (Parser (Action m con) c) a _ [] = -- eof case c of Empty x _ -> (con (snd . m $ a) errtoken x, [], []) _ -> (errresult, [makeError FatalErr nopos eofErr], []) -execParser (Parser (Action m con) c) a ts = -- eat one token - case m a of -- execute meta action - (a', x') -> case cont c a' ts of -- process next input token +execParser (Parser (Action m con) c) a f ts = -- eat one token + case m a of -- execute meta action + (a', x') -> case cont c a' f ts of -- process next input token -- !!! (t, (x, errs, ts')) -> ((((con $! x') $ t) $!x), errs, ts') (t, (x, errs, ts')) -> ((((con $ x') $ t) $ x), errs, ts') where - cont :: Token t => Cont a t r -> a -> [t] -> (t, (r, [Error], [t])) - cont Done _ (t:_) = makeErr (posOf t) trailErr - cont (Alts alts) a (t:ts) = case lookupFM alts t of - Nothing -> makeErr (posOf t) (illErr t) - Just p -> (t, execParser p a ts) - cont (Empty x p) a ts = + cont :: Token t + => Cont a t r -> a -> (t -> t) -> [t] -> (t, (r, [Error], [t])) + cont Done _ f (t:_) = makeErr (posOf (f t)) trailErr + cont (Alts alts) a f (t:ts) = let t' = f t + in case lookupFM alts t' of + Nothing -> makeErr (posOf t') (illErr t') + Just p -> (t', execParser p a f ts) + cont (Empty x p) a f ts = case p of Parser _ Done -> (errtoken, (x, [], ts)) - _ -> (errtoken, (execParser p a ts)) + _ -> (errtoken, (execParser p a f ts)) makeErr pos err = (errtoken, (errresult, [makeError FatalErr pos err], [])) |
From: Duncan C. <dun...@us...> - 2004-07-26 12:02:42
|
Update of /cvsroot/gtk2hs/gtk2hs/gconf/System/Gnome/GConf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23178/gconf/System/Gnome/GConf Added Files: GConfClient.chs GConfValue.chs Log Message: new gconf binding package --- NEW FILE: GConfValue.chs --- {-# OPTIONS -fallow-overlapping-instances #-} -- String & [a] overlap -- -*-haskell-*- -- GIMP Toolkit (GTK) GConf API -- -- Author : Duncan Coutts -- Created: 16 April 2004 -- -- Copyright (c) 2004 Duncan Coutts -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library 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 -- Library General Public License for more details. -- -- | -- -- Module for dealing with the values stored in the GConf system. -- -- GConfValue has its own primitive type system which is represented in -- Haskell using type classes. This allows values to be get and set without -- needing to perform any dynamic type casting or needing a union type. -- -- Alternatively, a dynamic\/union type is provided for the rare occasions -- when that degree of flexability is required. It should only be necessary -- if you need to deal with configuration values without statically knowing -- their type. -- module System.Gnome.GConf.GConfValue ( GConfPrimitiveValueClass, GConfValueClass, marshalFromGConfValue, marshalToGConfValue, GConfValue(GConfValue), GConfValueDyn(..), GConfSchema ) where import Monad (liftM, when) import FFI import GList (toGSList, readGSList) --{# context lib="gconf" prefix ="gconf_value" #} {# context lib="gconf" #} {# enum GConfValueType {underscoreToCase} deriving (Eq, Show) #} {# pointer *GConfValue newtype #} {# pointer *GConfSchema foreign newtype #} -- | Class of types which can be kept by GConf class GConfValueClass value where --unsafe because assumes non-null pointer and correct type unsafeMarshalFromGConfValue :: GConfValue -> IO value -- safe checked version, may throw exception marshalFromGConfValue :: GConfValue -> IO value marshalFromGConfValue value = do checkForNullAndExpectedType (typeofGConfValue (undefined::value)) value unsafeMarshalFromGConfValue value typeofGConfValue :: value -> GConfValueType marshalToGConfValue :: value -> IO GConfValue -- The above methods follow the following memory management rules regarding -- GConfValues: marshalFrom reads the value but does not gain ownership and thus -- does not deallocate. marshalTo allocates a new value and gives up ownership; -- it is not responsible for dellocation (it does not attach a finaliser). -- The code that uses marshalTo must ensure that it hands the value off to a -- function that is prepared to asume ownership of the value. -- dynamic version for when the type is not known statically data GConfValueDyn = GConfValueString String | GConfValueInt Int | GConfValueFloat Double | GConfValueBool Bool | GConfValueSchema GConfSchema | GConfValueList [GConfValueDyn] --must all be of same primitive type | GConfValuePair (GConfValueDyn, GConfValueDyn) --must both be primitive -- Allow variant using Maybe, where Nothing means the value was not set -- Use this variant when you expect the gconf key to not be set somethimes; -- otherwise the 'raw' types will raise an exception if you get an unset key. -- Just for consistency, setting a key to Nothing will unset the key, however -- it is preferable to use gconfClientUnset explicitly. instance GConfValueClass value => GConfValueClass (Maybe value) where typeofGConfValue _ = typeofGConfValue (undefined :: value) unsafeMarshalFromGConfValue = marshalFromGConfValue marshalFromGConfValue value = catch (liftM Just $ marshalFromGConfValue value) (\_ -> return Nothing) marshalToGConfValue (Just v) = marshalToGConfValue v marshalToGConfValue Nothing = return $ GConfValue nullPtr -- The GConfValue type system says some types are primitive. -- Compound types (lists & pairs) may only be constructed from primitive types. class GConfValueClass value => GConfPrimitiveValueClass value instance GConfPrimitiveValueClass Int instance GConfPrimitiveValueClass Bool instance GConfPrimitiveValueClass Double instance GConfPrimitiveValueClass String instance GConfValueClass Int where typeofGConfValue _ = GconfValueInt unsafeMarshalFromGConfValue = liftM fromIntegral . {# call unsafe gconf_value_get_int #} marshalToGConfValue n = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValueInt) {# call unsafe gconf_value_set_int #} value (fromIntegral n) return value instance GConfValueClass Bool where typeofGConfValue _ = GconfValueBool unsafeMarshalFromGConfValue = liftM toBool . {# call unsafe gconf_value_get_bool #} marshalToGConfValue b = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValueBool) {# call unsafe gconf_value_set_bool #} value (fromBool b) return value instance GConfValueClass Double where typeofGConfValue _ = GconfValueFloat unsafeMarshalFromGConfValue = liftM realToFrac . {# call unsafe gconf_value_get_float #} marshalToGConfValue f = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValueFloat) {# call unsafe gconf_value_set_float #} value (realToFrac f) return value -- Now unfortunately String & [a] overlap, although really they don't since Char -- is not an instance of GConfPrimitiveValueClass, however classes are open so -- we don't know that Char would never be an instance. I want closed classes! instance GConfValueClass String where typeofGConfValue _ = GconfValueString unsafeMarshalFromGConfValue value = do strPtr <- {# call unsafe gconf_value_get_string #} value peekUTFString strPtr marshalToGConfValue s = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValueString) withCString s $ \strPtr -> {# call unsafe gconf_value_set_string #} value strPtr return value instance GConfValueClass GConfSchema where typeofGConfValue _ = GconfValueString unsafeMarshalFromGConfValue value = do ptr <- {# call unsafe gconf_value_get_schema #} value liftM GConfSchema $ newForeignPtr_ ptr marshalToGConfValue s = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValueSchema) {# call unsafe gconf_value_set_schema #} value s return value instance (GConfPrimitiveValueClass a, GConfPrimitiveValueClass b) => GConfValueClass (a,b) where typeofGConfValue _ = GconfValuePair unsafeMarshalFromGConfValue value = do a <- {# call unsafe gconf_value_get_car #} value b <- {# call unsafe gconf_value_get_cdr #} value a' <- marshalFromGConfValue a b' <- marshalFromGConfValue b return (a',b') marshalToGConfValue (a,b) = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValuePair) a' <- marshalToGConfValue a b' <- marshalToGConfValue b {# call unsafe gconf_value_set_car_nocopy #} value a' {# call unsafe gconf_value_set_cdr_nocopy #} value b' return value instance GConfPrimitiveValueClass a => GConfValueClass [a] where typeofGConfValue _ = GconfValueList unsafeMarshalFromGConfValue value = do gsList <- {# call unsafe gconf_value_get_list #} value valuesPtrs <- readGSList gsList mapM (unsafeMarshalFromGConfValue . GConfValue) valuesPtrs marshalFromGConfValue value = do checkForNullAndExpectedType GconfValueList value listType <- liftM (toEnum . fromIntegral) $ {# call unsafe gconf_value_get_list_type #} value when (listType /= typeofGConfValue (undefined :: a)) (fail "GConf: key is list with elements of unexpected type") unsafeMarshalFromGConfValue value marshalToGConfValue list = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValueList) valuesPtrs <- mapM (liftM (\(GConfValue ptr) -> ptr) . marshalToGConfValue) list valuesList <- toGSList valuesPtrs {# call unsafe gconf_value_set_list_type #} value (fromIntegral $ fromEnum $ typeofGConfValue (undefined::a)) {# call unsafe gconf_value_set_list_nocopy #} value valuesList return value ---------------- -- For convenience and best practice, an instance for Enum -- This conforms to the GConf GTK+/Gnome convention for storing enum types, -- which is to store them as a string using ThisStlyeOfCapitalisation. -- Note: currently disabled since it requires -fallow-undecidable-instances {- instance (Show enum, Read enum, Enum enum, GConfValueClass enum) => GConfPrimitiveValueClass enum instance (Show enum, Read enum, Enum enum) => GConfValueClass enum where marshalFromGConfValue value = do enumStr <- marshalFromGConfValue value case reads enumStr of [(enum,_)] -> return enum _ -> fail "GCconf: invalid enum value" marshalFromGConfValue' value = do maybeEnumStr <- marshalFromGConfValue' value case maybeEnumStr of Nothing -> return Nothing (Just enumStr) -> case reads enumStr of [(enum,_)] -> return (Just enum) _ -> return Nothing marshalToGConfValue enum = marshalToGConfValue (show enum) typeofGConfValue _ = GconfValueString -} ---------------- -- Helper funcs gconfValueGetType :: GConfValue -> IO GConfValueType --we mean the following but unfortunately c2hs barfs on 'type' --gconfValueGetType (GConfValue valuePtr) = {# get GConfValue->type #} valuePtr -- so instead we have the ugly: gconfValueGetType (GConfValue valuePtr) = liftM (toEnum . fromIntegral) $ peek (castPtr valuePtr :: Ptr CInt) --TODO: check that sizeof(GConfValueType) == sizeof(int) -- returns Nothing if ok, or and error message checkForNullAndExpectedType :: GConfValueType -> GConfValue -> IO () checkForNullAndExpectedType expectedType value@(GConfValue ptr) | ptr == nullPtr = fail "GConf: cannot get value of key, key is unset" | otherwise = do valueType <- gconfValueGetType value when (valueType /= expectedType) (fail $ "GConf: key is of unexpected type, expected: " ++ show expectedType ++ ", got: " ++ show valueType) {- checkForNullAndExpectedType :: GConfValueType -> GConfValue -> IO GConfValue checkForNullAndExpectedType expectedType value@(GConfValue ptr) | ptr == nullPtr = fail "GConf: cannot get value of key, key is unset" | otherwise = do valueType <- gconfValueGetType value if valueType /= expectedType then fail $ "GConf: key is of unexpected type, expected: " ++ show expectedType ++ ", got: " ++ show valueType else return value checkForNullAndExpectedType' :: GConfValueType -> GConfValue -> IO (Maybe GConfValue) checkForNullAndExpectedType' expectedType value@(GConfValue ptr) | ptr == nullPtr = return Nothing | otherwise = do valueType <- gconfValueGetType value if valueType /= expectedType then return Nothing else return (Just value) -} ---------------- -- GConfValueDyn unsafeMarshalGConfValueDynListFromGConfValue :: GConfValue -> IO [GConfValueDyn] unsafeMarshalGConfValueDynListFromGConfValue value = do gsList <- {# call unsafe gconf_value_get_list #} value valuesPtrs <- readGSList gsList mapM (unsafeMarshalFromGConfValue . GConfValue) valuesPtrs marshalGConfValueDynListToGConfValue :: [GConfValueDyn] -> IO GConfValue marshalGConfValueDynListToGConfValue as = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValueList) valuesPtrs <- mapM (liftM (\(GConfValue ptr) -> ptr) . marshalToGConfValue) as valuesList <- toGSList valuesPtrs {# call unsafe gconf_value_set_list_type #} value (fromIntegral $ fromEnum $ (case as of [] -> GconfValueInvalid --unknown type (a:_) -> gconfValueDynGetType (head as))) {# call unsafe gconf_value_set_list_nocopy #} value valuesList return value unsafeMarshalGConfValueDynPairFromGConfValue :: GConfValue -> IO (GConfValueDyn, GConfValueDyn) unsafeMarshalGConfValueDynPairFromGConfValue value = do a <- {# call unsafe gconf_value_get_car #} value b <- {# call unsafe gconf_value_get_cdr #} value a' <- marshalFromGConfValue a b' <- marshalFromGConfValue b return (a', b') marshalGConfValueDynPairToGConfValue :: (GConfValueDyn, GConfValueDyn) -> IO GConfValue marshalGConfValueDynPairToGConfValue (a,b) = do value <- {# call unsafe gconf_value_new #} (fromIntegral $ fromEnum GconfValuePair) a' <- marshalToGConfValue a b' <- marshalToGConfValue b {# call unsafe gconf_value_set_car_nocopy #} value a' {# call unsafe gconf_value_set_cdr_nocopy #} value b' return value instance GConfValueClass GConfValueDyn where typeofGConfValue _ = undefined -- will never be used unsafeMarshalFromGConfValue value = do valueType <- gconfValueGetType value case valueType of GconfValueString -> liftM GConfValueString $ unsafeMarshalFromGConfValue value GconfValueInt -> liftM GConfValueInt $ unsafeMarshalFromGConfValue value GconfValueFloat -> liftM GConfValueFloat $ unsafeMarshalFromGConfValue value GconfValueBool -> liftM GConfValueBool $ unsafeMarshalFromGConfValue value GconfValueSchema -> liftM GConfValueSchema $ unsafeMarshalFromGConfValue value GconfValueList -> liftM GConfValueList $ unsafeMarshalGConfValueDynListFromGConfValue value GconfValuePair -> liftM GConfValuePair $ unsafeMarshalGConfValueDynPairFromGConfValue value marshalFromGConfValue value@(GConfValue ptr) = do when (ptr == nullPtr) $ fail "GConf: cannot get value of key, key is unset" unsafeMarshalFromGConfValue value marshalToGConfValue v = case v of (GConfValueString v') -> marshalToGConfValue v' (GConfValueInt v') -> marshalToGConfValue v' (GConfValueFloat v') -> marshalToGConfValue v' (GConfValueBool v') -> marshalToGConfValue v' (GConfValueSchema v') -> marshalToGConfValue v' (GConfValueList v') -> marshalGConfValueDynListToGConfValue v' (GConfValuePair v') -> marshalGConfValueDynPairToGConfValue v' gconfValueDynGetType :: GConfValueDyn -> GConfValueType gconfValueDynGetType (GConfValueString _) = GconfValueString gconfValueDynGetType (GConfValueInt _) = GconfValueInt gconfValueDynGetType (GConfValueFloat _) = GconfValueFloat gconfValueDynGetType (GConfValueBool _) = GconfValueBool gconfValueDynGetType (GConfValueSchema _) = GconfValueSchema gconfValueDynGetType (GConfValueList _) = GconfValueList gconfValueDynGetType (GConfValuePair _) = GconfValuePair --- NEW FILE: GConfClient.chs --- {-# OPTIONS -cpp #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) GConf API -- -- Author : Duncan Coutts -- Created: 16 April 2004 -- -- Copyright (c) 2004 Duncan Coutts -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library 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 -- Library General Public License for more details. -- -- | -- -- GConf is a system for maintaining program configuration information. -- The main difference between GConf and traditional configuration files / -- API's, is that GConf is that GConf is 'live'. Applications can be -- notified of changes in their configuration, it allows desktop wide setting -- to be propogated without restarting all applications, or multiple instances -- of a single application to synchronise their configuration. It is similar -- in many ways to the Win32 Registry with its directory-like structure. -- -- This module only binds the client library which is the only interface that -- normal applications should need. Only special GConf apps need lower level -- access. -- -- * Some low level functions have not been bound -- eg @gconf_client_get_for_engine@ -- module System.Gnome.GConf.GConfClient ( -- * Data types -- GConf, GConfPreloadType, GConfError, -- * Creation operation -- gconfGetDefault, -- * Registering for change notifications -- gconfAddDir, gconfRemoveDir, gconfNotifyAdd, gconfNotifyRemove, onValueChanged, afterValueChanged, -- * Getting and setting configuration values -- gconfGet, gconfSet, -- gconfGetFloat, -- gconfGetInt, -- gconfGetString, -- gconfGetBool, -- gconfGetSchema, -- gconfGetList, -- gconfGetPair, gconfGetWithoutDefault, gconfGetDefaultFromSchema, gconfUnset, -- * caching control -- gconfClearCache, gconfPreload, gconfSuggestSync, -- * Navigation -- gconfAllEntries, gconfAllDirs, gconfDirExists, -- * GConfValue -- GConfValueClass, GConfPrimitiveValueClass, GConfValue, GConfValueDyn(..), GConfSchema ) where import Monad (liftM, when) import LocalData (newIORef, readIORef, writeIORef) import FFI {#import Hierarchy#} {#import Signal#} import GObject (makeNewGObject) import GList import GError (GErrorDomain, GErrorClass(..), propagateGError) {#import System.Gnome.GConf.GConfType#} {#import System.Gnome.GConf.GConfValue#} {# context lib="gconf" prefix ="gconf_client" #} {# enum GConfClientPreloadType as GConfPreloadType {underscoreToCase} #} -- | The "GError" exceptions that can be thrown by functions in this module {# enum GConfError {underscoreToCase} #} gconfErrorDomain :: GErrorDomain gconfErrorDomain = unsafePerformIO {#call unsafe gconf_error_quark#} instance GErrorClass GConfError where gerrorDomain _ = gconfErrorDomain {# pointer *GConfEntry newtype #} -- |Operations -- ----------- -- |Creation operations -- - -- @constructor gconfGetDefault@ Create a new GConf object -- using the default configuration engine. -- gconfGetDefault :: IO GConf gconfGetDefault = makeNewGObject mkGConf {# call gconf_client_get_default #} -- |Registering for change notifications -- - -- @method gconfAddDir@ Add a directory to the list of directories the -- GConf will watch. You should use gconfNotifyAdd to associate -- change handlers with specific keys. -- -- * Added directories may not overlap. That is, if you add "/foo", you may not -- add "/foo/bar". However you can add "/foo" and "/bar". You can also add -- "/foo" multiple times; if you add a directory multiple times, it will not -- be removed until you call gconfRemoveDir an equal number of times. -- -- * Note that the watch is recursive, all keys below the given directory will -- be watched. So it would be a bad idea to watch the root "/". -- gconfAddDir :: GConf -> String -> IO () gconfAddDir gc key = gconfAddDirWithPreload gc key PreloadNone -- @method gconfAddDirWithPreload@ Like gconfAddDir but with the -- option to specify a preload mode. -- -- As a rule of thumb, if you plan to get the value of almost all the keys in a -- directory, preloading that directory will probably enhance performance. If -- you plan to use only half the keys, preloading is likely a bad idea. -- -- * PreloadNone specifies that no preload occurs -- * PreloadOnelevel loads the immediate children of the directory -- * PreloadRecursive loads all children of the directory and its -- subdirectories, recursively. -- gconfAddDirWithPreload :: GConf -> String -> GConfPreloadType -> IO () gconfAddDirWithPreload gc key preload = propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_add_dir #} gc strPtr (fromIntegral $ fromEnum preload) gerrorPtr -- @method gconfRemoveDir@ Remove a directory from the list created with -- gconfAddDir. If any notifications have been added below this directory -- with gconfNotifyAdd, those notifications will be disabled until you -- re-add the removed directory. -- -- * Note that if a directory has been added multiple times, you must remove it -- the same number of times before the remove takes effect. -- gconfRemoveDir :: GConf -> String -> IO () gconfRemoveDir gc key = propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_remove_dir #} gc strPtr gerrorPtr {#pointer GFreeFunc#} #if __GLASGOW_HASKELL__>=504 foreign import ccall "wrapper" mkDestructor :: IO () -> IO GFreeFunc #else foreign export dynamic mkDestructor :: IO () -> IO GFreeFunc #endif type GConfClientNotifyFunc = Ptr () -> --GConfClient *client {#type guint#} -> --guint cnxn_id Ptr () -> --GConfEntry *entry Ptr () -> --gpointer user_data IO () #if __GLASGOW_HASKELL__>=504 foreign import ccall "wrapper" mkHandler_GConfClientNotifyFunc :: GConfClientNotifyFunc -> IO (FunPtr GConfClientNotifyFunc) #else foreign export dynamic mkHandler_GConfClientNotifyFunc :: GConfClientNotifyFunc -> IO (FunPtr GConfClientNotifyFunc) #endif connect_GConfClientNotifyFunc :: GConf -> String -> (GConfEntry -> IO ()) -> IO GConfConnectId connect_GConfClientNotifyFunc gc key user = do hPtr <- mkHandler_GConfClientNotifyFunc (\_ _ entryPtr _ -> user (GConfEntry $ castPtr entryPtr)) dRef <- newIORef nullFunPtr dPtr <- mkDestructor $ do freeHaskellFunPtr hPtr dPtr <- readIORef dRef freeHaskellFunPtr dPtr writeIORef dRef dPtr cnxId <- propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_notify_add #} gc strPtr (castFunPtr hPtr) nullPtr dPtr gerrorPtr return $ GConfConnectId cnxId newtype GConfConnectId = GConfConnectId {#type guint#} gconfNotifyAdd :: GConfValueClass value => GConf -> String -> (String -> value -> IO ()) -> IO GConfConnectId gconfNotifyAdd gc key handler = connect_GConfClientNotifyFunc gc key (convertValueChangedHandler handler) where convertValueChangedHandler :: GConfValueClass value => (String -> value -> IO ()) -> (GConfEntry -> IO ()) convertValueChangedHandler handler entry = do keyStrPtr <- {# call unsafe gconf_entry_get_key #} entry valuePtr <- {# call unsafe gconf_entry_get_value #} entry key <- peekUTFString keyStrPtr value <- marshalFromGConfValue valuePtr handler key value gconfNotifyRemove :: GConf -> GConfConnectId -> IO () gconfNotifyRemove gc (GConfConnectId cxid) = {# call gconf_client_notify_remove #} gc cxid -- |Getting and setting configuration values -- - -- @method gconfGet@ Gets the value of a configuration key. -- -- * the second parameter is name of the key -- gconfGet :: GConfValueClass value => GConf -> String -> IO value gconfGet gc key = do value <- propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_get #} gc strPtr gerrorPtr marshalFromGConfValue value gconfGetInt :: GConf -> String -> IO Int gconfGetInt = gconfGet gconfGetBool :: GConf -> String -> IO Bool gconfGetBool = gconfGet gconfGetFloat :: GConf -> String -> IO Double gconfGetFloat = gconfGet gconfGetString :: GConf -> String -> IO String gconfGetString = gconfGet gconfGetSchema :: GConf -> String -> IO GConfSchema gconfGetSchema = gconfGet gconfGetPair :: GConfValueClass (a,b) => GConf -> String -> IO (a, b) gconfGetPair = gconfGet gconfGetList :: GConfValueClass [a] => GConf -> String -> IO [a] gconfGetList = gconfGet -- @method gconfSet@ Sets the value of a configuration key. -- -- * the second parameter is name of the key, the third is the new value -- gconfSet :: GConfValueClass value => GConf -> String -> value -> IO () gconfSet gc key val = do value@(GConfValue ptr) <- marshalToGConfValue val if ptr == nullPtr then gconfUnset gc key else propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_set #} gc strPtr value gerrorPtr gconfSetInt :: GConf -> String -> Int -> IO () gconfSetInt = gconfSet gconfSetBool :: GConf -> String -> Bool -> IO () gconfSetBool = gconfSet gconfSetFloat :: GConf -> String -> Double -> IO () gconfSetFloat = gconfSet gconfSetString :: GConf -> String -> String -> IO () gconfSetString = gconfSet gconfSetSchema :: GConf -> String -> GConfSchema -> IO () gconfSetSchema = gconfSet gconfSetPair :: GConfValueClass (a,b) => GConf -> String -> (a, b) -> IO () gconfSetPair = gconfSet gconfSetList :: GConfValueClass [a] => GConf -> String -> [a] -> IO () gconfSetList = gconfSet -- @method gconfGetWithoutDefault@ Gets the value of a configuration key. -- Same as gconfGet, but doesn't look for a default value if the key is -- unset. -- gconfGetWithoutDefault :: GConfValueClass value => GConf -> String -> IO value gconfGetWithoutDefault gc key = do value <- propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_get_without_default #} gc strPtr gerrorPtr marshalFromGConfValue value -- @method gconfGetDefaultFromSchema@ Returns the default value stored in -- the key's schema, if the key has a schema associated and the schema exists -- and the schema contains a default value. Note that gconfSet already -- returns the default value if no other value is found, so normally you do not -- need this function. -- gconfGetDefaultFromSchema :: GConfValueClass value => GConf -> String -> IO value gconfGetDefaultFromSchema gc key = do value <- propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_get_default_from_schema #} gc strPtr gerrorPtr marshalFromGConfValue value -- @method gconfGetWithoutDefault@ Unsets the value of key; if key is -- already unset, has no effect. An error of note is GCONF_OVERRIDDEN, -- indicating that the system administrator has "forced" a value for this key. -- gconfUnset :: GConf -> String -> IO () gconfUnset gc key = propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> do {# call gconf_client_unset #} gc strPtr gerrorPtr return () -- @method gconfClearCache@ Dumps everything out of the GConf -- client-side cache. If you know you're done using the GConf for a while, -- you can call this function to save some memory. -- gconfClearCache :: GConf -> IO () gconfClearCache gc = {# call gconf_client_clear_cache #} gc -- @method gconfPreload@ Preloads a directory. Normally you do this when -- you call gconfAddDirWithPreload, but if you've called -- gconfClearCache there may be a reason to do it again. -- gconfPreload :: GConf -> String -> GConfPreloadType -> IO () gconfPreload gc key preload = propagateGError $ \gerrorPtr -> withCString key $ \strPtr -> {# call gconf_client_preload #} gc strPtr (fromIntegral $ fromEnum preload) gerrorPtr -- @method gconfSuggestSync@ Suggests to gconfd that you've just finished -- a block of changes, and it would be an optimal time to sync to permanent -- storage. This is only a suggestion; and gconfd will eventually sync even if -- you don't call gconfSuggestSync. This function is just a "hint" -- provided to gconfd to maximize efficiency and minimize data loss. -- gconfSuggestSync :: GConf -> IO () gconfSuggestSync gc = propagateGError $ \gerrorPtr -> {# call gconf_client_suggest_sync #} gc gerrorPtr -- @method gconfAllEntries@ -- gconfAllEntries :: GConf -> String -> IO [(String, GConfValueDyn)] gconfAllEntries gc dir = do gsList <- propagateGError $ \gerrorPtr -> withCString dir $ \strPtr -> {# call gconf_client_all_entries #} gc strPtr gerrorPtr entryList <- fromGSList gsList mapM (\entry -> do let entry' = GConfEntry entry keyStrPtr <- {# call unsafe gconf_entry_get_key #} entry' valuePtr <- {# call unsafe gconf_entry_get_value #} entry' key <- peekUTFString keyStrPtr value <- marshalFromGConfValue valuePtr -- gconf_entry_free is depreciated, use gconf_entry_unref -- however gconf_entry_unref is not documented and docs -- still say to use gconf_entry_free. Confusing. {# call unsafe gconf_entry_free #} entry' return (key,value)) entryList -- @method gconfAllDirs@ -- gconfAllDirs :: GConf -> String -> IO [String] gconfAllDirs gc dir = do gsList <- withCString dir $ \strPtr -> {# call gconf_client_all_dirs #} gc strPtr nullPtr dirList <- fromGSList gsList mapM (\strPtr -> do str <- peekUTFString strPtr {# call unsafe g_free #} (castPtr strPtr) return str) dirList -- @method gconfDirExists@ -- gconfDirExists :: GConf -> String -> IO Bool gconfDirExists gc dir = withCString dir $ \strPtr -> liftM toBool $ {# call gconf_client_dir_exists #} gc strPtr nullPtr -- |Signals -- - onValueChanged, afterValueChanged :: GConf -> (String -> Maybe GConfValueDyn -> IO ()) -> IO (ConnectId GConf) onValueChanged gc handler = connect_STRING_PTR__NONE "value_changed" False gc (convertValueChangedHandler handler) afterValueChanged gc handler = connect_STRING_PTR__NONE "value_changed" True gc (convertValueChangedHandler handler) convertValueChangedHandler :: (String -> Maybe GConfValueDyn -> IO ()) -> (String -> Ptr GConfValue -> IO ()) convertValueChangedHandler handler key ptr = do value <- marshalFromGConfValue (GConfValue $ castPtr ptr) handler key value |
From: Duncan C. <dun...@us...> - 2004-07-26 12:02:42
|
Update of /cvsroot/gtk2hs/gtk2hs/gconf/System/Gnome In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23178/gconf/System/Gnome Added Files: GConf.hs Log Message: new gconf binding package --- NEW FILE: GConf.hs --- module System.Gnome.GConf ( module System.Gnome.GConf.GConfClient ) where import System.Gnome.GConf.GConfClient |
From: Duncan C. <dun...@us...> - 2004-07-26 12:02:19
|
Update of /cvsroot/gtk2hs/gtk2hs/gconf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23178/gconf Added Files: Makefile Log Message: new gconf binding package --- NEW FILE: Makefile --- TOP = .. include $(TOP)/mk/config.mk PACKAGENAME = gconf MAIN = System/Gnome/GConf.hs # HACK: need to have . is SUBDIRS so that ghc package file works SUBDIRS = ./ System/Gnome System/Gnome/GConf # In order for ghc and c2hs to find .chi and .hi files in ../gtk/* we # need to set these directories here. Note that this list is different # from SUBDIRS in that the directories given here are not searched for # compilable files. HIDIRS = $(TOP)/gtk/glib $(TOP)/gtk/abstract $(TOP)/gtk/general HEADER = gconf/gconf-client.h #EXTRA_HFILES = #EXTRA_TARFILES = ifneq (x$(MULTIPLE_CHS),xyes) GConfClient-HEADER = gconf/gconf-client.h GConfValue-HEADER = gconf/gconf-value.h endif # required because [a] & String overlap in GConfValue.chs # They don't actually overlap so it's safe. EXTRAHC_FLAGS = -fallow-overlapping-instances # Further options to the C preprocessor are passed verbatim: EXTRA_CPPFLAGS = $(GCONF_CFLAGS) EXTRA_LIBS = $(GCONF_LIBS) NEEDPACKAGES = gtk2 EXTRA_CHSFILES += System/Gnome/GConf/GConfType.chs TYPE_TAGS += gconf EXTRA_CLEANFILES+= System/Gnome/GConf/GConfType.chs NEEDCHI = System/Gnome/GConf/GConfType System/Gnome/GConf/GConfValue System/Gnome/GConf/GConfType.chs : $(TOP)/tools/hierarchyGen/hierarchy.list $(strip $(TOP)/tools/hierarchyGen/TypeGenerator \ $(TOP)/tools/hierarchyGen/hierarchy.list \ System/Gnome/GConf/GConfType.chs \ $(addprefix --tag=,$(TYPE_TAGS))) --lib=gconf --prefix=gconf \ --modname=System.Gnome.GConf.GConfType include $(TOP)/mk/common.mk |
From: Duncan C. <dun...@us...> - 2004-07-26 11:59:38
|
Update of /cvsroot/gtk2hs/gtk2hs/gconf/System/Gnome/GConf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22727/gconf/System/Gnome/GConf Log Message: Directory /cvsroot/gtk2hs/gtk2hs/gconf/System/Gnome/GConf added to the repository |
From: Duncan C. <dun...@us...> - 2004-07-26 11:59:36
|
Update of /cvsroot/gtk2hs/gtk2hs/gconf/System/Gnome In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22727/gconf/System/Gnome Log Message: Directory /cvsroot/gtk2hs/gtk2hs/gconf/System/Gnome added to the repository |
From: Duncan C. <dun...@us...> - 2004-07-26 11:59:36
|
Update of /cvsroot/gtk2hs/gtk2hs/gconf/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22727/gconf/System Log Message: Directory /cvsroot/gtk2hs/gtk2hs/gconf/System added to the repository |
From: Duncan C. <dun...@us...> - 2004-07-26 11:58:21
|
Update of /cvsroot/gtk2hs/gtk2hs/gconf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22564/gconf Log Message: Directory /cvsroot/gtk2hs/gtk2hs/gconf added to the repository |
From: Duncan C. <dun...@us...> - 2004-07-24 02:31:15
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9436 Modified Files: ChangeLog Log Message: spelling fix Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.180 retrieving revision 1.181 diff -u -d -r1.180 -r1.181 --- ChangeLog 17 Jul 2004 04:05:13 -0000 1.180 +++ ChangeLog 24 Jul 2004 02:31:05 -0000 1.181 @@ -1,3 +1,8 @@ +2004-07-24 Duncan Coutts <du...@co...> + + * gtk/glib/GError.chs, gtk/abstract/FileChooser.chs: spelling fix + propogateGError to propagateGError + 2004-07-17 Duncan Coutts <du...@co...> * gtk/glib/GError.chs: extra function for converting GError exceptions |
From: Duncan C. <dun...@us...> - 2004-07-24 02:31:14
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9436/gtk/glib Modified Files: GError.chs Log Message: spelling fix Index: GError.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/glib/GError.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GError.chs 17 Jul 2004 04:01:57 -0000 1.2 +++ GError.chs 24 Jul 2004 02:31:05 -0000 1.3 @@ -66,7 +66,7 @@ -- | * Note, these functions are only useful to implementors -- -- If you are wrapping a new API that reports 'GError's you should probably use - -- 'propogateGError' to convert the GError into an exception. You should also + -- 'propagateGError' to convert the GError into an exception. You should also -- note in the documentation for the function that it throws GError exceptions -- and the Haskell enumeration for the expected glib GError domain(s), so that -- users know what exceptions they might want to catch. @@ -75,7 +75,7 @@ -- Either\/Maybe) then you should use 'checkGError' or 'checkGErrorWithCont'. GErrorClass(..), - propogateGError, + propagateGError, checkGError, checkGErrorWithCont @@ -144,13 +144,13 @@ -- -- Example of use: -- --- > propogateGError $ \gerrorPtr -> +-- > propagateGError $ \gerrorPtr -> -- > {# call g_some_function_that_might_return_an_error #} a b gerrorPtr -- -propogateGError :: (Ptr (Ptr ()) -> IO a) -> IO a -propogateGError action = checkGError action throwGError +propagateGError :: (Ptr (Ptr ()) -> IO a) -> IO a +propagateGError action = checkGError action throwGError --- | Like 'propogateGError' but instead of throwing the GError as an exception +-- | Like 'propagateGError' but instead of throwing the GError as an exception -- handles the error immediately using the supplied error handler. -- -- Example of use: |