summaryrefslogtreecommitdiff
path: root/src/GFC.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2008-10-28 13:57:10 +0000
committerkrasimir <krasimir@chalmers.se>2008-10-28 13:57:10 +0000
commitebd98056ce9d478f0aca68d752a49d87f7431ec9 (patch)
tree8174b823fe84309b81f6b1b04c3353a44cfa357c /src/GFC.hs
parent8e43cfb8a8ce4a6c4c608678633c0c5ec67adfff (diff)
binary serialization for PGF
Diffstat (limited to 'src/GFC.hs')
-rw-r--r--src/GFC.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/GFC.hs b/src/GFC.hs
index 8af23d6e1..337acb87a 100644
--- a/src/GFC.hs
+++ b/src/GFC.hs
@@ -4,8 +4,6 @@ module GFC (mainGFC) where
import PGF
import PGF.CId
import PGF.Data
-import PGF.Raw.Parse
-import PGF.Raw.Convert
import GF.Compile
import GF.Compile.Export
@@ -16,6 +14,7 @@ import GF.Infra.Option
import GF.Data.ErrM
import Data.Maybe
+import Data.Binary
import System.FilePath
@@ -57,10 +56,17 @@ unionPGFFiles opts fs =
where readPGFVerbose f = putPointE Normal opts ("Reading " ++ f ++ "...") $ ioeIO $ readPGF f
writeOutputs :: Options -> PGF -> IOE ()
-writeOutputs opts pgf =
- sequence_ [writeOutput opts name str
- | fmt <- flag optOutputFormats opts,
- (name,str) <- exportPGF opts fmt pgf]
+writeOutputs opts pgf = do
+ writePGF opts pgf
+ sequence_ [writeOutput opts name str
+ | fmt <- flag optOutputFormats opts,
+ (name,str) <- exportPGF opts fmt pgf]
+
+writePGF :: Options -> PGF -> IOE ()
+writePGF opts pgf = do
+ let name = fromMaybe (prCId (absname pgf)) (flag optName opts)
+ outfile = name <.> "pgf"
+ putPointE Normal opts ("Writing " ++ outfile ++ "...") $ ioeIO $ encodeFile outfile pgf
writeOutput :: Options -> FilePath-> String -> IOE ()
writeOutput opts file str =