X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=helm%2Focaml%2Fmathql_interpreter%2FmQIMap.ml;fp=helm%2Focaml%2Fmathql_interpreter%2FmQIMap.ml;h=0000000000000000000000000000000000000000;hp=b215f366f212bf4988a6bb8a51c7e983615210a8;hb=1696761e4b8576e8ed81caa905fd108717019226;hpb=5325734bc2e4927ed7ec146e35a6f0f2b49f50c1 diff --git a/helm/ocaml/mathql_interpreter/mQIMap.ml b/helm/ocaml/mathql_interpreter/mQIMap.ml deleted file mode 100644 index b215f366f..000000000 --- a/helm/ocaml/mathql_interpreter/mQIMap.ml +++ /dev/null @@ -1,91 +0,0 @@ -(* 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/. - *) - -(* AUTOR: Ferruccio Guidi - *) - -module U = MQueryUtil - -type pg_map = (MathQL.path * (bool * string * string option)) list - -type pg_tables = (bool * string) list - -type pg_alias = (string * string) list - -let empty_map () = [], [] - -let read_map () = - let map = Helm_registry.get "mathql_interpreter.db_map" in - let ich = open_in map in - let rec aux r s = - let d = input_line ich in - match Str.split (Str.regexp "[ \t]+") d with - | [] -> aux r s - | "#" :: _ -> aux r s - | t :: "<-" :: p -> aux ((p, (false, t, None)) :: r) s - | t :: c :: "<-" :: p -> aux ((p, (false, t, Some c)) :: r) s - | t :: "<+" :: p -> aux ((p, (true, t, None)) :: r) s - | t :: c :: "<+" :: p -> aux ((p, (true, t, Some c)) :: r) s - | [a; "->"; t] -> aux r ((a, t) :: s) - | ["->"] -> r, s - | _ -> raise (Failure "MQIMap.read_map") - in - let pgm, pga = aux [] [] in - close_in ich; - pgm, pga - -let comp c1 c2 = match c1, c2 with - | (_, t1), (_, t2) when t1 < t2 -> U.Lt - | (_, t1), (_, t2) when t1 > t2 -> U.Gt - | (b1, t), (b2, _) -> U.Eq (b1 || b2, t) - -let get_tables pgm p = - let aux l = function - | q, (b, t, _) when q = p -> U.list_join comp l [(b, t)] - | _, _ -> l - in - List.fold_left aux [] pgm - -let rec refine_tables l1 l2 = - U.list_meet comp l1 l2 - -let default_table = function - | [(_, a)] -> a - | l -> - try List.assoc true l - with Not_found -> raise (Failure "MQIMap.default_table") - -let get_field pgm p t = - let aux = function - | q, (_, u, _) when q = p && u = t -> true - | _ -> false - in - match List.filter aux pgm with - | [_, (_, _, None)] -> "" - | [_, (_, _, Some c)] -> c - | _ -> raise (Failure "MQIMap.get_field") - -let resolve pga a = - try List.assoc a pga with Not_found -> a