]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/matita/matitaGui.ml
Matitaweb: added preliminary support for interactive disambiguation.
[helm.git] / matitaB / matita / matitaGui.ml
index cb7c63bac3ab49aa0d01caf02597a9578cdf3ba9..759ffa5ff2c3290671e88e6f5a10d3ecab28e35a 100644 (file)
@@ -378,11 +378,16 @@ let interactive_error_interp ~all_passes
                   let alias =
                    match k with
                    | DisambiguateTypes.Id id ->
+                       (* XXX we don't have an uri to put into Ident_alias! 
+                        * then we use the description??
+                        * what does this code mean?? *)
+                       (* FIXME we are not using info from the domain_item to
+                        * fill in the alias_spec *)
                        GrafiteAst.Ident_alias (id, desc)
-                   | DisambiguateTypes.Symbol (symb, i)-> 
-                       GrafiteAst.Symbol_alias (symb, i, desc)
-                   | DisambiguateTypes.Num ->
-                       GrafiteAst.Number_alias (i, desc)
+                   | DisambiguateTypes.Symbol symb-> 
+                       GrafiteAst.Symbol_alias (symb, None, desc)
+                   | DisambiguateTypes.Num ->
+                       GrafiteAst.Number_alias (None,desc)
                   in
                    GrafiteAstPp.pp_alias alias)
                 diff) ^ "\n"
@@ -1250,12 +1255,29 @@ let interactive_interp_choice () text prefix_len choices =
  in
   classify example_interp [] enumerated_choices
 
+let interactive_ast_choice () ts =
+  let choice =
+    interactive_string_choice
+     "" 0 ~title:"Ambiguous input"
+     ~msg:("Choose an interpretation") () ~id:"" [] ts
+  in
+  let choice = match choice with
+  | [c] -> c
+  | _ -> assert false
+  in
+  let rec posn x = function
+  | [] -> assert false
+  | he::tl -> if he = x then 0 else 1 + posn x tl
+  in
+  posn choice ts
+
 let _ =
   (* disambiguator callbacks *)
-  Disambiguate.set_choose_uris_callback
+  (* Disambiguate.set_choose_uris_callback
    (fun ~selection_mode ?ok ?(enable_button_for_non_vars=false) ~title ~msg ->
      interactive_uri_choice ~selection_mode ?ok_label:ok ~title ~msg ());
   Disambiguate.set_choose_interp_callback (interactive_interp_choice ());
+  Disambiguate.set_choose_disamb_callback (interactive_ast_choice ());*)
   (* gtk initialization *)
   GtkMain.Rc.add_default_file BuildTimeConf.gtkrc_file; (* loads gtk rc *)
   ignore (GMain.Main.init ())