1 (* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 (******************************************************************************)
30 (* Claudio Sacerdoti Coen <sacerdot@cs.unibo.it> *)
34 (******************************************************************************)
36 let get_annotation_from_term annterm =
39 C.ARel (_,ann,_,_) -> ann
40 | C.AVar (_,ann,_) -> ann
41 | C.AMeta (_,ann,_) -> ann
42 | C.ASort (_,ann,_) -> ann
43 | C.AImplicit (_,ann) -> ann
44 | C.ACast (_,ann,_,_) -> ann
45 | C.AProd (_,ann,_,_,_) -> ann
46 | C.ALambda (_,ann,_,_,_) -> ann
47 | C.ALetIn (_,ann,_,_,_) -> ann
48 | C.AAppl (_,ann,_) -> ann
49 | C.AConst (_,ann,_,_) -> ann
50 | C.AAbst (_,ann,_) -> ann
51 | C.AMutInd (_,ann,_,_,_) -> ann
52 | C.AMutConstruct (_,ann,_,_,_,_)-> ann
53 | C.AMutCase (_,ann,_,_,_,_,_,_) -> ann
54 | C.AFix (_,ann,_,_) -> ann
55 | C.ACoFix (_,ann,_,_) -> ann
58 let get_annotation_from_obj annobj =
61 C.ADefinition (_,ann,_,_,_,_) -> ann
62 | C.AAxiom (_,ann,_,_,_) -> ann
63 | C.AVariable (_,ann,_,_,_) -> ann
64 | C.ACurrentProof (_,ann,_,_,_,_) -> ann
65 | C.AInductiveDefinition (_,ann,_,_,_) -> ann
68 exception IdUnknown of string;;
70 let get_annotation (annobj,ids_to_targets) xpath =
72 match Hashtbl.find ids_to_targets xpath with
73 Cic.Object annobj -> get_annotation_from_obj annobj
74 | Cic.Term annterm -> get_annotation_from_term annterm
76 Not_found -> raise (IdUnknown xpath)