diff options
author | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2013-02-18 13:57:09 +0000 |
---|---|---|
committer | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2013-02-18 13:57:09 +0000 |
commit | 648c594489f8d0ffdde9596b87f5c1ff6ccef612 (patch) | |
tree | 8fef1eb15cad0a445ba9a07fe9f0f4c06febe727 /plugins | |
parent | 5d777a578b2973f57dffa9ca38d76bfda0551498 (diff) |
Minor code cleanups, especially take advantage of Dir_path.is_empty
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16210 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/funind/indfun.ml | 2 | ||||
-rw-r--r-- | plugins/funind/indfun_common.ml | 5 | ||||
-rw-r--r-- | plugins/funind/recdef.ml | 13 | ||||
-rw-r--r-- | plugins/setoid_ring/newring.ml4 | 6 | ||||
-rw-r--r-- | plugins/syntax/ascii_syntax.ml | 2 | ||||
-rw-r--r-- | plugins/syntax/numbers_syntax.ml | 11 | ||||
-rw-r--r-- | plugins/syntax/r_syntax.ml | 2 | ||||
-rw-r--r-- | plugins/syntax/z_syntax.ml | 2 | ||||
-rw-r--r-- | plugins/xml/doubleTypeInference.ml | 2 |
9 files changed, 20 insertions, 25 deletions
diff --git a/plugins/funind/indfun.ml b/plugins/funind/indfun.ml index 850234c3b..69e22da43 100644 --- a/plugins/funind/indfun.ml +++ b/plugins/funind/indfun.ml @@ -460,7 +460,7 @@ let register_mes fname rec_impls wf_mes_expr wf_rel_expr_opt wf_arg using_lemmas match wf_rel_expr_opt with | None -> let ltof = - let make_dir l = Dir_path.make (List.map Id.of_string (List.rev l)) in + let make_dir l = Dir_path.make (List.rev_map Id.of_string l) in Libnames.Qualid (Loc.ghost,Libnames.qualid_of_path (Libnames.make_path (make_dir ["Arith";"Wf_nat"]) (Id.of_string "ltof"))) in diff --git a/plugins/funind/indfun_common.ml b/plugins/funind/indfun_common.ml index a041205bf..e89e2f894 100644 --- a/plugins/funind/indfun_common.ml +++ b/plugins/funind/indfun_common.ml @@ -132,9 +132,8 @@ let coq_constant s = Coqlib.init_modules s;; let find_reference sl s = - (Nametab.locate (make_qualid(Names.Dir_path.make - (List.map Id.of_string (List.rev sl))) - (Id.of_string s)));; + let dp = Names.Dir_path.make (List.rev_map Id.of_string sl) in + Nametab.locate (make_qualid dp (Id.of_string s)) let eq = lazy(coq_constant "eq") let refl_equal = lazy(coq_constant "eq_refl") diff --git a/plugins/funind/recdef.ml b/plugins/funind/recdef.ml index 8816d960f..addce6b1c 100644 --- a/plugins/funind/recdef.ml +++ b/plugins/funind/recdef.ml @@ -50,10 +50,8 @@ let coq_base_constant s = (Coqlib.init_modules @ [["Coq";"Arith";"Le"];["Coq";"Arith";"Lt"]]) s;; let find_reference sl s = - (locate (make_qualid(Names.Dir_path.make - (List.map Id.of_string (List.rev sl))) - (Id.of_string s)));; - + let dp = Names.Dir_path.make (List.rev_map Id.of_string sl) in + locate (make_qualid dp (Id.of_string s)) let (declare_fun : Id.t -> logical_kind -> constr -> global_reference) = fun f_id kind value -> @@ -84,11 +82,8 @@ let type_of_const t = |_ -> assert false -let constant sl s = - constr_of_global - (locate (make_qualid(Names.Dir_path.make - (List.map Id.of_string (List.rev sl))) - (Id.of_string s)));; +let constant sl s = constr_of_global (find_reference sl s) + let const_of_ref = function ConstRef kn -> kn | _ -> anomaly (Pp.str "ConstRef expected") diff --git a/plugins/setoid_ring/newring.ml4 b/plugins/setoid_ring/newring.ml4 index 3bb57a3b3..6cfac9605 100644 --- a/plugins/setoid_ring/newring.ml4 +++ b/plugins/setoid_ring/newring.ml4 @@ -247,11 +247,11 @@ let my_constant c = let new_ring_path = Dir_path.make (List.map Id.of_string ["Ring_tac";plugin_dir;"Coq"]) let ltac s = - lazy(make_kn (MPfile new_ring_path) (Dir_path.make []) (Label.make s)) + lazy(make_kn (MPfile new_ring_path) Dir_path.empty (Label.make s)) let znew_ring_path = Dir_path.make (List.map Id.of_string ["InitialRing";plugin_dir;"Coq"]) let zltac s = - lazy(make_kn (MPfile znew_ring_path) (Dir_path.make []) (Label.make s)) + lazy(make_kn (MPfile znew_ring_path) Dir_path.empty (Label.make s)) let mk_cst l s = lazy (Coqlib.gen_constant "newring" l s);; let pol_cst s = mk_cst [plugin_dir;"Ring_polynom"] s ;; @@ -830,7 +830,7 @@ let new_field_path = Dir_path.make (List.map Id.of_string ["Field_tac";plugin_dir;"Coq"]) let field_ltac s = - lazy(make_kn (MPfile new_field_path) (Dir_path.make []) (Label.make s)) + lazy(make_kn (MPfile new_field_path) Dir_path.empty (Label.make s)) let _ = add_map "field" diff --git a/plugins/syntax/ascii_syntax.ml b/plugins/syntax/ascii_syntax.ml index 601a4ffd1..fc64da58e 100644 --- a/plugins/syntax/ascii_syntax.ml +++ b/plugins/syntax/ascii_syntax.ml @@ -16,7 +16,7 @@ open Coqlib exception Non_closed_ascii -let make_dir l = Dir_path.make (List.map Id.of_string (List.rev l)) +let make_dir l = Dir_path.make (List.rev_map Id.of_string l) let make_kn dir id = Globnames.encode_mind (make_dir dir) (Id.of_string id) let make_path dir id = Libnames.make_path (make_dir dir) (Id.of_string id) diff --git a/plugins/syntax/numbers_syntax.ml b/plugins/syntax/numbers_syntax.ml index 643dacbab..ef4636699 100644 --- a/plugins/syntax/numbers_syntax.ml +++ b/plugins/syntax/numbers_syntax.ml @@ -9,18 +9,19 @@ (* digit-based syntax for int31, bigN bigZ and bigQ *) open Bigint +open Names open Globnames open Glob_term (*** Constants for locating int31 / bigN / bigZ / bigQ constructors ***) -let make_dir l = Names.Dir_path.make (List.map Names.Id.of_string (List.rev l)) -let make_path dir id = Libnames.make_path (make_dir dir) (Names.Id.of_string id) +let make_dir l = Dir_path.make (List.rev_map Id.of_string l) +let make_path dir id = Libnames.make_path (make_dir dir) (Id.of_string id) -let make_mind mp id = Names.make_mind mp Names.Dir_path.empty (Names.Label.make id) -let make_mind_mpfile dir id = make_mind (Names.MPfile (make_dir dir)) id +let make_mind mp id = Names.make_mind mp Dir_path.empty (Label.make id) +let make_mind_mpfile dir id = make_mind (MPfile (make_dir dir)) id let make_mind_mpdot dir modname id = - let mp = Names.MPdot (Names.MPfile (make_dir dir), Names.Label.make modname) + let mp = MPdot (MPfile (make_dir dir), Label.make modname) in make_mind mp id diff --git a/plugins/syntax/r_syntax.ml b/plugins/syntax/r_syntax.ml index d84fad6ff..055b99adc 100644 --- a/plugins/syntax/r_syntax.ml +++ b/plugins/syntax/r_syntax.ml @@ -19,7 +19,7 @@ exception Non_closed_number open Glob_term open Bigint -let make_dir l = Dir_path.make (List.map Id.of_string (List.rev l)) +let make_dir l = Dir_path.make (List.rev_map Id.of_string l) let rdefinitions = make_dir ["Coq";"Reals";"Rdefinitions"] let make_path dir id = Libnames.make_path dir (Id.of_string id) diff --git a/plugins/syntax/z_syntax.ml b/plugins/syntax/z_syntax.ml index d583f44cb..ca02f61b7 100644 --- a/plugins/syntax/z_syntax.ml +++ b/plugins/syntax/z_syntax.ml @@ -23,7 +23,7 @@ open Glob_term let binnums = ["Coq";"Numbers";"BinNums"] -let make_dir l = Dir_path.make (List.map Id.of_string (List.rev l)) +let make_dir l = Dir_path.make (List.rev_map Id.of_string l) let make_path dir id = Libnames.make_path (make_dir dir) (Id.of_string id) let positive_path = make_path binnums "positive" diff --git a/plugins/xml/doubleTypeInference.ml b/plugins/xml/doubleTypeInference.ml index 864f35e80..fcd01569a 100644 --- a/plugins/xml/doubleTypeInference.ml +++ b/plugins/xml/doubleTypeInference.ml @@ -20,7 +20,7 @@ let cprop = N.make_con (N.MPfile (Libnames.dirpath_of_string "CoRN.algebra.CLogic")) - (N.Dir_path.make []) + (N.Dir_path.empty) (N.Label.make "CProp") ;; |