This commit is contained in:
aarne
2004-04-30 05:02:49 +00:00
parent 9e23c25e28
commit cbbb6d65c7
4 changed files with 23 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"