summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-06-25 18:14:45 +0000
committerbjorn <bjorn@bringert.net>2008-06-25 18:14:45 +0000
commite459cc777125b20c3caf1c88f385f17ef77a3bf8 (patch)
treed172f16f06fbe14ee913c8609e513fff08cc0bf9 /src/GF
parent5971c110e9463a97b3baa6d420982d36488adee0 (diff)
Include coding flag in .gfo files.
Because the PGF file gets all the flags from the GFO file automatically, we get the coding flag in the PGF file too. This is undesirable, since PGF is supposed to always by in UTF-8.
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/Infra/Option.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/GF/Infra/Option.hs b/src/GF/Infra/Option.hs
index 380cb3af7..f992d4f98 100644
--- a/src/GF/Infra/Option.hs
+++ b/src/GF/Infra/Option.hs
@@ -77,7 +77,7 @@ data Phase = Preproc | Convert | Compile | Link
deriving (Show,Eq,Ord)
data Encoding = UTF_8 | ISO_8859_1 | CP_1251
- deriving (Show,Eq,Ord)
+ deriving (Eq,Ord)
data OutputFormat = FmtPGF
| FmtJavaScript
@@ -186,11 +186,10 @@ moduleOptionsGFO :: ModuleOptions -> [(String,String)]
moduleOptionsGFO (ModuleOptions o) =
maybe [] (\x -> [("language",x)]) (optSpeechLanguage mfs)
++ maybe [] (\x -> [("startcat",x)]) (optStartCat mfs)
--- ++ maybe [] (\x -> [("coding", e2s x)]) (Just (optEncoding mfs))
+ ++ [("coding", show (optEncoding mfs))]
++ (if optErasing mfs then [("erasing","on")] else [])
where
mfs = o defaultModuleFlags
- e2s e = maybe [] id $ lookup e [(s,e) | (e,s) <- encodings]
-- Option manipulation
@@ -475,6 +474,9 @@ encodings =
("latin1", ISO_8859_1)
]
+instance Show Encoding where
+ show = lookupShow encodings
+
lookupShow :: Eq a => [(String,a)] -> a -> String
lookupShow xs z = fromMaybe "lookupShow" $ lookup z [(y,x) | (x,y) <- xs]