]> matita.cs.unibo.it Git - helm.git/commitdiff
Added parameter first_statement_only to the functions in matitaEngine
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Thu, 22 Dec 2005 18:05:32 +0000 (18:05 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Thu, 22 Dec 2005 18:05:32 +0000 (18:05 +0000)
helm/matita/matitaEngine.ml
helm/matita/matitaEngine.mli
helm/matita/matitacLib.ml

index fa9292c8986a7e7033d48c96f27f755b65c46830..bd240032cbc289d714de0e21eadd104b3611a714 100644 (file)
@@ -86,10 +86,16 @@ let eval_ast ?do_heavy_checks ?clean_baseuri lexicon_status
  in
   ((new_grafite_status,new_lexicon_status),None)::intermediate_states
 
-let eval_from_stream ~include_paths ?(prompt=false) ?do_heavy_checks
- ?clean_baseuri lexicon_status grafite_status str cb 
+let eval_from_stream ~first_statement_only ~include_paths ?(prompt=false)
+ ?do_heavy_checks ?clean_baseuri lexicon_status grafite_status str cb 
 =
  let rec loop lexicon_status grafite_status statuses =
+  let loop =
+   if first_statement_only then
+    fun _ _ _ -> raise End_of_file
+   else
+    loop
+  in
    if prompt then (print_string "matita> "; flush stdout);
    try
     let lexicon_status,ast =
@@ -116,8 +122,9 @@ let eval_from_stream ~include_paths ?(prompt=false) ?do_heavy_checks
   loop lexicon_status grafite_status []
 ;;
 
-let eval_string ~include_paths ?do_heavy_checks ?clean_baseuri lexicon_status
- status str
+let eval_string ~first_statement_only ~include_paths ?do_heavy_checks
?clean_baseuri lexicon_status status str
 =
- eval_from_stream ~include_paths ?do_heavy_checks ?clean_baseuri lexicon_status
-  status (Ulexing.from_utf8_string str) (fun _ _ -> ())
+ eval_from_stream ~first_statement_only ~include_paths ?do_heavy_checks
+  ?clean_baseuri lexicon_status status (Ulexing.from_utf8_string str)
+  (fun _ _ -> ())
index ddc905db36e26a41384d62695e0f9be92c010bcd..a3c54dea6a22537954f744fd4917965552528d6a 100644 (file)
@@ -39,6 +39,7 @@ val eval_ast :
 (* heavy checks slow down the compilation process but give you some interesting
  * infos like if the theorem is a duplicate *)
 val eval_string :
+  first_statement_only:bool ->
   include_paths:string list ->
   ?do_heavy_checks:bool ->
   ?clean_baseuri:bool ->
@@ -50,6 +51,7 @@ val eval_string :
   ) list
 
 val eval_from_stream :
+  first_statement_only:bool ->
   include_paths:string list ->
   ?prompt:bool ->
   ?do_heavy_checks:bool ->
index e769fd7d63bf7d19958006aad47b41ec1a99bb9b..7150c6f775cb57fecf8340070db8d3c659c8d424 100644 (file)
@@ -112,7 +112,7 @@ let rec interactive_loop () =
   let str = Ulexing.from_utf8_channel stdin in
   try
     run_script str 
-      (MatitaEngine.eval_from_stream ~prompt:true
+      (MatitaEngine.eval_from_stream ~first_statement_only:false ~prompt:true
       ~include_paths:(Helm_registry.get_list Helm_registry.string
         "matita.includes"))
   with 
@@ -180,7 +180,7 @@ let main ~mode =
      Helm_registry.get_list Helm_registry.string "matita.includes" in
     (try
       run_script is 
-       (MatitaEngine.eval_from_stream ~include_paths
+       (MatitaEngine.eval_from_stream ~first_statement_only:false ~include_paths
          ~clean_baseuri:(not (Helm_registry.get_bool "matita.preserve")))
      with End_of_file -> ());
     let elapsed = Unix.time () -. time in