|
rpm-build |
0f2925 |
(*
|
|
rpm-build |
0f2925 |
* UChar - Unicode (ISO-UCS) characters
|
|
rpm-build |
0f2925 |
* Copyright (C) 2002, 2003 Yamagata Yoriyuki
|
|
rpm-build |
0f2925 |
*
|
|
rpm-build |
0f2925 |
* This library is free software; you can redistribute it and/or
|
|
rpm-build |
0f2925 |
* modify it under the terms of the GNU Lesser General Public
|
|
rpm-build |
0f2925 |
* License as published by the Free Software Foundation; either
|
|
rpm-build |
0f2925 |
* version 2.1 of the License, or (at your option) any later version,
|
|
rpm-build |
0f2925 |
* with the special exception on linking described in file LICENSE.
|
|
rpm-build |
0f2925 |
*
|
|
rpm-build |
0f2925 |
* This library is distributed in the hope that it will be useful,
|
|
rpm-build |
0f2925 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
rpm-build |
0f2925 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
rpm-build |
0f2925 |
* Lesser General Public License for more details.
|
|
rpm-build |
0f2925 |
*
|
|
rpm-build |
0f2925 |
* You should have received a copy of the GNU Lesser General Public
|
|
rpm-build |
0f2925 |
* License along with this library; if not, write to the Free Software
|
|
rpm-build |
0f2925 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Unicode (ISO-UCS) characters.
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
This module implements Unicode (actually ISO-UCS) characters. All
|
|
rpm-build |
0f2925 |
31-bit code points are allowed.
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Unicode characters. All 31-bit code points are allowed.*)
|
|
rpm-build |
0f2925 |
type t
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
exception Out_of_range
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** [char_of u] returns the Latin-1 representation of [u].
|
|
rpm-build |
0f2925 |
If [u] can not be represented by Latin-1, raises Out_of_range *)
|
|
rpm-build |
0f2925 |
val char_of : t -> char
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** [of_char c] returns the Unicode character of the Latin-1 character [c] *)
|
|
rpm-build |
0f2925 |
val of_char : char -> t
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** [code u] returns the Unicode code number of [u].
|
|
rpm-build |
0f2925 |
If the value can not be represented by a positive integer,
|
|
rpm-build |
0f2925 |
raise Out_of_range *)
|
|
rpm-build |
0f2925 |
val code : t -> int
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** [code n] returns the Unicode character with the code number [n].
|
|
rpm-build |
0f2925 |
If n >= 2^32 or n < 0, raises [invalid_arg] *)
|
|
rpm-build |
0f2925 |
val chr : int -> t
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** [uint_code u] returns the Unicode code number of [u].
|
|
rpm-build |
0f2925 |
The returned int is unsigned, that is, on 32-bit platforms,
|
|
rpm-build |
0f2925 |
the sign bit is used for storing the 31-th bit of the code number. *)
|
|
rpm-build |
0f2925 |
external uint_code : t -> int = "%identity"
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** [chr_of_uint n] returns the Unicode character of the code number [n].
|
|
rpm-build |
0f2925 |
[n] is interpreted as unsigned, that is, on 32-bit platforms,
|
|
rpm-build |
0f2925 |
the sign bit is treated as the 31-th bit of the code number.
|
|
rpm-build |
0f2925 |
If n exceeds 31-bit values, then raise [Invalid_arg]. *)
|
|
rpm-build |
0f2925 |
val chr_of_uint : int -> t
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Unsafe version of {!UChar.chr_of_uint}.
|
|
rpm-build |
0f2925 |
No check of its argument is performed. *)
|
|
rpm-build |
0f2925 |
external unsafe_chr_of_uint : int -> t = "%identity"
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Equality by code point comparison *)
|
|
rpm-build |
0f2925 |
val eq : t -> t -> bool
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** [compare u1 u2] returns,
|
|
rpm-build |
0f2925 |
a value > 0 if [u1] has a larger Unicode code number than [u2],
|
|
rpm-build |
0f2925 |
0 if [u1] and [u2] are the same Unicode character,
|
|
rpm-build |
0f2925 |
a value < 0 if [u1] has a smaller Unicode code number than [u2]. *)
|
|
rpm-build |
0f2925 |
val compare : t -> t -> int
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Aliases of [type t] *)
|
|
rpm-build |
0f2925 |
type uchar = t
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Alias of [uint_code] *)
|
|
rpm-build |
0f2925 |
val int_of_uchar : uchar -> int
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Alias of [chr_of_uint] *)
|
|
rpm-build |
0f2925 |
val uchar_of_int : int -> uchar
|