diff --git a/paparazzi b/paparazzi new file mode 100755 index 0000000000..e2a3ed4379 --- /dev/null +++ b/paparazzi @@ -0,0 +1,13 @@ +#!/usr/bin/ocamlrun /usr/bin/ocaml +#load "unix.cma";; +let (//) = Filename.concat +let dirname = Filename.dirname Sys.argv.(0) +let env = + Array.map (fun var -> + let value = try Sys.getenv var with _ -> dirname in + Printf.sprintf "%s=%s" var value) + [|"PAPARAZZI_SRC"; "PAPARAZZI_HOME"|] +let com = dirname // "sw/supervision/paparazzicenter";; +Sys.argv.(0) <- com;; +let env = Array.append env (Unix.environment ());; +Unix.execve com Sys.argv env diff --git a/sw/supervision/paparazzicenter.glade b/sw/supervision/paparazzicenter.glade index 2a6957931f..772ca5f4c2 100644 --- a/sw/supervision/paparazzicenter.glade +++ b/sw/supervision/paparazzicenter.glade @@ -1895,6 +1895,42 @@ True + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + + 0 diff --git a/sw/supervision/paparazzicenter.ml b/sw/supervision/paparazzicenter.ml index ab4ba25489..1293744477 100644 --- a/sw/supervision/paparazzicenter.ml +++ b/sw/supervision/paparazzicenter.ml @@ -38,6 +38,9 @@ let () = gui#window#set_icon (Some (GdkPixbuf.from_file Env.icon_file)); + let s = gui#statusbar#new_context "env" in + ignore (s#push (sprintf "HOME=%s SRC=%s" Env.paparazzi_home Env.paparazzi_src)); + let ac_combo = AC.parse_conf_xml gui#vbox_ac and target_combo = combo ["sim";"fbw";"ap"] gui#vbox_target in @@ -55,18 +58,34 @@ let () = let tag = GText.tag ~name:color () in tag#set_property (`BACKGROUND color); (color, tag)) - ["red"; "green"] in + ["red"; "green";"orange"] in let tag_table = GText.tag_table () in List.iter (fun (color, tag) -> tag_table#add tag#as_tag) background_tags; let buffer = GText.buffer ~tag_table () in gui#console#set_buffer buffer; - let error_regexp = Str.regexp_case_fold ".*\\(error\\)\\|\\(no such file\\)" in + let errors = "red", ["error"; "no such file"; "undefined reference"] + and warnings = "orange", ["warning"] in + + let color_regexps = + List.map (fun (color, strings) -> + let s = List.map (fun s -> "\\("^s^"\\)") strings in + let s = String.concat "\\|" s in + let s = ".*\\("^s^"\\)" in + color, Str.regexp_case_fold s) + [errors; warnings] in let compute_tags = fun s -> - if Str.string_match error_regexp s 0 then - [List.assoc "red" background_tags] - else - [] in + let rec loop = function + (color, regexp)::rs -> + if Str.string_match regexp s 0 then + [List.assoc color background_tags] + else + loop rs + | [] -> [] in + loop color_regexps in + + (* Attach the second console to the buffer of the first one *) + gui#console_cp#set_buffer gui#console#buffer; let log = fun s -> let iter = gui#console#buffer#end_iter in @@ -91,5 +110,5 @@ let () = ignore(socket_GCS#connect#plug_removed (fun () -> gui#vbox_GCS#remove socket_GCS#coerce; socket ())) in socket (); - + GMain.Main.main ();; diff --git a/sw/supervision/pc_control_panel.ml b/sw/supervision/pc_control_panel.ml index 7321c805e9..b328a25add 100644 --- a/sw/supervision/pc_control_panel.ml +++ b/sw/supervision/pc_control_panel.ml @@ -213,11 +213,15 @@ let supervision = fun ?file gui log -> (* Programs *) let entries = ref [] in Hashtbl.iter - (fun name prog -> + (fun name prog -> let cb = fun () -> run_and_monitor ?file gui log name "" in entries := `I (name, cb) :: !entries) programs; + let compare = fun x y -> + match x, y with + `I (x, _), `I (y, _) -> compare x y + | _ -> compare x y in let menu = GMenu.menu () and sorted_entries = List.sort compare !entries in GToolbox.build_menu menu sorted_entries;