18 #ifndef MAGICKCORE_TOKEN_PRIVATE_H 19 #define MAGICKCORE_TOKEN_PRIVATE_H 21 #if defined(__cplusplus) || defined(c_plusplus) 29 #define MaxMultibyteCodes 6 43 { 0x80, 0x00, 0x000007f, 0x0000000 },
44 { 0xE0, 0xC0, 0x00007ff, 0x0000080 },
45 { 0xF0, 0xE0, 0x000ffff, 0x0000800 },
46 { 0xF8, 0xF0, 0x01fffff, 0x0010000 },
47 { 0xFC, 0xF8, 0x03fffff, 0x0200000 },
48 { 0xFE, 0xFC, 0x7ffffff, 0x4000000 },
53 register const unsigned char 56 register unsigned char 69 for (p=content; *p !=
'\0'; p++)
70 length+=(*p & 0x80) != 0 ? 2 : 1;
71 utf8=(
unsigned char *) NULL;
74 if (utf8 == (
unsigned char *) NULL)
75 return((
unsigned char *) NULL);
77 for (p=content; *p !=
'\0'; p++)
84 *q++=0xc0 | ((c >> 6) & 0x3f);
85 *q++=0x80 | (c & 0x3f);
105 if (text == (
const char *) NULL)
110 code=(int) (*text++) & 0xff;
117 if (unicode <
utf_info[i].utf_value)
119 *octets=(
unsigned int) (i+1);
122 c=(int) (*text++ ^ 0x80) & 0xff;
125 if (unicode > 0x10FFFF)
127 unicode=(unicode << 6) | c;
152 if (((code >= 0x0009) && (code <= 0x000d)) || (code == 0x0020) ||
153 (code == 0x0085) || (code == 0x00a0) || (code == 0x1680) ||
154 (code == 0x180e) || ((code >= 0x2000) && (code <= 0x200a)) ||
155 (code == 0x2028) || (code == 0x2029) || (code == 0x202f) ||
156 (code == 0x205f) || (code == 0x3000))
166 mask=(int) 0x7fffffff;
167 if (((code & ~mask) != 0) && ((code < 0xd800) || (code > 0xdfff)) &&
168 (code != 0xfffe) && (code != 0xffff))
179 if ((code & ~mask) != 0)
184 #if defined(__cplusplus) || defined(c_plusplus) #define EILSEQ
Definition: token-private.h:26
int code_value
Definition: token-private.h:34
Definition: token-private.h:31
static MagickBooleanType IsUTFSpace(int code)
Definition: token-private.h:150
static MagickBooleanType IsUTFValid(int code)
Definition: token-private.h:161
int utf_value
Definition: token-private.h:34
int utf_mask
Definition: token-private.h:34
MagickBooleanType
Definition: magick-type.h:189
static int GetUTFCode(const char *text)
Definition: token-private.h:133
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
Definition: memory.c:534
Definition: magick-type.h:192
static unsigned int GetUTFOctets(const char *text)
Definition: token-private.h:141
static unsigned char * ConvertLatin1ToUTF8(const unsigned char *content)
Definition: token-private.h:51
#define MaxMultibyteCodes
Definition: token-private.h:29
static UTFInfo utf_info[MaxMultibyteCodes]
Definition: token-private.h:41
static int GetNextUTFCode(const char *text, unsigned int *octets)
Definition: token-private.h:92
Definition: magick-type.h:191
static MagickBooleanType IsUTFAscii(int code)
Definition: token-private.h:173