"</html>"
;;
-let prooffile = "/home/zack/dati/HELM/currentproof.gTopLevel"
+let prooffile = "/public/sacerdot/currentproof";;
+(*CSC: the getter should handle the innertypes, not the FS *)
+let innertypesfile = "/public/sacerdot/innertypes";;
(* GLOBAL REFERENCES (USED BY CALLBACKS) *)
in
Arg.parse argspec ignore ""
+
(* MISC FUNCTIONS *)
let domImpl = Gdome.domImplementation ();;
let mml_of_cic_object uri annobj ids_to_inner_sorts ids_to_inner_types =
let xml =
- Cic2Xml.print_object uri ids_to_inner_sorts annobj
+ Cic2Xml.print_object uri ~ids_to_inner_sorts annobj
in
let xmlinnertypes =
- Cic2Xml.print_inner_types uri ids_to_inner_sorts
- ids_to_inner_types
+ Cic2Xml.print_inner_types uri ~ids_to_inner_sorts
+ ~ids_to_inner_types
in
let input = Xml2Gdome.document_of_xml domImpl xml in
(*CSC: We save the innertypes to disk so that we can retrieve them in the *)
(*CSC: stylesheet. This DOES NOT work when UWOBO and/or the getter are not *)
(*CSC: local. *)
- Xml.pp xmlinnertypes (Some "/tmp/innertypes") ;
+ Xml.pp xmlinnertypes (Some innertypesfile) ;
let output = applyStylesheets input mml_styles mml_args in
output
;;
- (* pretty print on standard output the current sequent *)
-let dumpsequent () =
- let metasenv =
- match !ProofEngine.proof with
- | None -> assert false
- | Some (_, metasenv, _, _) -> metasenv
- in
- let seq =
- match !ProofEngine.goal with
- | None -> assert false
- | Some metano -> List.find (function (m,_,_) -> m=metano) metasenv
- in
- print_string (
- "<current_seq>\n" ^
- (SequentPp.TextualPp.print_sequent seq) ^
- "\n</current_seq>");
- print_newline ()
-;;
(* CALLBACKS *)
(*
ignore(domImpl#saveDocumentToFile ~doc:sequent_doc
- ~name:"/public/sacerdot/guruguru1" ~indent:true ()) ;
+ ~name:"/home/galata/miohelm/guruguru1" ~indent:true ()) ;
*)
let mml_of_cic_term metano term =
None -> assert false
| Some (curi,_,_,_) -> curi
in
- let metasenv =
+ let uri,metasenv,bo,ty =
match !ProofEngine.proof with
None -> assert false
- | Some (_,metasenv,_,_) -> metasenv
+ | Some (uri,metasenv,bo,ty) -> uri,metasenv,bo,ty
in
let context =
List.map
try
while true do
match
- CicTextualParserContext.main curi context CicTextualLexer.token lexbuf
+ CicTextualParserContext.main
+ curi context metasenv CicTextualLexer.token lexbuf
with
None -> ()
- | Some expr ->
+ | Some (metasenv',expr) ->
+ ProofEngine.proof := Some (uri,metasenv',bo,ty) ;
tactic expr ;
refresh_sequent proofw ;
refresh_proof output
None -> assert false
| Some (curi,_,_,_) -> curi
in
- let metasenv =
+ let uri,metasenv,bo,ty =
match !ProofEngine.proof with
None -> assert false
- | Some (_,metasenv,_,_) -> metasenv
+ | Some (uri,metasenv,bo,ty) -> uri,metasenv,bo,ty
in
let context =
List.map
try
while true do
match
- CicTextualParserContext.main curi context
+ CicTextualParserContext.main curi context metasenv
CicTextualLexer.token lexbuf
with
None -> ()
- | Some expr ->
+ | Some (metasenv',expr) ->
+ ProofEngine.proof := Some (uri,metasenv',bo,ty) ;
tactic ~goal_input:(Hashtbl.find ids_to_terms id)
~input:expr ;
refresh_sequent proofw ;
call_tactic_with_hypothesis_input ProofEngine.clear rendering_window
;;
+let fourier rendering_window = call_tactic ProofEngine.fourier rendering_window;;
+
let whd_in_scratch scratch_window =
call_tactic_with_goal_input_in_scratch ProofEngine.whd_in_scratch
(*????
let dtdname = "http://www.cs.unibo.it/helm/dtd/cic.dtd";;
*)
-(* let dtdname = "/home/zack/dati/HELM/V7/dtd/cic.dtd";; *)
-let dtdname = "/public/helm-cvs/helm/dtd/cic.dtd";;
+let dtdname = "/projects/helm/V7/dtd/cic.dtd";;
let save rendering_window () =
let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
let (acurrentproof,_,_,ids_to_inner_sorts,_,_,_) =
Cic2acic.acic_object_of_cic_object currentproof
in
- let xml = Cic2Xml.print_object uri ids_to_inner_sorts acurrentproof in
+ let xml = Cic2Xml.print_object uri ~ids_to_inner_sorts acurrentproof in
let xml' =
[< Xml.xml_cdata "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
Xml.xml_cdata
while true do
(* Execute the actions *)
match
- CicTextualParserContext.main curi names_context CicTextualLexer.token
- lexbuf
+ CicTextualParserContext.main curi names_context metasenv
+ CicTextualLexer.token lexbuf
with
None -> ()
- | Some expr ->
+ | Some (metasenv',expr) ->
try
- let ty = CicTypeChecker.type_of_aux' metasenv context expr in
+ let ty = CicTypeChecker.type_of_aux' metasenv' context expr in
let mml = mml_of_cic_term 111 (Cic.Cast (expr,ty)) in
scratch_window#show () ;
scratch_window#mmlwidget#load_tree ~dom:mml
| [] -> ""
| head :: tail ->
inputt#delete_text 0 inputlen;
- MQueryGenerator.locate head
+ MQueryGenerator.locate_html head
with
e -> "<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>"
)
MQueryGenerator.backward metasenv ey ty level
in
output_html outputhtml result
+;;
let choose_selection
(mmlwidget : GMathView.math_view) (element : Gdome.element option)
let changeb =
GButton.button ~label:"Change"
~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let hbox4 =
+ GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
let letinb =
GButton.button ~label:"Let ... In"
- ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
let ringb =
GButton.button ~label:"Ring"
- ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
- let hbox4 =
- GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
let clearbodyb =
GButton.button ~label:"ClearBody"
~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
let clearb =
GButton.button ~label:"Clear"
~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
- let dumpb =
- GButton.button ~label:"Dump"
+ let fourierb =
+ GButton.button ~label:"Fourier"
~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
let outputhtml =
GHtml.xmhtml
ignore(ringb#connect#clicked (ring self)) ;
ignore(clearbodyb#connect#clicked (clearbody self)) ;
ignore(clearb#connect#clicked (clear self)) ;
- ignore(dumpb#connect#clicked dumpsequent);
+ ignore(fourierb#connect#clicked (fourier self)) ;
ignore(introsb#connect#clicked (intros self)) ;
Logger.log_callback :=
(Logger.log_to_html ~print_and_flush:(output_html outputhtml))
let _ =
CicCooking.init () ;
- if !usedb then MQueryGenerator.init () ;
+ if !usedb then
+ begin
+ MQueryGenerator.init () ;
+ CicTextualParser0.set_locate_object
+ (function id ->
+ let MathQL.MQRefs uris = MQueryGenerator.locate id in
+ let uri =
+ match uris with
+ [] ->
+ (GToolbox.input_string ~title:"Unknown input"
+ ("No URI matching \"" ^ id ^ "\" found. Please enter its URI"))
+ | [uri] -> Some uri
+ | _ ->
+ let choice =
+ GToolbox.question_box ~title:"Ambiguous input."
+ ~buttons:uris ~default:1 "Ambiguous input. Please, choose one."
+ in
+ if choice > 0 then
+ Some (List.nth uris (choice - 1))
+ else
+ (* No choice from the user *)
+ None
+ in
+ match uri with
+ Some uri' ->
+ (* Constant *)
+ if String.sub uri' (String.length uri' - 4) 4 = ".con" then
+(*CSC: what cooking number? Here I always use 0, which may be bugged *)
+ Some (Cic.Const (UriManager.uri_of_string uri',0))
+ else
+ (try
+ (* Inductive Type *)
+ let uri'',typeno = CicTextualLexer.indtyuri_of_uri uri' in
+(*CSC: what cooking number? Here I always use 0, which may be bugged *)
+ Some (Cic.MutInd (uri'',0,typeno))
+ with
+ _ ->
+ (* Constructor of an Inductive Type *)
+ let uri'',typeno,consno =
+ CicTextualLexer.indconuri_of_uri uri'
+ in
+(*CSC: what cooking number? Here I always use 0, which may be bugged *)
+ Some (Cic.MutConstruct (uri'',0,typeno,consno))
+ )
+ | None -> None
+ )
+ end ;
ignore (GtkMain.Main.init ()) ;
initialize_everything () ;
if !usedb then MQueryGenerator.close ();
- MQueryGenerator.close ()
;;
-