analyzetool/commandlineengine/src/CATModule2.cpp
branchRCL_3
changeset 59 8ad140f3dd41
parent 49 7fdc9a71d314
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
    25 
    25 
    26 CATModule2::CATModule2(void)
    26 CATModule2::CATModule2(void)
    27 {
    27 {
    28 	LOG_FUNC_ENTRY("CATModule2::CATModule2");
    28 	LOG_FUNC_ENTRY("CATModule2::CATModule2");
    29 	m_bAddressToLineInitialized = false;
    29 	m_bAddressToLineInitialized = false;
    30 	m_bS60FileNameResolved = false;
       
    31 	m_pAddressToLine = 0;
    30 	m_pAddressToLine = 0;
    32 	m_sErrors = "";
    31 	m_sErrors = "";
    33 	m_sMakeFile = "";
    32 	m_sMakeFile = "";
    34 	m_eBuildSystem = CATProject::SBS_V1;
    33 	m_eBuildSystem = CATProject::SBS_V1;
    35 	m_sCompileInfoText = "";
    34 	m_sCompileInfoText = "";
   332 		sNew.sLst = GetLstNameOfSource( sNew.sCpp );
   331 		sNew.sLst = GetLstNameOfSource( sNew.sCpp );
   333 		m_vSources.push_back( sNew );
   332 		m_vSources.push_back( sNew );
   334 	}
   333 	}
   335 }
   334 }
   336 bool CATModule2::CreateTempCpp(const string& sS60FileName
   335 bool CATModule2::CreateTempCpp(const string& sS60FileName
   337 							        , const string& sS60FilePath
       
   338 									, int eLoggingMode
   336 									, int eLoggingMode
   339 									, int eBuildType
   337 									, int eBuildType
   340 									, int iAllocCallStackSize
   338 									, int iAllocCallStackSize
   341 									, int iFreeCallStackSize )
   339 									, int iFreeCallStackSize )
   342 {
   340 {
   343 	LOG_FUNC_ENTRY("CATModule2::CreateTemporaryCpp");
   341 	LOG_FUNC_ENTRY("CATModule2::CreateTemporaryCpp");
   344 
   342 	// S60 filename
       
   343 	m_sS60FileName = sS60FileName;
   345 	// Make s60 filename target.type.dat if its empty and logging mode is file
   344 	// Make s60 filename target.type.dat if its empty and logging mode is file
   346 	if ( eLoggingMode == CATProject::FILE )
   345 	if ( eLoggingMode == CATProject::FILE
   347 	{
   346 		&& m_sS60FileName.empty() )
   348 		// S60 filename
   347 	{
   349 		SetS60FileName( sS60FileName );
   348 		m_sS60FileName = m_sTarget;
   350 		
   349 		m_sS60FileName.append(".");
   351 		// S60 filepath
   350 		m_sS60FileName.append( m_sTargetType );
   352 		// use double slashes in temp cpp file
   351 		m_sS60FileName.append(".dat");
   353 		m_sS60FilePath = sS60FilePath;
       
   354 		int iIgnore(0);
       
   355 		size_t iPos = m_sS60FilePath.find("\\", iIgnore );
       
   356 		while( iPos != string::npos )
       
   357 		{
       
   358 			m_sS60FilePath.replace( iPos, 1, "\\\\" );
       
   359 			// dont replace previously replaced slashes
       
   360 			iIgnore = iPos + 2;
       
   361 			iPos = m_sS60FilePath.find("\\", iIgnore );
       
   362 		}
       
   363 
       
   364 
       
   365 	}
   352 	}
   366 	return CreateTemporaryCpp( GetUniqueId(), m_sTempPath,
   353 	return CreateTemporaryCpp( GetUniqueId(), m_sTempPath,
   367 		m_sS60FileName, m_sS60FilePath, eLoggingMode, eBuildType, iAllocCallStackSize, iFreeCallStackSize );
   354 		m_sS60FileName, eLoggingMode, eBuildType, iAllocCallStackSize, iFreeCallStackSize );
   368 }
   355 }
   369 
   356 
   370 bool CATModule2::ModifyMmp()
   357 bool CATModule2::ModifyMmp()
   371 {
   358 {
   372 	LOG_FUNC_ENTRY("CATModule2::ModifyMmp");
   359 	LOG_FUNC_ENTRY("CATModule2::ModifyMmp");
  1297 }
  1284 }
  1298 
  1285 
  1299 string CATModule2::GetS60FileName() const
  1286 string CATModule2::GetS60FileName() const
  1300 {
  1287 {
  1301 	LOG_LOW_FUNC_ENTRY("CATModule2::GetS60FileName");
  1288 	LOG_LOW_FUNC_ENTRY("CATModule2::GetS60FileName");
       
  1289 	if ( m_sS60FileName.empty() )
       
  1290 	{
       
  1291 		string sGeneratedDatName = m_sTarget;
       
  1292 		sGeneratedDatName.append(".");
       
  1293 		sGeneratedDatName.append( m_sTargetType );
       
  1294 		sGeneratedDatName.append(".dat");
       
  1295 		return sGeneratedDatName;
       
  1296 	}
  1302 	return m_sS60FileName;
  1297 	return m_sS60FileName;
  1303 }
       
  1304 
       
  1305 void CATModule2::SetS60FileName( const string& aFileName  )
       
  1306 {
       
  1307 	LOG_LOW_FUNC_ENTRY("CATModule2::SetS60FileName");
       
  1308 
       
  1309 	m_sS60FileName = aFileName;
       
  1310 
       
  1311 	//check new m_sS60FileName and change it if needed
       
  1312 	string sProcessName = "";
       
  1313 	sProcessName.append( m_sTarget );
       
  1314 	sProcessName.append(".");
       
  1315 	sProcessName.append( m_sTargetType );
       
  1316 		
       
  1317 	if ( m_sS60FileName.empty() )
       
  1318 	{
       
  1319 		m_sS60FileName = sProcessName;
       
  1320 		m_sS60FileName.append(".dat");
       
  1321 	}
       
  1322 	else
       
  1323 	{
       
  1324 		// if data file name contains %processname% string, replace it with process name
       
  1325 		string sProcessnameTemp = "[";
       
  1326 		sProcessnameTemp.append( sProcessName );
       
  1327 		sProcessnameTemp.append( "]" );
       
  1328 		size_t iSpot;
       
  1329 
       
  1330 		//create temp name in lowercase
       
  1331 		string sS60FileNameLower = m_sS60FileName;
       
  1332 		ChangeToLower( sS60FileNameLower );
       
  1333 
       
  1334 		// find %processname% string in lowercase name, replace it with process name in in m_sS60FileName
       
  1335 		// replace it also in temp string (matching indexes)
       
  1336 		while( ( iSpot = sS60FileNameLower.find( AT_PROCESSNAME_TAG ) ) != string::npos )
       
  1337 		{
       
  1338 			m_sS60FileName.replace( iSpot, AT_PROCESSNAME_TAG.length(), sProcessnameTemp );
       
  1339 			sS60FileNameLower.replace( iSpot, AT_PROCESSNAME_TAG.length(), sProcessnameTemp );
       
  1340 		}
       
  1341     }
       
  1342 }
  1298 }
  1343 
  1299 
  1344 string CATModule2::GetLstNameOfSource(string sSource) const
  1300 string CATModule2::GetLstNameOfSource(string sSource) const
  1345 {
  1301 {
  1346 	LOG_LOW_FUNC_ENTRY("CATModule2::GetLstNameOfSource");
  1302 	LOG_LOW_FUNC_ENTRY("CATModule2::GetLstNameOfSource");