summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Infra
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/GF/Infra')
-rw-r--r--src/compiler/GF/Infra/Option.hs7
-rw-r--r--src/compiler/GF/Infra/SIO.hs11
2 files changed, 17 insertions, 1 deletions
diff --git a/src/compiler/GF/Infra/Option.hs b/src/compiler/GF/Infra/Option.hs
index 51aa44b82..a9a517a6e 100644
--- a/src/compiler/GF/Infra/Option.hs
+++ b/src/compiler/GF/Infra/Option.hs
@@ -73,7 +73,10 @@ errors = raise . unlines
-- Types
-data Mode = ModeVersion | ModeHelp | ModeInteractive | ModeRun | ModeCompiler
+data Mode = ModeVersion | ModeHelp
+ | ModeInteractive | ModeRun
+ | ModeInteractive2 | ModeRun2
+ | ModeCompiler
| ModeServer {-port::-}Int
deriving (Show,Eq,Ord)
@@ -302,6 +305,8 @@ optDescr =
Option ['j'] ["jobs"] (OptArg jobs "N") "Compile N modules in parallel with -batch (default 1).",
Option [] ["interactive"] (NoArg (mode ModeInteractive)) "Run in interactive mode (default).",
Option [] ["run"] (NoArg (mode ModeRun)) "Run in interactive mode, showing output only (no other messages).",
+ Option [] ["cshell"] (NoArg (mode ModeInteractive2)) "Start the C run-time shell.",
+ Option [] ["crun"] (NoArg (mode ModeRun2)) "Start the C run-time shell, showing output only (no other messages).",
Option [] ["server"] (OptArg modeServer "port") $
"Run in HTTP server mode on given port (default "++show defaultPort++").",
Option [] ["document-root"] (ReqArg gfDocuRoot "DIR")
diff --git a/src/compiler/GF/Infra/SIO.hs b/src/compiler/GF/Infra/SIO.hs
index 5ca683707..e24a6cb35 100644
--- a/src/compiler/GF/Infra/SIO.hs
+++ b/src/compiler/GF/Infra/SIO.hs
@@ -1,5 +1,6 @@
-- | Shell IO: a monad that can restrict acesss to arbitrary IO and has the
-- ability to capture output that normally would be sent to stdout.
+{-# LANGUAGE CPP #-}
module GF.Infra.SIO(
-- * The SIO monad
SIO,
@@ -11,6 +12,9 @@ module GF.Infra.SIO(
newStdGen,print,putStrLn,
-- ** Specific to GF
importGrammar,importSource,
+#ifdef C_RUNTIME
+ readPGF2,
+#endif
putStrLnFlush,runInterruptibly,lazySIO,
-- * Restricted accesss to arbitrary (potentially unsafe) IO operations
-- | If the environment variable GF_RESTRICTED is defined, these
@@ -33,6 +37,9 @@ import qualified System.Random as IO(newStdGen)
import qualified GF.Infra.UseIO as IO(getLibraryDirectory)
import qualified GF.System.Signal as IO(runInterruptibly)
import qualified GF.Command.Importing as GF(importGrammar, importSource)
+#ifdef C_RUNTIME
+import qualified PGF2
+#endif
-- * The SIO monad
@@ -96,3 +103,7 @@ lazySIO = lift1 lazyIO
importGrammar pgf opts files = lift0 $ GF.importGrammar pgf opts files
importSource opts files = lift0 $ GF.importSource opts files
+
+#ifdef C_RUNTIME
+readPGF2 = lift0 . PGF2.readPGF
+#endif