1
(* $Id: uSet.ml,v 1.2 2004/09/04 16:07:38 yori Exp $ *)
2
(* Copyright 2002, 2003 Yamagata Yoriyuki. distributed with LGPL *)
6
external uset_of_iset : ISet.t -> t = "%identity"
7
external iset_of_uset : t -> ISet.t = "%identity"
9
let mem u s = ISet.mem (UChar.uint_code u) s
11
let add u s = ISet.add (UChar.uint_code u) s
13
let add_range u1 u2 s =
14
ISet.add_range (UChar.uint_code u1) (UChar.uint_code u2) s
16
let singleton u = ISet.singleton (UChar.uint_code u)
18
let remove u s = ISet.remove (UChar.uint_code u) s
20
let remove_range u1 u2 s =
21
ISet.remove_range (UChar.uint_code u1) (UChar.uint_code u2) s
23
let from u s = ISet.from (UChar.uint_code u) s
24
let after u s = ISet.after (UChar.uint_code u) s
26
let until u s = ISet.until (UChar.uint_code u) s
27
let before u s = ISet.before (UChar.uint_code u) s
29
let iter f s = ISet.iter (fun n -> f (UChar.chr_of_uint n)) s
33
f (UChar.chr_of_uint n1) (UChar.chr_of_uint n2) in
37
let f' n a = f (UChar.chr_of_uint n) a in
40
let fold_range f s a =
42
f (UChar.chr_of_uint n1) (UChar.chr_of_uint n1) a in
43
ISet.fold_range f' s a
46
let p' n = p (UChar.chr_of_uint n) in
50
let p' n = p (UChar.chr_of_uint n) in
54
let p' n = p (UChar.chr_of_uint n) in
58
let p' n = p (UChar.chr_of_uint n) in
62
List.map UChar.chr_of_uint (ISet.elements s)
66
(UChar.chr_of_uint n1,
67
UChar.chr_of_uint n2) in
68
List.map f (ISet.ranges s)
70
let min_elt s = UChar.chr_of_uint (ISet.min_elt s)
71
let max_elt s = UChar.chr_of_uint (ISet.max_elt s)
72
let choose s = UChar.chr_of_uint (ISet.choose s)
74
let uset_of_iset s = s
75
let iset_of_uset s = s