From 06ea7fea4637d46882b00c39469e235f6910c200 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 16 Mar 2006 20:33:35 +0000 Subject: [PATCH] exitFailure with gf -make --- lib/resource-1.0/Makefile | 1 + lib/resource-1.0/lang.gfprob | 1 + lib/resource-1.0/romance/DiffRomance.gf | 2 +- lib/resource-1.0/spanish/ParadigmsSpa.gf | 2 +- lib/resource-1.0/spanish/StructuralSpa.gf | 2 +- src/GF/GFModes.hs | 2 +- src/GF/Shell.hs | 9 ++++++++- 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/resource-1.0/Makefile b/lib/resource-1.0/Makefile index bfee27e17..31a6e9ef4 100644 --- a/lib/resource-1.0/Makefile +++ b/lib/resource-1.0/Makefile @@ -7,6 +7,7 @@ test: pretest: echo "gr -cat=Cl -number=11 -prob | tb" | gf -probs=lang.gfprob -path=present:prelude -nocf ../present/Lang???.gfc + langs: echo "s ;; pm | wf langs.gfcm" | gf -nocf -src */Lang??*.gf english/LangEng.gf +RTS -M800M -K100M cp -p */*.gfc */*.gfr ../alltenses diff --git a/lib/resource-1.0/lang.gfprob b/lib/resource-1.0/lang.gfprob index 742081a0b..068127e61 100644 --- a/lib/resource-1.0/lang.gfprob +++ b/lib/resource-1.0/lang.gfprob @@ -15,3 +15,4 @@ --# prob yes_Phr 0.02 --# prob no_Phr 0.02 --# prob TEmpty 0.05 + diff --git a/lib/resource-1.0/romance/DiffRomance.gf b/lib/resource-1.0/romance/DiffRomance.gf index d88648837..5d58ac90d 100644 --- a/lib/resource-1.0/romance/DiffRomance.gf +++ b/lib/resource-1.0/romance/DiffRomance.gf @@ -27,7 +27,7 @@ interface DiffRomance = open CommonRomance, Prelude in { oper partAgr : VType -> VPAgr ; -- Whether participle agrees to foregoing clitic. --- (Fre "je l'ai vue", Ita "io la ho visto") +-- (Fre "je l'ai vue", Spa "yo la he visto") oper vpAgrClit : Agr -> VPAgr ; diff --git a/lib/resource-1.0/spanish/ParadigmsSpa.gf b/lib/resource-1.0/spanish/ParadigmsSpa.gf index c65855292..61a2519af 100644 --- a/lib/resource-1.0/spanish/ParadigmsSpa.gf +++ b/lib/resource-1.0/spanish/ParadigmsSpa.gf @@ -314,7 +314,7 @@ oper {s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ; isPre = a.isPre ; lock_A = <>} ; compADeg a = - {s = table {Posit => a.s ! Posit ; _ => \\f => "piů" ++ a.s ! Posit ! f} ; + {s = table {Posit => a.s ! Posit ; _ => \\f => "más" ++ a.s ! Posit ! f} ; isPre = a.isPre ; lock_A = <>} ; regADeg a = compADeg (regA a) ; diff --git a/lib/resource-1.0/spanish/StructuralSpa.gf b/lib/resource-1.0/spanish/StructuralSpa.gf index f1e3b4051..f7938c739 100644 --- a/lib/resource-1.0/spanish/StructuralSpa.gf +++ b/lib/resource-1.0/spanish/StructuralSpa.gf @@ -20,7 +20,7 @@ lin behind_Prep = {s = "detrás" ; c = MorphoSpa.genitive ; isDir = False} ; between_Prep = mkPreposition "entre" ; both7and_DConj = {s1,s2 = etConj.s ; n = Pl} ; - but_PConj = ss "mas" ; + but_PConj = ss "pero" ; by8agent_Prep = mkPreposition "por" ; by8means_Prep = mkPreposition "por" ; can8know_VV = mkVV (verboV (saber_71 "saber")) ; diff --git a/src/GF/GFModes.hs b/src/GF/GFModes.hs index bf3e90f97..dd25d1e49 100644 --- a/src/GF/GFModes.hs +++ b/src/GF/GFModes.hs @@ -90,7 +90,7 @@ putVerb st@(sh,_) s = if (oElem beSilent (globalOptions sh)) batchCompile :: Options -> FilePath -> IO () batchCompile os file = do let file' = mkGFC file - let st = initHState emptyShellState + let st = initHState $ addGlobalOptions (options [iOpt "make"]) emptyShellState let s = "i -o" +++ (unwords $ map ('-':) $ words $ prOpts os) +++ file let cs = pCommandLines st s execLines True cs st diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs index 062946649..1077616f5 100644 --- a/src/GF/Shell.hs +++ b/src/GF/Shell.hs @@ -65,6 +65,7 @@ import Data.Char (isDigit) import Data.Maybe (fromMaybe) import GF.System.Signal (runInterruptibly) +import System.Exit (exitFailure) ---- import qualified GrammarToGramlet as Gr ---- import qualified GrammarToCanonXML2 as Canon @@ -169,10 +170,16 @@ execLine :: Bool -> CommandLine -> ([String],HState) -> IO ([String],HState) execLine put (c@(co, os), arg, cs) (outps,st) = do (st',val) <- execC c (st, arg) let tr = oElem doTrace os || null cs -- option -tr leaves trace in pipe + make = oElem (iOpt "make") os + isErr = case arg of + AError _ -> True + _ -> False utf = if (oElem useUTF8 os) then encodeUTF8 else id outp = if tr then [utf (prCommandArg val)] else [] if put then mapM_ putStrLnFlush outp else return () - execs cs val (if put then [] else outps ++ outp, st') + if make && isErr + then exitFailure + else execs cs val (if put then [] else outps ++ outp, st') where execs [] arg st = return st execs (c:cs) arg st = execLine put (c, arg, cs) st