• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2module Main where
3
4main
5  = do x1 <- readFile "test2.sorted"
6       let x2 = lines x1
7           x3 = zip [1 ..] x2
8           x4 = concat (map qq x3)
9       --putStr x4
10       writeFile "test2.orig" x4
11
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
30