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 |