diff options
author | gmelquio <gmelquio@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2009-10-06 16:56:03 +0000 |
---|---|---|
committer | gmelquio <gmelquio@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2009-10-06 16:56:03 +0000 |
commit | 99e196294f3de42f5f7285cbc7fa40f8171026a6 (patch) | |
tree | 86304c3635a2ffd2f78bdc1c427ad198445c59ec /library/libobject.ml | |
parent | dd7a12f1a2caddef510ad857f0183ae3501b05ac (diff) |
Relaxed error severity when encountering unknown library objects or tactic
extensions. This makes it possible to load .vo compiled with a nonstandard
toplevel, e.g. ssreflect, which defines new tactics and new hint databases.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12375 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'library/libobject.ml')
-rw-r--r-- | library/libobject.ml | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/library/libobject.ml b/library/libobject.ml index 9beb32cfc..4bd701e13 100644 --- a/library/libobject.ml +++ b/library/libobject.ml @@ -124,26 +124,30 @@ let declare_object odecl = dyn_rebuild_function = rebuild }; (infun,outfun) +let missing_tab = (Hashtbl.create 17 : (string, unit) Hashtbl.t) + (* this function describes how the cache, load, open, and export functions are triggered. In relaxed mode, this function just return a meaningless value instead of raising an exception when they fail. *) let apply_dyn_fun deflt f lobj = let tag = object_tag lobj in - try - let dodecl = - try - Hashtbl.find cache_tab tag - with Not_found -> - if !relax_flag then - failwith "local to_apply_dyn_fun" - else - error - ("Cannot find library functions for an object with tag "^tag^ - " (maybe a plugin is missing)") in - f dodecl - with - Failure "local to_apply_dyn_fun" -> deflt;; + try + let dodecl = + try + Hashtbl.find cache_tab tag + with Not_found -> + failwith "local to_apply_dyn_fun" in + f dodecl + with + Failure "local to_apply_dyn_fun" -> + if not (!relax_flag || Hashtbl.mem missing_tab tag) then + begin + Pp.warning ("Cannot find library functions for an object with tag " + ^ tag ^ " (a plugin may be missing)"); + Hashtbl.add missing_tab tag () + end; + deflt let cache_object ((_,lobj) as node) = apply_dyn_fun () (fun d -> d.dyn_cache_function node) lobj |