X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fcommon%2Fentity.ml;h=de06f2924717613014f29960bc3af294526636de;hb=5dcae34c6e44a40e236db641f59ddb096d1a16ec;hp=7b8dab9508c23c6351445d4f0d5b56c88693d992;hpb=6753156ae1618ef3fc7ff401808f769abd9eb03d;p=helm.git diff --git a/helm/software/lambda-delta/common/entity.ml b/helm/software/lambda-delta/common/entity.ml index 7b8dab950..de06f2924 100644 --- a/helm/software/lambda-delta/common/entity.ml +++ b/helm/software/lambda-delta/common/entity.ml @@ -9,22 +9,31 @@ \ / This software is distributed as is, NO WARRANTY. V_______________________________________________________________ *) +module O = Options + type uri = NUri.uri type id = Aut.id type attr = Name of id * bool (* name, real? *) | Apix of int (* additional position index *) | Mark of int (* node marker *) + | Meta of string (* metaliguistic annotation *) | Priv (* private global definition *) type attrs = attr list (* attributes *) type 'term bind = Abst of 'term (* declaration: domain *) | Abbr of 'term (* definition: body *) + | Void (* exclusion *) type 'term entity = attrs * uri * 'term bind (* attrs, name, binder *) -type uri_generator = string -> string (* this could be in CPS *) +type status = { + delta: bool; (* global delta-expansion *) + rt: bool; (* reference typing *) + si: bool; (* sort inclusion *) + expand: bool (* always expand global definitions *) +} (* helpers ******************************************************************) @@ -56,6 +65,14 @@ let rec get_names f = function | e :: tl -> let f a = f (e :: a) in get_names f tl +let count_names a = + let rec aux k = function + | [] -> k + | Name _ :: tl -> aux (succ k) tl + | _ :: tl -> aux k tl + in + aux 0 a + let rec apix err f = function | Apix i :: _ -> f i | _ :: tl -> apix err f tl @@ -84,3 +101,13 @@ let xlate f xlate_term = function let f t = f (a, uri, Abst t) in xlate_term f t | a, uri, Abbr t -> let f t = f (a, uri, Abbr t) in xlate_term f t + | _, _, Void -> + assert false + +let initial_status () = { + delta = false; rt = false; si = !O.si; expand = !O.expand +} + +let refresh_status st = {st with + si = !O.si; expand = !O.expand +}