aboutsummaryrefslogtreecommitdiff
path: root/toplevel
diff options
context:
space:
mode:
authorClément Pit--Claudel2015-04-23 01:14:49 -0400
committerEnrico Tassi2015-05-04 13:17:23 +0200
commit2a295131a1a72dd56e6e7abdeaeca07b1b69ab6d (patch)
treef23c8dc1ce9238ebf5cb05f61f57aa21dd8ee8ca /toplevel
parentf19d0c7baf91fb410de77baed391b0a16db9c4e2 (diff)
Add a [Redirect] vernacular command
The command [Redirect "filename" (...)] redirects all the output of [(...)] to file "filename.out". This is useful for storing the results of an [Eval compute], for redirecting the results of a large search, for automatically generating traces of interesting developments, and so on.
Diffstat (limited to 'toplevel')
-rw-r--r--toplevel/vernac.ml2
-rw-r--r--toplevel/vernacentries.ml3
2 files changed, 4 insertions, 1 deletions
diff --git a/toplevel/vernac.ml b/toplevel/vernac.ml
index b3694d0e98..11cb047e09 100644
--- a/toplevel/vernac.ml
+++ b/toplevel/vernac.ml
@@ -27,7 +27,7 @@ let rec is_navigation_vernac = function
| VernacBacktrack _
| VernacBackTo _
| VernacBack _ -> true
- | VernacTime l ->
+ | VernacRedirect (_, l) | VernacTime l ->
List.exists
(fun (_,c) -> is_navigation_vernac c) l (* Time Back* is harmless *)
| c -> is_deep_navigation_vernac c
diff --git a/toplevel/vernacentries.ml b/toplevel/vernacentries.ml
index f33c71d8a6..4300d5e244 100644
--- a/toplevel/vernacentries.ml
+++ b/toplevel/vernacentries.ml
@@ -1849,6 +1849,7 @@ let interp ?proof locality poly c =
| VernacLoad _ -> assert false
| VernacFail _ -> assert false
| VernacTime _ -> assert false
+ | VernacRedirect _ -> assert false
| VernacTimeout _ -> assert false
| VernacStm _ -> assert false
@@ -2127,6 +2128,8 @@ let interp ?(verbosely=true) ?proof (loc,c) =
| VernacTimeout (n,v) ->
current_timeout := Some n;
aux ?locality ?polymorphism isprogcmd v
+ | VernacRedirect (s, v) ->
+ Pp.with_output_to_file s (aux_list ?locality ?polymorphism isprogcmd) v;
| VernacTime v ->
System.with_time !Flags.time
(aux_list ?locality ?polymorphism isprogcmd) v;