void CDirectiveData::encodeSjis() { static EncodingTable sjisTable; if (sjisTable.isLoaded() == false) { unsigned char hexBuffer[2]; sjisTable.setTerminationEntry((unsigned char*)"\0",1); for (unsigned short SJISValue = 0x0001; SJISValue < 0x0100; SJISValue++) { wchar_t unicodeValue = sjisToUnicode(SJISValue); if (unicodeValue != 0xFFFF) { hexBuffer[0] = SJISValue & 0xFF; sjisTable.addEntry(hexBuffer, 1, unicodeValue); } } for (unsigned short SJISValue = 0x8100; SJISValue < 0xEF00; SJISValue++) { wchar_t unicodeValue = sjisToUnicode(SJISValue); if (unicodeValue != 0xFFFF) { hexBuffer[0] = (SJISValue >> 8) & 0xFF; hexBuffer[1] = SJISValue & 0xFF; sjisTable.addEntry(hexBuffer, 2, unicodeValue); } }
bool DirectiveSJIS(ArgumentList& List, int flags) { ArgumentList NewList; if (Global.SJISTable.isLoaded() == false) { unsigned char hexBuffer[2]; Global.SJISTable.setTerminationEntry((unsigned char*)"\0",1); for (unsigned short SJISValue = 0x0000; SJISValue < 0x0100; SJISValue++) { wchar_t unicodeValue = sjisToUnicode(SJISValue); if (unicodeValue != 0xFFFF) { hexBuffer[0] = SJISValue & 0xFF; Global.SJISTable.addEntry(hexBuffer, 1, unicodeValue); } } for (unsigned short SJISValue = 0x8100; SJISValue < 0xEF00; SJISValue++) { wchar_t unicodeValue = sjisToUnicode(SJISValue); if (unicodeValue != 0xFFFF) { hexBuffer[0] = (SJISValue >> 8) & 0xFF; hexBuffer[1] = SJISValue & 0xFF; Global.SJISTable.addEntry(hexBuffer, 2, unicodeValue); } }