diff options
author | marche <marche@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2004-03-03 15:53:40 +0000 |
---|---|---|
committer | marche <marche@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2004-03-03 15:53:40 +0000 |
commit | cc4b49c10a523ed752a13497a91ab36f62b37c0f (patch) | |
tree | 31b7c2c4c196a7aeda6658c03e5068da2a79e2b4 /ide | |
parent | ad8585656fe4c3e902aab93a4c470079640844a2 (diff) |
ide: silent behavior better, save icon, -byte works
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@5427 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide')
-rw-r--r-- | ide/command_windows.ml | 2 | ||||
-rw-r--r-- | ide/coq.ml | 6 | ||||
-rw-r--r-- | ide/coq.mli | 2 | ||||
-rw-r--r-- | ide/coqide.ml | 123 | ||||
-rw-r--r-- | ide/preferences.ml | 10 |
5 files changed, 84 insertions, 59 deletions
diff --git a/ide/command_windows.ml b/ide/command_windows.ml index 0e2d5a378..32f2e3faf 100644 --- a/ide/command_windows.ml +++ b/ide/command_windows.ml @@ -107,7 +107,7 @@ object(self) then com ^ " " else com ^ " " ^ entry#text ^" . " in try - ignore(Coq.interp phrase); + ignore(Coq.interp false phrase); result#buffer#set_text ("Result for command " ^ phrase ^ ":\n" ^ Ideutils.read_stdout ()) with e -> diff --git a/ide/coq.ml b/ide/coq.ml index 71bc09cc2..17db71802 100644 --- a/ide/coq.ml +++ b/ide/coq.ml @@ -107,7 +107,7 @@ let is_in_proof_mode () = let user_error_loc l s = raise (Stdpp.Exc_located (l, Util.UserError ("CoqIde", s))) -let interp s = +let interp verbosely s = prerr_endline "Starting interp..."; prerr_endline s; let pa = Pcoq.Gram.parsable (Stream.of_string s) in @@ -149,7 +149,7 @@ let interp s = | VernacFixpoint _ | VernacCoFixpoint _ | VernacEndProof _ - -> Options.make_silent false + -> Options.make_silent (not verbosely) | _ -> () end; Vernac.raw_do_vernac (Pcoq.Gram.parsable (Stream.of_string s)); @@ -158,7 +158,7 @@ let interp s = last let interp_and_replace s = - let result = interp s in + let result = interp false s in let msg = read_stdout () in result,msg diff --git a/ide/coq.mli b/ide/coq.mli index bc9ac6526..488434e4e 100644 --- a/ide/coq.mli +++ b/ide/coq.mli @@ -16,7 +16,7 @@ open Evd val version : unit -> string val init : unit -> string list -val interp : string -> Util.loc * Vernacexpr.vernac_expr +val interp : bool -> string -> Util.loc * Vernacexpr.vernac_expr val interp_last : Util.loc * Vernacexpr.vernac_expr -> unit val interp_and_replace : string -> (Util.loc * Vernacexpr.vernac_expr) * string diff --git a/ide/coqide.ml b/ide/coqide.ml index 9bed06666..d9793abcc 100644 --- a/ide/coqide.ml +++ b/ide/coqide.ml @@ -169,13 +169,13 @@ object('self) method insert_message : string -> unit method insert_this_phrase_on_success : bool -> bool -> bool -> string -> string -> bool - method process_next_phrase : bool -> bool -> bool + method process_next_phrase : bool -> bool -> bool -> bool method process_until_iter_or_error : GText.iter -> unit method process_until_end_or_error : unit method recenter_insert : unit method reset_initial : unit method send_to_coq : - bool -> string -> + bool -> bool -> string -> bool -> bool -> bool -> (Util.loc * Vernacexpr.vernac_expr) option method set_message : string -> unit method show_goals : unit @@ -232,54 +232,61 @@ let coq_computing = Mutex.create () let coq_may_stop = Mutex.create () let break () = + prerr_endline "User break received:"; if not (Mutex.try_lock coq_computing) then begin - prerr_endline "Break received"; + prerr_endline " trying to stop computation:"; if Mutex.try_lock coq_may_stop then begin Util.interrupt := true; + prerr_endline " interrupt flag set. Computation should stop soon..."; Mutex.unlock coq_may_stop - end else prerr_endline "Break discarded (coq may not stop now)"; + end else prerr_endline " interruption refused (may not stop now)"; end else begin Mutex.unlock coq_computing; - prerr_endline "Break received and discarded (not computing)" + prerr_endline " ignored (not computing)" end let full_do_if_not_computing text f x = - ignore (Thread.create - (async (fun () -> - if Mutex.try_lock coq_computing then begin - prerr_endline ("Launching thread " ^ text); - let w = Blaster_window.blaster_window () in - if not (Mutex.try_lock w#lock) then begin - break (); - let lck = Mutex.create () in - Mutex.lock lck; - prerr_endline "Waiting on blaster..."; - Condition.wait w#blaster_killed lck; - prerr_endline "Waiting on blaster ok"; - Mutex.unlock lck - end else Mutex.unlock w#lock; - let idle = - Glib.Timeout.add ~ms:300 - ~callback:(fun () -> !pulse ();true) in - begin - prerr_endline "Getting lock"; - try - f x; - Glib.Timeout.remove idle; - prerr_endline "Releasing lock"; - Mutex.unlock coq_computing; - with e -> - Glib.Timeout.remove idle; - prerr_endline "Releasing lock (on error)"; - Mutex.unlock coq_computing; - raise e - end - end else - prerr_endline - "Discarded order (computations are ongoing)")) - ()) + ignore + (Thread.create + (async + (fun () -> + if Mutex.try_lock coq_computing + then + begin + prerr_endline ("Launching thread " ^ text); + let w = Blaster_window.blaster_window () in + if not (Mutex.try_lock w#lock) then begin + break (); + let lck = Mutex.create () in + Mutex.lock lck; + prerr_endline "Waiting on blaster..."; + Condition.wait w#blaster_killed lck; + prerr_endline "Waiting on blaster ok"; + Mutex.unlock lck + end else Mutex.unlock w#lock; + let idle = + Glib.Timeout.add ~ms:300 + ~callback:(fun () -> !pulse ();true) in + begin + prerr_endline "Getting lock"; + try + f x; + Glib.Timeout.remove idle; + prerr_endline "Releasing lock"; + Mutex.unlock coq_computing; + with e -> + Glib.Timeout.remove idle; + prerr_endline "Releasing lock (on error)"; + Mutex.unlock coq_computing; + raise e + end + end + else + prerr_endline + "Discarded order (computations are ongoing)")) + ()) let do_if_not_computing text f x = ignore (full_do_if_not_computing text f x) @@ -929,19 +936,22 @@ object(self) with e -> prerr_endline (Printexc.to_string e) end - method send_to_coq replace phrase show_output show_error localize = + method send_to_coq verbosely replace phrase show_output show_error localize = try full_goal_done <- false; prerr_endline "Send_to_coq starting now"; if replace then begin - let r,info = Coq.interp_and_replace ("Info " ^ phrase) in + let r,info = +(* full_do_if_not_computing "coq eval and replace" *) + Coq.interp_and_replace ("Info " ^ phrase) + in let msg = read_stdout () in self#insert_message (if show_output then msg else ""); Some r end else begin - let r = Some (Coq.interp phrase) in + let r = Some (Coq.interp verbosely phrase) in let msg = read_stdout () in self#insert_message (if show_output then msg else ""); r @@ -1044,7 +1054,7 @@ object(self) else false - method process_next_phrase display_goals do_highlight = + method process_next_phrase verbosely display_goals do_highlight = begin try self#clear_message; @@ -1070,7 +1080,7 @@ object(self) prerr_endline "process_next_phrase : getting phrase"; let phrase = start#get_slice ~stop in let r = - match self#send_to_coq false phrase true true true with + match self#send_to_coq verbosely false phrase true true true with | Some ast -> begin b#move_mark ~where:stop (`NAME "start_of_input"); @@ -1102,7 +1112,7 @@ object(self) method insert_this_phrase_on_success show_output show_msg localize coqphrase insertphrase = - match self#send_to_coq false coqphrase show_output show_msg localize with + match self#send_to_coq false false coqphrase show_output show_msg localize with | Some ast -> begin let stop = self#get_start_of_input in @@ -1160,7 +1170,7 @@ object(self) process_pending (); (try while ((stop#compare self#get_start_of_input>=0) - && (self#process_next_phrase false false)) + && (self#process_next_phrase false false false)) do Util.check_for_interrupt () done with Sys.Break -> prerr_endline "Interrupted during process_until_iter_or_error"); @@ -1467,8 +1477,8 @@ Please restart and report NOW."; if not (is_in_coq_path f) then begin let dir = Filename.dirname f in - ignore (Coq.interp - (Printf.sprintf "Add LoadPath \"%s\". " dir)) + ignore (Coq.interp false + (Printf.sprintf "Add LoadPath \"%s\". " dir)) end) in () @@ -1487,7 +1497,7 @@ Please restart and report NOW."; end with Found -> begin - ignore (self#process_next_phrase true true) + ignore (self#process_next_phrase false true true) end; end; last_index <- not last_index;) @@ -2391,8 +2401,11 @@ let main files = do_if_not_computing "do_or_activate" (do_or_activate (fun av -> f av ; !pop_info();!push_info (Coq.current_status()))) in - let add_to_menu_toolbar text ~tooltip ~key ~callback icon = - ignore (navigation_factory#add_item text ~key ~callback); + let add_to_menu_toolbar text ~tooltip ?key ~callback icon = + begin + match key with None -> () + | Some key -> ignore (navigation_factory#add_item text ~key ~callback) + end; ignore (toolbar#insert_button ~tooltip ~text:tooltip @@ -2401,10 +2414,16 @@ let main files = ()) in add_to_menu_toolbar + "_Save" + ~tooltip:"Save current buffer" + (* ~key:GdkKeysyms._Down *) + ~callback:save_f + `SAVE; + add_to_menu_toolbar "_Forward" ~tooltip:"Forward one command" ~key:GdkKeysyms._Down - ~callback:(do_or_activate (fun a -> a#process_next_phrase true true)) + ~callback:(do_or_activate (fun a -> a#process_next_phrase true true true)) `GO_DOWN; add_to_menu_toolbar "_Backward" ~tooltip:"Backward one command" diff --git a/ide/preferences.ml b/ide/preferences.ml index c4976748e..3d7b0017c 100644 --- a/ide/preferences.ml +++ b/ide/preferences.ml @@ -123,8 +123,14 @@ let (current:pref ref) = modifiers_valid = [`SHIFT; `CONTROL; `MOD1; `MOD4]; - cmd_browse = "netscape -remote \"OpenURL(", ")\""; - cmd_editor = "emacs ", ""; + cmd_browse = + if Sys.os_type = "Win32" + then "C:\\PROGRA~1\\INTERN~1\\IEXPLORE ", "" + else "netscape -remote \"OpenURL(", ")\""; + cmd_editor = + if Sys.os_type = "Win32" + then "NOTEPAD ", "" + else "emacs ", ""; text_font = Pango.Font.from_string "sans 12"; |