value.mli 3.34 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
module ValueSet: Set.S with type elt = t

26
exception CDuceExn of t
27
28
val raise': t -> 'a           (* "raise" for CDuce exceptions *)
val failwith': string -> 'a   (* "failwith" for CDuce exceptions *)
29
val tagged_tuple: string -> t list -> t
30

31
val print: Format.formatter -> t -> unit
32
val dump_xml: Format.formatter -> t -> unit
33

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

37
38
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 *)
39
val string_latin1 : string -> t
40
val string_utf8 : U.t -> t
41
val substring_utf8: U.uindex -> U.uindex -> U.t -> t -> t
42
val nil : t
43
44
45
val vtrue : t
val vfalse : t
val vbool : bool -> t
46

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

50
val sequence : t list -> t
51
52
53
54
val sequence_rev : t list -> t
val get_sequence : t -> t list
val get_sequence_rev : t -> t list

55
56
val fold_sequence: ('a -> t -> 'a) -> 'a -> t -> 'a

57
58
59
val atom_ascii : string -> t
val label_ascii : string -> label
val record : (label * t) list -> t
60
val record_ascii : (string * t) list -> t
61
val get_field : t -> label -> t
62
val get_field_ascii : t -> string -> t
63
64

val get_variant : t -> string * t option
65

66
67
68
val abstract : Types.Abstract.abs -> 'a -> t
val get_abstract : t -> 'a

69
70
71
val mk_ref : Types.t -> t -> t
val mk_ext_ref : Types.t -> (unit -> t) -> (t -> unit) -> t

72
73
74
  (* 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
75

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

79
80
val concat : t -> t -> t
val flatten : t -> t
81
val append : t -> t -> t
82

83

84
val get_string_latin1 : t -> string
85
val get_string_utf8 : t -> U.t * t
86
val is_str : t -> bool
87
val is_seq : t -> bool
88

89
val get_int : t -> int
90
val get_integer : t -> Intervals.V.t
91
92

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

95
96
val get_pair : t -> t * t

97
val compare : t -> t -> int
98
val equal : t -> t -> bool
99
100
101
102
103
104
val ( |<| ): t -> t -> bool
val ( |>| ): t -> t -> bool
val ( |<=| ): t -> t -> bool
val ( |>=| ): t -> t -> bool
val ( |=| ): t -> t -> bool
val ( |<>| ): t -> t -> bool
105
106
107
108


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

110
111
112
113
114

val ocaml2cduce_int : int -> t
val cduce2ocaml_int : t -> int
val ocaml2cduce_string : string -> t
val cduce2ocaml_string : t -> string
115
116
val ocaml2cduce_string_utf8 : U.t -> t
val cduce2ocaml_string_utf8 : t -> U.t
117
118
val ocaml2cduce_char : char -> t
val cduce2ocaml_char : t -> char
119
120
val ocaml2cduce_bigint : Big_int.big_int -> t
val cduce2ocaml_bigint : t -> Big_int.big_int
121
122
123


val print_utf8: U.t -> unit
124