import "File"
-public int UTF8toISO8859_1(char * source, char * dest, int max)
+public int UTF8toISO8859_1(const char * source, char * dest, int max)
{
unichar ch;
int nb;
return d;
}
-public uint16 * UTF8toUTF16Len(char * source, int byteCount, int * wordCount)
+public uint16 * UTF8toUTF16Len(const char * source, int byteCount, int * wordCount)
{
if(source)
{
}
if(i < numBytes)
error = true;
- if(codePoint > 0x10FFFF || (codePoint >= 0xD800 && codePoint <= 0xDFFF) ||
- (codePoint < 0x80 && numBytes > 1) ||
- (codePoint < 0x800 && numBytes > 2) ||
+ if(codePoint > 0x10FFFF || (codePoint >= 0xD800 && codePoint <= 0xDFFF) ||
+ (codePoint < 0x80 && numBytes > 1) ||
+ (codePoint < 0x800 && numBytes > 2) ||
(codePoint < 0x10000 && numBytes > 3))
error = true;
if(error)
if(codePoint > 0xFFFF)
{
uint16 lead = (uint16)(LEAD_OFFSET + (codePoint >> 10));
- uint16 trail = 0xDC00 + (uint16)(codePoint & 0x3FF);
+ uint16 trail = (uint16)(0xDC00 | (codePoint & 0x3FF));
dest[d++] = lead;
dest[d++] = trail;
return null;
}
-public int UTF8toUTF16BufferLen(char * source, uint16 * dest, int max, int len)
+public int UTF8toUTF16BufferLen(const char * source, uint16 * dest, int max, int len)
{
if(source)
{
if(codePoint > 0xFFFF)
{
uint16 lead = (uint16)(LEAD_OFFSET + (codePoint >> 10));
- uint16 trail = 0xDC00 + (uint16)(codePoint & 0x3FF);
+ uint16 trail = (uint16)(0xDC00 | (codePoint & 0x3FF));
if(d >= max - 1) break;
dest[d++] = lead;
dest[d++] = trail;
dest[d] = 0;
return d;
}
- return 0;
+ return 0;
}
-public int UTF16BEtoUTF8Buffer(uint16 * source, byte * dest, int max)
+public int UTF16BEtoUTF8Buffer(const uint16 * source, byte * dest, int max)
{
int c;
int d = 0;
if(u16 < 0xD800 || u16 > 0xDBFF)
{
// TOFIX: PRECOMP ERROR IF NO BRACKETS
- ch = (unichar)u16;
+ ch = (unichar)u16;
}
else
{
separators = CharCategories { separatorSpace = true, separatorLine = true, separatorParagraph = true },
others = CharCategories { otherControl = true, otherFormat = true, otherSurrogate = true, otherPrivateUse = true, otherNotAssigned = true },
letters = CharCategories { letterUpperCase = true, letterLowerCase = true, letterTitleCase = true, letterModifier = true, letterOther = true },
- punctuation = CharCategories { punctiationConnector = true, punctuationDash = true, punctuationOpen = true, punctuationClose = true, punctuationInitial = true,
+ punctuation = CharCategories { punctuationConnector = true, punctuationDash = true, punctuationOpen = true, punctuationClose = true, punctuationInitial = true,
punctuationFinal = true, punctuationOther = true },
symbols = CharCategories { symbolMath = true, symbolCurrency = true, symbolModifier = true, symbolOther = true },
- connector = CharCategories { punctuationConnector = true },
+ connector = CharCategories { punctuationConnector = true }
};
-public bool GetAlNum(char ** input, char * string, int max)
+public bool GetAlNum(const char ** input, char * string, int max)
{
int c = 0;
unichar ch;
int nb = 1;
bool result = true;
- char * buffer = *input;
+ const char * buffer = *input;
if(!buffer[0]) { string[0]=0; return false; }
// Eat all left spacing, leave last char in ch
static CharCategory asciiCategories[] =
{
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
Zs, Po, Po, Po, Sc, Po, Po, Po,
Ps, Pe, Po, Sm, Cs, Pd, Po, Po,
Nd, Nd, Nd, Nd, Nd, Nd, Nd, Nd,
Nd, Nd, Po, Po, Sm, Sm, Sm, Po,
- Po, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
- Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
- Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
+ Po, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
+ Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
+ Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
Lu, Lu, Lu, Ps, Po, Pe, Sk, Pc,
- Sk, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
- Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
- Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
+ Sk, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
+ Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
+ Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
Ll, Ll, Ll, Ps, Sm, Pe, Sm, Cc
};
if(line[0] && line[0] != '#')
{
char * endPtr;
- uint start = strtoul(line, &endPtr, 16);
+ uint start = (uint)strtoul(line, &endPtr, 16);
if(endPtr)
{
- uint end = (endPtr && *endPtr == '.') ? strtoul(endPtr + 2, &endPtr, 16) : start;
+ uint end = (endPtr && *endPtr == '.') ? (uint)strtoul(endPtr + 2, &endPtr, 16) : start;
if(endPtr)
{
endPtr = strchr(endPtr, ';');
if(category)
{
Range range { start, end, category };
- BTNode node { key = (uint) &range };
+ BTNode node { key = (uintptr) &range };
if(categories.Add(node))
{
- node.key = (uint)new Range[1];
+ node.key = (uintptr)new Range[1];
*(Range *)node.key = range;
- }
+ }
else
delete node;
}
string[len++] = ';';
string[len++] = ' ';
range->category.OnGetString(string + len, null, null);
- len += 2;
+ len += 2;
string[len++] = '\n';
string[len] = '\0';
f.Puts(string);
delete f;
}
*/
- }
+ }
}
~UnicodeDatabase()
{
{
CharCategory category = none;
Range range { ch, ch };
- BTNode node = dataBase.categories.Find((uint) &range);
+ BTNode node = dataBase.categories.Find((uintptr) &range);
if(node)
category = ((Range *)node.key)->category;
return category;