X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FgTopLevel%2Fcic2Xml.ml;h=f498effb6bc89944c3b068bec8ec69d360d802c0;hb=34878a91f0200675e19d09a683b31c2bc22defdf;hp=d76df870eb48d9f4cf26bd4e89df2bc23daf0c77;hpb=6ab193f88745acd3def85e47d643a92efb2f9fc5;p=helm.git diff --git a/helm/gTopLevel/cic2Xml.ml b/helm/gTopLevel/cic2Xml.ml index d76df870e..f498effb6 100644 --- a/helm/gTopLevel/cic2Xml.ml +++ b/helm/gTopLevel/cic2Xml.ml @@ -28,7 +28,12 @@ exception ImpossiblePossible;; exception NotImplemented;; -let dtdname = "http://localhost:8081/getdtd?uri=cic.dtd";; +let dtdname ~ask_dtd_to_the_getter dtd = + if ask_dtd_to_the_getter then + Configuration.getter_url ^ "getdtd?uri=" ^ dtd + else + "http://mowgli.cs.unibo.it/dtd/" ^ dtd +;; let param_attribute_of_params params = String.concat " " (List.map UriManager.string_of_uri params) @@ -251,12 +256,12 @@ let print_term ~ids_to_inner_sorts = aux ;; -let print_object uri ~ids_to_inner_sorts = - let rec aux = - let module C = Cic in - let module X = Xml in - let module U = UriManager in - function +let print_object uri ~ids_to_inner_sorts ~ask_dtd_to_the_getter obj = + let module C = Cic in + let module X = Xml in + let module U = UriManager in + let dtdname = dtdname ~ask_dtd_to_the_getter "cic.dtd" in + match obj with C.ACurrentProof (id,idbody,n,conjectures,bo,ty,params) -> let params' = param_attribute_of_params params in let xml_for_current_proof_body = @@ -302,13 +307,12 @@ let print_object uri ~ids_to_inner_sorts = in let xmlbo = [< X.xml_cdata "\n" ; - X.xml_cdata ("\n"); + X.xml_cdata ("\n"); xml_for_current_proof_body >] in let xmlty = [< X.xml_cdata "\n" ; - X.xml_cdata - ("\n"); + X.xml_cdata ("\n"); xml_for_current_proof_type >] in @@ -332,7 +336,7 @@ let print_object uri ~ids_to_inner_sorts = in let xmlty = [< X.xml_cdata "\n" ; - X.xml_cdata ("\n"); + X.xml_cdata ("\n"); X.xml_nempty "ConstantType" ["name",n ; "params",params' ; "id", id] [< print_term ids_to_inner_sorts ty >] @@ -361,8 +365,8 @@ let print_object uri ~ids_to_inner_sorts = | C.AInductiveDefinition (id,tys,params,nparams) -> let params' = param_attribute_of_params params in [< X.xml_cdata "\n" ; - X.xml_cdata ("\n") ; + X.xml_cdata + ("\n") ; X.xml_nempty "InductiveDefinition" ["noParams",string_of_int nparams ; "id",id ; @@ -390,24 +394,30 @@ let print_object uri ~ids_to_inner_sorts = ) >] >], None - in - aux ;; -let print_inner_types curi ~ids_to_inner_sorts ~ids_to_inner_types = +let + print_inner_types curi ~ids_to_inner_sorts ~ids_to_inner_types + ~ask_dtd_to_the_getter += let module C2A = Cic2acic in let module X = Xml in - X.xml_nempty "InnerTypes" ["of",UriManager.string_of_uri curi] - (Hashtbl.fold - (fun id {C2A.annsynthesized = synty ; C2A.annexpected = expty} x -> - [< x ; - X.xml_nempty "TYPE" ["of",id] - [< print_term ids_to_inner_sorts synty ; - match expty with - None -> [<>] - | Some expty' -> print_term ids_to_inner_sorts expty' + let dtdname = dtdname ~ask_dtd_to_the_getter "cictypes.dtd" in + [< X.xml_cdata "\n" ; + X.xml_cdata + ("\n") ; + X.xml_nempty "InnerTypes" ["of",UriManager.string_of_uri curi] + (Hashtbl.fold + (fun id {C2A.annsynthesized = synty ; C2A.annexpected = expty} x -> + [< x ; + X.xml_nempty "TYPE" ["of",id] + [< print_term ids_to_inner_sorts synty ; + match expty with + None -> [<>] + | Some expty' -> print_term ids_to_inner_sorts expty' + >] >] - >] - ) ids_to_inner_types [<>] - ) + ) ids_to_inner_types [<>] + ) + >] ;;