From 6be08d77e01ae418634897de62d44b5b1782566a Mon Sep 17 00:00:00 2001 From: krasimir Date: Mon, 23 Feb 2009 14:17:16 +0000 Subject: fix the handling of flag coding --- src/GF/Command/Commands.hs | 10 +++++----- src/GF/Command/Interpreter.hs | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/GF/Command') diff --git a/src/GF/Command/Commands.hs b/src/GF/Command/Commands.hs index 2a4a8b631..eda61255f 100644 --- a/src/GF/Command/Commands.hs +++ b/src/GF/Command/Commands.hs @@ -17,7 +17,7 @@ import PGF.Data ---- import PGF.Morphology import PGF.VisualizeTree import GF.Compile.Export -import GF.Infra.Option (noOptions, readOutputFormat) +import GF.Infra.Option (noOptions, readOutputFormat, Encoding(..)) import GF.Infra.UseIO import GF.Data.ErrM ---- import PGF.Expr (readTree) @@ -66,7 +66,7 @@ emptyCommandInfo = CommandInfo { lookCommand :: String -> Map.Map String CommandInfo -> Maybe CommandInfo lookCommand = Map.lookup -commandHelpAll :: String -> PGFEnv -> [Option] -> String +commandHelpAll :: Encoding -> PGFEnv -> [Option] -> String commandHelpAll cod pgf opts = unlines [commandHelp (isOpt "full" opts) (co,info) | (co,info) <- Map.assocs (allCommands cod pgf)] @@ -88,7 +88,7 @@ commandHelp full (co,info) = unlines $ [ type PGFEnv = (PGF, Map.Map Language Morpho) -- this list must no more be kept sorted by the command name -allCommands :: String -> PGFEnv -> Map.Map String CommandInfo +allCommands :: Encoding -> PGFEnv -> Map.Map String CommandInfo allCommands cod env@(pgf, mos) = Map.fromList [ ("!", emptyCommandInfo { synopsis = "system command: escape to system shell", @@ -704,12 +704,12 @@ stringOpOptions = [ treeOpOptions pgf = [(op,expl) | (op,(expl,_)) <- allTreeOps pgf] -translationQuiz :: String -> PGF -> Language -> Language -> Type -> IO () +translationQuiz :: Encoding -> PGF -> Language -> Language -> Type -> IO () translationQuiz cod pgf ig og typ = do tts <- translationList pgf ig og typ infinity mkQuiz cod "Welcome to GF Translation Quiz." tts -morphologyQuiz :: String -> PGF -> Language -> Type -> IO () +morphologyQuiz :: Encoding -> PGF -> Language -> Type -> IO () morphologyQuiz cod pgf ig typ = do tts <- morphologyList pgf ig typ infinity mkQuiz cod "Welcome to GF Morphology Quiz." tts diff --git a/src/GF/Command/Interpreter.hs b/src/GF/Command/Interpreter.hs index 7e9ebb653..7c962b375 100644 --- a/src/GF/Command/Interpreter.hs +++ b/src/GF/Command/Interpreter.hs @@ -16,6 +16,7 @@ import PGF.Macros import PGF.Morphology import GF.System.Signal import GF.Infra.UseIO +import GF.Infra.Option import GF.Data.ErrM ---- @@ -29,13 +30,13 @@ data CommandEnv = CommandEnv { expmacros :: Map.Map String Tree } -mkCommandEnv :: String -> PGF -> CommandEnv +mkCommandEnv :: Encoding -> PGF -> CommandEnv mkCommandEnv enc pgf = let mos = Map.fromList [(la,buildMorpho pgf la) | la <- languages pgf] in CommandEnv pgf mos (allCommands enc (pgf, mos)) Map.empty Map.empty emptyCommandEnv :: CommandEnv -emptyCommandEnv = mkCommandEnv "utf8" emptyPGF +emptyCommandEnv = mkCommandEnv UTF_8 emptyPGF interpretCommandLine :: (String -> String) -> CommandEnv -> String -> IO () interpretCommandLine enc env line = -- cgit v1.2.3