summaryrefslogtreecommitdiff
path: root/src/GF/Canon/GetGFC.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-25 16:43:48 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-25 16:43:48 +0000
commitb96b36f43de3e2f8b58d5f539daa6f6d47f25870 (patch)
tree0992334be13cec6538a1dea22fbbf26ad6bdf224 /src/GF/Canon/GetGFC.hs
parentfe367412e0aeb4ad5c02de68e6eca382e0f96984 (diff)
removed src for 2.9
Diffstat (limited to 'src/GF/Canon/GetGFC.hs')
-rw-r--r--src/GF/Canon/GetGFC.hs78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/GF/Canon/GetGFC.hs b/src/GF/Canon/GetGFC.hs
deleted file mode 100644
index 049f75efe..000000000
--- a/src/GF/Canon/GetGFC.hs
+++ /dev/null
@@ -1,78 +0,0 @@
-----------------------------------------------------------------------
--- |
--- Module : GetGFC
--- Maintainer : AR
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date: 2005/05/30 18:39:43 $
--- > CVS $Author: aarne $
--- > CVS $Revision: 1.9 $
---
--- (Description of the module)
------------------------------------------------------------------------------
-
-module GF.Canon.GetGFC (getCanonModule, getCanonGrammar) where
-
-import GF.Data.Operations
-import GF.Canon.ParGFC
-import GF.Canon.GFC
-import GF.Canon.MkGFC
-import GF.Infra.Modules
-import GF.Infra.UseIO
-
-import System.IO
-import System.Directory
-import Control.Monad
-
-getCanonModule :: FilePath -> IOE CanonModule
-getCanonModule file = do
- gr <- getCanonGrammar file
- case modules gr of
- [m] -> return m
- _ -> ioeErr $ Bad "expected exactly one module in a file"
-
-getCanonGrammar :: FilePath -> IOE CanonGrammar
--- getCanonGrammar = getCanonGrammarByLine
-getCanonGrammar file = do
- s <- ioeIO $ readFileIf file
- c <- ioeErr $ pCanon $ myLexer s
- return $ canon2grammar c
-
-{-
--- the following surprisingly does not save memory so it is
--- not in use
-
-getCanonGrammarByLine :: FilePath -> IOE CanonGrammar
-getCanonGrammarByLine file = do
- b <- ioeIO $ doesFileExist file
- if not b
- then ioeErr $ Bad $ "file" +++ file +++ "does not exist"
- else do
- ioeIO $ putStrLn ""
- hand <- ioeIO $ openFile file ReadMode ---- err
- size <- ioeIO $ hFileSize hand
- gr <- addNextLine (size,0) 1 hand emptyMGrammar
- ioeIO $ hClose hand
- return $ MGrammar $ reverse $ modules gr
-
- where
- addNextLine (size,act) d hand gr = do
- eof <- ioeIO $ hIsEOF hand
- if eof
- then return gr
- else do
- s <- ioeIO $ hGetLine hand
- let act' = act + toInteger (length s)
--- if isHash act act' then (ioeIO $ putChar '#') else return ()
- updGrammar act' d gr $ pLine $ myLexer s
- where
- updGrammar a d gr (Ok t) = case buildCanonGrammar d gr t of
- (gr',d') -> addNextLine (size,a) d' hand gr'
- updGrammar _ _ gr (Bad s) = do
- ioeIO $ putStrLn s
- return emptyMGrammar
-
- isHash a b = a `div` step < b `div` step
- step = size `div` 50
--}