type exn += IncompatibleDeclarations : 'a action_kind * 'a * 'a -> exn
let check_same_types typ c1 c2 = ifnot (Constant.CanOrd.equal c1 c2) thenraise (IncompatibleDeclarations (IncompatTypes typ, c1, c2))
let check_same_inds ind i1 i2 = ifnot (Ind.CanOrd.equal i1 i2) thenraise (IncompatibleDeclarations (IncompatInd ind, i1, i2))
let add_retroknowledge retro action = match action with
| Register_type(typ,c) -> beginmatch typ with
| PT_int63 ->
(match retro.retro_int63 with
| None -> { retro with retro_int63 = Some c }
| Some c' -> check_same_types typ c c'; retro)
| PT_float64 ->
(match retro.retro_float64 with
| None -> { retro with retro_float64 = Some c }
| Some c' -> check_same_types typ c c'; retro)
| PT_string ->
(match retro.retro_string with
| None -> { retro with retro_string = Some c }
| Some c' -> check_same_types typ c c'; retro)
| PT_array ->
(match retro.retro_array with
| None -> { retro with retro_array = Some c }
| Some c' -> check_same_types typ c c'; retro) end
| Register_ind(pit,ind) -> beginmatch pit with
| PIT_bool -> let r = match retro.retro_bool with
| None -> ((ind,1), (ind,2))
| Some (((ind',_),_) as t) -> check_same_inds pit ind ind'; t in
{ retro with retro_bool = Some r }
| PIT_carry -> let r = match retro.retro_carry with
| None -> ((ind,1), (ind,2))
| Some (((ind',_),_) as t) -> check_same_inds pit ind ind'; t in
{ retro with retro_carry = Some r }
| PIT_pair -> let r = match retro.retro_pair with
| None -> (ind,1)
| Some ((ind',_) as t) -> check_same_inds pit ind ind'; t in
{ retro with retro_pair = Some r }
| PIT_cmp -> let r = match retro.retro_cmp with
| None -> ((ind,1), (ind,2), (ind,3))
| Some (((ind',_),_,_) as t) -> check_same_inds pit ind ind'; t in
{ retro with retro_cmp = Some r }
| PIT_f_cmp -> let r = match retro.retro_f_cmp with
| None -> ((ind,1), (ind,2), (ind,3), (ind,4))
| Some (((ind',_),_,_,_) as t) -> check_same_inds pit ind ind'; t in
{ retro with retro_f_cmp = Some r }
| PIT_f_class -> let r = match retro.retro_f_class with
| None -> ((ind,1), (ind,2), (ind,3), (ind,4),
(ind,5), (ind,6), (ind,7), (ind,8),
(ind,9))
| Some (((ind',_),_,_,_,_,_,_,_,_) as t) ->
check_same_inds pit ind ind'; t in
{ retro with retro_f_class = Some r } end
let get_int_type env = match (Environ.retroknowledge env).retro_int63 with
| Some c -> c
| None -> anomaly Pp.(str"Reduction of primitive: int63 not registered")
let get_float_type env = match (Environ.retroknowledge env).retro_float64 with
| Some c -> c
| None -> anomaly Pp.(str"Reduction of primitive: float64 not registered")
let get_string_type env = match (Environ.retroknowledge env).retro_string with
| Some c -> c
| None -> anomaly Pp.(str"Reduction of primitive: string not registered")
let get_cmp_type env = match (Environ.retroknowledge env).retro_cmp with
| Some (((mindcmp,_),_),_,_) ->
Constant.make (MutInd.user mindcmp) (MutInd.canonical mindcmp)
| None -> anomaly Pp.(str"Reduction of primitive: comparison not registered")
let get_bool_constructors env = match (Environ.retroknowledge env).retro_bool with
| Some r -> r
| None -> anomaly Pp.(str"Reduction of primitive: bool not registered")
let get_carry_constructors env = match (Environ.retroknowledge env).retro_carry with
| Some r -> r
| None -> anomaly Pp.(str"Reduction of primitive: carry not registered")
let get_pair_constructor env = match (Environ.retroknowledge env).retro_pair with
| Some c -> c
| None -> anomaly Pp.(str"Reduction of primitive: pair not registered")
let get_cmp_constructors env = match (Environ.retroknowledge env).retro_cmp with
| Some r -> r
| None -> anomaly Pp.(str"Reduction of primitive: cmp not registered")
let get_f_cmp_constructors env = match (Environ.retroknowledge env).retro_f_cmp with
| Some r -> r
| None -> anomaly Pp.(str"Reduction of primitive: fcmp not registered")
let get_f_class_constructors env = match (Environ.retroknowledge env).retro_f_class with
| Some r -> r
| None -> anomaly Pp.(str"Reduction of primitive: fclass not registered")
exception NativeDestKO
module type RedNativeEntries = sig type elem type args type evd (* will be unit in kernel, evar_map outside *) type uinstance
val get : args -> int -> elem val get_int : evd -> elem -> Uint63.t val get_float : evd -> elem -> Float64.t val get_string : evd -> elem -> Pstring.t val get_parray : evd -> elem -> elem Parray.t val mkInt : env -> Uint63.t -> elem val mkFloat : env -> Float64.t -> elem val mkString : env -> Pstring.t -> elem val mkBool : env -> bool -> elem val mkCarry : env -> bool -> elem -> elem (* true if carry *) val mkIntPair : env -> elem -> elem -> elem val mkFloatIntPair : env -> elem -> elem -> elem val mkLt : env -> elem val mkEq : env -> elem val mkGt : env -> elem val mkFLt : env -> elem val mkFEq : env -> elem val mkFGt : env -> elem val mkFNotComparable : env -> elem val mkPNormal : env -> elem val mkNNormal : env -> elem val mkPSubn : env -> elem val mkNSubn : env -> elem val mkPZero : env -> elem val mkNZero : env -> elem val mkPInf : env -> elem val mkNInf : env -> elem val mkNaN : env -> elem val mkArray : env -> uinstance -> elem Parray.t -> elem -> elem end
module type RedNative = sig type elem type args type evd type uinstance val red_prim : env -> evd -> CPrimitives.t -> uinstance -> args -> elem option end
module RedNative (E:RedNativeEntries) :
RedNative withtype elem = E.elem withtype args = E.args withtype evd = E.evd withtype uinstance = E.uinstance = struct type elem = E.elem type args = E.args type evd = E.evd type uinstance = E.uinstance
let get_int evd args i = E.get_int evd (E.get args i)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.