]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/gTopLevel/cic2Xml.ml
* inner types file generation ported to V7_3_new_exportation
[helm.git] / helm / gTopLevel / cic2Xml.ml
index e02f8cb15d3e650c7733ef4566c405e6908313dc..df460edce8c6fd5bdb42893cae0342818569fbbe 100644 (file)
 exception ImpossiblePossible;;
 exception NotImplemented;;
 
+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)
 ;;
@@ -249,17 +256,12 @@ let print_term ~ids_to_inner_sorts =
    aux
 ;;
 
-let print_object uri ~ids_to_inner_sorts ~ask_dtd_to_the_getter =
+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 =
-  if ask_dtd_to_the_getter then
-   Configuration.getter_url ^ "getdtd?uri=cic.dtd"
-  else
-   "http://www.cs.unibo.it/helm/dtd/cic.dtd"
- in
-    function
+  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 =
@@ -394,20 +396,29 @@ let print_object uri ~ids_to_inner_sorts ~ask_dtd_to_the_getter =
          >], None
 ;;
 
-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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+      X.xml_cdata
+       ("<!DOCTYPE InnerTypes SYSTEM \"" ^ dtdname ^ "\">\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]
+               [< X.xml_nempty "synthesized" []
+                [< print_term ids_to_inner_sorts synty >] ;
+                 match expty with
+                   None -> [<>]
+                 | Some expty' -> X.xml_nempty "expected" [] [< print_term ids_to_inner_sorts expty' >]
+               >]
            >]
-       >]
-     ) ids_to_inner_types [<>]
-   )
+         ) ids_to_inner_types [<>]
+       )
+   >]
 ;;