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: Duncan C. <dun...@us...> - 2005-01-10 17:25:38
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/apicoverage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5659/tools/apicoverage Modified Files: Makefile Log Message: update regexps to match the output of current versions of c2hs. The apicoverage tool should now be accurate. Index: Makefile =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apicoverage/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile 3 Aug 2004 02:40:13 -0000 1.4 +++ Makefile 10 Jan 2005 17:25:27 -0000 1.5 @@ -1,9 +1,9 @@ # system to help check gtk2hs's api coverage -# which vesion of gtk+ to compare against, eg 2.0.9, 2.2.4, 2.4.4 +# which vesion of gtk+ to compare against, eg 2.0.9, 2.2.4, 2.4.13 GTK_MAJOR_VERSION = 2 -GTK_MINOR_VERSION = 2 -GTK_MICRO_VERSION = 0 +GTK_MINOR_VERSION = 6 +GTK_MICRO_VERSION = 1 GTK_VERSION = $(GTK_MAJOR_VERSION).$(GTK_MINOR_VERSION).$(GTK_MICRO_VERSION) @@ -20,8 +20,9 @@ GTK_CHS_FILES = $(shell find ../../gtk -name '*.chs') gtk.coverage : $(GTK_CHS_FILES) - grep -h 'foreign import ccall \(unsafe \)\?" \?&\?.*"' `find ../../gtk -name '*.hs'` | \ - sed 's:foreign import ccall \(unsafe \)\?" \?&\?\(.*\)".*:\2:' | \ + grep -h 'foreign import ccall \(safe \|unsafe \)\?" \?&\?.*"' \ + `find ../../gtk -name '*.hs'` | \ + sed 's:foreign import ccall \(safe \|unsafe \)\?" \?&\?\(.*\)".*:\2:' | \ sort -u | grep '^gtk_' | grep --invert-match '_get_type$$' > gtk.coverage # We can have (optional) api.ignore files in the gtk directories to have a |
From: Duncan C. <dun...@us...> - 2005-01-10 17:25:37
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5659 Modified Files: ChangeLog Log Message: update regexps to match the output of current versions of c2hs. The apicoverage tool should now be accurate. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.279 retrieving revision 1.280 diff -u -d -r1.279 -r1.280 --- ChangeLog 10 Jan 2005 17:23:04 -0000 1.279 +++ ChangeLog 10 Jan 2005 17:25:27 -0000 1.280 @@ -12,6 +12,9 @@ * tools/apiGen/Template.chs: import System.Glib.FFI rather than Foreign, also a couple cosmetic improvements. + * tools/apicoverage/Makefile: update regexps to match the output of + current versions of c2hs. The apicoverage tool should now be accurate. + 2005-01-09 Duncan Coutts <du...@co...> * tools/apiGen/format-docs.xsl: fix generation of function version |
From: Duncan C. <dun...@us...> - 2005-01-10 17:23:16
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/apiGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4629/tools/apiGen Modified Files: format-docs.xsl ApiGen.hs gen-all.sh Template.chs Log Message: Deal with more complicated formatting, definition lists, itemised lists, subsections, titled and untitled program listing examples. It now works for all modules in gtk 2.6 Index: Template.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/Template.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Template.chs 7 Jan 2005 17:45:40 -0000 1.2 +++ Template.chs 10 Jan 2005 17:23:05 -0000 1.3 @@ -22,7 +22,7 @@ -- Stability : provisional -- Portability : non-portable (uses gtk+ C library) -- --- @DESCRIPTION@ @TODO@ +-- @DESCRIPTION@@TODO@ -- module @MODULE_NAME@ ( @DOCUMENTATION@ @@ -30,9 +30,9 @@ ) where import Monad (liftM) -import Foreign -import Foreign.C + +import System.Glib.FFI @IMPORTS@ -{#context lib="@CONTEXT_LIB@" prefix="@CONTEXT_PREFIX@" #} +{# context lib="@CONTEXT_LIB@" prefix="@CONTEXT_PREFIX@" #} @MODULE_BODY@ Index: format-docs.xsl =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/format-docs.xsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- format-docs.xsl 9 Jan 2005 23:45:11 -0000 1.3 +++ format-docs.xsl 10 Jan 2005 17:23:04 -0000 1.4 @@ -28,32 +28,66 @@ <arg><xsl:value-of select="."/></arg> </xsl:template> +<xsl:template match="para[not(example) and not(informalexample)]"> +<para><xsl:apply-templates/></para> +</xsl:template> + +<xsl:template match="para[informalexample]"> +<para><xsl:apply-templates select="node()[name()!='informalexample']"/></para> +<xsl:apply-templates select="informalexample"/> +</xsl:template> + +<xsl:template match="para[example]"> +<para><xsl:apply-templates select="node()[name()!='example']"/></para> +<xsl:apply-templates select="example"/> +</xsl:template> + +<xsl:template match="varlistentry"> +<definition> + <term><xsl:value-of select="term"/></term> + <xsl:apply-templates select="listitem/para/child::node()"/> +</definition> +</xsl:template> + +<xsl:template match="itemizedlist/listitem/para"> +<listitem><xsl:apply-templates/></listitem> +</xsl:template> + +<xsl:template match="section | refsect2"> +<section> + <title><xsl:value-of select="title"/></title> + <xsl:apply-templates select="para | programlisting | example"/> +</section> +</xsl:template> + +<xsl:template match="example"> +<example> + <title><xsl:value-of select="title"/></title> + <xsl:apply-templates select="para | programlisting"/> +</example> +</xsl:template> + +<xsl:template match="programlisting"> +<programlisting><xsl:value-of select="."/></programlisting> +</xsl:template> + +<xsl:template match="footnote"></xsl:template> + <xsl:template match="/"> <apidoc> <module> <name><xsl:value-of select="/book/refentry/refnamediv/refname"/></name> <summary><xsl:value-of select="/book/refentry/refnamediv/refpurpose"/></summary> <description> - <xsl:for-each select="/book/refentry/refsect1[title='Description']/para"> - <para><xsl:apply-templates/></para> + <xsl:for-each select="/book/refentry/refsect1[title='Description']"> + <xsl:apply-templates select="para | section | refsect2"/> </xsl:for-each> </description> - <extra-sections> - <xsl:for-each select="/book/refentry/refsect1[title='Description']/section"> - <section> - <title><xsl:value-of select="title"/></title> - <xsl:for-each select="para | programlisting"> - <xsl:if test="name()='para'"> - <para><xsl:apply-templates/></para> - </xsl:if> - <xsl:if test="name()='programlisting'"> - <xsl:copy-of select="."/> - </xsl:if> - </xsl:for-each> - </section> + <object-hierarchy> + <xsl:for-each select="/book/refentry/refsect1[title='Object Hierarchy']/synopsis"> + <xsl:copy-of select="text() | link"/> </xsl:for-each> - </extra-sections> - <object-hierarchy></object-hierarchy> + </object-hierarchy> </module> <xsl:for-each select="/book/refentry/refsect1[title='Details']/refsect2[contains(title,' ()')]"> <function> @@ -62,10 +96,7 @@ <xsl:value-of select="normalize-space(substring-after(para[starts-with(text(),'Since')], 'Since'))"/> </since> <doc> - <xsl:for-each select="para[not(starts-with(text(),'Since')) and normalize-space(text())!='']"> - <!--<xsl:copy-of select="."/>--> - <para><xsl:apply-templates/></para> - </xsl:for-each> + <xsl:apply-templates select="para[not(starts-with(text(),'Since')) and normalize-space(text())!='']"/> </doc> </function> </xsl:for-each> Index: gen-all.sh =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/gen-all.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gen-all.sh 7 Jan 2005 17:45:40 -0000 1.2 +++ gen-all.sh 10 Jan 2005 17:23:05 -0000 1.3 @@ -1,7 +1,7 @@ #!/bin/bash -DOCBOOKDIR=../apicoverage/tars/gtk+-2.4.13/docs/reference/gtk/xml -HEADDERS=/usr/include/gtk-2.0/gtk/*.h +DOCBOOKDIR=../apicoverage/tars/gtk+-2.6.1/docs/reference/gtk/xml +HEADDERS=../apicoverage/tars/image/usr/local/include/gtk-2.0/gtk/*.h mkdirhier doc api modules echo > modules/missing_docs @@ -14,7 +14,7 @@ DOCFILE=doc/$(basename ${HEADDER%.h}).xml echo Processing $HEADDER - ./gapi_pp.pl $HEADDER | ./gapi2xml.pl Gtk $APIFILE gtk+ >> /dev/null || exit + ./gapi_pp.pl $HEADDER | ./gapi2xml.pl Gtk $APIFILE gtk >> /dev/null || exit # ./gapi_format_xml $APIFILE.tmp $APIFILE || exit # rm $APIFILE.tmp Index: ApiGen.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/ApiGen.hs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ApiGen.hs 9 Jan 2005 23:45:11 -0000 1.3 +++ ApiGen.hs 10 Jan 2005 17:23:05 -0000 1.4 @@ -162,18 +162,18 @@ ------------------------------------------------------------------------------- data ApiDoc = ApiDoc { - apidoc_name :: String, - apidoc_summary :: String, - apidoc_description :: [DocPara], - apidoc_extrasections :: [DocSection], - apidoc_functions :: [FuncDoc] + apidoc_name :: String, -- these docs apply to this object + apidoc_summary :: String, -- a one line summary + apidoc_description :: [DocPara], -- the main description + apidoc_sections :: [DocSection], -- any additional titled subsections + apidoc_functions :: [FuncDoc] -- documentation for each function } noApiDoc = ApiDoc { apidoc_name = "", apidoc_summary = "", apidoc_description = [], - apidoc_extrasections = [], + apidoc_sections = [], apidoc_functions = [] } @@ -188,8 +188,12 @@ funcdoc_since :: Maybe String -- which version of the api the } -- function is avaliable from, eg "2.4" -data DocPara = TextPara [DocParaSpan] - | ProgramListing String +data DocPara = + DocParaText [DocParaSpan] -- an ordinary word-wrapped paragraph + | DocParaProgram String -- a verbatum section + | DocParaExample String String -- a verbatum section with a title + | DocParaDefItem String [DocParaSpan] -- a definition list item + | DocParaListItem [DocParaSpan] -- a itemisted list item data DocParaSpan = DocText String -- just simple text | DocFuncXRef String -- cross reference to a function name @@ -210,14 +214,18 @@ (Xml.CElem (Xml.Elem "module" [] [Xml.CElem (Xml.Elem "name" [] name) ,Xml.CElem (Xml.Elem "summary" [] summary) - ,Xml.CElem (Xml.Elem "description" [] paras) - ,Xml.CElem (Xml.Elem "extra-sections" [] sections) + ,Xml.CElem (Xml.Elem "description" [] parasAndSections) ,Xml.CElem (Xml.Elem "object-hierarchy" [] _)] - )) = ApiDoc { + )) = + let (paras, sections) = span (\elem -> + case elem of + Xml.CElem (Xml.Elem "section" _ _) -> False + _ -> True) parasAndSections + in ApiDoc { apidoc_name = Xml.verbatim name, apidoc_summary = Xml.verbatim summary, - apidoc_description = map extractDocPara paras, - apidoc_extrasections = map extractDocSection sections, + apidoc_description = concatMap extractDocPara paras, + apidoc_sections = map extractDocSection sections, apidoc_functions = undefined } @@ -228,7 +236,7 @@ :paras))) = DocSection { section_title = title, - section_paras = map extractDocPara paras + section_paras = concatMap extractDocPara paras } extractDocSection other = error $ "extractDocSection: " ++ Xml.verbatim other @@ -244,16 +252,51 @@ [Xml.CString _ since] -> Just since in FuncDoc { funcdoc_name = name, - funcdoc_paragraphs = map extractDocPara paras, + funcdoc_paragraphs = concatMap extractDocPara paras, funcdoc_since = since } -extractDocPara :: Xml.Content -> DocPara +extractDocPara :: Xml.Content -> [DocPara] extractDocPara (Xml.CElem elem@(Xml.Elem "para" [] _)) = case Xml.xmlUnEscape Xml.stdXmlEscaper elem of - (Xml.Elem _ [] spans) -> TextPara (map extractDocParaSpan spans) -extractDocPara (Xml.CElem (Xml.Elem "programlisting" _ [Xml.CString _ listing])) = - ProgramListing listing + (Xml.Elem _ [] spans) -> extractDocPara' spans +extractDocPara (Xml.CElem (Xml.Elem "programlisting" _ content)) = + let listing = concat [ str | (Xml.CString _ str) <- content ] in + [DocParaProgram listing] +extractDocPara (Xml.CElem (Xml.Elem "example" _ + [Xml.CElem (Xml.Elem "title" [] [Xml.CString _ title]) + ,(Xml.CElem (Xml.Elem "programlisting" _ content))])) = + let listing = concat [ str | (Xml.CString _ str) <- content ] in + [DocParaExample title listing] +{-extractDocPara (Xml.CElem (Xml.Elem "example" _ + [Xml.CElem (Xml.Elem "title" [] [Xml.CString _ title]) + ,(Xml.CElem (Xml.Elem "programlisting" _ other))])) = error $ "extractDocPara: example1:\n" ++ Prelude.unlines (map ((++ "\n\n\nFOOBAR\n\n\n") . Xml.verbatim) other) ++ "\n len = " ++ show (length other) +extractDocPara (Xml.CElem (Xml.Elem "example" _ other)) = error $ "extractDocPara: example2:\n" ++ Xml.verbatim other ++ "\n len = " ++ show (length other)-} +extractDocPara other = error $ "extractDocPara: " ++ Xml.verbatim other + +extractDocPara' :: [Xml.Content] -> [DocPara] +extractDocPara' = reconstructParas [] . map extractDocParaOrSpan + where reconstructParas :: [DocParaSpan] -> [Either DocParaSpan DocPara] -> [DocPara] + reconstructParas [] [] = [] + reconstructParas spans [] = [DocParaText (reverse spans)] + reconstructParas spans (Left span:rest) = reconstructParas (span:spans) rest + reconstructParas [] (Right para:rest) = para : reconstructParas [] rest + reconstructParas spans (Right para:rest) = DocParaText (reverse spans) + : para : reconstructParas [] rest + +extractDocParaOrSpan :: Xml.Content -> Either DocParaSpan DocPara +extractDocParaOrSpan (Xml.CElem (Xml.Elem "listitem" [] content)) = + Right $ DocParaListItem (map extractDocParaSpan content) +extractDocParaOrSpan (Xml.CElem (Xml.Elem "definition" [] + (Xml.CElem (Xml.Elem "term" [] [Xml.CString _ term]) + :content))) = + Right $ DocParaDefItem term (map extractDocParaSpan content) +extractDocParaOrSpan (Xml.CElem (Xml.Elem "programlisting" _ content)) = + let listing = concat [ str | (Xml.CString _ str) <- content ] in + Right $ DocParaProgram listing +extractDocParaOrSpan content@(Xml.CElem _ ) = Left $ extractDocParaSpan content +extractDocParaOrSpan content@(Xml.CString _ _) = Left $ extractDocParaSpan content +extractDocParaOrSpan other = error $ "extractDocParaOrSpan: " ++ Xml.verbatim other extractDocParaSpan :: Xml.Content -> DocParaSpan extractDocParaSpan (Xml.CString _ text) = DocText text @@ -266,6 +309,7 @@ "emphasis" -> DocEmphasis text "literal" -> DocLiteral text "arg" -> DocArg text + other -> error $ "extractDocParaSpan: other tag " ++ tag extractDocParaSpan other = error $ "extractDocParaSpan: " ++ Xml.verbatim other ------------------------------------------------------------------------------- @@ -279,9 +323,9 @@ else comment.ss "* Description".nl. comment.nl. comment.ss "| ".haddocFormatParas (apidoc_description apidoc).nl). - (if null (apidoc_extrasections apidoc) + (if null (apidoc_sections apidoc) then id - else nl.comment.haddocFormatSections (apidoc_extrasections apidoc).nl.comment) + else nl.comment.haddocFormatSections (apidoc_sections apidoc).nl.comment) addVersionParagraphs :: NameSpace -> ApiDoc -> ApiDoc addVersionParagraphs namespace apiDoc = @@ -296,7 +340,7 @@ funcdoc_paragraphs = funcdoc_paragraphs funcdoc ++ let line = "Available since " ++ namespace_name namespace ++ " version " ++ fromJust (funcdoc_since funcdoc) - in [TextPara [DocText line]] + in [DocParaText [DocText line]] } else funcdoc | funcdoc <- funcdocs ] @@ -307,7 +351,7 @@ Just since -> let line = "Module available since " ++ namespace_name namespace ++ " version " ++ since - in [TextPara [DocText line]] + in [DocParaText [DocText line]] -- figure out if the whole module appeared in some version of gtk later -- than the original version @@ -331,19 +375,33 @@ . map haddocFormatPara haddocFormatPara :: DocPara -> ShowS -haddocFormatPara (TextPara spans) = - sepBy' "\n-- " - . map (sepBy " ") - . wrapText 77 - . words - . concatMap haddocFormatSpan - $ spans -haddocFormatPara (ProgramListing prog) = +haddocFormatPara (DocParaText spans) = haddocFormatSpans spans +haddocFormatPara (DocParaProgram prog) = ((ss "* FIXME: port the follwing code example from C to Haskell or remove it".nl. comment).) . sepBy "\n-- > " . List.lines $ prog +haddocFormatPara (DocParaExample title prog) = + ((ss "* ". ss title.nl. + comment).) + . sepBy "\n-- > " + . List.lines + $ prog +haddocFormatPara (DocParaDefItem term spans) = + sc '['. ss term. sc ']'. + haddocFormatSpans spans +haddocFormatPara (DocParaListItem spans) = + ss "* ". + haddocFormatSpans spans + +haddocFormatSpans :: [DocParaSpan] -> ShowS +haddocFormatSpans = + sepBy' "\n-- " + . map (sepBy " ") + . wrapText 77 + . words + . concatMap haddocFormatSpan haddocFormatSpan :: DocParaSpan -> String haddocFormatSpan (DocText text) = escapeHaddockSpecialChars text @@ -378,7 +436,7 @@ -- wraps a list of words to lines of words wrapText :: Int -> [String] -> [[String]] -wrapText width = wrap 0 [] +wrapText width = wrap 3 [] where wrap :: Int -> [String] -> [String] -> [[String]] wrap col line (word:words) | col + length word + 1 > width = reverse line : wrap 0 [] (word:words) @@ -394,7 +452,7 @@ formattedDoc. ss functionName. ss " :: ". functionType. nl. ss functionName. sc ' '. sepBy " " paramNames. ss " =". - indent 1. body. nl + indent 1. body where functionName = lowerCaseFirstChar (method_name method) (classConstraints', paramTypes', paramMarshalers) = @@ -419,6 +477,12 @@ Just doc -> ss "-- | ". haddocFormatParas (funcdoc_paragraphs doc). nl. comment. nl +genModuleBody :: Object -> ApiDoc -> ShowS +genModuleBody object apiDoc = + doVersionIfDefs (sepBy' "\n\n") $ + genConstructors object (apidoc_functions apiDoc) + ++ genMethods object (apidoc_functions apiDoc) + genMethods :: Object -> [FuncDoc] -> [(ShowS, Maybe FuncDoc)] genMethods object apiDoc = [ (genFunction object method doc, doc) @@ -478,13 +542,13 @@ genExports object docs = nl. comment.ss "* Constructors".nl. - doVersionIfDefs + doVersionIfDefs lines [ (ss " ". ss (lowerCaseFirstChar (method_name constructor)). sc ',', doc) | (constructor, doc) <- constructors object docs]. nl. nl. comment.ss "* Methods".nl. - doVersionIfDefs + doVersionIfDefs lines [ (ss " ". ss (lowerCaseFirstChar (method_name method)). sc ',', doc) | (method, doc) <- methods object docs] @@ -504,8 +568,8 @@ ss "TODO: the following varargs functions were not bound\n". lines (map (ss "-- * ".) varargsFunctions) -doVersionIfDefs :: [(ShowS, Maybe FuncDoc)] -> ShowS -doVersionIfDefs = +doVersionIfDefs :: ([ShowS] -> ShowS) -> [(ShowS, Maybe FuncDoc)] -> ShowS +doVersionIfDefs lines = lines . map (\group -> sinceVersion (snd (head group)) (lines (map fst group))) @@ -700,8 +764,7 @@ "IMPORTS" -> ss "-- CHECKME: extra imports may be required\n" "CONTEXT_LIB" -> ss (if null lib then namespace_library namespace else lib) "CONTEXT_PREFIX" -> ss (if null prefix then namespace_library namespace else prefix) - "MODULE_BODY" -> doVersionIfDefs (genConstructors object (apidoc_functions apiDoc') - ++ genMethods object (apidoc_functions apiDoc')) + "MODULE_BODY" -> genModuleBody object apiDoc' _ -> ss "" ) "") [ (namespace, object) | namespace <- api |
From: Duncan C. <dun...@us...> - 2005-01-10 17:23:15
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4629 Modified Files: ChangeLog Log Message: Deal with more complicated formatting, definition lists, itemised lists, subsections, titled and untitled program listing examples. It now works for all modules in gtk 2.6 Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.278 retrieving revision 1.279 diff -u -d -r1.278 -r1.279 --- ChangeLog 9 Jan 2005 23:45:11 -0000 1.278 +++ ChangeLog 10 Jan 2005 17:23:04 -0000 1.279 @@ -1,5 +1,19 @@ 2005-01-09 Duncan Coutts <du...@co...> + * tools/apiGen/format-docs.xsl: nicer code and more comprehensively + deal with various sorts of paragrahps, lists, sections and examples. + + * tools/apiGen/ApiGen.hs: deal with more complicated formatting, + definition lists, itemised lists, subsections, inline and titled + program listing examples. + + * tools/apiGen/gen-all.sh: now works with the latest version of gtk + + * tools/apiGen/Template.chs: import System.Glib.FFI rather than + Foreign, also a couple cosmetic improvements. + +2005-01-09 Duncan Coutts <du...@co...> + * tools/apiGen/format-docs.xsl: fix generation of function version numbers when they have no version given. |
From: Duncan C. <dun...@us...> - 2005-01-09 23:45:22
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15817 Modified Files: ChangeLog Log Message: Fix generation of function version numbers when they have no version given. Fix for when no functions are defined in the documentation file. Also, take the c2hs context prefix and lib values from the api file be default. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.277 retrieving revision 1.278 diff -u -d -r1.277 -r1.278 --- ChangeLog 8 Jan 2005 18:12:48 -0000 1.277 +++ ChangeLog 9 Jan 2005 23:45:11 -0000 1.278 @@ -1,3 +1,12 @@ +2005-01-09 Duncan Coutts <du...@co...> + + * tools/apiGen/format-docs.xsl: fix generation of function version + numbers when they have no version given. + + * tools/apiGen/ApiGen.hs: Fix for when no functions are defined in the + documentation file. Also, take the c2hs context prefix and lib values + from the api file be default. + 2005-01-08 Duncan Coutts <du...@co...> * gtk/Graphics/UI/Gtk.hs: commit the grand hierarchical namespace |
From: Duncan C. <dun...@us...> - 2005-01-09 23:45:20
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/apiGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15817/tools/apiGen Modified Files: format-docs.xsl ApiGen.hs Log Message: Fix generation of function version numbers when they have no version given. Fix for when no functions are defined in the documentation file. Also, take the c2hs context prefix and lib values from the api file be default. Index: format-docs.xsl =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/format-docs.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- format-docs.xsl 8 Jan 2005 07:37:11 -0000 1.2 +++ format-docs.xsl 9 Jan 2005 23:45:11 -0000 1.3 @@ -59,7 +59,7 @@ <function> <name><xsl:value-of select="indexterm/primary"/></name> <since> - <xsl:value-of select="number(substring-after(para[starts-with(text(),'Since')], 'Since '))"/> + <xsl:value-of select="normalize-space(substring-after(para[starts-with(text(),'Since')], 'Since'))"/> </since> <doc> <xsl:for-each select="para[not(starts-with(text(),'Since')) and normalize-space(text())!='']"> Index: ApiGen.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/ApiGen.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ApiGen.hs 7 Jan 2005 17:45:40 -0000 1.2 +++ ApiGen.hs 9 Jan 2005 23:45:11 -0000 1.3 @@ -312,8 +312,10 @@ -- figure out if the whole module appeared in some version of gtk later -- than the original version moduleVersion :: Maybe String - moduleVersion = minimum [ funcdoc_since funcdoc - | funcdoc <- apidoc_functions apiDoc ] + moduleVersion = case [ funcdoc_since funcdoc + | funcdoc <- apidoc_functions apiDoc ] of + [] -> Nothing + versions -> minimum versions haddocFormatSections :: [DocSection] -> ShowS haddocFormatSections = @@ -634,10 +636,10 @@ [] -> "" (docFile:_) -> docFile let lib = case map (drop 6) (filter ("--lib=" `isPrefixOf`) rem) of - [] -> "gtk" + [] -> "" (lib:_) -> lib let prefix = case map (drop 9) (filter ("--prefix=" `isPrefixOf`) rem) of - [] -> "gtk" + [] -> "" (prefix:_) -> prefix let modPrefix = case map (drop 12) (filter ("--modprefix=" `isPrefixOf`) rem) of [] -> "" @@ -696,8 +698,8 @@ "MODULE_NAME" -> ss (modPrefix ++ object_name object) "EXPORTS" -> genExports object (apidoc_functions apiDoc') "IMPORTS" -> ss "-- CHECKME: extra imports may be required\n" - "CONTEXT_LIB" -> ss lib - "CONTEXT_PREFIX" -> ss prefix + "CONTEXT_LIB" -> ss (if null lib then namespace_library namespace else lib) + "CONTEXT_PREFIX" -> ss (if null prefix then namespace_library namespace else prefix) "MODULE_BODY" -> doVersionIfDefs (genConstructors object (apidoc_functions apiDoc') ++ genMethods object (apidoc_functions apiDoc')) _ -> ss "" @@ -718,9 +720,9 @@ \ <outDir> is the name and path of the output file\n\ \ <docFile> api doc file output from format-doc.xsl\n\ \ <lib> set the lib to use in the c2hs {#context #}\n\ - \ declaration (the default is \"gtk\")\n\ + \ declaration (the default is taken from the api file)\n\ \ <prefix> set the prefix to use in the c2hs {#context #}\n\ - \ declaration (the default is \"gtk\")\n\ + \ declaration (the default is taken from the api file)\n\ \ <modPrefix> specify module name prefix, eg if using\n\ \ hierarchical module names\n" exitWith $ ExitFailure 1 |
From: Duncan C. <dun...@us...> - 2005-01-08 18:12:57
|
Update of /cvsroot/gtk2hs/gtk2hs/glib/System/Glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6591/glib/System/Glib Added Files: Types.chs Log Message: commit glib module I missed earlier. This contains the definition of the GObject type which breaks what would otherwise be a cyclic module dependency between GObject and GValue. --- NEW FILE: Types.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget GObject -- -- Author : Axel Simon -- -- Created: 9 April 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 18:12:49 $ -- -- Copyright (c) 2001 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- Implements the base GObject class. -- module System.Glib.Types ( GObject(..), GObjectClass, mkGObject, unGObject, toGObject, fromGObject, castToGObject, ) where import Foreign (ForeignPtr) import GHC.Base (unsafeCoerce#) {# context lib="glib" prefix="g" #} {#pointer *GObject foreign newtype #} mkGObject = GObject unGObject (GObject o) = o class GObjectClass o toGObject :: GObjectClass o => o -> GObject toGObject = unsafeCoerce# fromGObject :: GObjectClass o => GObject -> o fromGObject = unsafeCoerce# instance GObjectClass GObject castToGObject :: GObjectClass obj => obj -> obj castToGObject = id |
From: Duncan C. <dun...@us...> - 2005-01-08 18:12:57
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6591 Modified Files: ChangeLog Log Message: commit glib module I missed earlier. This contains the definition of the GObject type which breaks what would otherwise be a cyclic module dependency between GObject and GValue. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.276 retrieving revision 1.277 diff -u -d -r1.276 -r1.277 --- ChangeLog 8 Jan 2005 17:54:57 -0000 1.276 +++ ChangeLog 8 Jan 2005 18:12:48 -0000 1.277 @@ -193,8 +193,8 @@ glib/System/Glib/GObject.chs.pp, glib/System/Glib/GParameter.hsc glib/System/Glib/GType.chs, glib/System/Glib/GValue.chs, glib/System/Glib/GValueTypes.chs, glib/System/Glib/StoreValue.hsc - glib/System/Glib/UTFString.hs: move glib modules to a seperate - package and use hierarchical namespace names. + glib/System/Glib/UTFString.hs, glib/System/Glib/Types.chs: move glib + modules to a seperate package and use hierarchical namespace names. * configure.ac: add glib tests and flags stuff. Emit the result of the win32 test into config.h so it'll be used. |
From: Duncan C. <dun...@us...> - 2005-01-08 17:55:12
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3445 Modified Files: ChangeLog Log Message: changelog for configure.ac and Makefile.am (should have comitted at the same time, oops) Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.275 retrieving revision 1.276 diff -u -d -r1.275 -r1.276 --- ChangeLog 8 Jan 2005 17:43:36 -0000 1.275 +++ ChangeLog 8 Jan 2005 17:54:57 -0000 1.276 @@ -196,6 +196,13 @@ glib/System/Glib/UTFString.hs: move glib modules to a seperate package and use hierarchical namespace names. + * configure.ac: add glib tests and flags stuff. Emit the result of the + win32 test into config.h so it'll be used. + + * Makefile.am: add glib package, change file names to reflect module + renaming. Add glib flags before gtk flags everywere. All .hi files + now install using nobase to preserve directory names. + 2005-01-07 Duncan Coutts <du...@co...> * tools/apiGen/ApiGen.hs: several documentation improvements, add |
From: Duncan C. <dun...@us...> - 2005-01-08 17:52:46
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2956 Modified Files: Makefile.am configure.ac Log Message: configure.ac: add glib tests and flags stuff. Emit the result of the win32 test into config.h so it'll be used. Makefile.am: add glib package, change file names to reflect module renaming. Add glib flags before gtk flags everywere. All .hi files now install using nobase to preserve directory names. Index: configure.ac =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/configure.ac,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- configure.ac 20 Dec 2004 03:30:58 -0000 1.14 +++ configure.ac 8 Jan 2005 17:52:36 -0000 1.15 @@ -112,6 +112,10 @@ CREATE_TYPES=default; fi; +if test "$WIN32" = "yes"; then + AC_DEFINE(WIN32, [], [Are we building on a Win32 system]) +fi + dnl determine a temporary directory for c2hs TMPDIR="/tmp" if test "$WIN32" = "yes"; then @@ -173,6 +177,7 @@ FOUR_WORD_CALLBACK=no GTKHS_PROG_CHECK_VERSION($GHC_VERSION, -lt, 9.9.9, [ if test $host_cpu = sparc; then FOUR_WORD_CALLBACK=yes; fi + dnl TODO: is this only on Sparc Solaris or on all Sparc (ie Linux too)? ]) AC_MSG_RESULT([$FOUR_WORD_CALLBACK]) @@ -272,7 +277,8 @@ dnl Check for the GTK&Co libraries. Use the special PKG_CHECK_MODULES dnl macro from the pkg-config program. -PKG_CHECK_MODULES(GTK,[glib-2.0 >= 2.0.0 gdk-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 gdk-pixbuf-2.0 >= 0.12.0]) +PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.0.0]) +PKG_CHECK_MODULES(GTK,[gdk-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 gdk-pixbuf-2.0 >= 0.12.0]) dnl if test x$ENABLE_OPENGL = xyes; then dnl PKG_CHECK_MODULES(GTKGLEXT,[gtkglext-1.0 >= 0.7.1]) dnl fi @@ -287,6 +293,7 @@ PKG_CHECK_MODULES(MOZEMBED,[mozilla-gtkmozembed >= 1.4]) fi + dnl Some APIs only appeared in later versions of libraries. Generate only dnl Haskell types for the available C types. CREATE_TYPES="$CREATE_TYPES `$PKG_CONFIG gtk+-2.0 --atleast-version=2.2 && echo gtk-2.2`" @@ -316,20 +323,34 @@ dnl Furthermore we remove all libraries and directories for packages that dnl built on top of gtk so that they don't appear several times on the dnl command line. -GTK_CFLAGS=`tools/checkDirs.sh $GTK_CFLAGS`; -GTK_LIBS=`tools/checkDirs.sh $GTK_LIBS`; -SOURCEVIEW_CFLAGS=`CFLAGS="$GTK_CFLAGS" tools/checkDirs.sh $SOURCEVIEW_CFLAGS`; -SOURCEVIEW_LIBS=`LDFLAGS="$GTK_LIBS" tools/checkDirs.sh $SOURCEVIEW_LIBS`; -LIBGLADE_CFLAGS=`CFLAGS="$GTK_CFLAGS" tools/checkDirs.sh $LIBGLADE_CFLAGS`; -LIBGLADE_LIBS=`LDFLAGS="$GTK_LIBS" tools/checkDirs.sh $LIBGLADE_LIBS`; -GCONF_CFLAGS=`CFLAGS="$GTK_CFLAGS" tools/checkDirs.sh $GCONF_CFLAGS`; -GCONF_LIBS=`LDFLAGS="$GTK_LIBS" tools/checkDirs.sh $GCONF_LIBS`; -MOZEMBED_CFLAGS=`CFLAGS="$GTK_CFLAGS" tools/checkDirs.sh $MOZEMBED_CFLAGS`; -MOZEMBED_LIBS=`LDFLAGS="$GTK_LIBS" tools/checkDirs.sh $MOZEMBED_LIBS`; +GLIB_CFLAGS=`tools/checkDirs.sh $GLIB_CFLAGS`; +GLIB_LIBS=`tools/checkDirs.sh $GLIB_LIBS`; + +GTK_CFLAGS=`CFLAGS="$GLIB_CFLAGS" tools/checkDirs.sh $GTK_CFLAGS`; +GTK_LIBS=`LDFLAGS="$GLIB_LIBS" tools/checkDirs.sh $GTK_LIBS`; + +SOURCEVIEW_CFLAGS=`CFLAGS="$GLIB_CFLAGS $GTK_CFLAGS" tools/checkDirs.sh $SOURCEVIEW_CFLAGS`; +SOURCEVIEW_LIBS=`LDFLAGS="$GLIB_LIBS $GTK_LIBS" tools/checkDirs.sh $SOURCEVIEW_LIBS`; + +LIBGLADE_CFLAGS=`CFLAGS="$GLIB_CFLAGS $GTK_CFLAGS" tools/checkDirs.sh $LIBGLADE_CFLAGS`; +LIBGLADE_LIBS=`LDFLAGS="$GLIB_LIBS $GTK_LIBS" tools/checkDirs.sh $LIBGLADE_LIBS`; + +GCONF_CFLAGS=`CFLAGS="$GLIB_CFLAGS $GTK_CFLAGS" tools/checkDirs.sh $GCONF_CFLAGS`; +GCONF_LIBS=`LDFLAGS="$GLIB_LIBS $GTK_LIBS" tools/checkDirs.sh $GCONF_LIBS`; + +MOZEMBED_CFLAGS=`CFLAGS="$GLIB_CFLAGS $GTK_CFLAGS" tools/checkDirs.sh $MOZEMBED_CFLAGS`; +MOZEMBED_LIBS=`LDFLAGS="$GLIB_LIBS $GTK_LIBS" tools/checkDirs.sh $MOZEMBED_LIBS`; dnl Change the representation of these flags to "flag1","flag2". The dnl letters CQ stand for Comma, Quote. +GTKHS_REFORMAT_PACKAGE_CFLAGS(GLIB_CFLAGS, GLIB_CFLAGS_CQ) +GTKHS_REFORMAT_PACKAGE_LIBS(GLIB_LIBS, GLIB_LIBS_CQ, GLIB_LIBDIR_CQ, GLIB_LIBEXTRA_CQ) +AC_SUBST(GLIB_CFLAGS_CQ) +AC_SUBST(GLIB_LIBS_CQ) +AC_SUBST(GLIB_LIBDIR_CQ) +AC_SUBST(GLIB_LIBEXTRA_CQ) + GTKHS_REFORMAT_PACKAGE_CFLAGS(GTK_CFLAGS, GTK_CFLAGS_CQ) GTKHS_REFORMAT_PACKAGE_LIBS(GTK_LIBS, GTK_LIBS_CQ, GTK_LIBDIR_CQ, GTK_LIBEXTRA_CQ) AC_SUBST(GTK_CFLAGS_CQ) @@ -551,6 +572,7 @@ tools/c2hs/toplevel/C2HSConfig.hs gtk2hs.spec mk/chsDepend + glib/glib.pkg gtk/gtk.pkg mogul/mogul.pkg glade/glade.pkg Index: Makefile.am =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/Makefile.am,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Makefile.am 20 Dec 2004 03:30:58 -0000 1.29 +++ Makefile.am 8 Jan 2005 17:52:36 -0000 1.30 @@ -3,11 +3,10 @@ MOSTLYCLEANFILES = *.deps.bak CLEANFILES = DISTCLEANFILES = */*.precomp -CPPFLAGS += $(filter -I% -D%, \ - $(GTK_CFLAGS) $(SOURCEVIEW_CFLAGS) \ - $(LIBGLADE_CFLAGS) $(GCONF_CFLAGS) \ - $(MOZEMBED_CFLAGS)) -nobase_hi_SCRIPTS = #hack 'til gtk uses it +#CPPFLAGS += $(filter -I% -D%, \ +# $(GLIB_CFLAGS) $(GTK_CFLAGS) \ +# $(SOURCEVIEW_CFLAGS) $(LIBGLADE_CFLAGS) \ +# $(GCONF_CFLAGS) $(MOZEMBED_CFLAGS)) # Build c2hs before anything else. @@ -29,6 +28,7 @@ # all packages and applications lib_LIBRARIES = \ + libHSglib.a \ libHSgtk.a \ libHSmogul.a if ENABLE_LIBGLADE @@ -93,13 +93,14 @@ MOSTLYCLEANFILES+= $(tools_callbackGen_HookGenerator_SOURCES:.hs=.hi) -gtk/general/Signal.chs : $(srcdir)/tools/callbackGen/Signal.chs-boot1 \ - $(srcdir)/tools/callbackGen/Signal.chs-boot2 \ - $(srcdir)/tools/callbackGen/gtkmarshal.list \ - $(srcdir)/tools/callbackGen/HookGenerator +gtk/Graphics/UI/Gtk/Signals.chs : \ + $(srcdir)/tools/callbackGen/Signal.chs-boot1 \ + $(srcdir)/tools/callbackGen/Signal.chs-boot2 \ + $(srcdir)/tools/callbackGen/gtkmarshal.list \ + $(srcdir)/tools/callbackGen/HookGenerator $(strip $(srcdir)/tools/callbackGen/HookGenerator $(MARSHALLDEFS) \ - $(srcdir)/tools/callbackGen/ gtk/general/Signal.chs \ - $(if $(subst yes,,$(BROKENCB)),--broken)) + $(srcdir)/tools/callbackGen/ $@ \ + $(if $(subst yes,,$(FOUR_WORD_CALLBACK)),--broken)) # # API Coverage Tool @@ -208,6 +209,74 @@ endif # +# glib package +# +################################################################################ + +libHSglib_a_NAME = libHSglib.a +$(libHSglib_a_NAME) : NAME = libHSglib_a + +libHSglib_a_PACKAGE = glib/glib.pkg +libHSglib_a_PACKAGEDEPS = +libHSglib_a_HEADER = glib-object.h +libHSglib_a_PRECOMP = glib/glib.precomp +libHSglib_a_LIBS = $(GLIB_LIBS) +libHSglib_a_HCFLAGS = -fffi +libHSglib_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS)) +libHSglib_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS)) + +libHSglib_a_SOURCESDIRS = glib + +libHSglib_a_SOURCES = \ + glib/System/Glib.hs \ + glib/System/Glib/FFI.hs \ + glib/System/Glib/UTFString.hs \ + glib/System/Glib/Types.chs \ + glib/System/Glib/GType.chs \ + glib/System/Glib/GValue.chs \ + glib/System/Glib/GValueTypes.chs \ + glib/System/Glib/GParameter.hsc \ + glib/System/Glib/StoreValue.hsc \ + glib/System/Glib/GObject.chs \ + glib/System/Glib/GError.chs \ + glib/System/Glib/GList.chs + +glib_System_Glib_Types_hs_HCFLAGS = -fglasgow-exts +glib_System_Glib_GError_hs_HCFLAGS = -fglasgow-exts + +am_libHSglib_a_OBJECTS = $(libHSglib_a_HSFILES:.hs=.$(OBJEXT)) + +libHSglib_a_CHSPPFILES = $(filter %.chs.pp,$(libHSglib_a_SOURCES)) +libHSglib_a_CHSFILES = \ + $(filter %.chs,$(libHSglib_a_SOURCES:.chs.pp=.chs)) +libHSglib_a_CHSFILES_HS = $(libHSglib_a_CHSFILES:.chs=.hs) +libHSglib_a_HSCFILES = $(filter %.hsc, $(libHSglib_a_SOURCES)) +libHSglib_a_HSCFILES_HS = $(libHSglib_a_HSCFILES:.hsc=.hs) +libHSglib_a_BUILDSOURCES = \ + $(libHSglib_a_CHSPPFILES:.chs.pp=.chs) \ + $(libHSglib_a_CHSFILES_HS) \ + $(libHSglib_a_HSCFILES_HS) +libHSglib_a_HSFILES = \ + $(filter %.hs,$(libHSglib_a_BUILDSOURCES)) \ + $(filter %.hs,$(libHSglib_a_SOURCES)) + +nobase_pkglib_SCRIPTS = $(libHSglib_a_HSFILES:.hs=.hi) + +MOSTLYCLEANFILES += $(am_libHSglib_a_OBJECTS) +MOSTLYCLEANFILES += $(libHSglib_a_HSFILES:.hs=.hi) +MOSTLYCLEANFILES += \ + $(libHSglib_a_CHSFILES:.chs=.chi) \ + $(libHSglib_a_CHSFILES:.chs=_stub.h) \ + $(libHSglib_a_CHSFILES:.chs=_stub.o) \ + $(libHSglib_a_CHSFILES:.chs=_stub.c) +CLEANFILES += $(libHSglib_a_BUILDSOURCES) + +DISTCLEANFILES+= libHSglib_a.deps $(libHSglib_a_CHSFILES_HS:.hs=.dep) +ifeq (,$(findstring clean,$(MAKECMDGOALS))) +-include libHSglib_a.deps $(libHSglib_a_CHSFILES:.chs=.dep) + endif + +# # gtk package # ################################################################################ @@ -220,185 +289,182 @@ libHSgtk_a_HEADER = gtk/gtk.h libHSgtk_a_PRECOMP = gtk/gtk.precomp libHSgtk_a_LIBS = $(GTK_LIBS) -libHSgtk_a_HCFLAGS = -fglasgow-exts -libHSgtk_a_CFLAGS = $(filter-out -I% -D%,$(GTK_CFLAGS)) -libHSgtk_a_CPPFLAGS = $(filter -I% -D%,$(GTK_CFLAGS)) +libHSgtk_a_HCFLAGS = -fffi +libHSgtk_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS)) +libHSgtk_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS)) -libHSgtk_a_SOURCESDIRS = \ - gtk/glib gtk/general gtk/pango gtk/treeList gtk/multiline gtk/gdk \ - gtk/abstract gtk/display gtk/entry gtk/misc gtk/multiline \ - gtk/ornaments gtk/scrolling gtk/treeList gtk/selectors gtk/embedding \ - gtk/layout gtk/menuComboToolbar gtk/buttons gtk/windows +libHSgtk_a_SOURCESDIRS = $(libHSglib_a_SOURCESDIRS) gtk -libHSgtk_a_SOURCES = \ - gtk/general/Hierarchy.chs \ - gtk/general/Signal.chs \ - gtk/glib/GValue.chs \ - gtk/glib/GList.chs \ - gtk/glib/GObject.chs.pp \ - gtk/pango/PangoTypes.chs.pp \ - gtk/treeList/TreeModel.chs.pp \ - gtk/treeList/TreeViewColumn.chs \ - gtk/multiline/TextIter.chs.pp \ - gtk/gdk/Region.chs.pp \ - gtk/abstract/Bin.chs \ - gtk/abstract/Box.chs \ - gtk/abstract/ButtonBox.chs.pp \ - gtk/abstract/Container.chs \ - gtk/abstract/FileChooser.chs \ - gtk/abstract/Misc.chs \ - gtk/abstract/Object.chs.pp \ - gtk/abstract/Paned.chs \ - gtk/abstract/Range.chs \ - gtk/abstract/Scale.chs \ - gtk/abstract/Widget.chs \ - gtk/buttons/Button.chs.pp \ - gtk/buttons/CheckButton.chs \ - gtk/buttons/RadioButton.chs \ - gtk/buttons/ToggleButton.chs \ - gtk/display/AccelLabel.chs \ - gtk/display/Image.chs \ - gtk/display/Label.chs \ - gtk/display/ProgressBar.chs \ - gtk/display/Statusbar.chs \ - gtk/entry/Editable.chs \ - gtk/entry/Entry.chs.pp \ - gtk/entry/EntryCompletion.chs.pp \ - gtk/entry/HScale.chs \ - gtk/entry/SpinButton.chs \ - gtk/entry/VScale.chs \ - gtk/general/Enums.chs.pp \ - gtk/general/General.chs \ - gtk/general/IconFactory.chs.pp \ - gtk/general/Style.chs \ - gtk/layout/Alignment.chs.pp \ - gtk/layout/AspectFrame.chs \ - gtk/layout/Expander.chs.pp \ - gtk/layout/Fixed.chs \ - gtk/layout/HBox.chs \ - gtk/layout/HButtonBox.chs \ - gtk/layout/HPaned.chs \ - gtk/layout/Layout.chs \ - gtk/layout/Notebook.chs.pp \ - gtk/layout/Table.chs \ - gtk/layout/VBox.chs \ - gtk/layout/VButtonBox.chs \ - gtk/layout/VPaned.chs \ - gtk/menuComboToolbar/CheckMenuItem.chs.pp \ - gtk/menuComboToolbar/Combo.chs.pp \ - gtk/menuComboToolbar/ComboBox.chs.pp \ - gtk/menuComboToolbar/ComboBoxEntry.chs.pp \ - gtk/menuComboToolbar/ImageMenuItem.chs \ - gtk/menuComboToolbar/Menu.chs.pp \ - gtk/menuComboToolbar/MenuBar.chs \ - gtk/menuComboToolbar/MenuItem.chs \ - gtk/menuComboToolbar/MenuShell.chs \ - gtk/menuComboToolbar/OptionMenu.chs.pp \ - gtk/menuComboToolbar/RadioMenuItem.chs \ - gtk/menuComboToolbar/TearoffMenuItem.chs \ - gtk/menuComboToolbar/ToolItem.chs.pp \ - gtk/menuComboToolbar/Toolbar.chs.pp \ - gtk/misc/Adjustment.chs \ - gtk/misc/Calendar.chs.pp \ - gtk/misc/DrawingArea.chs \ - gtk/misc/EventBox.chs.pp \ - gtk/misc/FileChooserWidget.chs.pp \ - gtk/misc/GArrow.chs \ - gtk/misc/HandleBox.chs \ - gtk/misc/SizeGroup.chs \ - gtk/misc/Tooltips.chs.pp \ - gtk/misc/Viewport.chs \ - gtk/multiline/TextBuffer.chs \ - gtk/multiline/TextMark.chs \ - gtk/multiline/TextTag.chs.pp \ - gtk/multiline/TextTagTable.chs \ - gtk/multiline/TextView.chs \ - gtk/ornaments/Frame.chs \ - gtk/ornaments/HSeparator.chs \ - gtk/ornaments/VSeparator.chs \ - gtk/scrolling/HScrollbar.chs \ - gtk/scrolling/ScrolledWindow.chs \ - gtk/scrolling/VScrollbar.chs \ - gtk/selectors/ColorSelection.chs \ - gtk/selectors/ColorSelectionDialog.chs \ - gtk/selectors/FontSelection.chs \ - gtk/selectors/FontSelectionDialog.chs \ - gtk/treeList/CellRendererPixbuf.chs \ - gtk/treeList/CellRendererText.chs \ - gtk/treeList/CellRendererToggle.chs \ - gtk/treeList/ListStore.chs.pp \ - gtk/treeList/TreeModelSort.chs \ - gtk/treeList/TreeSelection.chs \ - gtk/treeList/TreeStore.chs.pp \ - gtk/treeList/TreeView.chs.pp \ - gtk/windows/Dialog.chs \ - gtk/windows/FileChooserDialog.chs.pp \ - gtk/windows/FileSel.chs \ - gtk/windows/Window.chs.pp \ - gtk/gdk/Drawable.chs.pp \ - gtk/gdk/GC.chs \ - gtk/gdk/Gdk.chs \ - gtk/gdk/GdkEnums.chs \ - gtk/gdk/Keys.chs \ - gtk/gdk/Pixbuf.chs \ - gtk/glib/GError.chs.pp \ - gtk/glib/GType.chs \ - gtk/glib/GValueTypes.chs \ - gtk/pango/Description.chs \ - gtk/pango/PangoEnums.chs \ - gtk/pango/PangoLayout.chs \ - gtk/pango/Rendering.chs \ - gtk/embedding/Plug.chs \ - gtk/embedding/Socket.chs \ - gtk/general/StockItems.hsc \ - gtk/general/Structs.hsc \ - gtk/treeList/StoreValue.hsc \ - gtk/gdk/Events.hsc \ - gtk/glib/GParameter.hsc \ - gtk/embedding/Embedding.hsc \ - gtk/abstract/Scrollbar.hs \ - gtk/abstract/Separator.hs \ - gtk/general/FFI.hs \ - gtk/general/Gtk.hs \ - gtk/treeList/CellRenderer.hs \ - gtk/gdk/DrawWindow.hs \ - gtk/pango/Markup.hs +libHSgtk_a_SOURCES = \ + gtk/Graphics/UI/Gtk.hs \ + gtk/Graphics/UI/Gtk/Types.chs \ + gtk/Graphics/UI/Gtk/Signals.chs \ + gtk/Graphics/UI/Gtk/Pango/Types.chs.pp \ + gtk/Graphics/UI/Gtk/TreeList/TreeModel.chs.pp \ + gtk/Graphics/UI/Gtk/TreeList/TreeViewColumn.chs \ + gtk/Graphics/UI/Gtk/Multiline/TextIter.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/Region.chs.pp \ + gtk/Graphics/UI/Gtk/Abstract/Bin.chs \ + gtk/Graphics/UI/Gtk/Abstract/Box.chs \ + gtk/Graphics/UI/Gtk/Abstract/ButtonBox.chs.pp \ + gtk/Graphics/UI/Gtk/Abstract/Container.chs \ + gtk/Graphics/UI/Gtk/Abstract/Misc.chs \ + gtk/Graphics/UI/Gtk/Abstract/Object.chs.pp \ + gtk/Graphics/UI/Gtk/Abstract/Paned.chs \ + gtk/Graphics/UI/Gtk/Abstract/Range.chs \ + gtk/Graphics/UI/Gtk/Abstract/Scale.chs \ + gtk/Graphics/UI/Gtk/Abstract/Widget.chs \ + gtk/Graphics/UI/Gtk/Buttons/Button.chs.pp \ + gtk/Graphics/UI/Gtk/Buttons/CheckButton.chs \ + gtk/Graphics/UI/Gtk/Buttons/RadioButton.chs \ + gtk/Graphics/UI/Gtk/Buttons/ToggleButton.chs \ + gtk/Graphics/UI/Gtk/Display/AccelLabel.chs \ + gtk/Graphics/UI/Gtk/Display/Image.chs \ + gtk/Graphics/UI/Gtk/Display/Label.chs \ + gtk/Graphics/UI/Gtk/Display/ProgressBar.chs \ + gtk/Graphics/UI/Gtk/Display/Statusbar.chs \ + gtk/Graphics/UI/Gtk/Entry/Editable.chs \ + gtk/Graphics/UI/Gtk/Entry/Entry.chs.pp \ + gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp \ + gtk/Graphics/UI/Gtk/Entry/HScale.chs \ + gtk/Graphics/UI/Gtk/Entry/SpinButton.chs \ + gtk/Graphics/UI/Gtk/Entry/VScale.chs \ + gtk/Graphics/UI/Gtk/General/Enums.chs.pp \ + gtk/Graphics/UI/Gtk/General/General.chs \ + gtk/Graphics/UI/Gtk/General/IconFactory.chs.pp \ + gtk/Graphics/UI/Gtk/General/Style.chs \ + gtk/Graphics/UI/Gtk/Layout/Alignment.chs.pp \ + gtk/Graphics/UI/Gtk/Layout/AspectFrame.chs \ + gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp \ + gtk/Graphics/UI/Gtk/Layout/Fixed.chs \ + gtk/Graphics/UI/Gtk/Layout/HBox.chs \ + gtk/Graphics/UI/Gtk/Layout/HButtonBox.chs \ + gtk/Graphics/UI/Gtk/Layout/HPaned.chs \ + gtk/Graphics/UI/Gtk/Layout/Layout.chs \ + gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp \ + gtk/Graphics/UI/Gtk/Layout/Table.chs \ + gtk/Graphics/UI/Gtk/Layout/VBox.chs \ + gtk/Graphics/UI/Gtk/Layout/VButtonBox.chs \ + gtk/Graphics/UI/Gtk/Layout/VPaned.chs \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/CheckMenuItem.chs.pp \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/Combo.chs.pp \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/Menu.chs.pp \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuBar.chs \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs.pp \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/TearoffMenuItem.chs \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs.pp \ + gtk/Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs.pp \ + gtk/Graphics/UI/Gtk/Misc/Adjustment.chs \ + gtk/Graphics/UI/Gtk/Misc/Calendar.chs.pp \ + gtk/Graphics/UI/Gtk/Misc/DrawingArea.chs \ + gtk/Graphics/UI/Gtk/Misc/EventBox.chs.pp \ + gtk/Graphics/UI/Gtk/Misc/GArrow.chs \ + gtk/Graphics/UI/Gtk/Misc/HandleBox.chs \ + gtk/Graphics/UI/Gtk/Misc/SizeGroup.chs \ + gtk/Graphics/UI/Gtk/Misc/Tooltips.chs.pp \ + gtk/Graphics/UI/Gtk/Misc/Viewport.chs \ + gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs \ + gtk/Graphics/UI/Gtk/Multiline/TextMark.chs \ + gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp \ + gtk/Graphics/UI/Gtk/Multiline/TextTagTable.chs \ + gtk/Graphics/UI/Gtk/Multiline/TextView.chs \ + gtk/Graphics/UI/Gtk/Ornaments/Frame.chs \ + gtk/Graphics/UI/Gtk/Ornaments/HSeparator.chs \ + gtk/Graphics/UI/Gtk/Ornaments/VSeparator.chs \ + gtk/Graphics/UI/Gtk/Scrolling/HScrollbar.chs \ + gtk/Graphics/UI/Gtk/Scrolling/ScrolledWindow.chs \ + gtk/Graphics/UI/Gtk/Scrolling/VScrollbar.chs \ + gtk/Graphics/UI/Gtk/Selectors/ColorSelection.chs \ + gtk/Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs \ + gtk/Graphics/UI/Gtk/Selectors/FontSelection.chs \ + gtk/Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs \ + gtk/Graphics/UI/Gtk/Selectors/FileChooser.chs \ + gtk/Graphics/UI/Gtk/Selectors/FileChooserWidget.chs.pp \ + gtk/Graphics/UI/Gtk/Selectors/FileChooserDialog.chs.pp \ + gtk/Graphics/UI/Gtk/TreeList/CellRendererPixbuf.chs \ + gtk/Graphics/UI/Gtk/TreeList/CellRendererText.chs \ + gtk/Graphics/UI/Gtk/TreeList/CellRendererToggle.chs \ + gtk/Graphics/UI/Gtk/TreeList/ListStore.chs.pp \ + gtk/Graphics/UI/Gtk/TreeList/TreeModelSort.chs \ + gtk/Graphics/UI/Gtk/TreeList/TreeSelection.chs \ + gtk/Graphics/UI/Gtk/TreeList/TreeStore.chs.pp \ + gtk/Graphics/UI/Gtk/TreeList/TreeView.chs.pp \ + gtk/Graphics/UI/Gtk/Windows/Dialog.chs \ + gtk/Graphics/UI/Gtk/Windows/FileSel.chs \ + gtk/Graphics/UI/Gtk/Windows/Window.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/Drawable.chs.pp \ + gtk/Graphics/UI/Gtk/Gdk/GC.chs \ + gtk/Graphics/UI/Gtk/Gdk/Gdk.chs \ + gtk/Graphics/UI/Gtk/Gdk/Enums.chs \ + gtk/Graphics/UI/Gtk/Gdk/Keys.chs \ + gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs \ + gtk/Graphics/UI/Gtk/Pango/Description.chs \ + gtk/Graphics/UI/Gtk/Pango/Enums.chs \ + gtk/Graphics/UI/Gtk/Pango/Layout.chs \ + gtk/Graphics/UI/Gtk/Pango/Rendering.chs \ + gtk/Graphics/UI/Gtk/Embedding/Plug.chs \ + gtk/Graphics/UI/Gtk/Embedding/Socket.chs \ + gtk/Graphics/UI/Gtk/General/StockItems.hsc \ + gtk/Graphics/UI/Gtk/General/Structs.hsc \ + gtk/Graphics/UI/Gtk/Gdk/Events.hsc \ + gtk/Graphics/UI/Gtk/Embedding/Embedding.hsc \ + gtk/Graphics/UI/Gtk/Abstract/Scrollbar.hs \ + gtk/Graphics/UI/Gtk/Abstract/Separator.hs \ + gtk/Graphics/UI/Gtk/TreeList/CellRenderer.hs \ + gtk/Graphics/UI/Gtk/Gdk/DrawWindow.hs \ + gtk/Graphics/UI/Gtk/Pango/Markup.hs -libHSgtk_a_LIBADD = \ - gtk/abstract/Container_stub.o \ - gtk/multiline/TextIter_stub.o gtk/entry/EntryCompletion_stub.o \ - gtk/multiline/TextTagTable_stub.o gtk/general/General_stub.o \ - gtk/treeList/TreeModel_stub.o gtk/general/Signal_stub.o \ - gtk/treeList/TreeSelection_stub.o gtk/glib/GObject_stub.o \ - gtk/treeList/TreeView_stub.o +gtk_Graphics_UI_Gtk_hs_HCFLAGS = -fno-warn-duplicate-exports #FIXME +gtk_Graphics_UI_Gtk_Gdk_Enums_hs_HCFLAGS = -fglasgow-exts +gtk_Graphics_UI_Gtk_Types_hs_HCFLAGS = -fglasgow-exts +gtk_Graphics_UI_Gtk_General_Structs_hs_HCFLAGS = -fglasgow-exts +gtk_Graphics_UI_Gtk_Gdk_Events_hs_HCFLAGS = -fglasgow-exts +gtk_Graphics_UI_Gtk_General_StockItems_hs_HCFLAGS = -fglasgow-exts +gtk_Graphics_UI_Gtk_Gdk_Region_hs_HCFLAGS = -fglasgow-exts +gtk_Graphics_UI_Gtk_Gdk_Drawable_hs_HCFLAGS = -fglasgow-exts + +libHSgtk_a_LIBADD = \ + gtk/Graphics/UI/Gtk/Abstract/Container_stub.o \ + gtk/Graphics/UI/Gtk/Multiline/TextIter_stub.o \ + gtk/Graphics/UI/Gtk/Entry/EntryCompletion_stub.o \ + gtk/Graphics/UI/Gtk/Multiline/TextTagTable_stub.o \ + gtk/Graphics/UI/Gtk/General/General_stub.o \ + gtk/Graphics/UI/Gtk/TreeList/TreeModel_stub.o \ + gtk/Graphics/UI/Gtk/Signals_stub.o \ + gtk/Graphics/UI/Gtk/TreeList/TreeSelection_stub.o \ + gtk/Graphics/UI/Gtk/TreeList/TreeView_stub.o # Pretend these stub files can be created by a simple rule. -gtk/abstract/Container_stub.o \ - gtk/multiline/TextIter_stub.o gtk/entry/EntryCompletion_stub.o \ - gtk/multiline/TextTagTable_stub.o gtk/general/General_stub.o \ - gtk/treeList/TreeModel_stub.o gtk/general/Signal_stub.o \ - gtk/treeList/TreeSelection_stub.o gtk/glib/GObject_stub.o \ - gtk/treeList/TreeView_stub.o: +$(libHSgtk_a_LIBADD) : touch $(@:.o=.c) $(CC) -c -o $@ $(@:.o=.c) -gtk/general/Hierarchy.chs : $(srcdir)/tools/hierarchyGen/hierarchy.list \ - $(srcdir)/tools/hierarchyGen/TypeGenerator \ - $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template +gtk/Graphics/UI/Gtk/Types.chs : \ + $(srcdir)/tools/hierarchyGen/hierarchy.list \ + $(srcdir)/tools/hierarchyGen/TypeGenerator \ + $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template $(strip $(srcdir)/tools/hierarchyGen/TypeGenerator \ $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template \ - $@ $(addprefix --tag=,$(CREATE_TYPES))) + $@ $(addprefix --tag=,$(CREATE_TYPES)) \ + --modname=Graphics.UI.Gtk.Types \ + --parentname=System.Glib.GObject) am_libHSgtk_a_OBJECTS = \ $(addsuffix .$(OBJEXT),$(basename $(basename $(libHSgtk_a_SOURCES)))) -libHSgtk_a_CHSPPFILES = $(filter %.chs.pp,$(libHSgtk_a_SOURCES)) -libHSgtk_a_CHSFILES = \ - $(filter %.chs,$(libHSgtk_a_SOURCES:.chs.pp=.chs)) -libHSgtk_a_CHSFILES_HS = $(libHSgtk_a_CHSFILES:.chs=.hs) -libHSgtk_a_HSCFILES = $(filter %.hsc, $(libHSgtk_a_SOURCES)) -libHSgtk_a_HSCFILES_HS = $(libHSgtk_a_HSCFILES:.hsc=.hs) +libHSgtk_a_CHSPPFILES = $(filter %.chs.pp,$(libHSgtk_a_SOURCES)) +libHSgtk_a_CHSFILES = $(filter %.chs,$(libHSgtk_a_SOURCES:.chs.pp=.chs)) +libHSgtk_a_CHSFILES_HS = $(libHSgtk_a_CHSFILES:.chs=.hs) +libHSgtk_a_HSCFILES = $(filter %.hsc, $(libHSgtk_a_SOURCES)) +libHSgtk_a_HSCFILES_HS = $(libHSgtk_a_HSCFILES:.hsc=.hs) + libHSgtk_a_BUILDSOURCES = \ $(libHSgtk_a_CHSPPFILES:.chs.pp=.chs) \ $(libHSgtk_a_CHSFILES_HS) \ @@ -407,8 +473,7 @@ $(filter %.hs,$(libHSgtk_a_BUILDSOURCES)) \ $(filter %.hs,$(libHSgtk_a_SOURCES)) -# add prefix nobase_ when changing to hierarchical module namespace -hi_SCRIPTS = $(libHSgtk_a_HSFILES:.hs=.hi) +nobase_hi_SCRIPTS = $(libHSgtk_a_HSFILES:.hs=.hi) MOSTLYCLEANFILES += $(am_libHSgtk_a_OBJECTS) MOSTLYCLEANFILES += $(libHSgtk_a_HSFILES:.hs=.hi) @@ -442,12 +507,12 @@ libHSmogul_a_SOURCESDIRS = $(libHSgtk_a_SOURCESDIRS) mogul libHSmogul_a_SOURCES = \ - mogul/GetWidget.hs \ - mogul/MDialog.hs \ - mogul/Mogul.hs \ - mogul/NewWidget.hs \ - mogul/TreeList.hs \ - mogul/WidgetTable.hs + mogul/Graphics/UI/Gtk/Mogul.hs \ + mogul/Graphics/UI/Gtk/Mogul/GetWidget.hs \ + mogul/Graphics/UI/Gtk/Mogul/MDialog.hs \ + mogul/Graphics/UI/Gtk/Mogul/NewWidget.hs \ + mogul/Graphics/UI/Gtk/Mogul/TreeList.hs \ + mogul/Graphics/UI/Gtk/Mogul/WidgetTable.hs am_libHSmogul_a_OBJECTS = \ $(addsuffix .$(OBJEXT),$(basename $(basename $(libHSmogul_a_SOURCES)))) @@ -455,7 +520,7 @@ libHSmogul_a_HSFILES = $(libHSmogul_a_SOURCES) .PRECIOUS: $(libHSmogul_a_HSFILES:.hs=hi) -hi_SCRIPTS += $(libHSmogul_a_HSFILES:.hs=.hi) +nobase_hi_SCRIPTS += $(libHSmogul_a_HSFILES:.hs=.hi) MOSTLYCLEANFILES += $(am_libHSmogul_a_OBJECTS) MOSTLYCLEANFILES += $(libHSmogul_a_HSFILES:.hs=.hi) @@ -481,25 +546,26 @@ libHSglade_a_PRECOMP = glade/glade.precomp libHSglade_a_LIBS = $(LIBGLADE_LIBS) libHSglade_a_HCFLAGS = -fffi -libHSglade_a_CFLAGS = $(filter-out -I% -D%,$(GTK_CFLAGS) $(LIBGLADE_CFLAGS)) -libHSglade_a_CPPFLAGS = $(filter -I% -D%,$(GTK_CFLAGS) $(LIBGLADE_CFLAGS)) +libHSglade_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(LIBGLADE_CFLAGS)) +libHSglade_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(LIBGLADE_CFLAGS)) libHSglade_a_SOURCESDIRS = $(libHSgtk_a_SOURCESDIRS) glade libHSglade_a_SOURCES = \ - glade/GladeType.chs \ - glade/Glade.chs + glade/Graphics/UI/Gtk/Glade/Types.chs \ + glade/Graphics/UI/Gtk/Glade.chs -glade_GladeType_hs_HCFLAGS = -fglasgow-exts +glade_Graphics_UI_Gtk_Glade_Types_hs_HCFLAGS = -fglasgow-exts -glade/GladeType.chs : $(srcdir)/tools/hierarchyGen/hierarchy.list \ +glade/Graphics/UI/Gtk/Glade/Types.chs : $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/TypeGenerator \ $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template $(strip $(srcdir)/tools/hierarchyGen/TypeGenerator \ $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template \ $@ --tag=libglade --lib=glade --prefix=glade \ - --parentname=Hierarchy) + --modname=Graphics.UI.Gtk.Glade.Types \ + --parentname=Graphics.UI.Gtk.Types) am_libHSglade_a_OBJECTS = \ $(addsuffix .$(OBJEXT),$(basename $(basename $(libHSglade_a_SOURCES)))) @@ -513,12 +579,12 @@ libHSglade_a_BUILDSOURCES = \ $(libHSglade_a_CHSPPFILES:.chs.pp=.chs) \ $(libHSglade_a_CHSFILES_HS) \ - glade/GladeType.chs + $(libHSglade_a_HSCFILES_HS) libHSglade_a_HSFILES = \ $(filter %.hs,$(libHSglade_a_BUILDSOURCES)) \ $(filter %.hs,$(libHSglade_a_SOURCES)) -hi_SCRIPTS += $(libHSglade_a_HSFILES:.hs=.hi) +nobase_hi_SCRIPTS += $(libHSglade_a_HSFILES:.hs=.hi) MOSTLYCLEANFILES += $(am_libHSglade_a_OBJECTS) MOSTLYCLEANFILES += $(libHSglade_a_HSFILES:.hs=.hi) @@ -548,8 +614,8 @@ libHSgconf_a_PRECOMP = gconf/gconf.precomp libHSgconf_a_LIBS = $(GCONF_LIBS) libHSgconf_a_HCFLAGS = -fglasgow-exts -fallow-overlapping-instances -libHSgconf_a_CFLAGS = $(filter-out -I% -D%,$(GTK_CFLAGS) $(GCONF_CFLAGS)) -libHSgconf_a_CPPFLAGS = $(filter -I% -D%,$(GTK_CFLAGS) $(GCONF_CFLAGS)) +libHSgconf_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(GCONF_CFLAGS)) +libHSgconf_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(GCONF_CFLAGS)) libHSgconf_a_SOURCESDIRS = $(libHSgtk_a_SOURCESDIRS) gconf @@ -567,7 +633,7 @@ $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template \ $@ --tag=gconf --lib=gconf --prefix=gconf \ - --modname=System.Gnome.GConf.GConfType --parentname=Hierarchy) + --modname=System.Gnome.GConf.GConfType --parentname=System.Glib.GObject) am_libHSgconf_a_OBJECTS = \ $(addsuffix .$(OBJEXT),$(basename $(basename $(libHSgconf_a_SOURCES)))) @@ -581,6 +647,7 @@ libHSgconf_a_BUILDSOURCES = \ $(libHSgconf_a_CHSPPFILES:.chs.pp=.chs) \ $(libHSgconf_a_CHSFILES_HS) \ + $(libHSgconf_a_HSCFILES_HS) \ gconf/System/Gnome/GConf/GConfType.chs libHSgconf_a_HSFILES = \ $(filter %.hs,$(libHSgconf_a_BUILDSOURCES)) \ @@ -621,35 +688,37 @@ libHSsourceview_a_PRECOMP = sourceview/sourceview.precomp libHSsourceview_a_LIBS = $(SOURCEVIEW_LIBS) libHSsourceview_a_HCFLAGS = -fffi -libHSsourceview_a_CFLAGS = $(filter-out -I% -D%,$(GTK_CFLAGS) $(SOURCEVIEW_CFLAGS)) -libHSsourceview_a_CPPFLAGS = $(filter -I% -D%,$(GTK_CFLAGS) $(SOURCEVIEW_CFLAGS)) -Isourceview +libHSsourceview_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(SOURCEVIEW_CFLAGS)) +libHSsourceview_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(SOURCEVIEW_CFLAGS)) -Isourceview libHSsourceview_a_SOURCESDIRS = $(libHSgtk_a_SOURCESDIRS) sourceview libHSsourceview_a_SOURCES = \ - sourceview/SourceViewType.chs \ - sourceview/SourceBuffer.chs \ - sourceview/SourceIter.chs \ - sourceview/SourceLanguage.chs \ - sourceview/SourceLanguagesManager.chs \ - sourceview/SourceMarker.chs \ - sourceview/SourceStyleScheme.chs \ - sourceview/SourceTag.chs \ - sourceview/SourceTagStyle.hsc \ - sourceview/SourceTagTable.chs \ - sourceview/SourceView.chs + sourceview/Graphics/UI/Gtk/SourceView.hs \ + sourceview/Graphics/UI/Gtk/SourceView/Types.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceBuffer.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceIter.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceLanguage.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceLanguagesManager.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceMarker.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceTag.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceTagStyle.hsc \ + sourceview/Graphics/UI/Gtk/SourceView/SourceTagTable.chs \ + sourceview/Graphics/UI/Gtk/SourceView/SourceView.chs -sourceview_SourceViewType_hs_HCFLAGS = -fglasgow-exts -sourceview_SourceTagStyle_hs_HCFLAGS = -fglasgow-exts +sourceview_Graphics_UI_Gtk_SourceView_Types_hs_HCFLAGS = -fglasgow-exts +sourceview_Graphics_UI_Gtk_SourceView_SourceTagStyle_hs_HCFLAGS = -fglasgow-exts -sourceview/SourceViewType.chs : \ +sourceview/Graphics/UI/Gtk/SourceView/Types.chs : \ $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/TypeGenerator \ $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template $(strip $(srcdir)/tools/hierarchyGen/TypeGenerator \ $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template \ - $@ --tag=sourceview --parentname=Hierarchy) + $@ --tag=sourceview --parentname=Graphics.UI.Gtk.Types \ + --modname=Graphics.UI.Gtk.SourceView.Types) am_libHSsourceview_a_OBJECTS = \ $(addsuffix .$(OBJEXT),$(basename $(basename $(libHSsourceview_a_SOURCES)))) @@ -663,13 +732,12 @@ libHSsourceview_a_BUILDSOURCES = \ $(libHSsourceview_a_CHSPPFILES:.chs.pp=.chs) \ $(libHSsourceview_a_CHSFILES_HS) \ - $(libHSsourceview_a_HSCFILES_HS) \ - sourceview/SourceViewType.chs + $(libHSsourceview_a_HSCFILES_HS) libHSsourceview_a_HSFILES = \ $(filter %.hs,$(libHSsourceview_a_BUILDSOURCES)) \ $(filter %.hs,$(libHSsourceview_a_SOURCES)) -hi_SCRIPTS += $(libHSsourceview_a_HSFILES:.hs=.hi) +nobase_hi_SCRIPTS += $(libHSsourceview_a_HSFILES:.hs=.hi) MOSTLYCLEANFILES += $(am_libHSsourceview_a_OBJECTS) MOSTLYCLEANFILES += $(libHSsourceview_a_HSFILES:.hs=.hi) @@ -700,8 +768,8 @@ libHSmozembed_a_PRECOMP = mozembed/mozembed.precomp libHSmozembed_a_LIBS = $(MOZEMBED_LIBS) libHSmozembed_a_HCFLAGS = -fffi -libHSmozembed_a_CFLAGS = $(filter-out -I% -D%,$(GTK_CFLAGS) $(MOZEMBED_CFLAGS)) -libHSmozembed_a_CPPFLAGS = $(filter -I% -D%,$(GTK_CFLAGS) $(MOZEMBED_CFLAGS)) +libHSmozembed_a_CFLAGS = $(filter-out -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(MOZEMBED_CFLAGS)) +libHSmozembed_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GTK_CFLAGS) $(MOZEMBED_CFLAGS)) libHSmozembed_a_SOURCESDIRS = $(libHSgtk_a_SOURCESDIRS) mozembed @@ -711,7 +779,6 @@ mozembed_Graphics_UI_Gtk_MozEmbedType_hs_HCFLAGS = -fglasgow-exts - mozembed/Graphics/UI/Gtk/MozEmbedType.chs : \ $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/TypeGenerator \ @@ -719,7 +786,7 @@ $(strip $(srcdir)/tools/hierarchyGen/TypeGenerator \ $(srcdir)/tools/hierarchyGen/hierarchy.list \ $(srcdir)/tools/hierarchyGen/Hierarchy.chs.template \ - $@ --tag=mozembed --parentname=Hierarchy \ + $@ --tag=mozembed --parentname=Graphics.UI.Gtk.Types \ --modname=Graphics.UI.Gtk.MozEmbedType) am_libHSmozembed_a_OBJECTS = \ |
From: Duncan C. <dun...@us...> - 2005-01-08 17:46:24
|
Update of /cvsroot/gtk2hs/gtk2hs/glib/System/Glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1442/glib/System/Glib Added Files: GObject.chs.pp GParameter.hsc GType.chs GValue.chs Log Message: move glib modules to a seperate package and use hierarchical namespace names. --- NEW FILE: GType.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) GType -- -- Author : Axel Simon -- -- Created: 1 June 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:46:16 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- * This module implements only the necessities for the GTK binding. -- module System.Glib.GType ( GType, typeInstanceIsA ) where import Monad (liftM) import Foreign import Foreign.C import Foreign (unsafePerformIO) {# context lib="glib" prefix="g" #} type GType = {#type GType#} -- | Check if an object is of the specific type or derived from it. -- -- * Internally used by Hierarchy. -- typeInstanceIsA :: Ptr () -> GType -> Bool typeInstanceIsA obj p = toBool $ unsafePerformIO ({#call unsafe g_type_check_instance_is_a#} obj p) --- NEW FILE: GParameter.hsc --- -- -*-haskell-*- -- GIMP Toolkit (GTK) GParameter -- -- Author : Duncan Coutts -- -- Created: 29 March 2004 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:46:16 $ -- -- Copyright (c) 2004 Duncan Coutts -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- Storable instance for GParameter, used by objectNew -- module System.Glib.GParameter ( GParameter(..) ) where import Foreign import Foreign.C import System.Glib.GValue --import StoreValue #include <glib-object.h> --newtype GParameter = GParameter (String, GenericValue) newtype GParameter = GParameter (String, GValue) instance Storable GParameter where sizeOf _ = #const sizeof(GParameter) alignment _ = #{const __alignof__(GParameter)} poke ptr (GParameter (name, value)) = do strPtr <- newCString name #{poke GParameter, name} ptr strPtr -- poke (#{ptr GParameter, value} ptr) value #{poke GParameter, value} ptr value --- NEW FILE: GObject.chs.pp --- -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget GObject -- -- Author : Axel Simon -- -- Created: 9 April 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:46:16 $ -- -- Copyright (c) 2001 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- Implements the base GObject class to satisfy the type checker. -- module System.Glib.GObject ( GObject(..), GObjectClass, mkGObject, unGObject, toGObject, fromGObject, castToGObject, objectNew, objectRef, objectUnref, makeNewGObject, GWeakNotify, mkDestructor, objectWeakref, objectWeakunref ) where import Monad (liftM) import Data.IORef (newIORef, readIORef, writeIORef) import System.Glib.FFI {#import System.Glib.Types#} import System.Glib.GValue (GValue) import System.Glib.GType (GType) import System.Glib.GParameter {# context lib="glib" prefix="g" #} {# pointer *GParameter as GParm -> GParameter #} -- | Construct a new object (should rairly be used directly) -- objectNew :: GType -> [(String, GValue)] -> IO (Ptr GObject) objectNew objType parameters = liftM castPtr $ --caller must makeNewGObject as we don't know --if it this a GObject or a GtkObject withArray (map GParameter parameters) $ \paramArrayPtr -> {# call g_object_newv #} objType (fromIntegral $ length parameters) paramArrayPtr -- | Increase the reference counter of an object -- objectRef :: GObjectClass obj => Ptr obj -> IO () objectRef obj = do {#call unsafe object_ref#} (castPtr obj) return () -- | Decrease the reference counter of an object -- #if __GLASGOW_HASKELL__>=600 foreign import ccall unsafe "&g_object_unref" object_unref' :: FinalizerPtr a objectUnref :: Ptr a -> FinalizerPtr a objectUnref _ = object_unref' #elif __GLASGOW_HASKELL__>=504 foreign import ccall unsafe "g_object_unref" objectUnref :: Ptr a -> IO () #else foreign import ccall "g_object_unref" unsafe objectUnref :: Ptr a -> IO () #endif -- | This is a convenience function to generate an object that does not -- derive from Object. It adds objectUnref as finalizer. -- -- * The constr argument is the contructor of the specific object. -- makeNewGObject :: GObjectClass obj => (ForeignPtr obj -> obj) -> IO (Ptr obj) -> IO obj makeNewGObject constr generator = do objPtr <- generator objectRef objPtr obj <- newForeignPtr objPtr (objectUnref objPtr) return $ constr obj {#pointer GWeakNotify#} foreign import ccall "wrapper" mkDestructor :: IO () -> IO GWeakNotify -- | Attach a callback that will be called after the -- destroy hooks have been called -- objectWeakref :: GObjectClass o => o -> IO () -> IO GWeakNotify objectWeakref obj uFun = do funPtrContainer <- newIORef nullFunPtr uFunPtr <- mkDestructor $ do uFun funPtr <- readIORef funPtrContainer freeHaskellFunPtr funPtr writeIORef funPtrContainer uFunPtr {#call unsafe object_weak_ref#} (toGObject obj) uFunPtr nullPtr return uFunPtr -- | Detach a weak destroy callback function -- objectWeakunref :: GObjectClass o => o -> GWeakNotify -> IO () objectWeakunref obj fun = {#call unsafe object_weak_unref#} (toGObject obj) fun nullPtr --- NEW FILE: GValue.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) GValue -- -- Author : Axel Simon -- -- Created: 1 June 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:46:16 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- This module implements only the necessities for the GTK binding. -- -- * Everything here is only used by 'TreeStore' and friends. -- module System.Glib.GValue ( GenericValue(..), GValue, valueInit, valueUnset ) where import Monad (liftM) import Foreign import Foreign.C import System.Glib.GType (GType) import System.Glib.Types (GObject) {# context lib="glib" prefix="g" #} {#pointer *GValue -> GenericValue#} -- | A union with information about the currently stored type. -- -- * Internally used by 'TreeStore'. -- data GenericValue = GVuint {#type guint#} | GVint {#type gint#} | GVuchar {#type guchar#} | GVchar {#type gchar#} | GVboolean Bool | GVenum Int | GVflags Int | GVpointer (Ptr ()) | GVfloat Float | GVdouble Double | GVstring (Maybe String) | GVobject GObject | GVboxed (Ptr ()) -- | Clear a GValue. -- valueInit :: GValue -> GType -> IO () valueInit gv gt = liftM (const ()) $ {#call unsafe value_init#} gv gt -- | Free the data in a GValue. -- valueUnset :: GValue -> IO () valueUnset = {#call unsafe value_unset#} |
From: Duncan C. <dun...@us...> - 2005-01-08 17:45:51
|
Update of /cvsroot/gtk2hs/gtk2hs/glib/System/Glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1356/glib/System/Glib Added Files: GValueTypes.chs StoreValue.hsc UTFString.hs Log Message: move glib modules to a seperate package and use hierarchical namespace names. --- NEW FILE: GValueTypes.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) GValueTypes -- -- Author : Axel Simon -- -- Created: 1 June 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:45:41 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- * This module implements only the necessities for the GTK binding. -- -- * Everything here is only used by 'TreeStore' and friends. -- -- TODO -- -- * Replace POINTER with Stable Dynamic or something safe and Haskell like. -- module System.Glib.GValueTypes ( valueSetUInt, valueGetUInt, valueSetInt, valueGetInt, valueSetUChar, valueGetUChar, valueSetChar, valueGetChar, valueSetBoolean, valueGetBoolean, valueSetPointer, valueGetPointer, valueSetFloat, valueGetFloat, valueSetDouble, valueGetDouble, valueSetString, valueGetString, valueSetObject, valueGetObject ) where import Monad (liftM) import Foreign import Foreign.C import System.Glib.UTFString import System.Glib.GObject import System.Glib.GType (GType) {#import System.Glib.GValue#} (GValue, GenericValue(..)) {# context lib="glib" prefix="g" #} -- Retrieve and set the data item in the GenericValue. -- valueSetUInt :: GValue -> {#type guint#} -> IO () valueSetUInt = {#call unsafe value_set_uint#} valueGetUInt :: GValue -> IO {#type guint#} valueGetUInt = {#call unsafe value_get_uint#} valueSetInt :: GValue -> {#type gint#} -> IO () valueSetInt = {#call unsafe value_set_int#} valueGetInt :: GValue -> IO {#type gint#} valueGetInt = {#call unsafe value_get_int#} valueSetUChar :: GValue -> {#type guchar#} -> IO () valueSetUChar = {#call unsafe value_set_uchar#} valueGetUChar :: GValue -> IO {#type guchar#} valueGetUChar = {#call unsafe value_get_uchar#} valueSetChar :: GValue -> {#type gchar#} -> IO () valueSetChar = {#call unsafe value_set_char#} valueGetChar :: GValue -> IO {#type gchar#} valueGetChar = {#call unsafe value_get_char#} valueSetBoolean :: GValue -> Bool -> IO () valueSetBoolean gv b = {#call unsafe value_set_boolean#} gv (fromBool b) valueGetBoolean :: GValue -> IO Bool valueGetBoolean gv = liftM toBool $ {#call unsafe value_get_boolean#} gv -- These functions should probably never be used as they are dangerous. -- valueSetPointer :: GValue -> (Ptr ()) -> IO () valueSetPointer = {#call unsafe value_set_pointer#} valueGetPointer :: GValue -> IO (Ptr ()) valueGetPointer = {#call unsafe value_get_pointer#} valueSetFloat :: GValue -> Float -> IO () valueSetFloat gv f = {#call unsafe value_set_float#} gv (realToFrac f) valueGetFloat :: GValue -> IO Float valueGetFloat gv = liftM realToFrac $ {#call unsafe value_get_float#} gv valueSetDouble :: GValue -> Double -> IO () valueSetDouble gv d= {#call unsafe value_set_double#} gv (realToFrac d) valueGetDouble :: GValue -> IO Double valueGetDouble gv = liftM realToFrac $ {#call unsafe value_get_double#} gv valueSetString :: GValue -> Maybe String -> IO () valueSetString gv (Just str) = do strPtr <- newUTFString str {#call unsafe value_set_static_string#} gv strPtr valueSetString gv Nothing = {#call unsafe value_set_static_string#} gv nullPtr valueGetString :: GValue -> IO (Maybe String) valueGetString gv = do strPtr <- {#call unsafe value_get_string#} gv if strPtr==nullPtr then return Nothing else liftM Just $ peekUTFString strPtr -- * for some weird reason the API says that gv is a gpointer, not a GObject -- valueSetObject :: GValue -> GObject -> IO () valueSetObject gv obj = withForeignPtr (unGObject obj) $ \objPtr -> {#call unsafe g_value_set_object#} gv (castPtr objPtr) valueGetObject :: GValue -> IO GObject valueGetObject gv = makeNewGObject mkGObject $ throwIfNull "GType.valueGetObject: extracting invalid object" $ liftM castPtr $ {#call unsafe value_get_object#} gv --- NEW FILE: UTFString.hs --- {-# OPTIONS -cpp #-} -- GIMP Toolkit (GTK) UTF aware string marshalling -- -- Author : Axel Simon -- -- Created: 22 June 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:45:41 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- This module adds CString-like functions that handle UTF8 strings. -- module System.Glib.UTFString ( withUTFString, withUTFStringLen, newUTFString, newUTFStringLen, peekUTFString, peekUTFStringLen, readUTFString, readCString, ) where import Monad (liftM) import Char import Foreign (unsafePerformIO) import Data.Bits import System.Glib.FFI -- Define withUTFString to emit UTF-8. -- withUTFString :: String -> (CString -> IO a) -> IO a withUTFString hsStr = withCString (toUTF hsStr) -- Define withUTFStringLen to emit UTF-8. -- withUTFStringLen :: String -> (CStringLen -> IO a) -> IO a withUTFStringLen hsStr = withCStringLen (toUTF hsStr) -- Define newUTFString to emit UTF-8. -- newUTFString :: String -> IO CString newUTFString = newCString . toUTF -- Define newUTFStringLen to emit UTF-8. -- newUTFStringLen :: String -> IO CStringLen newUTFStringLen = newCStringLen . toUTF -- Define peekUTFString to retrieve UTF-8. -- peekUTFString :: CString -> IO String peekUTFString strPtr = liftM fromUTF $ peekCString strPtr -- Define peekUTFStringLen to retrieve UTF-8. -- peekUTFStringLen :: CStringLen -> IO String peekUTFStringLen strPtr = liftM fromUTF $ peekCStringLen strPtr -- like peekUTFString but then frees the string using g_free -- readUTFString :: CString -> IO String readUTFString strPtr = do str <- peekUTFString strPtr free (castPtr strPtr) return str -- like peekCString but then frees the string using g_free -- readCString :: CString -> IO String readCString strPtr = do str <- peekCString strPtr free (castPtr strPtr) return str -- Convert Unicode characters to UTF-8. -- toUTF :: String -> String toUTF [] = [] toUTF (x:xs) | ord x<=0x007F = x:toUTF xs | ord x<=0x07FF = chr (0xC0 .|. ((ord x `shift` (-6)) .&. 0x1F)): chr (0x80 .|. (ord x .&. 0x3F)): toUTF xs | otherwise = chr (0xE0 .|. ((ord x `shift` (-12)) .&. 0x0F)): chr (0x80 .|. ((ord x `shift` (-6)) .&. 0x3F)): chr (0x80 .|. (ord x .&. 0x3F)): toUTF xs -- Convert UTF-8 to Unicode. -- fromUTF :: String -> String fromUTF [] = [] fromUTF (all@(x:xs)) | ord x<=0x7F = x:fromUTF xs | ord x<=0xBF = err | ord x<=0xDF = twoBytes all | ord x<=0xEF = threeBytes all | otherwise = err where twoBytes (x1:x2:xs) = chr (((ord x1 .&. 0x1F) `shift` 6) .|. (ord x2 .&. 0x3F)):fromUTF xs twoBytes _ = error "fromUTF: illegal two byte sequence" threeBytes (x1:x2:x3:xs) = chr (((ord x1 .&. 0x0F) `shift` 12) .|. ((ord x2 .&. 0x3F) `shift` 6) .|. (ord x3 .&. 0x3F)):fromUTF xs threeBytes _ = error "fromUTF: illegal three byte sequence" err = error "fromUTF: illegal UTF-8 character" --- NEW FILE: StoreValue.hsc --- -- -*-haskell-*- -- GIMP Toolkit (GTK) StoreValue TreeStore -- -- Author : Axel Simon -- -- Created: 23 May 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:45:41 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- module System.Glib.StoreValue ( TMType(..), GenericValue(..) ) where import Monad (liftM) import Foreign import System.Glib.GValue (GValue, GenericValue(..), valueInit) import System.Glib.GValueTypes import System.Glib.GType (GType) import Control.Exception (throw, Exception(AssertionFailed)) #include <glib-object.h> -- This is an enumeration of all GTypes that can be used in a TreeModel. -- data TMType = TMinvalid | TMuint | TMint | TMuchar | TMchar | TMboolean | TMenum | TMflags | TMpointer | TMfloat | TMdouble | TMstring | TMobject | TMboxed instance Enum TMType where fromEnum TMinvalid = #const G_TYPE_INVALID fromEnum TMuint = #const G_TYPE_UINT fromEnum TMint = #const G_TYPE_INT fromEnum TMuchar = #const G_TYPE_UCHAR fromEnum TMchar = #const G_TYPE_CHAR fromEnum TMboolean = #const G_TYPE_BOOLEAN fromEnum TMenum = #const G_TYPE_ENUM fromEnum TMflags = #const G_TYPE_FLAGS fromEnum TMpointer = #const G_TYPE_POINTER fromEnum TMfloat = #const G_TYPE_FLOAT fromEnum TMdouble = #const G_TYPE_DOUBLE fromEnum TMstring = #const G_TYPE_STRING fromEnum TMobject = #const G_TYPE_OBJECT fromEnum TMboxed = #const G_TYPE_BOXED toEnum #{const G_TYPE_INVALID} = TMinvalid toEnum #{const G_TYPE_UINT} = TMuint toEnum #{const G_TYPE_INT} = TMint toEnum #{const G_TYPE_UCHAR} = TMuchar toEnum #{const G_TYPE_CHAR} = TMchar toEnum #{const G_TYPE_BOOLEAN} = TMboolean toEnum #{const G_TYPE_ENUM} = TMenum toEnum #{const G_TYPE_FLAGS} = TMflags toEnum #{const G_TYPE_POINTER} = TMpointer toEnum #{const G_TYPE_FLOAT} = TMfloat toEnum #{const G_TYPE_DOUBLE} = TMdouble toEnum #{const G_TYPE_STRING} = TMstring toEnum #{const G_TYPE_OBJECT} = TMobject toEnum #{const G_TYPE_BOXED} = TMboxed toEnum _ = error "StoreValue.toEnum(TMType): no dynamic types allowed." instance Storable GenericValue where sizeOf _ = #const sizeof(GValue) alignment _ = alignment (undefined::#type GType) peek gvPtr = do gtype <- liftM (toEnum.fromIntegral::#{type GType} -> TMType) $ #{peek GValue, g_type} gvPtr case gtype of TMinvalid -> throw $ AssertionFailed "StoreValue.peek(GenericValue): invalid or unavailable value." TMuint -> liftM GVuint $ valueGetUInt gvPtr TMint -> liftM GVint $ valueGetInt gvPtr TMuchar -> liftM GVuchar $ valueGetUChar gvPtr TMchar -> liftM GVchar $ valueGetChar gvPtr TMboolean -> liftM GVboolean $ valueGetBoolean gvPtr TMenum -> liftM (GVenum . fromIntegral) $ valueGetUInt gvPtr TMflags -> liftM (GVflags . fromIntegral) $ valueGetUInt gvPtr TMpointer -> liftM GVpointer $ valueGetPointer gvPtr TMfloat -> liftM GVfloat $ valueGetFloat gvPtr TMdouble -> liftM GVdouble $ valueGetDouble gvPtr TMstring -> liftM GVstring $ valueGetString gvPtr TMobject -> liftM GVobject $ valueGetObject gvPtr TMboxed -> liftM GVpointer $ valueGetPointer gvPtr poke gvPtr val = do -- The g_type field of the value must be zero or valueInit will fail. poke (castPtr gvPtr) (0::#type GType) case val of (GVuint x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMuint) valueSetUInt gvPtr x (GVint x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMint) valueSetInt gvPtr x (GVuchar x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMuchar) valueSetUChar gvPtr x (GVchar x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMchar) valueSetChar gvPtr x (GVboolean x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMboolean) valueSetBoolean gvPtr x (GVenum x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMenum) valueSetUInt gvPtr (fromIntegral x) (GVflags x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMflags) valueSetUInt gvPtr (fromIntegral x) (GVpointer x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMpointer) valueSetPointer gvPtr x (GVfloat x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMfloat) valueSetFloat gvPtr x (GVdouble x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMdouble) valueSetDouble gvPtr x (GVstring x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMstring) valueSetString gvPtr x (GVobject x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMobject) valueSetObject gvPtr x (GVboxed x) -> do valueInit gvPtr ((fromIntegral.fromEnum) TMboxed) valueSetPointer gvPtr x |
From: Duncan C. <dun...@us...> - 2005-01-08 17:45:16
|
Update of /cvsroot/gtk2hs/gtk2hs/glib/System/Glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1228/glib/System/Glib Added Files: GError.chs.pp FFI.hs GList.chs Log Message: move glib modules to a seperate package and use hierarchical namespace names. --- NEW FILE: FFI.hs --- {-# OPTIONS -cpp #-} -- GIMP Toolkit (GTK) version dependencies -- -- Author : Axel Simon -- -- Created: 22 June 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:45:06 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- This module serves as an impedance matcher for different compiler -- versions. -- module System.Glib.FFI ( with, nullForeignPtr, foreignFree, newForeignPtr, foreignPtrToPtr, module Foreign, module Foreign.C ) where import Foreign (unsafePerformIO) import Foreign.C import qualified Foreign # if __GLASGOW_HASKELL__>=602 import Foreign hiding (with, newForeignPtr) import qualified Foreign hiding (newForeignPtr) # else import Foreign hiding (with) # endif with :: (Storable a) => a -> (Ptr a -> IO b) -> IO b with = Foreign.with #if __GLASGOW_HASKELL__>=602 newForeignPtr = flip Foreign.newForeignPtr foreignPtrToPtr = unsafeForeignPtrToPtr #endif #if __GLASGOW_HASKELL__>=600 foreign import ccall unsafe "&free" --TODO: should we be using g_free? free' :: FinalizerPtr a foreignFree :: Ptr a -> FinalizerPtr a foreignFree _ = free' nullForeignPtr :: ForeignPtr a nullForeignPtr = unsafePerformIO $ newForeignPtr nullPtr free' #else nullForeignPtr :: ForeignPtr a nullForeignPtr = unsafePerformIO $ newForeignPtr nullPtr (return ()) foreignFree :: Ptr a -> IO () foreignFree = free #endif --- NEW FILE: GList.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) -- -- Author : Axel Simon -- -- Created: 19 March 2002 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 17:45:06 $ -- -- 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 -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file 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. -- -- | -- -- Defines functions to extract data from a GList and to produce a GList from -- a list of pointers. -- -- * The same for GSList. -- module System.Glib.GList ( ptrToInt, GList, fromGList, toGList, GSList, readGSList, fromGSList, fromGSListRev, toGSList ) where import Monad (liftM) import Foreign {# context lib="glib" prefix="g" #} {#pointer * GList#} {#pointer * GSList#} -- methods -- Convert a pointer to an Int. -- ptrToInt :: Ptr a -> Int ptrToInt ptr = minusPtr ptr nullPtr -- Turn a GList into a list of pointers. -- fromGList :: GList -> IO [Ptr a] fromGList glist = do glist' <- {#call unsafe list_reverse#} glist extractList glist' [] where extractList gl xs | gl==nullPtr = return xs | otherwise = do x <- {#get GList.data#} gl gl' <- {#call unsafe list_delete_link#} gl gl extractList gl' (castPtr x:xs) -- Turn a GSList into a list of pointers but don't destroy the list. -- readGSList :: GSList -> IO [Ptr a] readGSList gslist | gslist==nullPtr = return [] | otherwise = do x <- {#get GSList->data#} gslist gslist' <- {#get GSList->next#} gslist xs <- readGSList gslist' return (castPtr x:xs) -- Turn a GSList into a list of pointers. -- fromGSList :: GSList -> IO [Ptr a] fromGSList gslist | gslist==nullPtr = return [] | otherwise = do x <- {#get GSList->data#} gslist gslist' <- {#call unsafe slist_delete_link#} gslist gslist xs <- fromGSList gslist' return (castPtr x:xs) -- Turn a GSList into a list of pointers and reverse it. -- fromGSListRev :: GSList -> IO [Ptr a] fromGSListRev gslist = extractList gslist [] where extractList gslist xs | gslist==nullPtr = return xs | otherwise = do x <- {#get GSList->data#} gslist gslist' <- {#call unsafe slist_delete_link#} gslist gslist extractList gslist' (castPtr x:xs) -- Convert an Int into a pointer. -- intToPtr :: Int -> Ptr a intToPtr int = plusPtr nullPtr int -- Turn a list of something into a GList. -- toGList :: [Ptr a] -> IO GList toGList xs = makeList nullPtr xs where -- makeList :: GList -> [Ptr a] -> IO GList makeList current (x:xs) = do newHead <- {#call unsafe list_prepend#} current (castPtr x) makeList newHead xs makeList current [] = return current -- Turn a list of something into a GSList. -- toGSList :: [Ptr a] -> IO GSList toGSList xs = makeList nullPtr xs where -- makeList :: GSList -> [Ptr a] -> IO GSList makeList current (x:xs) = do newHead <- {#call unsafe slist_prepend#} current (castPtr x) makeList newHead xs makeList current [] = return current --- NEW FILE: GError.chs.pp --- -- -*-haskell-*- -- GIMP Toolkit (GTK) GError API -- -- Author : Duncan Coutts -- Created: 2 July 2004 -- -- Copyright (c) 2004 Duncan Coutts -- parts derived from Structs.hsc Copyright (c) 1999..2002 Axel Simon -- -- 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. -- -- | -- -- Error Reporting, glib's system for reporting errors. -- -- 'GError's are used by glib to report recoverable runtime errors. -- -- This module provides functions for checking glib\/gtk functions that report -- 'GError's. It also provides functions for throwing and catching 'GError's as -- Haskell exceptions. -- module System.Glib.GError ( -- * Data types -- GError(..), GErrorDomain, GErrorCode, GErrorMessage, -- * Catching GError exceptions -- | To catch GError exceptions thrown by gtk2hs functions use the catchGError* -- or handleGError* functions. They work in a similar way to the standard -- 'Control.Exception.catch' and 'Control.Exception.handle' functions. -- -- 'catchGError'\/'handleGError' catches all GError exceptions, you provide a -- handler function that gets given the GError if an exception was thrown. This -- is the most general but is probably not what you want most of the time. It -- just gives you the raw error code rather than a Haskell enumeration of the -- error codes. Most of the time you will only want to catch a specific error -- or any error from a specific error domain. To catch just a single specific -- error use 'catchGErrorJust'\/'handleGErrorJust'. To catch any error in a -- particular error domain use 'catchGErrorJustDomain'\/'handleGErrorJustDomain' -- catchGError, catchGErrorJust, catchGErrorJustDomain, handleGError, handleGErrorJust, handleGErrorJustDomain, failOnGError, throwGError, -- * Checking for GErrors returned by glib\/gtk functions -- | * Note, these functions are only useful to implementors -- -- If you are wrapping a new API that reports 'GError's you should probably use -- '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. -- -- If you think it is more appropriate to use an alternate return value (eg -- Either\/Maybe) then you should use 'checkGError' or 'checkGErrorWithCont'. GErrorClass(..), propagateGError, checkGError, checkGErrorWithCont ) where import Monad (when) import Foreign import Foreign.C import System.Glib.UTFString import Control.Exception import Data.Dynamic {# context lib="gtk" prefix ="gtk" #} -- | A GError consists of a domain, code and a human readable message. data GError = GError !GErrorDomain !GErrorCode !GErrorMessage # if __GLASGOW_HASKELL__>=600 deriving Typeable #else {-# NOINLINE gerrorTypeRep #-} gerrorTypeRep :: TypeRep gerrorTypeRep = mkAppTy (mkTyCon "Graphics.UI.Gtk.GError.GError") [] instance Typeable GError where typeOf _ = gerrorTypeRep #endif type GQuark = {#type GQuark #} -- | A code used to identify the \'namespace\' of the error. Within each error -- domain all the error codes are defined in an enumeration. Each gtk\/gnome -- module that uses GErrors has its own error domain. The rationale behind -- using error domains is so that each module can organise its own error codes -- without having to coordinate on a global error code list. type GErrorDomain = GQuark -- | A code to identify a specific error within a given 'GErrorDomain'. Most of -- time you will not need to deal with this raw code since there is an -- enumeration type for each error domain. Of course which enumeraton to use -- depends on the error domain, but if you use 'catchGErrorJustDomain' or -- 'handleGErrorJustDomain', this is worked out for you automatically. type GErrorCode = Int -- | A human readable error message. type GErrorMessage = String instance Storable GError where sizeOf _ = {#sizeof GError #} alignment _ = alignment (undefined:: GQuark) peek ptr = do (domain :: GQuark) <- {#get GError->domain #} ptr (code :: {#type gint #}) <- {#get GError->code #} ptr (msgPtr :: CString) <- {#get GError->message #} ptr msg <- peekUTFString msgPtr return $ GError (fromIntegral domain) (fromIntegral code) msg poke _ = error "GError::poke: not implemented" -- | Each error domain's error enumeration type should be an instance of this -- class. This class helps to hide the raw error and domain codes from the -- user. This interface should be implemented by calling the approrpiate -- @{error_domain}_error_quark@. It is safe to use 'unsafePerformIO' for this. -- -- Example for 'PixbufError': -- -- > instance GErrorClass PixbufError where -- > gerrorDomain _ = unsafePerformIO {#call unsafe pixbuf_error_quark#} -- class Enum err => GErrorClass err where gerrorDomain :: err -> GErrorDomain -- ^ This must not use the value of its parameter -- so that it is safe to pass 'undefined'. -- | Glib functions which report 'GError's take as a parameter a @GError **error@. -- Use this function to supply such a parameter. It checks if an error was -- reported and if so throws it as a Haskell exception. -- -- Example of use: -- -- > propagateGError $ \gerrorPtr -> -- > {# call g_some_function_that_might_return_an_error #} a b gerrorPtr -- propagateGError :: (Ptr (Ptr ()) -> IO a) -> IO a propagateGError action = checkGError action throwGError -- | Like 'propagateGError' but instead of throwing the GError as an exception -- handles the error immediately using the supplied error handler. -- -- Example of use: -- -- > checkGError -- > (\gerrorPtr -> {# call g_some_function_that_might_return_an_error #} a b gerrorPtr) -- > (\(GError domain code msg) -> ...) -- checkGError :: (Ptr (Ptr ()) -> IO a) -> (GError -> IO a) -> IO a checkGError action handler = alloca $ \(errPtrPtr :: Ptr (Ptr GError)) -> do poke errPtrPtr nullPtr result <- action (castPtr errPtrPtr) errPtr <- peek errPtrPtr if errPtr == nullPtr then return result else do gerror <- peek errPtr {# call unsafe g_error_free #} (castPtr errPtr) handler gerror -- | Like 'checkGError' but with an extra continuation applied to the result. -- This can be useful when something needs to be done after making the call -- to the function that can raise an error but is should only be done if there -- was no error. -- -- Example of use: -- -- > checkGErrorWithCont (\gerrorPtr -> -- > {# call g_some_function_that_might_return_an_error #} a b gerrorPtr) -- > (\(GError domain code msg) -> ...) -- what to do in case of error -- > (\result -> ...) -- what to do after if no error -- checkGErrorWithCont :: (Ptr (Ptr ()) -> IO b) -> (GError -> IO a) -> (b -> IO a) -> IO a checkGErrorWithCont action handler cont = alloca $ \(errPtrPtr :: Ptr (Ptr GError)) -> do poke errPtrPtr nullPtr result <- action (castPtr errPtrPtr) errPtr <- peek errPtrPtr if errPtr == nullPtr then cont result else do gerror <- peek errPtr {# call unsafe g_error_free #} (castPtr errPtr) handler gerror -- | Use this if you need to explicitly throw a GError or re-throw an existing -- GError that you do not wish to handle. throwGError :: GError -> IO a throwGError gerror = evaluate (throwDyn gerror) -- | This will catch any GError exception. The handler function will receive the -- raw GError. This is probably only useful when you want to take some action -- that does not depend on which GError exception has occured, otherwise it -- would be better to use either 'catchGErrorJust' or 'catchGErrorJustDomain'. -- For example: -- -- > catchGError -- > (do ... -- > ...) -- > (\(GError dom code msg) -> fail msg) -- catchGError :: IO a -- ^ The computation to run -> (GError -> IO a) -- ^ Handler to invoke if an exception is raised -> IO a catchGError action handler = catchDyn action handler -- | This will catch just a specific GError exception. If you need to catch a -- range of related errors, 'catchGErrorJustDomain' is probably more -- appropriate. Example: -- -- > do image <- catchGErrorJust PixbufErrorCorruptImage -- > loadImage -- > (\errorMessage -> do log errorMessage -- > return mssingImagePlaceholder) -- catchGErrorJust :: GErrorClass err => err -- ^ The error to catch -> IO a -- ^ The computation to run -> (GErrorMessage -> IO a) -- ^ Handler to invoke if an exception is raised -> IO a catchGErrorJust code action handler = catchGError action handler' where handler' gerror@(GError domain code' msg) | fromIntegral domain == gerrorDomain code && code' == fromEnum code = handler msg | otherwise = throwGError gerror -- | Catch all GErrors from a particular error domain. The handler function -- should just deal with one error enumeration type. If you need to catch -- errors from more than one error domain, use this function twice with an -- appropriate handler functions for each. -- -- > catchGErrorJustDomain -- > loadImage -- > (\err message -> case err of -- > PixbufErrorCorruptImage -> ... -- > PixbufErrorInsufficientMemory -> ... -- > PixbufErrorUnknownType -> ... -- > _ -> ...) -- catchGErrorJustDomain :: GErrorClass err => IO a -- ^ The computation to run -> (err -> GErrorMessage -> IO a) -- ^ Handler to invoke if an exception is raised -> IO a catchGErrorJustDomain action (handler :: err -> GErrorMessage -> IO a) = catchGError action handler' where handler' gerror@(GError domain code msg) | fromIntegral domain == gerrorDomain (undefined::err) = handler (toEnum code) msg | otherwise = throwGError gerror -- | A verson of 'catchGError' with the arguments swapped around. -- -- > handleGError (\(GError dom code msg) -> ...) $ -- > ... -- handleGError :: (GError -> IO a) -> IO a -> IO a handleGError = flip catchGError -- | A verson of 'handleGErrorJust' with the arguments swapped around. handleGErrorJust :: GErrorClass err => err -> (GErrorMessage -> IO a) -> IO a -> IO a handleGErrorJust code = flip (catchGErrorJust code) -- | A verson of 'handleGErrorJustDomain' with the arguments swapped around. handleGErrorJustDomain :: GErrorClass err => (err -> GErrorMessage -> IO a) -> IO a -> IO a handleGErrorJustDomain = flip catchGErrorJustDomain -- | Catch all GError exceptions and convert them into a general failure. failOnGError :: IO a -> IO a failOnGError action = catchGError action (\(GError dom code msg) -> fail msg) |
From: Duncan C. <dun...@us...> - 2005-01-08 17:43:50
|
Update of /cvsroot/gtk2hs/gtk2hs/glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv803/glib Added Files: glib.pkg.in Log Message: move glib modules to a seperate package and use hierarchical namespace names. --- NEW FILE: glib.pkg.in --- Package { name = "glib", auto = False, import_dirs = ["@hidir@"], source_dirs = [], library_dirs = [@GLIB_LIBDIR_CQ@], hs_libraries = ["HSglib"], extra_libraries = [@GLIB_LIBS_CQ@], include_dirs = [@GLIB_CFLAGS_CQ@], c_includes = ["glib.h", "glib-object.h"], package_deps = ["haskell98"], extra_ghc_opts = [], extra_cc_opts = [], extra_ld_opts = [@GLIB_LIBEXTRA_CQ@] } |
From: Duncan C. <dun...@us...> - 2005-01-08 17:43:50
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv803 Modified Files: ChangeLog Log Message: move glib modules to a seperate package and use hierarchical namespace names. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.274 retrieving revision 1.275 diff -u -d -r1.274 -r1.275 --- ChangeLog 8 Jan 2005 17:38:02 -0000 1.274 +++ ChangeLog 8 Jan 2005 17:43:36 -0000 1.275 @@ -188,6 +188,14 @@ falsely detecting clashes between source modules producing the same object file. Also --include the module header for .hsc files. + * glib/glib.pkg.in, glib/System/Glib.hs, glib/System/Glib/FFI.hs, + glib/System/Glib/GError.chs.pp, glib/System/Glib/GList.chs + glib/System/Glib/GObject.chs.pp, glib/System/Glib/GParameter.hsc + glib/System/Glib/GType.chs, glib/System/Glib/GValue.chs, + glib/System/Glib/GValueTypes.chs, glib/System/Glib/StoreValue.hsc + glib/System/Glib/UTFString.hs: move glib modules to a seperate + package and use hierarchical namespace names. + 2005-01-07 Duncan Coutts <du...@co...> * tools/apiGen/ApiGen.hs: several documentation improvements, add |
From: Duncan C. <dun...@us...> - 2005-01-08 17:43:48
|
Update of /cvsroot/gtk2hs/gtk2hs/glib/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv803/glib/System Added Files: Glib.hs Log Message: move glib modules to a seperate package and use hierarchical namespace names. --- NEW FILE: Glib.hs --- module System.Glib ( module System.Glib.UTFString, module System.Glib.GType, module System.Glib.GValueTypes, module System.Glib.GObject, module System.Glib.GParameter, module System.Glib.GError, module System.Glib.GList ) where import System.Glib.UTFString import System.Glib.GType import System.Glib.GValueTypes import System.Glib.GObject import System.Glib.GParameter import System.Glib.GError import System.Glib.GList -- do not import System.Glib.FFI |
From: Duncan C. <dun...@us...> - 2005-01-08 17:38:12
|
Update of /cvsroot/gtk2hs/gtk2hs/mk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31754/mk Modified Files: common.mk Log Message: bludgeon automake into submission. Stop it from falsely detecting clashes between source modules producing the same object file. Also --include the module header for .hsc files. Index: common.mk =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/mk/common.mk,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- common.mk 20 Dec 2004 03:30:59 -0000 1.47 +++ common.mk 8 Jan 2005 17:38:03 -0000 1.48 @@ -12,7 +12,11 @@ $(addprefix -package ,$($(NAME)_PACKAGEDEPS)) \ $(AM_LDFLAGS) $($(NAME)_LDFLAGS)) -.hs.o: $(CONFIG_H) +#Using pattern rule here to prevent automake from understanding the rule +#and falsely concluding that two source files will produce the same object +#file even though the object files will be in different directories. +#Obviously the 'subdir-objects' option only works for C/C++ files. +%.o : %.hs $(CONFIG_H) @echo Building for $(NAME) $(strip $(HC) -c $< -o $@ $(HCFLAGS) $($(NAME)_HCFLAGS) \ $(call getVar,$<,HCFLAGS) -i$(call pkgVPATH,$(NAME)) \ @@ -85,7 +89,7 @@ $($(NAME)_CFLAGS))\ $(filter -I%,$(AM_CPPFLAGS)) \ $($(NAME)_CPPFLAGS)\ - --include $(CONFIG_H) \ + --include $(CONFIG_H) --include $($(NAME)_HEADER) \ --cc=$(HC) --lflag=-no-hs-main $<) .chs.hs: |
From: Duncan C. <dun...@us...> - 2005-01-08 17:38:12
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31754 Modified Files: ChangeLog Log Message: bludgeon automake into submission. Stop it from falsely detecting clashes between source modules producing the same object file. Also --include the module header for .hsc files. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.273 retrieving revision 1.274 diff -u -d -r1.273 -r1.274 --- ChangeLog 8 Jan 2005 17:27:25 -0000 1.273 +++ ChangeLog 8 Jan 2005 17:38:02 -0000 1.274 @@ -184,6 +184,10 @@ * tools/callbackGen/Signal.chs-boot1, tools/callbackGen/Signal.chs-boot2: fix module name and imports. + * mk/common.mk: bludgeon automake into submission. Stop it from + falsely detecting clashes between source modules producing the same + object file. Also --include the module header for .hsc files. + 2005-01-07 Duncan Coutts <du...@co...> * tools/apiGen/ApiGen.hs: several documentation improvements, add |
From: Duncan C. <dun...@us...> - 2005-01-08 17:32:03
|
Update of /cvsroot/gtk2hs/gtk2hs/glib/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30403/glib/System Log Message: Directory /cvsroot/gtk2hs/gtk2hs/glib/System added to the repository |
From: Duncan C. <dun...@us...> - 2005-01-08 17:31:55
|
Update of /cvsroot/gtk2hs/gtk2hs/glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30403/glib Log Message: Directory /cvsroot/gtk2hs/gtk2hs/glib added to the repository |
From: Duncan C. <dun...@us...> - 2005-01-08 17:31:55
|
Update of /cvsroot/gtk2hs/gtk2hs/glib/System/Glib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30403/glib/System/Glib Log Message: Directory /cvsroot/gtk2hs/gtk2hs/glib/System/Glib added to the repository |
From: Duncan C. <dun...@us...> - 2005-01-08 17:27:36
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/callbackGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29378/tools/callbackGen Modified Files: Signal.chs-boot1 Signal.chs-boot2 Log Message: fix module name and imports. Index: Signal.chs-boot1 =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/callbackGen/Signal.chs-boot1,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Signal.chs-boot1 25 May 2004 02:05:10 -0000 1.2 +++ Signal.chs-boot1 8 Jan 2005 17:27:26 -0000 1.3 @@ -43,5 +43,5 @@ -- -- * Check if we need all prototypes mentioned in gtkmarshal.list. -- -module Signal( +module Graphics.UI.Gtk.Signals ( Index: Signal.chs-boot2 =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/callbackGen/Signal.chs-boot2,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Signal.chs-boot2 9 Dec 2004 18:26:03 -0000 1.4 +++ Signal.chs-boot2 8 Jan 2005 17:27:26 -0000 1.5 @@ -5,11 +5,11 @@ ) where import Monad (liftM) -import FFI import Data.IORef -import GObject (objectRef, objectUnref) -import GError (failOnGError) -{#import Hierarchy#} + +import System.Glib.FFI +import System.Glib.GError (failOnGError) +{#import System.Glib.GObject#} hiding (mkDestructor) {#context lib="gtk" prefix="gtk" #} |
From: Duncan C. <dun...@us...> - 2005-01-08 17:27:34
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29378 Modified Files: ChangeLog Log Message: fix module name and imports. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.272 retrieving revision 1.273 diff -u -d -r1.272 -r1.273 --- ChangeLog 8 Jan 2005 17:25:04 -0000 1.272 +++ ChangeLog 8 Jan 2005 17:27:25 -0000 1.273 @@ -181,6 +181,9 @@ modules. Also castToGObject will be imported so need not be defined locally. + * tools/callbackGen/Signal.chs-boot1, + tools/callbackGen/Signal.chs-boot2: fix module name and imports. + 2005-01-07 Duncan Coutts <du...@co...> * tools/apiGen/ApiGen.hs: several documentation improvements, add |
From: Duncan C. <dun...@us...> - 2005-01-08 17:25:14
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28603 Modified Files: ChangeLog Log Message: Do not generate top of hierarchy, ie GObject. Let it be imported instead. This allows it to me moved to the glib package. Fixup names of imported modules in Hierarchy.chs.template. Also castToGObject will be imported so need not be defined locally. Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.271 retrieving revision 1.272 diff -u -d -r1.271 -r1.272 --- ChangeLog 8 Jan 2005 16:59:02 -0000 1.271 +++ ChangeLog 8 Jan 2005 17:25:04 -0000 1.272 @@ -173,6 +173,14 @@ gconf/System/Gnome/GConf/GConfClient.chs: fixup names of imported modules. + * tools/hierarchyGen/TypeGen.hs: Do not generate top of hierarchy, ie + GObject. Let it be imported instead. This allows it to me moved to the + glib package. + + * tools/hierarchyGen/Hierarchy.chs.template: fixup names of imported + modules. Also castToGObject will be imported so need not be defined + locally. + 2005-01-07 Duncan Coutts <du...@co...> * tools/apiGen/ApiGen.hs: several documentation improvements, add |
From: Duncan C. <dun...@us...> - 2005-01-08 17:25:14
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28603/tools/hierarchyGen Modified Files: TypeGen.hs Hierarchy.chs.template Log Message: Do not generate top of hierarchy, ie GObject. Let it be imported instead. This allows it to me moved to the glib package. Fixup names of imported modules in Hierarchy.chs.template. Also castToGObject will be imported so need not be defined locally. Index: Hierarchy.chs.template =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen/Hierarchy.chs.template,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Hierarchy.chs.template 13 Dec 2004 20:22:18 -0000 1.1 +++ Hierarchy.chs.template 8 Jan 2005 17:25:05 -0000 1.2 @@ -24,17 +24,14 @@ @MODULE_EXPORTS@ ) where -import FFI (ForeignPtr, castForeignPtr, foreignPtrToPtr, - CULong, withForeignPtr) -import GType (typeInstanceIsA) -import GHC.Base (unsafeCoerce#) +import System.Glib.FFI (ForeignPtr, castForeignPtr, foreignPtrToPtr, + CULong, withForeignPtr) +import System.Glib.GType (typeInstanceIsA) +import GHC.Base (unsafeCoerce#) @IMPORT_PARENT@ {#context lib="@CONTEXT_LIB@" prefix="@CONTEXT_PREFIX@" #} -castToGObject :: GObjectClass obj => obj -> obj -castToGObject = id - -- The usage of foreignPtrToPtr should be safe as the evaluation will only be -- forced if the object is used afterwards @CASTING_FUNCTIONS@ Index: TypeGen.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/hierarchyGen/TypeGen.hs,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- TypeGen.hs 13 Dec 2004 20:22:18 -0000 1.10 +++ TypeGen.hs 8 Jan 2005 17:25:05 -0000 1.11 @@ -91,7 +91,7 @@ main = do args <- getArgs - when (length args<2) usage + when (length args<3) usage ----------------------------------------------------------------------------- -- Parse command line parameters @@ -230,6 +230,7 @@ ss " = GT".makeGT obj eds makeClass :: String -> TypeTable -> [String] -> ShowS +makeClass prefix table (name:[]) = id makeClass prefix table (name:parents) = indent 0.ss "-- ".ss (replicate (75-length name) '*').sc ' '.ss name. indent 0. @@ -247,9 +248,7 @@ indent 0.ss "mk".ss name.ss " = ".ss name. indent 0.ss "un".ss name.ss " (".ss name.ss " o) = o". indent 0. - (if null parents - then indent 0.ss "class ".ss name.ss "Class o" - else indent 0.ss "class ".ss (head parents).ss "Class o => ".ss name.ss "Class o"). + indent 0.ss "class ".ss (head parents).ss "Class o => ".ss name.ss "Class o". indent 0.ss "to".ss name.ss " :: ".ss name.ss "Class o => o -> ".ss name. indent 0.ss "to".ss name.ss " = unsafeCoerce#". indent 0.ss "from".ss name.ss " :: ".ss name.ss "Class o => ".ss name.ss " -> o". @@ -264,8 +263,6 @@ indent 0.ss "instance ".ss par.ss "Class ".ss name. makeInstance name ents - - templateSubstitute :: String -> (String -> ShowS) -> ShowS templateSubstitute template varSubst = doSubst template where doSubst [] = id |