Remove deprecated debug script and forgotten comments to bypass the selective export of Text module

This commit is contained in:
Tissevert 2019-10-07 12:30:07 +02:00
parent 3a3e1533b4
commit c9f050e64b
3 changed files with 2 additions and 47 deletions

View file

@ -56,16 +56,6 @@ executable getObj
ghc-options: -Wall ghc-options: -Wall
default-language: Haskell2010 default-language: Haskell2010
executable debug
main-is: examples/debug.hs
build-depends: base
, bytestring
, containers
, Hufflepdf
, mtl
ghc-options: -Wall
default-language: Haskell2010
executable getText executable getText
main-is: examples/getText.hs main-is: examples/getText.hs
build-depends: base build-depends: base

View file

@ -1,35 +0,0 @@
{-# LANGUAGE NamedFieldPuns #-}
module Main where
import Control.Monad.Reader
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as C8
import qualified Data.Map as Map
import PDF.Object (Name(..), StringObject(..), array)
import PDF.CMap (CMappers, CRange(..), cMap, emptyCMap)
import PDF.Parser (evalParser)
import PDF.Text
test :: CMappers -> ParserWithFont a -> BS.ByteString -> Either String a
test fonts parser =
evalParser (runReaderT parser fonts) emptyCMap
main :: IO ()
main = do
input <- BS.readFile "20.stream"
--input <- BS.readFile "array.bin"
--let input = C8.pack "\f\xb5\0I"
Right font <- cMap <$> BS.readFile "6300.stream"
--mapM_ (\(size, m) -> putStrLn ("taille " ++ show size) >> mapM_ showCRange m) $ Map.toList font
--case pageContents (Map.singleton (Name "R9") font) input of
--case test (Map.singleton (Name "R9") font) array input of
--case test (Map.singleton (Name "R9") font) (a textOperator) input of
case test (Map.singleton (Name "R9") font) page input of
Left e -> putStrLn e
Right l -> putStrLn . show $ l
where
showMapping = mapM_ (\(k, v) -> putStr (show k) >> putStr " -> " >> C8.putStrLn v) . Map.toList
showCRange :: CRange -> IO ()
showCRange (CRange {fromSequence, toSequence, mapping}) = do
putStrLn $ "from " ++ C8.unpack fromSequence ++ " to " ++ C8.unpack toSequence
showMapping mapping

View file

@ -1,9 +1,9 @@
{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module PDF.Text {-( module PDF.Text (
PageContents(..) PageContents(..)
, pageContents , pageContents
)-} where ) where
import Control.Applicative ((<|>)) import Control.Applicative ((<|>))
import Control.Monad (foldM) import Control.Monad (foldM)