summaryrefslogtreecommitdiff
path: root/otherlibs/labltk/browser/main.ml
blob: 681342cff56e101923a9f7e03e75c44b534be1c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(* $Id$ *)

open Tk

let _ =
  let path = ref [] in
  Arg.parse
    keywords:[ "-I", Arg.String (fun s -> path := s :: !path),
	       "<dir>  Add <dir> to the list of include directories" ]
    others:(fun name -> raise(Arg.Bad("don't know what to do with " ^ name)))
    errmsg:"lablbrowser :";
  Config.load_path := List.rev !path @ [Config.standard_library];
  begin
    try Searchid.start_env := Env.open_pers_signature "Pervasives" Env.initial
    with Env.Error _ -> ()
  end;
  
  Searchpos.view_defined_ref := Viewer.view_defined;
  Searchpos.editor_ref.contents <- Editor.f;

  let top = openTkClass "LablBrowser" in
  Jg_config.init ();

  bind top events:[[], `Destroy] action:(`Set ([], fun _ -> exit 0));
  at_exit Shell.kill_all;
  

  Viewer.f on:top ();

  while true do
    try
      Printexc.print mainLoop ()
    with Protocol.TkError _ -> ()
  done