charset.h revision 330571
1114592Sobrien/*
287866Ssheldonh * Copyright (C) 1984-2017  Mark Nudelman
387866Ssheldonh *
4119363Stjr * You may distribute under the terms of either the GNU General Public
587866Ssheldonh * License or the Less License, as specified in the README file.
687866Ssheldonh *
787866Ssheldonh * For more information, see the README file.
887866Ssheldonh */
987866Ssheldonh
1087866Ssheldonh#define IS_ASCII_OCTET(c)   (((c) & 0x80) == 0)
1187866Ssheldonh#define IS_UTF8_TRAIL(c)    (((c) & 0xC0) == 0x80)
1287866Ssheldonh#define IS_UTF8_LEAD2(c)    (((c) & 0xE0) == 0xC0)
1387866Ssheldonh#define IS_UTF8_LEAD3(c)    (((c) & 0xF0) == 0xE0)
1487866Ssheldonh#define IS_UTF8_LEAD4(c)    (((c) & 0xF8) == 0xF0)
1587866Ssheldonh#define IS_UTF8_LEAD5(c)    (((c) & 0xFC) == 0xF8)
1687866Ssheldonh#define IS_UTF8_LEAD6(c)    (((c) & 0xFE) == 0xFC)
1787866Ssheldonh#define IS_UTF8_INVALID(c)  (((c) & 0xFE) == 0xFE)
1887866Ssheldonh#define IS_UTF8_LEAD(c)     (((c) & 0xC0) == 0xC0 && !IS_UTF8_INVALID(c))
1988282Ssheldonh