value.mli 3.35 KB
Newer Older
1
open Ident
2
open Encodings
3

4
5
6
type t =
(* Canonical representation *)
  | Pair of t * t
7
  | Xml of t * t * t
8
  | Record of t label_map
9
10
11
  | Atom of Atoms.V.t
  | Integer of Intervals.V.t
  | Char of Chars.V.t
12
  | Abstraction of (Types.descr * Types.descr) list * (t -> t)
13
  | Abstraction2 of t array * (Types.t * Types.t) list * Lambda.branches
14
  | Abstract of Types.Abstract.V.t
15
16

(* Derived forms *)
17
  | String_latin1 of int * int * string * t
18
  | String_utf8 of U.uindex * U.uindex * U.t * t
19
  | Concat of t * t
20

21
(* Special value for absent record fields, and failed pattern matching *)
22
23
  | Absent

24
25
(* Only in evaluation environment *)
  | Delayed of t ref
26

27
28
module ValueSet: Set.S with type elt = t

29
exception CDuceExn of t
30
31
val raise': t -> 'a           (* "raise" for CDuce exceptions *)
val failwith': string -> 'a   (* "failwith" for CDuce exceptions *)
32

33
val print: Format.formatter -> t -> unit
34
val dump_xml: Format.formatter -> t -> unit
35

36
37
val normalize: t -> t
  (* Transform a derived form to its canonical equivalent *)
38

39
40
val const : Types.const -> t  (* extract the const value from a const type *)
val inv_const : t -> Types.const  (* build a const type from a const value *)
41
val string_latin1 : string -> t
42
val string_utf8 : U.t -> t
43
val substring_utf8: U.uindex -> U.uindex -> U.t -> t -> t
44
val nil : t
45
46
47
val vtrue : t
val vfalse : t
val vbool : bool -> t
48

49
  (** @return a Record value from an associative list of fields *)
50
val vrecord : (Ns.qname * t) list -> t
51

52
val sequence : t list -> t
53
54
55
56
57
58
59
60
61
62
val sequence_rev : t list -> t
val get_sequence : t -> t list
val get_sequence_rev : t -> t list

val atom_ascii : string -> t
val label_ascii : string -> label
val record : (label * t) list -> t
val get_field : t -> label -> t

val get_variant : t -> string * t option
63

64
65
66
val abstract : Types.Abstract.abs -> 'a -> t
val get_abstract : t -> 'a

67
68
69
val mk_ref : Types.t -> t -> t
val mk_ext_ref : Types.t -> (unit -> t) -> (t -> unit) -> t

70
71
72
  (* iterator on the content of an Xml value. First callback is invoked on Utf8
  character children; second callback is invoked on other children values *)
val iter_xml : (U.t -> unit) -> (t -> unit) -> t -> unit
73

74
75
76
  (* as above for map *)
val map_xml : (U.t -> U.t) -> (t -> t) -> t -> t

77
78
val concat : t -> t -> t
val flatten : t -> t
79

80

81
val get_string_latin1 : t -> string
82
val get_string_utf8 : t -> U.t * t
83
val is_str : t -> bool
84
val is_seq : t -> bool
85

86
87
88
val get_int : t -> int

  (** @return an associative list of fields from a Record value *)
89
val get_fields : t -> (Ns.qname * t) list
90

91
92
val get_pair : t -> t * t

93
val compare : t -> t -> int
94
val equal : t -> t -> bool
95
96
97
98
99
100
val ( |<| ): t -> t -> bool
val ( |>| ): t -> t -> bool
val ( |<=| ): t -> t -> bool
val ( |>=| ): t -> t -> bool
val ( |=| ): t -> t -> bool
val ( |<>| ): t -> t -> bool
101
102
103
104


val set_cdr : t -> t -> unit
val append_cdr : t -> t -> t
105

106
107
108
109
110

val ocaml2cduce_int : int -> t
val cduce2ocaml_int : t -> int
val ocaml2cduce_string : string -> t
val cduce2ocaml_string : t -> string
111
112
val ocaml2cduce_string_utf8 : U.t -> t
val cduce2ocaml_string_utf8 : t -> U.t
113
114
val ocaml2cduce_char : char -> t
val cduce2ocaml_char : t -> char
115
116
val ocaml2cduce_bigint : Big_int.big_int -> t
val cduce2ocaml_bigint : t -> Big_int.big_int
117
118
119


val print_utf8: U.t -> unit
120

121
122

(*CQL Aggregats *)
123
val query_min: t-> t 
124
val query_max: t-> t 
125
126
127
val query_sum: t-> t
val query_avg: t-> t
val query_count: t-> t 
128
129
val query_member: t->t -> t 
val query_distinct: t -> t