summaryrefslogtreecommitdiff
path: root/src/GF.hs
diff options
context:
space:
mode:
authoraarne <unknown>2005-06-10 20:04:00 +0000
committeraarne <unknown>2005-06-10 20:04:00 +0000
commit6a66fc5d71747c1009590e68887a9bbd6f44e598 (patch)
tree13506416fc358d7e05a5c6c1d4d94db609455f50 /src/GF.hs
parent3f192bd2bb99f827abd20be36fc125c0e6553e80 (diff)
gfe as preprocessing to compiler
Diffstat (limited to 'src/GF.hs')
-rw-r--r--src/GF.hs43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/GF.hs b/src/GF.hs
index 96cf33661..ed07ede8b 100644
--- a/src/GF.hs
+++ b/src/GF.hs
@@ -5,9 +5,9 @@
-- Stability : (stability)
-- Portability : (portability)
--
--- > CVS $Date: 2005/06/03 21:51:58 $
+-- > CVS $Date: 2005/06/10 21:04:01 $
-- > CVS $Author: aarne $
--- > CVS $Revision: 1.27 $
+-- > CVS $Revision: 1.28 $
--
-- The Main module of GF program.
-----------------------------------------------------------------------------
@@ -20,6 +20,7 @@ import GF.Infra.UseIO
import GF.Infra.Option
import GF.API.IOGrammar
import GF.Compile.ShellState
+import GF.Compile.Compile
import GF.Compile.MkConcrete
import GF.Shell
import GF.Shell.SubShell
@@ -30,19 +31,22 @@ import GF.Text.UTF8
import GF.Today (today,version)
import GF.System.Arch
-import System (getArgs)
-import Control.Monad (foldM)
+import System (getArgs,system)
+import Control.Monad (foldM,liftM)
+import Data.List (nub)
-- AR 19/4/2000 -- 28/4/2005
main :: IO ()
main = do
xs <- getArgs
- let (os,fs) = getOptions "-" xs
- opt j = oElem j os
- st0 = optInitShellState os
- ifNotSil c = if oElem beSilent os then return () else c
- case 0 of
+ let
+ (os,fs) = getOptions "-" xs
+ opt j = oElem j os
+ st0 = optInitShellState os
+ ifNotSil c = if oElem beSilent os then return () else c
+
+ doGF os fs = case 0 of
_ | opt getHelp -> do
putStrLnFlush $ encodeUTF8 helpMsg
@@ -62,6 +66,10 @@ main = do
_ | opt makeConcrete -> do
mkConcretes fs
+ _ | opt openEditor -> do
+ system $ "jgf" +++ unwords xs
+ return ()
+
_ | opt doBatch -> do
if opt beSilent then return () else putStrLnFlush "<gfbatch>"
st <- useIOE st0 $
@@ -77,17 +85,26 @@ main = do
if null fs then return () else (ifNotSil putCPU)
gfInteract (initHState st)
return ()
+ -- preprocessing gfe
+ if opt fromExamples
+ then do
+ es <- liftM (nub . concat) $ mapM (getGFEFiles os) fs
+ mkConcretes es
+ doGF (removeOption fromExamples os) fs
+ else doGF os fs
helpMsg = unlines [
"Usage: gf <option>* <file>*",
"Options:",
+ " -batch structure session by XML tags (use > to send into a file)",
+ " -edit start the editor GUI (same as command 'jgf')",
+ " -ex first compile .gfe files as needed, then .gf files",
+ " -examples batch-compile .gfe files by parsing examples",
+ " -help show this message",
" -make batch-compile files",
" -noemit do not emit code when compiling",
" -v be verbose when compiling",
- " -batch structure session by XML tags (use > to send into a file)",
- " -examples batch-compile .gfe file by parsing examples",
- " -help show this message",
- "To use the GUI: jgf <option>* <file>*"
+ "Also all flags for import (i) are interpreted; see 'help i'."
]
welcomeMsg =