Xt templating language (OCaml server) (http://chris.pacejo.net/programs/xt)

root / unicode.mli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
open Streams

type code_point = int

val u: char -> code_point
val to_char: code_point -> char

val valid: code_point -> bool
val in_bmp: code_point -> bool
val ascii: code_point -> bool

val bom: code_point
val bom_reversed: code_point

module type Encoding = sig
	type u
	
	module Reader(Reader: Reader with type u = u): sig
		include Reader with type u = code_point
		val of_reader: Reader.t -> t
	end
	
	module Putback(Putback: Putback with type u = u): sig
		include Putback with type u = code_point
		val of_putback: Putback.t -> t
	end
	
	module Writer(Writer: Writer with type u = u): sig
		include Writer with type u = code_point
		val of_writer: Writer.t -> t
	end
end

module UTF_8: sig
	include Encoding with type u = byte
	exception Unexpected_byte of byte
end

module UTF_16_Word: sig
	include Encoding with type u = word
	exception Unexpected_word of word
end

module UTF_16_LE: Encoding with type u = byte
module UTF_16_BE: Encoding with type u = byte
module UTF_16: Encoding with type u = byte
module UTF_XML: Encoding with type u = byte

type utf8_string = string

module UTF_8_String: sig
	type t = utf8_string
	
	module Reader: sig
		include Reader with type u = code_point
		val of_utf8_string: utf8_string -> t
	end
	
	module Writer: sig
		include Writer with type u = code_point
		val of_buffer: Buffer.t -> t
	end
	
	val of_cp_list: code_point list -> utf8_string
end