X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fhelena%2Fsrc%2Fxml%2FxmlLibrary.ml;h=4667b3aa57db8fd9009d17b1416a2fab6c7866c4;hb=f7d7f2459b3b0409be5f168822be3b836ccc929b;hp=2e3fdef8a6d9322725977a6c45cee3bf121fd974;hpb=ac97468f5422efc770316286cb807e3d3245a474;p=helm.git diff --git a/helm/software/helena/src/xml/xmlLibrary.ml b/helm/software/helena/src/xml/xmlLibrary.ml index 2e3fdef8a..4667b3aa5 100644 --- a/helm/software/helena/src/xml/xmlLibrary.ml +++ b/helm/software/helena/src/xml/xmlLibrary.ml @@ -9,13 +9,16 @@ \ / This software is distributed as is, NO WARRANTY. V_______________________________________________________________ *) -module F = Filename -module U = NUri -module C = Cps -module H = Hierarchy -module G = Options -module E = Entity -module N = Level +module KF = Filename + +module U = NUri +module C = Cps +module G = Options +module H = Hierarchy +module N = Layer +module E = Entity + +IFDEF OBJECTS THEN (* internal functions *******************************************************) @@ -23,21 +26,17 @@ let base = "xml" let ext = ".xml" -let obj_root = "ENTITY" - -let ccs_name = "ccs.ldc" - -let ccs_root = "CCS" +let obj_root = "CONSTANT" let home = "http://lambdadelta.info/" -let system = F.concat (F.concat home base) "ld.dtd" +let system = KF.concat (KF.concat home base) "ld.dtd" let xmlns = "xmlns", home let path_of_uri xdir uri = - let base = F.concat xdir base in - F.concat base (Str.string_after (U.string_of_uri uri) 3) + let base = KF.concat xdir base in + KF.concat base (Str.string_after (U.string_of_uri uri) 3) (* interface functions ******************************************************) @@ -78,7 +77,7 @@ let gref = "GRef" let cast = "Cast" -let appl = "Appl" +let appl x = if x then "Appx" else "Appr" let proj = "Proj" @@ -91,6 +90,9 @@ let void = "Void" let position i = "position", string_of_int i +let depth i = + "depth", string_of_int i + let uri u = "uri", U.string_of_uri u @@ -99,13 +101,23 @@ let name a = let f n r = "name", if r then n else "-" ^ n in E.name err f a -let apix a = - let err () = "age", "" in - let f i = "age", string_of_int i in - E.apix err f a +let layer st n = + "layer", N.to_string st n + +let main a = + let sort, degr = a.E.b_main in + ["main-position", string_of_int sort; + "main-degree", string_of_int degr; + ] -let level st n = - "level", N.to_string st n +let side a = + let sort, degr = a.E.b_side in + ["side-position", string_of_int sort; + "side-degree", string_of_int degr; + ] + +let apix a = + "level", string_of_int a.E.n_apix let meta a = let map = function @@ -124,12 +136,12 @@ let info a = let export_entity pp_term (ra, na, u, b) = let path = path_of_uri !G.xdir u in - let _ = Sys.command (Printf.sprintf "mkdir -p %s" (F.dirname path)) in + let _ = Sys.command (Printf.sprintf "mkdir -p %s" (KF.dirname path)) in let och = open_out (path ^ ext) in let out = output_string och in xml out "1.0" "UTF-8"; doctype out obj_root system; - let na = {na with E.n_name = Some (U.name_of_uri u, true)} in - let attrs = uri u :: name na :: apix na :: meta ra :: info ra in + let ba = E.bind_attrs ~name:(U.name_of_uri u, true) () in + let attrs = uri u :: name ba :: apix na :: meta ra :: info ra in let contents = match b with | E.Abst w -> tag "GDec" attrs ~contents:(pp_term w) | E.Abbr v -> tag "GDef" attrs ~contents:(pp_term v) @@ -140,3 +152,5 @@ let export_entity pp_term (ra, na, u, b) = let attrs = [xmlns; "hierarchy", shp; "options", opts] in tag obj_root attrs ~contents out 0; close_out och + +END