Beispiel #1
0
bool XAP_Dictionary::save(void)
{
	if (!m_bDirty)
		return true;

	if (!_openFile("w"))
		return false;

	UT_GenericVector<UT_UCSChar *> * pVec = m_hashWords.enumerate();
	UT_ASSERT(pVec);

	UT_uint32 size = pVec->size();

	for (UT_uint32 i = 0; i < size; i++)
	{
		UT_UCSChar * pWord = pVec->getNthItem(i);
		_outputUTF8(pWord, UT_UCS4_strlen(pWord));
		_writeBytes(reinterpret_cast<const UT_Byte *>("\n"));
	}

	_closeFile();

	delete pVec;
	m_bDirty = false;

	return true;
}
Beispiel #2
0
bool XAP_Dictionary::_writeBytes(const UT_Byte * sz)
{
	UT_ASSERT(m_fp);
	UT_ASSERT(sz);
	int length = strlen(reinterpret_cast<const char *>(sz));
	UT_ASSERT(length);
	
	return (_writeBytes(sz,length)==static_cast<UT_uint32>(length));
}
Beispiel #3
0
void XAP_Dictionary::_outputUTF8(const UT_UCSChar * data, UT_uint32 length)
{
	UT_String buf;
	const UT_UCSChar * pData;

	for (pData = data; (pData<data+length); /**/)
	{
		if (*pData > 0x007f)
		{
			gchar outbuf[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
			g_unichar_to_utf8(*pData++, outbuf);
			buf += outbuf;
		}
		else
		{
			buf += (char)*pData++;
		}
	}

	_writeBytes(reinterpret_cast<const UT_Byte *>(buf.c_str()),buf.size());
}
Beispiel #4
0
	void aADD_EAX_iIMM( int imm ) { _writeBytes(0x05); _writeInt(imm); }
Beispiel #5
0
	void aMOV_pESIoIMM_uIMM( int off, unsigned int imm ) { _writeBytes(0xC7,0x86); _writeInt(off); _writeUint(imm); }
Beispiel #6
0
	void aMOV_pESIoIMM_EAX( int off ) { _writeBytes(0x89,0x86); _writeInt(off); }
Beispiel #7
0
	void aMOV_pEAX_ECX( ) { _writeBytes(0x89,0x08); }
Beispiel #8
0
	void aMOV_ECX_pESIoIMM( int off ) { _writeBytes(0x8b,0x8e); _writeInt(off); }
Beispiel #9
0
	void aMOV_EAX_uIMM( unsigned int imm ) { _writeBytes(0xB8); _writeUint(imm); }
Beispiel #10
0
	void aPUSH_EAX( ) { _writeBytes(0x50); };
Beispiel #11
0
	void aCALL_IMM( unsigned int imm ) { _writeBytes(0xE8); _writeInt((int)imm-(int)_cursor-4); }
Beispiel #12
0
	void aJMP_IMM( unsigned int imm ) { _writeBytes(0xE9); _writeInt((int)imm-(int)_cursor-4); }
Beispiel #13
0
	void aRETN( ) { _writeBytes(0xC3); };
Beispiel #14
0
	void aINT3( ) { _writeBytes(0xCC); };
Beispiel #15
0
	void aNOP( ) { _writeBytes(0x90); };
Beispiel #16
0
	void aADD_EAX_pESIoIMM( int off ) { _writeBytes(0x03,0x86); _writeInt(off); }
Beispiel #17
0
	void aADD_pESIoIMM_iIMM( int off, int imm ) { _writeBytes(0x81,0x86); _writeInt(off); _writeInt(imm); }
Beispiel #18
0
	void aMOV_EAX_ECX( ) { _writeBytes(0x89,0xc1); }