Hi,

Here's a patch on top of the one Daniel Wagner sent a couple of weeks
ago, fixing c2hs to not use haskell98. I wouldn't apply it as-is, but
hopefully it'll be of use to whoever ends up fixing this properly. ;-)

Thanks,

-- 
Adam Sampson <a...@offog.org>                         <http://offog.org/>
2 patches for repository http://code.haskell.org/gtk2hs:

Sat Aug 13 21:31:07 BST 2011  Adam Sampson <a...@offog.org>
  * Support alex >= 3.0.
  
  Alex 3 expects alexGetByte rather than alexGetChar.

Sat Aug 13 21:32:47 BST 2011  Adam Sampson <a...@offog.org>
  * Make tools build with GHC 7.2.
  
  This quick-and-dirty patch fixes up c2hs's imports so that it doesn't
  use haskell98 any more. A more subtle approach would be more appropriate
  if backwards compatibility is desired; if it isn't, then there are
  various other version-conditional bits of code that could be removed.


New patches:

[Support alex >= 3.0.
Adam Sampson <a...@offog.org>**20110813203107
 Ignore-this: 37ff1e7ceefb44b2867d949d34b4f860
 
 Alex 3 expects alexGetByte rather than alexGetChar.
] hunk ./tools/c2hs/c/CLexer.x 70
 module CLexer (lexC, parseError) where
 
 import Char      (isDigit)
+import Data.Word      (Word8)
 import Numeric   (readDec, readOct, readHex)
 
 import Position  (Position(..), Pos(posOf))
hunk ./tools/c2hs/c/CLexer.x 392
 alexInputPrevChar :: AlexInput -> Char
 alexInputPrevChar _ = error "alexInputPrevChar not used"
 
+-- For alex >= 3.0
+alexGetByte :: AlexInput -> Maybe (Word8,AlexInput)
+alexGetByte (p,[]) = Nothing
+alexGetByte (p,(c:s))  = let p' = alexMove p c in p' `seq`
+                           Just (fromIntegral $ ord c, (p', s))
+
+-- For alex < 3.0
 alexGetChar :: AlexInput -> Maybe (Char,AlexInput)
 alexGetChar (p,[]) = Nothing
 alexGetChar (p,(c:s))  = let p' = alexMove p c in p' `seq`
[Make tools build with GHC 7.2.
Adam Sampson <a...@offog.org>**20110813203247
 Ignore-this: f15e4b4ace7760a6fd1adce3ea29a851
 
 This quick-and-dirty patch fixes up c2hs's imports so that it doesn't
 use haskell98 any more. A more subtle approach would be more appropriate
 if backwards compatibility is desired; if it isn't, then there are
 various other version-conditional bits of code that could be removed.
] hunk ./tools/c2hs/base/general/FastMutInt.hs 2
 {-# OPTIONS -cpp -fglasgow-exts #-}
+{-# LANGUAGE BangPatterns #-}
 --
 -- (c) The University of Glasgow 2002
 --
hunk ./tools/c2hs/base/general/FastMutInt.hs 16
 #define SIZEOF_HSINT  4
 
 import GHC.Base
-import GHC.IOBase
+import GHC.IO
 
 data FastMutInt = FastMutInt (MutableByteArray# RealWorld)
 
hunk ./tools/c2hs/base/general/FileOps.hs 35
 where
 
 -- standard libs
-import Char      (chr, ord)
-import Directory (doesFileExist)
-import IO       (Handle, IOMode(..), openFile)
-import Monad    (liftM)
-import Random    (newStdGen, randomRs)
+import Data.Char      (chr, ord)
+import System.Directory (doesFileExist)
+import System.IO        (Handle, IOMode(..), openFile)
+import Control.Monad    (liftM)
+import System.Random    (newStdGen, randomRs)
 
 import FNameOps  (dirname, stripDirname, addPath)
 
hunk ./tools/c2hs/base/general/UNames.hs 58
               saveRootNameSupply, restoreRootNameSupply)
 where
 
-import Monad  (when)
-import Ix
+import Control.Monad  (when)
+import Data.Ix
 import System.IO.Unsafe (unsafePerformIO)
 import Data.IORef       (IORef, newIORef, readIORef, writeIORef)
 import Binary (Binary(..))
hunk ./tools/c2hs/base/state/CIO.hs 75
            fileFindInCIO, mktempCIO)
 where
 
-import IO
-import Directory
-import System
+import System.IO
+import System.IO.Error
+import System.Cmd
+import System.Directory
+import System.Exit
+import System.Environment
 #if __GLASGOW_HASKELL__ >= 612
 import System.IO (hSetEncoding, latin1)
 #endif
hunk ./tools/c2hs/base/state/State.hs 72
              getNameSupply)
 where
 
-import Ix
-import Monad       (when)
-import List        (sort)
+import Data.Ix
+import Control.Monad       (when)
+import Data.List        (sort)
 
 import BaseVersion (version, copyright, disclaimer)
 import Config     (errorLimit)
hunk ./tools/c2hs/base/state/StateTrans.hs 82
                   MVar, newMV, readMV, assignMV)
 where
 
-import Monad      (liftM)
+import Control.Monad      (liftM)
 import System.IO  (fixIO)
 import Data.IORef (IORef, newIORef, readIORef, writeIORef)
 
hunk ./tools/c2hs/base/syms/Attributes.hs 91
                   getGenAttr, setGenAttr, updGenAttr) 
 where
 
-import Array
+import Data.Array
 import Control.Exception (assert)
 import Position   (Position, Pos(posOf), nopos, isNopos, dontCarePos, 
                   isDontCarePos)
hunk ./tools/c2hs/base/syms/Idents.hs 66
               getIdentAttrs, dumpIdent)  
 where
 
-import Char
+import Data.Char
 import Position   (Position, Pos(posOf), nopos)
 import UNames     (Name)
 import Errors     (interr)
hunk ./tools/c2hs/base/syntax/Lexers.hs 137
               star, plus, quest, alt, string, LexerState, execLexer)
 where 
 
-import Maybe  (fromMaybe, isNothing)
-import Array  (Ix(..), Array, array, (!), assocs, accumArray)
+import Data.Maybe  (fromMaybe, isNothing)
+import Data.Array  (Ix(..), Array, array, (!), assocs, accumArray)
 
 import Position (Position(..), Pos (posOf), nopos, incPos, tabPos, retPos)
 import DLists (DList, openDL, zeroDL, unitDL, snocDL, joinDL, closeDL)
hunk ./tools/c2hs/c/CAttrs.hs 71
               CObj(..), CTag(..), CDef(..))
 where
 
-import Char      (toUpper)
-import List       (isPrefixOf)
-import Maybe     (mapMaybe)
+import Data.Char         (toUpper)
+import Data.List       (isPrefixOf)
+import Data.Maybe        (mapMaybe)
 
 import Position   (Position, Pos(posOf), nopos, dontCarePos, builtinPos)
 import Errors     (interr)
hunk ./tools/c2hs/c/CLexer.x 69
 
 module CLexer (lexC, parseError) where
 
-import Char      (isDigit)
+import Data.Char      (isDigit)
 import Data.Word      (Word8)
 import Numeric   (readDec, readOct, readHex)
 
hunk ./tools/c2hs/c/CNames.hs 40
 module CNames (nameAnalysis)
 where
 
-import Monad    (when, mapM_)
+import Control.Monad    (when, mapM_)
 
 import Position  (Position, posOf)
 import Idents   (Ident, identToLexeme)
hunk ./tools/c2hs/c/CParser.y 1
+{-# LANGUAGE BangPatterns #-}
 --  C -> Haskell Compiler: Parser for C Header Files
 --
 --  Author : Duncan Coutts, Manuel M T Chakravarty
hunk ./tools/c2hs/c/CTrav.hs 83
              lookupDeclOrTag)
 where
 
-import List       (find)
-import Maybe     (fromMaybe)
-import Monad     (liftM)
+import Data.List       (find)
+import Data.Maybe        (fromMaybe)
+import Control.Monad     (liftM)
 import Control.Exception (assert)
 
 import Position   (Position, Pos(..), nopos)
hunk ./tools/c2hs/chs/CHS.hs 98
 where 
 
 -- standard libraries
-import Char     (isSpace, toUpper, toLower)
-import List     (intersperse)
-import Monad    (when, unless)
+import Data.Char        (isSpace, toUpper, toLower)
+import Data.List        (intersperse)
+import Control.Monad    (when, unless)
 
 -- Compiler Toolkit
 import Position  (Position(..), Pos(posOf), nopos, isBuiltinPos)
hunk ./tools/c2hs/chs/CHSLexer.hs 172
 module CHSLexer (CHSToken(..), lexCHS) 
 where 
 
-import List     ((\\))
-import Char     (isDigit)
-import Monad    (liftM)
+import Data.List        ((\\))
+import Data.Char        (isDigit)
+import Control.Monad    (liftM)
 import Numeric   (readDec, readOct, readHex)
 
 import Position  (Position(..), Pos(posOf), incPos, retPos, tabPos)
hunk ./tools/c2hs/gen/GBMonad.hs 75
   ) where
 
 -- standard libraries
-import Char      (toUpper, toLower, isSpace)
-import List       (find)
-import Maybe     (fromMaybe)
+import Data.Char         (toUpper, toLower, isSpace)
+import Data.List       (find)
+import Data.Maybe        (fromMaybe)
 
 -- Compiler Toolkit
 import Position   (Position, Pos(posOf), nopos, builtinPos)
hunk ./tools/c2hs/gen/GenBind.hs 115
 where 
 
 -- standard libraries
-import Char      (toUpper, toLower, isSpace)
-import List       (deleteBy, intersperse, isPrefixOf, find)
-import Maybe     (isNothing, isJust, fromJust, fromMaybe)
-import Monad     (when, unless, liftM, mapAndUnzipM)
+import Data.Char         (toUpper, toLower, isSpace)
+import Data.List       (deleteBy, intersperse, isPrefixOf, find)
+import Data.Maybe        (isNothing, isJust, fromJust, fromMaybe)
+import Control.Monad     (when, unless, liftM, mapAndUnzipM)
 
 import Data.Bits  ((.&.), (.|.), xor, complement)
 
hunk ./tools/c2hs/gen/GenHeader.hs 51
 ) where 
 
 -- standard libraries
-import Monad     (when)
+import Control.Monad     (when)
 
 -- Compiler Toolkit
 import Position  (Position, Pos(..), nopos)
hunk ./tools/c2hs/state/C2HSState.hs 54
                  putTraceStr, setSwitch, getSwitch) 
 where
 
-import Monad    (when)
+import Control.Monad    (when)
 
 import State
 
hunk ./tools/c2hs/toplevel/C2HSConfig.hs 45
   bitfieldDirection, bitfieldPadding, bitfieldIntSigned, bitfieldAlignment
 ) where
 
-import Ix    (Ix)
-import Array (Array, array)
+import Data.Ix    (Ix)
+import Data.Array (Array, array)
 
 import Foreign (Ptr, FunPtr)
 import Foreign  (Storable(sizeOf, alignment), toBool)
hunk ./tools/c2hs/toplevel/Main.hs 143
 where
 
 -- standard libraries
-import List      (isPrefixOf)
-import IO        ()
-import Monad      (when, unless, mapM)
-import Maybe      (fromJust)
+import Data.List         (isPrefixOf)
+import System.IO         ()
+import Control.Monad      (when, unless, mapM)
+import Data.Maybe      (fromJust)
 
 -- base libraries
 import System.Console.GetOpt     
hunk ./tools/gtk2hs-buildtools.cabal 55
         main-is:        Main.hs
         build-depends:  base >= 4 && < 5,
                         process, directory, array, containers, pretty,
-                        haskell98, filepath
+                        filepath, random
         build-tools:    alex, happy
         other-modules:  BaseVersion
                         Config

Context:

[Fix typo and add docs in INSTALL
Andy Stewart <lazycat.mana...@gmail.com>**20101222122119
 Ignore-this: bc363a0efc4f6c975f35a3c8ffdbca1
] 
[Add have-quartz-gtk flag to disable linking against gdk_x11_drawable_get_xid
Max Bolingbroke <batterseapo...@hotmail.com>**20101222113914
 Ignore-this: 3cf2009a8db78814ad5de1ed0b2173ba
] 
[Fix docs about 'imContextRetrieveSurrounding' signal.
Andy Stewart <lazycat.mana...@gmail.com>**20101217115003
 Ignore-this: 26e7b7d10a3e97f7a185a0afbe72a9b9
] 
[Don't emit an update signal with the incorrect stamp.
axel.si...@in.tum.de**20101216124643
 Ignore-this: 64b053e5495b4879923b802194b91111
] 
[Wrap version flag make gio can compile under gio-2.18.x
Andy Stewart <lazycat.mana...@gmail.com>**20101130130716
 Ignore-this: 84989139d42c5790828cadaaec6a73bf
] 
[Wrap 2.16.0 with EntryIconPosition to make gtk can compile in gtk+-2.14.x
Andy Stewart <lazycat.mana...@gmail.com>**20101130125652
 Ignore-this: 2853a6fc9749f123b67ddc0b10b53174
] 
[Add functions to query and show tooltips in TreeViews.
axel.si...@in.tum.de**20101123090253
 Ignore-this: fa122105338c3b22d0ebccb8e213ebd0
] 
[Add a note on broken binary Gtk+ installers on Windows.
axel.si...@in.tum.de**20101116154707
 Ignore-this: 30ab8f947870103cca14271237e5b423
] 
[Added basic GString support.
Andreas Baldeau <andr...@baldeau.net>**20101115103157
 Ignore-this: 4fc62813b652cc6e420c7b69006dfdae
] 
[TAG 0.12.0
axel.si...@in.tum.de**20101107135304
 Ignore-this: 14b3023f48c36eed2cb136a2b69d6dae
] 
Patch bundle hash:
8cba7f8b1c240ec576cf4d579ffcf9a9d2279ac3
------------------------------------------------------------------------------
FREE DOWNLOAD - uberSVN with Social Coding for Subversion.
Subversion made easy with a complete admin console. Easy 
to use, easy to manage, easy to install, easy to extend. 
Get a Free download of the new open ALM Subversion platform now.
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to