summaryrefslogtreecommitdiffstats
path: root/otherlibs/labltk/browser/main.ml
blob: f38c8ff78c4021f2c9a80e73135cbd4cb6fa4624 (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