blob: 0d947b675432ef2bfe412408e4559c0e07a4fecf [file] [log] [blame]
sewardja24827f2005-01-20 17:57:55 +00001
2module Main where
3
4main
sewardj807598d2005-01-31 18:54:23 +00005 = do x1 <- readFile "test2.sorted"
sewardja24827f2005-01-20 17:57:55 +00006 let x2 = lines x1
7 x3 = zip [1 ..] x2
8 x4 = concat (map qq x3)
9 --putStr x4
sewardj807598d2005-01-31 18:54:23 +000010 writeFile "test2.orig" x4
sewardja24827f2005-01-20 17:57:55 +000011
12
13qq :: (Int, String) -> String
14qq (n, s0)
15 = let ws = words s0
16 bytes = head ws
17 rest = unwords (tail ws)
18 bytes2 = foo bytes
19 in
20 unlines [
21 "",
22 rest,
23 ". " ++ show n ++ " 0x12345678 " ++ show (1 + (length bytes `div` 2)),
24 ". " ++ bytes2 ++ "C3"
25 ]
26
27
28foo [] = []
29foo (x:y:rest) = x:y:' ':foo rest