2009-06-28 15:44:22 -07:00
|
|
|
#define nsHtml5NamedCharacters_cpp__
|
|
|
|
#include "prtypes.h"
|
|
|
|
#include "jArray.h"
|
|
|
|
#include "nscore.h"
|
|
|
|
|
|
|
|
#include "nsHtml5NamedCharacters.h"
|
|
|
|
|
2009-08-20 10:37:48 -07:00
|
|
|
jArray<jArray<PRUnichar,PRInt32>,PRInt32> nsHtml5NamedCharacters::NAMES;
|
|
|
|
jArray<PRUnichar,PRInt32>* nsHtml5NamedCharacters::VALUES;
|
|
|
|
PRUnichar** nsHtml5NamedCharacters::WINDOWS_1252;
|
2009-06-28 15:44:22 -07:00
|
|
|
static PRUnichar const WINDOWS_1252_DATA[] = {
|
|
|
|
0x20AC,
|
|
|
|
0xFFFD,
|
|
|
|
0x201A,
|
|
|
|
0x0192,
|
|
|
|
0x201E,
|
|
|
|
0x2026,
|
|
|
|
0x2020,
|
|
|
|
0x2021,
|
|
|
|
0x02C6,
|
|
|
|
0x2030,
|
|
|
|
0x0160,
|
|
|
|
0x2039,
|
|
|
|
0x0152,
|
|
|
|
0xFFFD,
|
|
|
|
0x017D,
|
|
|
|
0xFFFD,
|
|
|
|
0xFFFD,
|
|
|
|
0x2018,
|
|
|
|
0x2019,
|
|
|
|
0x201C,
|
|
|
|
0x201D,
|
|
|
|
0x2022,
|
|
|
|
0x2013,
|
|
|
|
0x2014,
|
|
|
|
0x02DC,
|
|
|
|
0x2122,
|
|
|
|
0x0161,
|
|
|
|
0x203A,
|
|
|
|
0x0153,
|
|
|
|
0xFFFD,
|
|
|
|
0x017E,
|
|
|
|
0x0178
|
|
|
|
};
|
2009-08-20 10:37:48 -07:00
|
|
|
|
|
|
|
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
|
|
|
|
static PRUnichar const NAME_##N[] = { CHARS };
|
|
|
|
#include "nsHtml5NamedCharactersInclude.h"
|
|
|
|
#undef NAMED_CHARACTER_REFERENCE
|
|
|
|
|
|
|
|
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
|
|
|
|
static PRUnichar const VALUE_##N[] = { VALUE };
|
|
|
|
#include "nsHtml5NamedCharactersInclude.h"
|
|
|
|
#undef NAMED_CHARACTER_REFERENCE
|
2009-06-29 01:54:40 -07:00
|
|
|
|
2009-06-29 02:09:27 -07:00
|
|
|
// XXX bug 501082: for some reason, msvc takes forever to optimize this function
|
2009-06-29 01:54:40 -07:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma optimize("", off)
|
|
|
|
#endif
|
|
|
|
|
2009-06-28 15:44:22 -07:00
|
|
|
void
|
|
|
|
nsHtml5NamedCharacters::initializeStatics()
|
|
|
|
{
|
|
|
|
NAMES = jArray<jArray<PRUnichar,PRInt32>,PRInt32>(2137);
|
2009-08-20 10:37:48 -07:00
|
|
|
|
|
|
|
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
|
|
|
|
NAMES[N] = jArray<PRUnichar,PRInt32>((PRUnichar*)NAME_##N, LEN);
|
|
|
|
#include "nsHtml5NamedCharactersInclude.h"
|
|
|
|
#undef NAMED_CHARACTER_REFERENCE
|
|
|
|
|
2009-06-28 15:44:22 -07:00
|
|
|
VALUES = new jArray<PRUnichar,PRInt32>[2137];
|
2009-08-20 10:37:48 -07:00
|
|
|
|
|
|
|
#define NAMED_CHARACTER_REFERENCE(N, CHARS, LEN, VALUE, SIZE) \
|
|
|
|
VALUES[N] = jArray<PRUnichar,PRInt32>((PRUnichar*)VALUE_##N, SIZE);
|
|
|
|
#include "nsHtml5NamedCharactersInclude.h"
|
|
|
|
#undef NAMED_CHARACTER_REFERENCE
|
2009-06-28 15:44:22 -07:00
|
|
|
|
|
|
|
WINDOWS_1252 = new PRUnichar*[32];
|
|
|
|
for (PRInt32 i = 0; i < 32; ++i) {
|
|
|
|
WINDOWS_1252[i] = (PRUnichar*)&(WINDOWS_1252_DATA[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-29 01:54:40 -07:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma optimize("", on)
|
|
|
|
#endif
|
|
|
|
|
2009-06-28 15:44:22 -07:00
|
|
|
void
|
|
|
|
nsHtml5NamedCharacters::releaseStatics()
|
|
|
|
{
|
|
|
|
NAMES.release();
|
|
|
|
delete[] VALUES;
|
2009-06-30 03:53:58 -07:00
|
|
|
delete[] WINDOWS_1252;
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|