#![allow(unused)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
use crate::letter::*;
use crate::tables::*;
use gostd_builtin::*;
use lazy_static::lazy_static;
use std::sync::Arc;
pub const MaxRune: i32 = '\u{10FFFF}' as i32; pub const ReplacementChar: i32 = '\u{FFFD}' as i32; pub const MaxASCII: i32 = '\u{007F}' as i32; pub const MaxLatin1: i32 = '\u{00FF}' as i32;
pub(crate) const PC: isize = 1 << 0; pub(crate) const pP: isize = 1 << 1; pub(crate) const pN: isize = 1 << 2; pub(crate) const pS: isize = 1 << 3; pub(crate) const pZ: isize = 1 << 4; pub(crate) const pLu: isize = 1 << 5; pub(crate) const pLl: isize = 1 << 6; pub(crate) const pp: isize = 1 << 7; pub(crate) const pg: isize = pp | pZ; pub(crate) const pLo: isize = pLl | pLu; pub(crate) const pLmask: isize = pLo;
pub fn IsPrint(r: i32) -> bool {
if r as u32 <= MaxLatin1 as u32 {
return properties[r as usize] as isize & pp != 0;
}
In(r, &PrintRanges)
}
pub fn In(r: i32, ranges: &[Arc<RangeTable>]) -> bool {
for inside in ranges {
if Is(inside.clone(), r) {
return true;
}
}
false
}
lazy_static! {
static ref PrintRanges: Arc<Vec<Arc<RangeTable>>> =
Arc::new(vec![L.clone(), M.clone(), N.clone(), P.clone(), S.clone(),]);
}
lazy_static::lazy_static! {
static ref L: Arc<RangeTable> =_L.clone();
}
lazy_static::lazy_static! {
static ref M: Arc<RangeTable> = _M.clone();
}
lazy_static::lazy_static! {
static ref N: Arc<RangeTable> = _N.clone();
}
lazy_static::lazy_static! {
static ref P: Arc<RangeTable> = _P.clone();
}
lazy_static::lazy_static! {
static ref S: Arc<RangeTable> = _S.clone();
}
pub fn IsLetter(r: i32) -> bool {
if r as u32 <= MaxLatin1 as u32 {
return properties[r as usize] as isize & pLmask != 0;
}
isExcludingLatin(Letter.clone(), r)
}