on master help sign in
Add tools/BuildUnicodeTable.hs, a testing program for unicode table API
commit60c55bae3d780340b2174b3d5a93d420d4ffc9b2 authorJonathan Daugherty <cygnus@foobox.com> dateThu 27 Feb 2020, 15:25 (7 years ago) parent908d189
2 files changed+36
tools/BuildUnicodeTable.hs+26 vty.cabal+10
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
123123
124124 ghc-prof-options: -O2 -funbox-strict-fields -caf-all -Wall -fspec-constr -fspec-constr-count=10
125125
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+
126136executable vty-mode-demo
127137 main-is: ModeDemo.hs
128138 hs-source-dirs: demos