VSL - The prelude.char Structure
# Copyright 2011 Petter Urkedal
#
# This file is part of the Viz Standard Library <http://www.vizlang.org/>.
#
# The Viz Standard Library (VSL) is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# The VSL is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the VSL. If not, see <http://www.gnu.org/licenses/>.
open prereq
#?ffoc include compat.ocaml_unicode.char
let eq x y be __generic_eq x y
let cmp x y be __generic_cmp x y
# FIXME
let is_space be c" " ↦ true; c"\n" ↦ true; c"\t" ↦ true; _ ↦ false
let digit_value a ch
let c be as_int ch
if 0x30 ≤ c ≤ 0x39 be some (c - 0x30)
if 0x61 ≤ c ≤ 0x7a + a - 10 be some (c - 0x61)
if 0x41 ≤ c ≤ 0x5a + a - 10 be some (c - 0x41)
be none