You are viewing a development version of the library. Goto the latest version.

Module OASISExpr

module OASISExpr: sig .. end
Boolean expressions

This module provides a boolean expression evaluator. See OASIS manual for the precise syntax of the boolean expression
Author(s): Sylvain Le Gall
See also OASIS Manual


type test 
Test definition.
val tests : test list
Mandatory tests.
val string_of_test : test -> string
Convert a test to string.
val test_of_string : string -> test
Convert a string to test.


type flag = string 

type t =
| EBool of bool (*true or false*)
| ENot of t (*! e*)
| EAnd of t * t (*e1 && e2*)
| EOr of t * t (*e1 || e2*)
| EFlag of flag (*flag(foo), a boolean value.*)
| ETest of test * string (*os_type(Win32), a value compared to a string.*)
Boolean expression definition.
type 'a choices = (t * 'a) list 
Choose among different values
val eval : (string -> string) -> t -> bool
eval eval_tst t Evaluates the expression. Use eval_tst to get values of flags and tests.
val choose : ?printer:('a -> string) ->
?name:string -> (string -> string) -> 'a choices -> 'a
choose ~printer ~name eval_tst choices Evaluate each conditions of choices and choose the last condition that evaluates to true. If something goes wrong, use printer to display values and ~name as the choice list name.

See also OASISExpr.eval.

val check : flag list -> t -> unit
Check that a boolean expression only use available flags. Not exported.
val reduce : t -> t
Try to reduce the size of a boolean expression. Not exported.
val reduce_choices : (t * 'a) list -> (t * 'a) list
Try to reduce the size of a choice list. Not exported.
val if_then_else : t ->
(t * 'a) list -> (t * 'a) list -> (t * 'a) list
if_then_else cond choices_if choices_else Combine choices, if_then_else style.
val odn_of_t : t -> ODN.t
Dump ODN.t. Not exported.
val odn_of_choices : ('a -> ODN.t) -> 'a choices -> ODN.t
val to_string : t -> string
Transform an expression into a string. Not exported
val string_of_choices : ('a -> string) -> 'a choices -> string
Transform a list of choice into a string. Not exported