From 8d6e61a8df4480385a1f2ef29a96f6a88af9e3ba Mon Sep 17 00:00:00 2001 From: hallgren Date: Mon, 10 Aug 2015 14:12:51 +0000 Subject: gf -cshell: preliminary support for the C run-time system in the GF shell Some C run-time functionality is now available in the GF shell, by starting GF with 'gf -cshell' or 'gf -crun'. Only limited functionality is available when running the shell in these modes: - You can only import .pgf files, not source files. - The -retain flag can not be used and the commands that require it to work are not available. - Only 18 of the 40 commands available in the usual shell have been implemented. The 'linearize' and 'parse' commands are the only ones that call the C run-time system, and they support only a limited set of options and flags. Use the 'help' commmands for details. - A new command 'generate_all', that calls PGF2.generateAll, has been added. Unfortuntaly, using it causes 'segmentation fault'. This is implemented by adding two new modules: GF.Command.Commands2 and GF.Interactive2. They are copied and modified versions of GF.Command.Commands and GF.Interactive, respectively. Code for unimplemented commands and other code that has not been adapted to the C run-time system has been left in place, but commented out, pending further work. --- src/compiler/GF/Infra/Option.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/compiler/GF/Infra/Option.hs') 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") -- cgit v1.2.3