Пример #1
0
bool CScriptKeyAlloc::ParseKey( LPCTSTR pszKey, LPCTSTR pszVal )
{
	ADDTOCALLSTACK("CScriptKeyAlloc::ParseKey");
	ASSERT(pszKey);

	size_t lenkey = strlen( pszKey );
	if ( ! lenkey )
	{
		return ParseKey(pszVal);
	}

	ASSERT( lenkey < SCRIPT_MAX_LINE_LEN-2 );

	size_t lenval = 0;
	if ( pszVal )
	{
		lenval = strlen( pszVal );
	}

	m_pszKey = GetKeyBufferRaw( lenkey + lenval + 1 );

	strcpy( m_pszKey, pszKey );
	m_pszArg = m_pszKey + lenkey;

	if ( pszVal )
	{
		m_pszArg ++;
		lenval = m_Mem.GetDataLength() - 2;
		strcpylen( m_pszArg, pszVal, ( lenval - lenkey ) + 1 );	// strcpylen
	}

	return( true );
}
Пример #2
0
bool CScriptKeyAlloc::ParseKey( LPCTSTR pszKey )
{
	ADDTOCALLSTACK("CScriptKeyAlloc::ParseKey");
	// Skip leading white space 
	if ( ! pszKey )
	{
		GetKeyBufferRaw(0);
		return false;
	}

	GETNONWHITESPACE( pszKey );

	TCHAR * pBuffer = GetKeyBufferRaw( strlen( pszKey ));
	ASSERT(pBuffer);

	size_t iLen = m_Mem.GetDataLength() - 1;
	strncpy( pBuffer, pszKey, iLen );
	pBuffer[iLen] = '\0';

	Str_Parse( pBuffer, &m_pszArg );
	return( true );
}
Пример #3
0
bool CScript::ReadTextLine( bool fRemoveBlanks ) // Read a line from the opened script file
{
	ADDTOCALLSTACK("CScript::ReadTextLine");
	// ARGS:
	// fRemoveBlanks = Don't report any blank lines, (just keep reading)
	//

	while ( PhysicalScriptFile::ReadString( GetKeyBufferRaw(SCRIPT_MAX_LINE_LEN), SCRIPT_MAX_LINE_LEN ))
	{
		m_iLineNum++;
		if ( fRemoveBlanks )
		{
			if ( ParseKeyEnd() <= 0 )
				continue;
		}
		return( true );
	}

	m_pszKey[0] = '\0';
	return( false );
}
Пример #4
0
bool CResourceLock::ReadTextLine( bool fRemoveBlanks ) // Read a line from the opened script file
{
	ADDTOCALLSTACK("CResourceLock::ReadTextLine");
	// ARGS:
	// fRemoveBlanks = Don't report any blank lines, (just keep reading)
	//

	ASSERT(m_pLock);
	ASSERT( ! IsBinaryMode());

	while ( PhysicalScriptFile::ReadString( GetKeyBufferRaw(SCRIPT_MAX_LINE_LEN), SCRIPT_MAX_LINE_LEN ))
	{
		m_pLock->m_iLineNum = ++m_iLineNum;	// share this with original open.
		if ( fRemoveBlanks )
		{
			if ( ParseKeyEnd() <= 0 )
				continue;
		}
		return( true );
	}

	m_pszKey[0] = '\0';
	return( false );
}