diff --git a/bin/jgf2 b/bin/jgf2 index ed5fc144d..95c411b13 100644 --- a/bin/jgf2 +++ b/bin/jgf2 @@ -1,7 +1,7 @@ #! /bin/sh # change the value of GFHOME to the directory where you have the gf binary -GFHOME=/home/aarne/GF2/bin +GFHOME=/home/aarne/GF/bin JGUILIB=$GFHOME/java/ GF=$GFHOME/gf2 diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs index a14461928..9e922171f 100644 --- a/src/GF/Shell.hs +++ b/src/GF/Shell.hs @@ -15,6 +15,9 @@ import Compile ---- import GFTex import TeachYourself -- also a subshell +import Randomized --- +import Editing (goFirstMeta) --- + import ShellState import Option import Information @@ -24,6 +27,8 @@ import PrGrammar import Monad (foldM) import System (system) +import Random (newStdGen) ---- +import Zipper ---- import Operations import UseIO @@ -168,9 +173,19 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of CTranslate il ol -> do let a' = opST2CommandArg (optParseArgErr opts (sgr il)) a returnArg (opTS2CommandArg (optLinearizeTreeVal opts (sgr ol)) a') sa - CGenerateRandom n -> do - ts <- randomTreesIO opts gro (optIntOrN opts flagNumber n) - returnArg (ATrms ts) sa + CGenerateRandom n -> case a of + ASTrm _ -> do + case s2t a of + ATrms [trm] -> do + g <- newStdGen + case (goFirstMeta (tree2loc trm) >>= refineRandom g 41 cgr) of + Ok trm' -> returnArg (ATrms [loc2tree trm']) sa + Bad s -> returnArg (AError s) sa + _ -> returnArg a sa + _ -> do + ts <- randomTreesIO opts gro (optIntOrN opts flagNumber n) + returnArg (ATrms ts) sa + CPutTerm -> changeArg (opTT2CommandArg (optTermCommand opts gro) . s2t) sa ----- CWrapTerm f -> changeArg (opTT2CommandArg (return . wrapByFun opts gro f)) sa CMorphoAnalyse -> changeArg (AString . morphoAnalyse opts gro . prCommandArg) sa @@ -229,6 +244,7 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of gro = grammarOfOptState opts st opts = addOptions opts0 (globalOptions st) src = srcModules st + cgr = canModules st s2t a = case a of ASTrm s -> err AError (ATrms . return) $ string2treeErr gro s diff --git a/src/GF/Shell/PShell.hs b/src/GF/Shell/PShell.hs index c2db72e63..06554287b 100644 --- a/src/GF/Shell/PShell.hs +++ b/src/GF/Shell/PShell.hs @@ -71,7 +71,8 @@ pCommand ws = case ws of "p" : s -> aString CParse s "t" : i:o: s -> aString (CTranslate (language i) (language o)) s "gr" : [] -> aUnit (CGenerateRandom 1) - "gr" : n : [] -> aUnit (CGenerateRandom (readIntArg n)) -- deprecated 12/5/2001 + "gr" : t -> aTerm (CGenerateRandom 1) t +--- "gr" : n : [] -> aUnit (CGenerateRandom (readIntArg n)) -- deprecated 12/5/2001 "pt" : s -> aTerm CPutTerm s ----- "wt" : f : s -> aTerm (CWrapTerm (string2id f)) s "ma" : s -> aString CMorphoAnalyse s diff --git a/src/Today.hs b/src/Today.hs index 3cb4fe183..8f7baf3bc 100644 --- a/src/Today.hs +++ b/src/Today.hs @@ -1 +1 @@ -module Today where today = "Tor Apr 29 09:41:39 CEST 2004" +module Today where today = "Fri Apr 30 07:57:27 CEST 2004"