X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Ftoplevel%2FmetaAut.ml;h=db18ade47742dfd95b63d041bdf59a49d71d750d;hb=bee436af0c6ceb1c83259c94036df8b12f901f2d;hp=7e18bd1e5332d7a64fec80ef1004198612eb56ea;hpb=a3ebffd30c70d8c93a40d06eff578703a586f2b9;p=helm.git diff --git a/helm/software/lambda-delta/toplevel/metaAut.ml b/helm/software/lambda-delta/toplevel/metaAut.ml index 7e18bd1e5..db18ade47 100644 --- a/helm/software/lambda-delta/toplevel/metaAut.ml +++ b/helm/software/lambda-delta/toplevel/metaAut.ml @@ -28,7 +28,7 @@ type status = { node: context_node; (* current context node *) nodes: context_node list; (* context node list *) line: int; (* line number *) - explicit: bool (* need explicit context root? *) + cover: string (* initial segment of URI hierarchy *) } type resolver = Local of int @@ -38,22 +38,23 @@ let hsize = 7000 (* hash tables initial size *) (* Internal functions *******************************************************) -let initial_status size = { - path = []; node = None; nodes = []; line = 1; explicit = true; +let initial_status size cover = { + path = []; node = None; nodes = []; line = 1; cover = cover; henv = H.create size; hcnt = H.create size } let id_of_name (id, _, _) = id -let mk_qid id path = - let str = String.concat "/" path in - let str = Filename.concat str id in - U.uri_of_string ("ld:/" ^ str), id, path +let mk_qid st id path = + let uripath = if st.cover = "" then path else st.cover :: path in + let str = String.concat "/" uripath in + let str = Filename.concat str id in + U.uri_of_string ("ld:/" ^ str ^ ".ld"), id, path let uri_of_qid (uri, _, _) = uri let complete_qid f st (id, is_local, qs) = - let f qs = f (mk_qid id qs) in + let f qs = f (mk_qid st id qs) in let f path = Cps.list_rev_append f path ~tail:qs in let rec skip f = function | phd :: ptl, qshd :: _ when phd = qshd -> f ptl @@ -62,17 +63,17 @@ let complete_qid f st (id, is_local, qs) = in if is_local then f st.path else skip f (st.path, qs) -let relax_qid f (_, id, path) = - let f path = f (mk_qid id path) in +let relax_qid f st (_, id, path) = + let f path = f (mk_qid st id path) in let f = function | _ :: tl -> Cps.list_rev f tl | [] -> assert false in Cps.list_rev f path -let relax_opt_qid f = function +let relax_opt_qid f st = function | None -> f None - | Some qid -> let f qid = f (Some qid) in relax_qid f qid + | Some qid -> let f qid = f (Some qid) in relax_qid f st qid let resolve_lref f st l lenv id = let rec aux f i = function @@ -95,7 +96,7 @@ let resolve_gref f st qid = let resolve_gref_relaxed f st qid = let rec g qid = function - | None -> relax_qid (resolve_gref g st) qid + | None -> relax_qid (resolve_gref g st) st qid | Some args -> f qid args in resolve_gref g st qid @@ -109,7 +110,7 @@ let get_pars f st = function let get_pars_relaxed f st = let rec g pars = function | None -> f pars - | Some node -> relax_opt_qid (get_pars g st) node + | Some node -> relax_opt_qid (get_pars g st) st node in get_pars g st st.node @@ -144,8 +145,8 @@ let rec xlate_term f st lenv = function in resolve_lref f st l lenv (id_of_name name) -let xlate_item f st = function - | A.Section (Some name) -> +let xlate_entity f st = function + | A.Section (Some (_, name)) -> f {st with path = name :: st.path; nodes = st.node :: st.nodes} None | A.Section None -> begin match st.path, st.nodes with @@ -200,6 +201,7 @@ let xlate_item f st = function (* Interface functions ******************************************************) -let initial_status = initial_status hsize +let initial_status ?(cover="") () = + initial_status hsize cover -let meta_of_aut = xlate_item +let meta_of_aut = xlate_entity