automath/autLexer.cmx: automath/autParser.cmx
toplevel/meta.cmo: automath/aut.cmx
toplevel/meta.cmx: automath/aut.cmx
-toplevel/metaAut.cmo: toplevel/meta.cmx cps/cps.cmx automath/aut.cmx
-toplevel/metaAut.cmx: toplevel/meta.cmx cps/cps.cmx automath/aut.cmx
+toplevel/metaAut.cmi: toplevel/meta.cmx automath/aut.cmx
+toplevel/metaAut.cmo: toplevel/meta.cmx cps/cps.cmx automath/aut.cmx \
+ toplevel/metaAut.cmi
+toplevel/metaAut.cmx: toplevel/meta.cmx cps/cps.cmx automath/aut.cmx \
+ toplevel/metaAut.cmi
toplevel/top.cmo: cps/cps.cmx automath/autParser.cmi automath/autLexer.cmx \
automath/autHelpers.cmi
toplevel/top.cmx: cps/cps.cmx automath/autParser.cmx automath/autLexer.cmx \
type context_node = M.qid option (* context node: None = root *)
-type context = (M.qid, context_node) H.t (* context: son, parent *)
+type context = (M.qid, M.term * context_node) H.t (* context: son, parent *)
type status = {
genv: M.environment; (* global environment *)
| _ :: tl -> get_local f (succ i) tl
in
let rec get_global f = function
- | [] -> None
+ | [] -> f None
| (args, name, _, _) :: _ when name = gref -> f (Some args)
| _ :: tl -> get_global f tl
in
in
let f name = resolve_gref (f name) st lenv name in
complete_qid f st name
+
+let xlate_item f st = function
+ | A.Section (Some name) ->
+ f {st with path = name :: st.path}
+ | A.Section None ->
+ begin match st.path with
+ | [] -> assert false
+ | _ :: tl -> f {st with path = tl}
+ end
+ | A.Context None ->
+ f {st with node = None}
+ | A.Context (Some name) ->
+ let f name = f {st with node = Some name} in
+ complete_qid f st name
+ | A.Block (name, w) ->
+ let f name ww = H.add st.cnt name (ww, st.node); f st in
+ let f name = xlate_term (f name) st [] w in
+ complete_qid f st (name, true, [])
+ | A.Decl (name, w) -> f st
+ | A.Def (name, w, trans, v) -> f st
+
+let meta_of_aut f book =
+ let f st = f st.genv in
+ Cps.list_fold_left f xlate_item initial_status book
--- /dev/null
+(* Copyright (C) 2000, HELM Team.
+ *
+ * This file is part of HELM, an Hypertextual, Electronic
+ * Library of Mathematics, developed at the Computer Science
+ * Department, University of Bologna, Italy.
+ *
+ * HELM is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * HELM is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HELM; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ * For details, see the HELM World-Wide-Web page,
+ * http://cs.unibo.it/helm/.
+ *)
+
+val meta_of_aut: (Meta.environment -> 'a) -> Aut.book -> 'a