Version française
Home     About     Download     Resources     Contact us    
Browse thread
[ANN] Camomile 0.7.3
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dmitry.bely@g...>
Subject: Re: [Caml-list] Re: [ANN] Camomile 0.7.3
How "heavy-weight" is Camomile? I was a bit scared with the size of
its distribution. Currently I use under Windows the following my own
simple Unicode-support module (implemented via
WideCharToMultiByte/MultiByteToWideChar Win32 API functions). Maybe
it's time to switch to Camomile?

(** Wide char/string operations. *)

type codePage =
    CP_ACP (* ANSI code page *)
  | CP_MACCP (* Macintosh code page *)
  | CP_OEMCP (* OEM code page *)
  | CP_SYMBOL (* Symbol code page (42) *)
  | CP_THREAD_ACP (* The current thread's ANSI code page *)
  | CP_UTF7 (* Translate using UTF-7 *)
  | CP_UTF8 (* Translate using UTF-8 *)
  | CP_NUMERIC of int

module Wchar:
sig
(*IF-OCAML*)
  type t = private int
(*ENDIF-OCAML*)
(*F#
  type t = char
F#*)

  val compare: t -> t -> int
  val of_int: int -> t
  val to_int: t -> int
  val encode: codePage -> t -> Bytes.bytes
  val decode: codePage -> Bytes.bytes -> t
end

module Wstring:
sig
(*IF-OCAML*)
  type t = private int array
(*ENDIF-OCAML*)
(*F#
  type t = string
F#*)

  val compare: t -> t -> int
  val length : t -> int
  val get: t -> int -> Wchar.t
  val make: int -> Wchar.t -> t
  val append: t -> t -> t
  val uppercase: t -> t
  val lowercase: t -> t

  val of_array: Wchar.t array -> t
  val to_array: t -> Wchar.t array
  val of_int_array: int array -> t
  val to_int_array: t -> int array
  val of_list: Wchar.t list -> t
  val to_list: t -> Wchar.t list

  val empty: t
(*IF-OCAML*)
  external pack_to_string: t -> string = "w32_unicode_pack_to_string"
    (** convert to packed 2-byte UCS2 string, stored as Caml string *)
  external unpack_from_string: string -> t = "w32_unicode_unpack_from_string"
    (** inverse function for pack_to_string *)
(*ENDIF-OCAML*)
  val encode: codePage -> t -> Bytes.bytes
  val decode: codePage -> Bytes.bytes -> t
end

type wchar = Wchar.t
type wstring = Wstring.t

(**/**)

- Dmitry Bely