Thu Dec 31 14:04:22 CST 2009 Antoine Latter * always read and write to files as UTF8 New patches: [always read and write to files as UTF8 Antoine Latter **20091231200422 Ignore-this: a3a925698a59a9625ab7250827904e9d ] { hunk ./src/Main.hs 38 import System.Environment ( getProgName, getArgs ) import System.Exit ( ExitCode(..), exitWith ) import System.IO ( stderr, Handle, IOMode(..), openFile, hClose, hPutStr, hPutStrLn ) +#if __GLASGOW_HASKELL__ >= 612 +import System.IO ( hGetContents, hSetEncoding, utf8 ) +#endif + +-- We need to force every file we open to be read in +-- as UTF8 +alexReadFile :: FilePath -> IO String +#if __GLASGOW_HASKELL__ >= 612 +alexReadFile file = do + h <- alexOpenFile file ReadMode + hGetContents h +#else +alexReadFile = readFile +#endif + +-- We need to force every file we write to be written +-- to as UTF8 +alexOpenFile :: FilePath -> IOMode -> IO Handle +#if __GLASGOW_HASKELL__ >= 612 +alexOpenFile file mode = do + h <- openFile file mode + hSetEncoding h utf8 + return h +#else +alexOpenFile = openFile +#endif -- `main' decodes the command line arguments and calls `alex'. hunk ./src/Main.hs 97 'x':'.':r -> return (reverse r) _ -> die (file ++ ": filename must end in \'.x\'\n") - prg <- readFile file + prg <- alexReadFile file script <- parseScript file prg alex cli file basename script hunk ./src/Main.hs 138 -- open the output file; remove it if we encounter an error bracketOnError - (openFile o_file WriteMode) + (alexOpenFile o_file WriteMode) (\h -> do hClose h; removeFile o_file) $ \out_h -> do hunk ./src/Main.hs 156 -- add the wrapper, if necessary when (isJust wrapper_name) $ - do str <- readFile (fromJust wrapper_name) + do str <- alexReadFile (fromJust wrapper_name) hPutStr out_h str let dfa = scanner2dfa scanner_final scs hunk ./src/Main.hs 171 hPutStr out_h (actions "") -- add the template - tmplt <- readFile template_name + tmplt <- alexReadFile template_name hPutStr out_h tmplt hClose out_h hunk ./src/Main.hs 261 infoStart :: FilePath -> FilePath -> IO (String -> IO (), IO ()) infoStart x_file info_file = do bracketOnError - (openFile info_file WriteMode) + (alexOpenFile info_file WriteMode) (\h -> do hClose h; removeFile info_file) (\h -> do infoHeader h x_file return (hPutStr h, hClose h) } Context: [add a base < 5 dependency, to convince Cabal to use base-4 Simon Marlow **20091117090840 Ignore-this: 5a045e6410edb503e38498c40564a3d9 ] [Use bang patterns on unlifted bindings Ian Lynagh **20090603225854] [Turn off warnings in Parser.y Ian Lynagh **20090603205809] [Fix warnings in DFA Ian Lynagh **20090603205231] [Hide all warnings in the generated Scan module Ian Lynagh **20090603204507] [Fix warnings Ian Lynagh **20090603204452] [Fix warnings Ian Lynagh **20090603204437] [Turn on -Wall when building Ian Lynagh **20090603200305] [doc/alex.xml: Missing closing quotation mark. Marco TĂșlio Gontijo e Silva **20090507144456 Ignore-this: 1d789a125393fe942d1b41f6dd46687e ] [using dblatex for formatting printable docs Simon Marlow **20090423134433 Ignore-this: 4ad5b1d68498c60219910b2e4aeea38a ] [use my gmail.com email address; add bug-reports and commented-out source-repo Simon Marlow **20081219093616] [TAG 2.3.1 Simon Marlow **20081204091945] [version 2.3.1 Simon Marlow **20081204091938] [fix build with GHC 6.10.1 Simon Marlow **20081204091913] [TAG 2.3 Simon Marlow **20081013083324] [special sdist steps aren't necessary now Simon Marlow **20081013083106] [version 2.3 Simon Marlow **20081013083050] [2.3 updates Simon Marlow **20081013082759] [build-type: Custom Simon Marlow **20081013081925] [Fix to make Setup.lhs compile with Cabal-1.2, 1.4 and 1.6 Duncan Coutts **20081011181133] [monadUserState alcremi@pobox.com**20080902075531 add the monadUserState wrapper, and its variant monadUserState-bytestring, allowing to define a custom state monad in the lex specification ] [Add support for efficient lexing of strict bytestrings Don Stewart **20080718224320] [Untabify Don Stewart **20080718224243] [doc fix Simon Marlow **20080218092857] [fix small doc bug, pointed out by Ben Challenor [bdc25@cam.ac.uk] Simon Marlow **20071219085223] [add release instructions Simon Marlow **20071114150257] [TAG 2.2 release Simon Marlow **20071101141613] Patch bundle hash: 533be7031f766b1cc9232aca7dd958f71e22dfcd