+ The restrictions on arbitrary IO when GF is running in restricted mode is now
enforced in the types.
+ This hopefully also solves an intermittent problem when accessing the GF
shell through the web API provided by gf -server. This was visible in the
Simple Translation Tool and probably caused by some low-level bug in the
GHC IO libraries.
The SIO monad is a restriction of the IO monad with two purposes:
+ Access to arbitrary IO operations can be turned off by setting the environment
variable GF_RESTRICTED. There is a limited set of IO operations that are
considered safe and always allowed.
+ It allows output to stdout to be captured. This can be used in gf -server
mode, where output of GF shell commands is made part of HTTP responses
returned to clients.
The dependency on PGFEnv has been moved from the list to the exec function of
the commands in the list. This means that the help command no longer needs
to generate a new list of commands and that the state of the shell
(type GF.Command.Interpreter.CommandEnv) no longer needs to contain the list
of commands.
+ More restrictive limits on which file paths can be downloaded and removed.
+ Add more extensions to the list of file types that may be removed. In
particular, allow documents created by simple translation tool to be removed.
Introduced the function
parallelCheck :: [Check a] -> Check [a]
that runs independent checks in parallel, potentially allowing faster grammar
compilation on multi-core computers, if you run gf with +RTS -N.
However, on my dual core laptop, this seems to slow down compilation somewhat
even though CPU utilization goes up as high as 170% at times.
(This is with GF compiled with GHC 7.0.4.)
In GF.Compile.CheckGrammar, use a new topological sorting function that
groups independent judgements, allowing them all to be checked before
continuing or reporting errors.
Reimplemented it with the new function accumulateError.
Also keeping the formatting of errors and warnings unchanged for now, to avoid
potentially causing problems in the GF Eclipse Plugin.
Using accumulated errors in the Check monad.
TODO: some errors are still not accumulated, but thanks to checkMapRecover
at least one error per judgement is reported.
In addition to warnings, the Check monad in GF.Infra.CheckM can now accumulate
errors. There are two new functions
checkAccumError: Message -> Check ()
accumulateError :: (a -> Check a) -> a -> Check a
The former (with the same type as checkWarn) is used to report an accumulated
(nonfatal) error. The latter converts fatal errors into accumulated errors.
Accumulated errors are reported as regular errors by runCheck.
Also, the Check monad type has been made abstract.
This turns error messages like
gf: too few bytes. Failed reading at byte position 1
gf: /some/path/somefile.gfo: too few bytes. Failed reading at byte position 1
but a better fix would be to ignore bad .gfo files and compile from source.
The problem is the way this decision is made in
GF.Compile.ReadFiles.selectFormat...
The Setup.hs script now queries darcs to create more detailed version info
to include in the startup message.
Note thought that with distributed version control systems like darcs,
the only way to uniquely identify a version is by the set of patches included.
Since the patches are not totally ordered, just looking at the last patch is
not enough.
For official releases, we tag the current set of patches so we can refer to
it by name (e.g. RELEASE-3.3.3).
As a temporary workaround, alex is no longer invoked automatically when
building with cabal. Developers who want to modify the lexer need to run
alex on Lexer.x manually and record the modified Lexer.hs.
src/compiler/GF/Grammar/lexer/Lexer.x -- hidden from cabal
src/compiler/GF/Grammar/Lexer.hs -- update it manually
An apparent bug in ghc-7.2.2 causes the type Value to be exported from PGF.Data.
Workaround: restrict the imports from PGF.Data in GF.Command.Abstract and
GF.Compile.GeneratePMCFG to avoid the clash with locally defined type Value.
(ghc-7.0.4 and ghc-7.4.1 appear to be free from this bug.)
+ Preserve the startcat flag.
+ Preserve judgement order when possible (GF's parser does not preserve order
and does not record exact source locations, only line numbers)