shithub: femtolisp

ref: 62389c8990cafb8e99ae29b2bccbcd100ce4c7f0
dir: /3rd/utf/utf.h/

View raw version
#pragma once

enum {
	Runeself = 0x80,
	Runeerror = 0xfffd,
	Runemax = 0x10ffff,
	UTFmax = 4,
};

typedef uint32_t Rune;

int chartorune(Rune *rune, const char *str);
int runetochar(char *str, const Rune *rune);
int runenlen(const Rune *r, int nrune);
int fullrune(const char *str, int n);
int runelen(Rune c);
Rune tolowerrune(Rune c) fl_constfn;
Rune toupperrune(Rune c) fl_constfn;
Rune totitlerune(Rune c) fl_constfn;
int islowerrune(Rune c) fl_constfn;
int isupperrune(Rune c) fl_constfn;
int isalpharune(Rune c) fl_constfn;
int istitlerune(Rune c) fl_constfn;
int isspacerune(Rune c) fl_constfn;
int isdigitrune(Rune c) fl_constfn;

int utfnlen(const char *s, long m);