on master help sign in
Add tools/BuildUnicodeTable.hs, a testing program for unicode table API
60c55baJonathan Daugherty
tools/BuildUnicodeTable.hsnew file+26
@@ -0,0 +1,26 @@
1+module Main where
2+
3+import System.Exit (exitFailure)
4+
5+import Graphics.Vty.UnicodeWidthTable.Types
6+import Graphics.Vty.UnicodeWidthTable.IO
7+
8+main :: IO ()
9+main = do
10+ let r1 = WidthTableRange 0 100 1
11+ r2 = WidthTableRange 101 200 2
12+ t = UnicodeWidthTable { unicodeWidthTableRanges = [r1, r2]
13+ }
14+
15+ writeUnicodeWidthTable "testfile.dat" t
16+ result <- readUnicodeWidthTable "testfile.dat"
17+
18+ case result of
19+ Left msg -> do
20+ putStrLn $ "Error reading table: " <> msg
21+ exitFailure
22+ Right t2 -> do
23+ putStrLn "Original table:"
24+ print t
25+ putStrLn "New table:"
26+ print t2
vty.cabal+10
@@ -123,6 +123,16 @@ library
123
123
124 ghc-prof-options: -O2 -funbox-strict-fields -caf-all -Wall -fspec-constr -fspec-constr-count=10
124 ghc-prof-options: -O2 -funbox-strict-fields -caf-all -Wall -fspec-constr -fspec-constr-count=10
125
125
126+executable vty-build-table
127+ main-is: BuildUnicodeTable.hs
128+ hs-source-dirs: tools
129+
130+ default-language: Haskell2010
131+ ghc-options: -threaded
132+
133+ build-depends: vty,
134+ base >= 4.8 && < 5
135+
126executable vty-mode-demo
136executable vty-mode-demo
127 main-is: ModeDemo.hs
137 main-is: ModeDemo.hs
128 hs-source-dirs: demos
138 hs-source-dirs: demos